Merge pull request #3375 from Quix0r/rewrites/coding-convention-split2-3-2

Coding convention applied split 2-3-2 (of 2-14-2)
This commit is contained in:
Hypolite Petovan 2017-04-22 09:11:18 -04:00 committed by GitHub
commit 0f67934e05
10 changed files with 137 additions and 129 deletions

View file

@ -590,7 +590,7 @@ function update_contact_birthdays() {
// This only handles foreign or alien networks where a birthday has been provided. // This only handles foreign or alien networks where a birthday has been provided.
// In-network birthdays are handled within local_delivery // In-network birthdays are handled within local_delivery
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` > '0001-01-01' AND SUBSTRING(`bd`,1,4) != `bdyear` "); $r = q("SELECT * FROM `contact` WHERE `bd` != '' AND `bd` > '0001-01-01' AND SUBSTRING(`bd`, 1, 4) != `bdyear` ");
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
@ -598,14 +598,12 @@ function update_contact_birthdays() {
$nextbd = datetime_convert('UTC','UTC','now','Y') . substr($rr['bd'], 4); $nextbd = datetime_convert('UTC','UTC','now','Y') . substr($rr['bd'], 4);
/** /*
*
* Add new birthday event for this person * Add new birthday event for this person
* *
* $bdtext is just a readable placeholder in case the event is shared * $bdtext is just a readable placeholder in case the event is shared
* with others. We will replace it during presentation to our $importer * with others. We will replace it during presentation to our $importer
* to contain a sparkle link and perhaps a photo. * to contain a sparkle link and perhaps a photo.
*
*/ */
// Check for duplicates // Check for duplicates
@ -638,7 +636,6 @@ function update_contact_birthdays() {
// update bdyear // update bdyear
q("UPDATE `contact` SET `bdyear` = '%s', `bd` = '%s' WHERE `uid` = %d AND `id` = %d", q("UPDATE `contact` SET `bdyear` = '%s', `bd` = '%s' WHERE `uid` = %d AND `id` = %d",
dbesc(substr($nextbd,0,4)), dbesc(substr($nextbd,0,4)),
dbesc($nextbd), dbesc($nextbd),

View file

@ -82,6 +82,7 @@ function format_event_html($ev, $simple = false) {
} }
/* /*
@TODO old-lost code found?
function parse_event($h) { function parse_event($h) {
require_once('include/Scrape.php'); require_once('include/Scrape.php');

View file

@ -271,6 +271,7 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
if ($creator != "") { if ($creator != "") {
$item["author-name"] = $creator; $item["author-name"] = $creator;
} }
/// @TODO ? /// @TODO ?
// <category>Ausland</category> // <category>Ausland</category>
// <media:thumbnail width="152" height="76" url="http://www.taz.de/picture/667875/192/14388767.jpg"/> // <media:thumbnail width="152" height="76" url="http://www.taz.de/picture/667875/192/14388767.jpg"/>
@ -293,8 +294,9 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
$type = $attributes->textContent; $type = $attributes->textContent;
} }
} }
if(strlen($item["attach"])) if (strlen($item["attach"])) {
$item["attach"] .= ','; $item["attach"] .= ',';
}
$attachments[] = array("link" => $href, "type" => $type, "length" => $length); $attachments[] = array("link" => $href, "type" => $type, "length" => $length);

View file

@ -33,11 +33,13 @@ function gprobe_run(&$argv, &$argc){
$arr = probe_url($url); $arr = probe_url($url);
if (is_null($result)) if (is_null($result)) {
Cache::set("gprobe:".$urlparts["host"], $arr); Cache::set("gprobe:".$urlparts["host"], $arr);
}
if (!in_array($arr["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) if (!in_array($arr["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
update_gcontact($arr); update_gcontact($arr);
}
$r = q("SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1", $r = q("SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
dbesc(normalise_link($url)) dbesc(normalise_link($url))

View file

@ -347,9 +347,10 @@ function groups_containing($uid,$c) {
$ret = array(); $ret = array();
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach ($r as $rr) {
$ret[] = $rr['gid']; $ret[] = $rr['gid'];
} }
}
return $ret; return $ret;
} }

View file

@ -205,15 +205,17 @@ function profile_sidebar($profile, $block = 0) {
// This function can also use contact information in $profile // This function can also use contact information in $profile
$is_contact = x($profile, 'cid'); $is_contact = x($profile, 'cid');
if((! is_array($profile)) && (! count($profile))) if ((! is_array($profile)) && (! count($profile))) {
return $o; return $o;
}
$profile['picdate'] = urlencode($profile['picdate']); $profile['picdate'] = urlencode($profile['picdate']);
if (($profile['network'] != "") AND ($profile['network'] != NETWORK_DFRN)) { if (($profile['network'] != "") AND ($profile['network'] != NETWORK_DFRN)) {
$profile['network_name'] = format_network_name($profile['network'], $profile['url']); $profile['network_name'] = format_network_name($profile['network'], $profile['url']);
} else } else {
$profile['network_name'] = ""; $profile['network_name'] = "";
}
call_hooks('profile_sidebar_enter', $profile); call_hooks('profile_sidebar_enter', $profile);
@ -630,9 +632,7 @@ function advanced_profile(App $a) {
if ($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] ); if ($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] );
if (($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) { if (($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) {
$year_bd_format = t('j F, Y'); $year_bd_format = t('j F, Y');
$short_bd_format = t('j F'); $short_bd_format = t('j F');
@ -881,16 +881,20 @@ function zrl_init(App $a) {
} }
function zrl($s,$force = false) { function zrl($s,$force = false) {
if(! strlen($s)) if (! strlen($s)) {
return $s; return $s;
if((! strpos($s,'/profile/')) && (! $force)) }
if ((! strpos($s,'/profile/')) && (! $force)) {
return $s; return $s;
if($force && substr($s,-1,1) !== '/') }
if ($force && substr($s,-1,1) !== '/') {
$s = $s . '/'; $s = $s . '/';
}
$achar = strpos($s,'?') ? '&' : '?'; $achar = strpos($s,'?') ? '&' : '?';
$mine = get_my_url(); $mine = get_my_url();
if($mine and ! link_compare($mine,$s)) if ($mine and ! link_compare($mine,$s)) {
return $s . $achar . 'zrl=' . urlencode($mine); return $s . $achar . 'zrl=' . urlencode($mine);
}
return $s; return $s;
} }
@ -911,9 +915,10 @@ function zrl($s,$force = false) {
function get_theme_uid() { function get_theme_uid() {
$uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0); $uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0);
if (local_user()) { if (local_user()) {
if((get_pconfig(local_user(),'system','always_my_theme')) || (! $uid)) if ((get_pconfig(local_user(),'system','always_my_theme')) || (! $uid)) {
return local_user(); return local_user();
} }
}
return $uid; return $uid;
} }