From aa92901b11a70c495904d902bfdb4f4e21af8b47 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 26 Feb 2012 14:29:17 +0000 Subject: [PATCH 1/7] Wrong variable name --- include/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config.php b/include/config.php index 92694f5193..2cddda0b8d 100755 --- a/include/config.php +++ b/include/config.php @@ -162,7 +162,7 @@ function del_config($family,$key) { if(x($a->config[$family],$key)) unset($a->config[$family][$key]); $ret = q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", - dbesc($cat), + dbesc($family), dbesc($key) ); return $ret; From fd9c12128afba39d91b81371b240e0cd92f66469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Sun, 26 Feb 2012 20:39:37 +0000 Subject: [PATCH 2/7] should probably be a->user['hidewall'] instead of profile['hidewall'] --- mod/profile.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mod/profile.php b/mod/profile.php index eba9874a86..74e1a23020 100755 --- a/mod/profile.php +++ b/mod/profile.php @@ -107,7 +107,7 @@ function profile_content(&$a, $update = 0) { $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false); - if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) { + if($a->user['hidewall'] && (! $is_owner) && (! $remote_contact)) { notice( t('Access to this profile has been restricted.') . EOL); return; } @@ -228,10 +228,12 @@ function profile_content(&$a, $update = 0) { intval($a->profile['profile_uid']), dbesc($parents_str) ); + + $items = conv_sort($items,'created'); + } else { + $items = array(); } - $items = conv_sort($items,'created'); - if($is_owner && ! $update) { $o .= get_birthdays(); $o .= get_events(); From 792abc3a24d13408d4e31a4137a8173e3039bd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Sun, 26 Feb 2012 20:40:41 +0000 Subject: [PATCH 3/7] necessare fields not loaded from DB --- mod/acl.php | 4 +++- mod/ping.php | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mod/acl.php b/mod/acl.php index 98ca90ded8..375c618c86 100755 --- a/mod/acl.php +++ b/mod/acl.php @@ -16,6 +16,8 @@ function acl_init(&$a){ if ($search!=""){ $sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'"; $sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')"; + } else { + $sql_extra = $sql_extra2 = ""; } // count groups and contacts @@ -75,7 +77,7 @@ function acl_init(&$a){ if ($type=='' || $type=='c'){ - $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url` FROM `contact` + $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != '' $sql_extra2 ORDER BY `name` ASC ", diff --git a/mod/ping.php b/mod/ping.php index 0f6f0a9d68..7380ff7d05 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -26,9 +26,10 @@ function ping_init(&$a) { $dislikes = array(); $friends = array(); $posts = array(); - + $home = 0; + $network = 0; - $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, + $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` From cbc6ca642a15d077e66e5cf9fe89a16521b3e6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Sun, 26 Feb 2012 20:41:41 +0000 Subject: [PATCH 4/7] 1 Bugfix (missing $ character) and avoid some notices --- include/conversation.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index 3d13a11798..53369cf20f 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -232,7 +232,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $alike = array(); $dlike = array(); - + $o = ""; // array with html for each thread (parent+comments) $threads = array(); @@ -436,7 +436,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { } else { // prevent private email from leaking into public conversation - if((! $toplevelpost) && (! toplevelprivate) && ($item['private']) && ($profile_owner != local_user())) + if((! $toplevelpost) && (! $toplevelprivate) && ($item['private']) && ($profile_owner != local_user())) continue; $comments_seen ++; } @@ -641,7 +641,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $body = prepare_body($item,true); $tmp_item = replace_macros($template,array( - '$type' => implode("",array_slice(split("/",$item['verb']),-1)), + '$type' => implode("",array_slice(explode("/",$item['verb']),-1)), '$tags' => $tags, '$body' => template_escape($body), '$id' => $item['item_id'], From b102a1d5ecda36a9a48a841f06df9ef5d33fa46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Sun, 26 Feb 2012 20:43:23 +0000 Subject: [PATCH 5/7] is not always defined; but if defined, then always of type integer --- mod/photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/photo.php b/mod/photo.php index a5a5a1dc17..c4a93769af 100755 --- a/mod/photo.php +++ b/mod/photo.php @@ -119,7 +119,7 @@ function photo_init(&$a) { // NOTREACHED } - if(intval($customres) && $customres > 0 && $customres < 500) { + if(isset($customres) && $customres > 0 && $customres < 500) { require_once('include/Photo.php'); $ph = new Photo($data); if($ph->is_valid()) { From ac86407fdf34b0bb872da017231a8c23a84f277b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Sun, 26 Feb 2012 20:43:35 +0000 Subject: [PATCH 6/7] Bugfix --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/text.php b/include/text.php index 0f7d2f731c..1f5d4a3e12 100755 --- a/include/text.php +++ b/include/text.php @@ -996,7 +996,7 @@ function lang_selector() { } $ll = substr($l,5); $ll = substr($ll,0,strrpos($ll,'/')); - $selected = (($ll === $lang && (x($_SESSION['language']))) ? ' selected="selected" ' : ''); + $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? ' selected="selected" ' : ''); $o .= ''; } } From 4b1de0f538e6d3f48e2a4d1e82522aced6b08129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Sun, 26 Feb 2012 20:43:51 +0000 Subject: [PATCH 7/7] Avoid some notices --- include/event.php | 2 +- include/items.php | 6 +++--- include/template_processor.php | 15 ++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/event.php b/include/event.php index c7669b381c..4a9a9a0041 100755 --- a/include/event.php +++ b/include/event.php @@ -163,7 +163,7 @@ function bbtoevent($s) { if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match)) $ev['adjust'] = $match[1]; $match = ''; - $ev['nofinish'] = (($ev['start'] && (! $ev['finish'])) ? 1 : 0); + $ev['nofinish'] = (($ev['start'] && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0); return $ev; } diff --git a/include/items.php b/include/items.php index c461b83b49..7d52571c25 100755 --- a/include/items.php +++ b/include/items.php @@ -308,7 +308,7 @@ function get_atom_elements($feed,$item) { if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; foreach($base as $link) { - if(! $res['author-avatar']) { + if(!x($res, 'author-avatar') || !$res['author-avatar']) { if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') $res['author-avatar'] = unxmlify($link['attribs']['']['href']); } @@ -323,7 +323,7 @@ function get_atom_elements($feed,$item) { foreach($base as $link) { if($link['attribs']['']['rel'] === 'alternate' && (! $res['author-link'])) $res['author-link'] = unxmlify($link['attribs']['']['href']); - if(! $res['author-avatar']) { + if(!x($res, 'author-avatar') || !$res['author-avatar']) { if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo') $res['author-avatar'] = unxmlify($link['attribs']['']['href']); } @@ -503,7 +503,7 @@ function get_atom_elements($feed,$item) { $base = $rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; foreach($base as $link) { - if(! $res['owner-avatar']) { + if(!x($res, 'owner-avatar') || !$res['owner-avatar']) { if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') $res['owner-avatar'] = unxmlify($link['attribs']['']['href']); } diff --git a/include/template_processor.php b/include/template_processor.php index 0d476f0e6e..7f270fb4b3 100755 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -32,11 +32,12 @@ if(is_array($r) && count($r)) { foreach ($r as $k => $v ) { - if (is_array($v)) + if (is_array($v)) { $this->_build_replace($v, "$prefix$k."); - - $this->search[] = $prefix . $k; - $this->replace[] = $v; + } else { + $this->search[] = $prefix . $k; + $this->replace[] = $v; + } } } } @@ -53,7 +54,7 @@ $keys = array_map('trim',explode(".",$name)); $val = $this->r; foreach($keys as $k) { - $val = $val[$k]; + $val = (isset($val[$k]) ? $val[$k] : null); } return $val; } @@ -79,8 +80,8 @@ } else { $val = $this->_get_var($args[2]); } - list($strue, $sfalse)= preg_split("|{{ *else *}}|", $args[3]); - return ($val?$strue:$sfalse); + $x = preg_split("|{{ *else *}}|", $args[3]); + return ( $val ? $x[0] : (isset($x[1]) ? $x[1] : "")); } /**