diff options
-rw-r--r-- | boot.php | 20 | ||||
-rw-r--r-- | index.php | 22 | ||||
-rw-r--r-- | mod/ping.php | 7 | ||||
-rw-r--r-- | mod/profile.php | 4 | ||||
-rw-r--r-- | version.inc | 2 |
5 files changed, 44 insertions, 11 deletions
@@ -369,6 +369,7 @@ if(! class_exists('App')) { public $account = null; private $channel = null; + private $widgets = array(); public $language; public $module_loaded = false; @@ -603,6 +604,20 @@ if(! class_exists('App')) { return $this->channel; } + function set_widget($title,$html, $location = 'aside') { + $this->widgets[] = array('title' => $title, 'html' => $html, 'location' => $location); + } + + function get_widgets($location) { + if($location && count($this->widgets)) { + $ret = array(); + foreach($widgets as $w) + if($w['location'] == $location) + $ret[] = $w; + return $ret; + } + return $this->widgets; + } function set_pager_total($n) { $this->pager['total'] = intval($n); @@ -1142,9 +1157,6 @@ function profile_load(&$a, $nickname, $profile = 0) { require_once($theme_info_file); } - if(! (x($a->page,'aside'))) - $a->page['aside'] = ''; - if(local_user() && local_user() == $a->profile['uid']) { $a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'),array( '$editprofile' => t('Edit profile'), @@ -1154,7 +1166,7 @@ function profile_load(&$a, $nickname, $profile = 0) { $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); - $a->page['aside'] .= profile_sidebar($a->profile, $block); + $a->set_widget('profile',profile_sidebar($a->profile, $block)); /*if(! $block) $a->page['aside'] .= contact_block();*/ @@ -158,6 +158,8 @@ $a->apps = $arr['app_menu']; if(strlen($a->module)) { + + /** * * We will always have a module name. @@ -176,10 +178,19 @@ if(strlen($a->module)) { */ if((! $a->module_loaded) && (file_exists("mod/{$a->module}.php"))) { - include_once("mod/{$a->module}.php"); - $a->module_loaded = true; + if((strpos($a->module,'admin') === 0) && (! is_site_admin())) { + $a->module_loaded = false; + notice( t('Permission denied.') . EOL); + goaway(z_root()); + } + else { + include_once("mod/{$a->module}.php"); + $a->module_loaded = true; + } } + + /** * * The URL provided does not resolve to a valid module. @@ -362,6 +373,13 @@ head_add_js('mod_' . $a->module . '.js'); '$js_strings' => js_strings() )); +$arr = $a->get_widgets(); +if(count($arr)) { + foreach($arr as $x) { + $a->page[$x['location']] .= $x['html']; + } +} + $page = $a->page; $profile = $a->profile; diff --git a/mod/ping.php b/mod/ping.php index da612a255..21f36a163 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -100,7 +100,7 @@ function ping_init(&$a) { $t1 = dba_timer(); $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`, - `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, + `item`.`contact-id`, `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` WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND @@ -109,7 +109,10 @@ function ping_init(&$a) { intval(local_user()) ); - if(count($r)) { + if(count($r)) { + + call_hooks('network_ping', array('items' => $r)); + foreach ($r as $it) { if($it['wall']) $result['home'] ++; diff --git a/mod/profile.php b/mod/profile.php index 4351c607a..68dc6db72 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -35,8 +35,8 @@ function profile_aside(&$a) { profile_load($a,$which,$profile); - $a->page['aside'] .= posted_date_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true); - $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$cat); + $a->set_widget('archive',posted_date_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true)); + $a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$cat)); } diff --git a/version.inc b/version.inc index 636607431..1fa732ab6 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2012-09-25.88 +2012-09-27.90 |