aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-09-27 17:48:10 -0700
committerfriendica <info@friendica.com>2012-09-27 17:48:10 -0700
commitd261fe271fdee747244c76f7ba4679b8372a2e8c (patch)
tree90da2f6f16c484243c4b422d32b72ddd9e04965f
parentba4fe4ff919fa3250db33eee2425870f10107e81 (diff)
downloadvolse-hubzilla-d261fe271fdee747244c76f7ba4679b8372a2e8c.tar.gz
volse-hubzilla-d261fe271fdee747244c76f7ba4679b8372a2e8c.tar.bz2
volse-hubzilla-d261fe271fdee747244c76f7ba4679b8372a2e8c.zip
create a widget registry for pages so themes can reorder, insert/delete, and relocate widgets to different regions of the page
-rw-r--r--boot.php20
-rw-r--r--index.php22
-rw-r--r--mod/ping.php7
-rw-r--r--mod/profile.php4
-rw-r--r--version.inc2
5 files changed, 44 insertions, 11 deletions
diff --git a/boot.php b/boot.php
index ae69ffacb..778e00cfc 100644
--- a/boot.php
+++ b/boot.php
@@ -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();*/
diff --git a/index.php b/index.php
index 3c45a3b4c..f8069445f 100644
--- a/index.php
+++ b/index.php
@@ -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