Mostly some checks in order to avoid Notices; 1 real bugfix in /mod/network.php

This commit is contained in:
Tobias Hößl 2012-02-28 21:56:42 +00:00
parent 3d249f0edd
commit 5bb8ed4b8b
4 changed files with 19 additions and 11 deletions

View file

@ -373,7 +373,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$comments[$item['parent']] = 1; $comments[$item['parent']] = 1;
else else
$comments[$item['parent']] += 1; $comments[$item['parent']] += 1;
} } elseif(! x($comments,$item['parent']))
$comments[$item['parent']] = 0; // avoid notices later on
} }
// map all the like/dislike activities for each parent item // map all the like/dislike activities for each parent item
@ -921,7 +922,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$return_path' => $a->cmd, '$return_path' => $a->cmd,
'$action' => $a->get_baseurl().'/item', '$action' => $a->get_baseurl().'/item',
'$share' => (($x['button']) ? $x['button'] : t('Share')), '$share' => (x($x,'button') ? $x['button'] : t('Share')),
'$upload' => t('Upload photo'), '$upload' => t('Upload photo'),
'$shortupload' => t('upload photo'), '$shortupload' => t('upload photo'),
'$attach' => t('Attach file'), '$attach' => t('Attach file'),

View file

@ -62,7 +62,7 @@ function oembed_fetch_url($embedurl){
function oembed_format_object($j){ function oembed_format_object($j){
$embedurl = $j->embedurl; $embedurl = $j->embedurl;
$jhtml = oembed_iframe($j->embedurl,$j->width,$j->height ); $jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null) );
$ret="<span class='oembed ".$j->type."'>"; $ret="<span class='oembed ".$j->type."'>";
switch ($j->type) { switch ($j->type) {
case "video": { case "video": {

View file

@ -92,8 +92,13 @@
*/ */
private function _replcb_for($args){ private function _replcb_for($args){
$m = array_map('trim', explode(" as ", $args[2])); $m = array_map('trim', explode(" as ", $args[2]));
list($keyname, $varname) = explode("=>",$m[1]); $x = explode("=>",$m[1]);
if (is_null($varname)) { $varname=$keyname; $keyname=""; } if (count($x) == 1) {
$varname = $x[0];
$keyname = "";
} else {
list($keyname, $varname) = $x;
}
if ($m[0]=="" || $varname=="" || is_null($varname)) die("template error: 'for ".$m[0]." as ".$varname."'") ; if ($m[0]=="" || $varname=="" || is_null($varname)) die("template error: 'for ".$m[0]." as ".$varname."'") ;
//$vals = $this->r[$m[0]]; //$vals = $this->r[$m[0]];
$vals = $this->_get_var($m[0]); $vals = $this->_get_var($m[0]);

View file

@ -44,7 +44,7 @@ function network_init(&$a) {
} }
$a->page['aside'] .= group_side('network','network',true,$group_id); $a->page['aside'] .= group_side('network','network',true,$group_id);
$a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(($_GET['nets']) ? $_GET['nets'] : '')); $a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search); $a->page['aside'] .= saved_searches($search);
} }
@ -130,15 +130,15 @@ function network_content(&$a, $update = 0) {
$starred_active = 'active'; $starred_active = 'active';
} }
if($_GET['bmark']) { if(x($_GET,'bmark')) {
$bookmarked_active = 'active'; $bookmarked_active = 'active';
} }
if($_GET['conv']) { if(x($_GET,'conv')) {
$conv_active = 'active'; $conv_active = 'active';
} }
if($_GET['spam']) { if(x($_GET,'spam')) {
$spam_active = 'active'; $spam_active = 'active';
} }
@ -245,7 +245,7 @@ function network_content(&$a, $update = 0) {
$def_acl = array('allow_cid' => '<' . intval($cid) . '>'); $def_acl = array('allow_cid' => '<' . intval($cid) . '>');
if(! $update) { if(! $update) {
if(group) { if($group) {
if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) { if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
notice( sprintf( tt('Warning: This group contains %s member from an insecure network.', notice( sprintf( tt('Warning: This group contains %s member from an insecure network.',
'Warning: This group contains %s members from an insecure network.', 'Warning: This group contains %s members from an insecure network.',
@ -492,6 +492,8 @@ function network_content(&$a, $update = 0) {
$items = conv_sort($items,$ordering); $items = conv_sort($items,$ordering);
} else {
$items = array();
} }
} }