From 8981da89c3426f94b8a963ffe8189a9d0400333f Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 19 Oct 2012 03:36:09 -0700 Subject: don't show categories widget if there are none --- boot.php | 1 + include/contact_widgets.php | 23 ++++++++++++----------- index.php | 1 - mod/install.php | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/boot.php b/boot.php index d731069dc..43672695c 100644 --- a/boot.php +++ b/boot.php @@ -522,6 +522,7 @@ if(! class_exists('App')) { $this->cmd = 'profile/' . substr($this->cmd,1); + /** * * Break the URL path into C style argc/argv style arguments for our diff --git a/include/contact_widgets.php b/include/contact_widgets.php index a8eb893a5..ebefa1c23 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -111,20 +111,21 @@ function categories_widget($baseurl,$selected = '') { intval($a->profile['profile_uid']), intval(TERM_CATEGORY) ); - if(count($r)) { + if($r && count($r)) { foreach($r as $rr) - $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); - } + $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); - return replace_macros(get_markup_template('categories_widget.tpl'),array( - '$title' => t('Categories'), - '$desc' => '', - '$sel_all' => (($selected == '') ? 'selected' : ''), - '$all' => t('Everything'), - '$terms' => $terms, - '$base' => $baseurl, + return replace_macros(get_markup_template('categories_widget.tpl'),array( + '$title' => t('Categories'), + '$desc' => '', + '$sel_all' => (($selected == '') ? 'selected' : ''), + '$all' => t('Everything'), + '$terms' => $terms, + '$base' => $baseurl, - )); + )); + } + return ''; } function common_friends_visitor_widget($profile_uid) { diff --git a/index.php b/index.php index 130f9c939..18d54d79e 100644 --- a/index.php +++ b/index.php @@ -157,7 +157,6 @@ $a->apps = $arr['app_menu']; if(strlen($a->module)) { - /** * * We will always have a module name. diff --git a/mod/install.php b/mod/install.php index 87a1c041a..7f6e9fc21 100755 --- a/mod/install.php +++ b/mod/install.php @@ -84,7 +84,7 @@ function install_post(&$a) { '$dbdata' => $dbdata, '$timezone' => $timezone, '$siteurl' => $siteurl, - '$site_id' => hash('whirlpool', random_string()), + '$site_id' => random_string(), '$phpath' => $phpath, '$adminmail' => $adminmail )); -- cgit v1.2.3