aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorMichael <icarus@dabo.de>2012-02-26 21:47:47 +0100
committerMichael <icarus@dabo.de>2012-02-26 21:47:47 +0100
commit437e18d7a7433ea5a9e3388c39ba32c7fe25eb18 (patch)
tree747449ae089f3dd3f6bb55afdf93fa79081bd564 /mod
parentedc44933a4f57c09ee1cfb93615d052a2b125d99 (diff)
parent2081e6d507d5983f802c1024cf1e38c6d06d6067 (diff)
downloadvolse-hubzilla-437e18d7a7433ea5a9e3388c39ba32c7fe25eb18.tar.gz
volse-hubzilla-437e18d7a7433ea5a9e3388c39ba32c7fe25eb18.tar.bz2
volse-hubzilla-437e18d7a7433ea5a9e3388c39ba32c7fe25eb18.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'mod')
-rwxr-xr-xmod/admin.php181
-rwxr-xr-xmod/follow.php5
-rwxr-xr-xmod/item.php5
-rwxr-xr-xmod/notifications.php8
-rw-r--r--mod/notify.php32
-rw-r--r--mod/ping.php269
-rwxr-xr-xmod/settings.php20
7 files changed, 365 insertions, 155 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 028ed8624..0f600e312 100755
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -6,14 +6,19 @@
require_once("include/remoteupdate.php");
function admin_post(&$a){
+
+
if(!is_site_admin()) {
return;
}
+ // do not allow a page manager to access the admin panel at all.
if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
return;
+
+
// urls
if ($a->argc > 1){
switch ($a->argv[1]){
@@ -66,6 +71,7 @@ function admin_content(&$a) {
'site' => Array($a->get_baseurl()."/admin/site/", t("Site") , "site"),
'users' => Array($a->get_baseurl()."/admin/users/", t("Users") , "users"),
'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins"),
+ 'themes' => Array($a->get_baseurl()."/admin/themes/", t("Themes") , "themes"),
'update' => Array($a->get_baseurl()."/admin/update/", t("Update") , "update")
);
@@ -108,6 +114,9 @@ function admin_content(&$a) {
case 'plugins':
$o = admin_page_plugins($a);
break;
+ case 'themes':
+ $o = admin_page_themes($a);
+ break;
case 'logs':
$o = admin_page_logs($a);
break;
@@ -564,7 +573,7 @@ function admin_page_plugins(&$a){
'$info' => get_plugin_info($plugin),
'$admin_form' => $admin_form,
-
+ '$function' => 'plugins',
'$readme' => $readme
));
}
@@ -593,11 +602,179 @@ function admin_page_plugins(&$a){
'$page' => t('Plugins'),
'$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(),
-
+ '$function' => 'plugins',
'$plugins' => $plugins
));
}
+function toggle_theme(&$themes,$th,&$result) {
+ for($x = 0; $x < count($themes); $x ++) {
+ if($themes[$x]['name'] === $th) {
+ if($themes[$x]['allowed']) {
+ $themes[$x]['allowed'] = 0;
+ $result = 0;
+ }
+ else {
+ $themes[$x]['allowed'] = 1;
+ $result = 1;
+ }
+ }
+ }
+}
+
+function theme_status($themes,$th) {
+ for($x = 0; $x < count($themes); $x ++) {
+ if($themes[$x]['name'] === $th) {
+ if($themes[$x]['allowed']) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+ }
+ return 0;
+}
+
+
+
+function rebuild_theme_table($themes) {
+ $o = '';
+ if(count($themes)) {
+ foreach($themes as $th) {
+ if($th['allowed']) {
+ if(strlen($o))
+ $o .= ',';
+ $o .= $th['name'];
+ }
+ }
+ }
+ return $o;
+}
+
+
+/*
+ * Themes admin page
+ */
+
+function admin_page_themes(&$a){
+
+ $allowed_themes_str = get_config('system','allowed_themes');
+ $allowed_themes_raw = explode(',',$allowed_themes_str);
+ $allowed_themes = array();
+ if(count($allowed_themes_raw))
+ foreach($allowed_themes_raw as $x)
+ if(strlen(trim($x)))
+ $allowed_themes[] = trim($x);
+
+ $themes = array();
+ $files = glob('view/theme/*');
+ if($files) {
+ foreach($files as $file) {
+ $f = basename($file);
+ $is_experimental = intval(file_exists($file . '/experimental'));
+ $is_unsupported = 1-(intval(file_exists($file . '/unsupported')));
+ $is_allowed = intval(in_array($f,$allowed_themes));
+ $themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed);
+ }
+ }
+
+ if(! count($themes)) {
+ notice( t('No themes found.'));
+ return;
+ }
+
+ /**
+ * Single theme
+ */
+
+ if ($a->argc == 3){
+ $theme = $a->argv[2];
+ if(! is_dir("view/theme/$theme")){
+ notice( t("Item not found.") );
+ return;
+ }
+
+ if (x($_GET,"a") && $_GET['a']=="t"){
+
+ // Toggle theme status
+
+ toggle_theme($themes,$theme,$result);
+ $s = rebuild_theme_table($themes);
+ if($result)
+ info( sprintf('Theme %s enabled.',$theme));
+ else
+ info( sprintf('Theme %s disabled.',$theme));
+
+ set_config('system','allowed_themes',$s);
+ goaway($a->get_baseurl() . '/admin/themes' );
+ return; // NOTREACHED
+ }
+
+ // display theme details
+ require_once('library/markdown.php');
+
+ if (theme_status($themes,$theme)) {
+ $status="on"; $action= t("Disable");
+ } else {
+ $status="off"; $action= t("Enable");
+ }
+
+ $readme=Null;
+ if (is_file("view/$theme/README.md")){
+ $readme = file_get_contents("view/$theme/README.md");
+ $readme = Markdown($readme);
+ } else if (is_file("view/$theme/README")){
+ $readme = "<pre>". file_get_contents("view/$theme/README") ."</pre>";
+ }
+
+ $admin_form="";
+
+ $t = get_markup_template("admin_plugins_details.tpl");
+ return replace_macros($t, array(
+ '$title' => t('Administration'),
+ '$page' => t('Themes'),
+ '$toggle' => t('Toggle'),
+ '$settings' => t('Settings'),
+ '$baseurl' => $a->get_baseurl(),
+
+ '$plugin' => $theme,
+ '$status' => $status,
+ '$action' => $action,
+ '$info' => get_theme_info($theme),
+ '$function' => 'themes',
+ '$admin_form' => $admin_form,
+
+ '$readme' => $readme
+ ));
+ }
+
+
+
+ /**
+ * List plugins
+ */
+
+ $xthemes = array();
+ if($themes) {
+ foreach($themes as $th) {
+ $xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
+ }
+ }
+
+ $t = get_markup_template("admin_plugins.tpl");
+ return replace_macros($t, array(
+ '$title' => t('Administration'),
+ '$page' => t('Themes'),
+ '$submit' => t('Submit'),
+ '$baseurl' => $a->get_baseurl(),
+ '$function' => 'themes',
+ '$plugins' => $xthemes,
+ '$experimental' => t('[Experimental]'),
+ '$unsupported' => t('[Unsupported]')
+ ));
+}
+
/**
* Logs admin page
diff --git a/mod/follow.php b/mod/follow.php
index f8964885e..ae8cb200c 100755
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -49,6 +49,11 @@ function follow_init(&$a) {
goaway($_SESSION['return_url']);
}
}
+
+ // This just confuses things, remove it
+ if($ret['network'] === NETWORK_DIASPORA)
+ $ret['url'] = str_replace('?absolute=true','',$ret['url']);
+
// do we have enough information?
diff --git a/mod/item.php b/mod/item.php
index 3035989f3..81d7c753b 100755
--- a/mod/item.php
+++ b/mod/item.php
@@ -400,6 +400,8 @@ function item_post(&$a) {
$body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body);
+ $body = scale_external_images($body,false);
+
/**
* Look for any tags and linkify them
*/
@@ -753,7 +755,8 @@ function item_post(&$a) {
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
'verb' => ACTIVITY_POST,
- 'otype' => 'item'
+ 'otype' => 'item',
+ 'parent' => $parent,
));
}
diff --git a/mod/notifications.php b/mod/notifications.php
index 5831c1b7a..99031a1d5 100755
--- a/mod/notifications.php
+++ b/mod/notifications.php
@@ -295,7 +295,7 @@ function notifications_content(&$a) {
}
$o .= replace_macros($notif_tpl,array(
- '$notif_header' => t('Notifications'),
+ '$notif_header' => t('Network Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
@@ -325,7 +325,7 @@ function notifications_content(&$a) {
}
$o .= replace_macros($notif_tpl,array(
- '$notif_header' => t('System'),
+ '$notif_header' => t('System Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
@@ -420,7 +420,7 @@ function notifications_content(&$a) {
}
$o .= replace_macros($notif_tpl,array(
- '$notif_header' => t('Notifications'),
+ '$notif_header' => t('Personal Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
@@ -501,7 +501,7 @@ function notifications_content(&$a) {
}
$o .= replace_macros($notif_tpl,array(
- '$notif_header' => t('Notifications'),
+ '$notif_header' => t('Home Notifications'),
'$tabs' => $tabs,
'$notif_content' => $notif_content,
));
diff --git a/mod/notify.php b/mod/notify.php
index 229020f4a..e6a7a8859 100644
--- a/mod/notify.php
+++ b/mod/notify.php
@@ -36,4 +36,36 @@ function notify_init(&$a) {
function notify_content(&$a) {
if(! local_user())
return login();
+
+ $notif_tpl = get_markup_template('notifications.tpl');
+
+ $not_tpl = get_markup_template('notify.tpl');
+ require_once('include/bbcode.php');
+
+ $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
+ intval(local_user())
+ );
+
+ if (count($r) > 0) {
+ foreach ($r as $it) {
+ $notif_content .= replace_macros($not_tpl,array(
+ '$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'],
+ '$item_image' => $it['photo'],
+ '$item_text' => strip_tags(bbcode($it['msg'])),
+ '$item_when' => relative_date($it['date'])
+ ));
+ }
+ } else {
+ $notif_content .= t('No more system notifications.');
+ }
+
+ $o .= replace_macros($notif_tpl,array(
+ '$notif_header' => t('System Notifications'),
+ '$tabs' => '', // $tabs,
+ '$notif_content' => $notif_content,
+ ));
+
+ return $o;
+
+
} \ No newline at end of file
diff --git a/mod/ping.php b/mod/ping.php
index 2898042a3..0f6f0a9d6 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -12,13 +12,14 @@ function ping_init(&$a) {
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
if(local_user()){
- $z = q("select * from notify where seen = 0 and uid = %d
- order by date desc",
+ $firehose = intval(get_pconfig(local_user(),'system','notify_full'));
+
+ $z = q("select * from notify where uid = %d
+ order by seen asc, date desc limit 0, 50",
intval(local_user())
);
-
$tags = array();
$comments = array();
$likes = array();
@@ -32,72 +33,48 @@ function ping_init(&$a) {
`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
- `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0
+ `item`.`deleted` = 0 AND `item`.`uid` = %d
ORDER BY `item`.`created` DESC",
intval(local_user())
);
-
- $network = count($r);
- foreach ($r as $it) {
- switch($it['verb']){
- case ACTIVITY_TAG:
- $obj = parse_xml_string($xmlhead.$it['object']);
- $it['tname'] = $obj->content;
- $tags[] = $it;
- break;
- case ACTIVITY_LIKE:
- $likes[] = $it;
- break;
- case ACTIVITY_DISLIKE:
- $dislikes[] = $it;
- break;
- case ACTIVITY_FRIEND:
- $obj = parse_xml_string($xmlhead.$it['object']);
- $it['fname'] = $obj->title;
- $friends[] = $it;
- break;
- default:
- if ($it['parent']!=$it['id']) {
- $comments[] = $it;
- } else {
- $posts[] = $it;
- }
- }
- }
- $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `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`
- WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
- `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1",
- intval(local_user())
- );
- $home = count($r);
- foreach ($r as $it) {
- switch($it['verb']){
- case ACTIVITY_TAG:
- $obj = parse_xml_string($xmlhead.$it['object']);
- $it['tname'] = $obj->content;
- $tags[] = $it;
- break;
- case ACTIVITY_LIKE:
- $likes[] = $it;
- break;
- case ACTIVITY_DISLIKE:
- $dislikes[] = $it;
- break;
- case ACTIVITY_FRIEND:
- $obj = parse_xml_string($xmlhead.$it['object']);
- $it['fname'] = $obj->title;
- $friends[] = $it;
- break;
- default:
- if ($it['parent']!=$it['id']) $comments[] = $it;
+ if(count($r)) {
+
+ foreach ($r as $it) {
+
+ if($it['wall'])
+ $home ++;
+ else
+ $network ++;
+
+ switch($it['verb']){
+ case ACTIVITY_TAG:
+ $obj = parse_xml_string($xmlhead.$it['object']);
+ $it['tname'] = $obj->content;
+ $tags[] = $it;
+ break;
+ case ACTIVITY_LIKE:
+ $likes[] = $it;
+ break;
+ case ACTIVITY_DISLIKE:
+ $dislikes[] = $it;
+ break;
+ case ACTIVITY_FRIEND:
+ $obj = parse_xml_string($xmlhead.$it['object']);
+ $it['fname'] = $obj->title;
+ $friends[] = $it;
+ break;
+ default:
+ if ($it['parent']!=$it['id']) {
+ $comments[] = $it;
+ } else {
+ if(! $it['wall'])
+ $posts[] = $it;
+ }
+ }
}
}
-
$intros1 = q("SELECT `intro`.`id`, `intro`.`datetime`,
`fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo`
FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
@@ -122,24 +99,25 @@ function ping_init(&$a) {
intval(local_user()),
dbesc($myurl)
);
- $mail = $mails[0]['total'];
+ if($mails)
+ $mail = $mails[0]['total'];
if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()){
$regs = q("SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`, COUNT(*) as `total` FROM `contact` RIGHT JOIN `register` ON `register`.`uid`=`contact`.`uid` WHERE `contact`.`self`=1");
- $register = $regs[0]['total'];
+ if($regs)
+ $register = $regs[0]['total'];
} else {
$register = "0";
}
- function xmlize($href, $name, $url, $photo, $date, $message){
- $notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s">%s</note>';
+ function xmlize($href, $name, $url, $photo, $date, $seen, $message){
+ $notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" >%s</note>';
return sprintf ( $notsxml,
- xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($message)
- );
+ xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($seen), xmlify($message)
+ );
}
-
echo "<intro>$intro</intro>
<mail>$mail</mail>
<net>$network</net>
@@ -147,95 +125,100 @@ function ping_init(&$a) {
if ($register!=0) echo "<register>$register</register>";
$tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags);
-
- echo ' <notif count="'.$tot.'">';
require_once('include/bbcode.php');
-
- if(count($z)) {
- foreach($z as $zz) {
- echo xmlize($a->get_baseurl() . '/notify/' . $zz['id'], $zz['name'],$zz['url'],$zz['photo'],relative_date($zz['date']), bbcode($zz['msg']));
-
+ $sysnotify = 0;
+
+ if($firehose) {
+ echo ' <notif count="'.$tot.'">';
+ }
+ else {
+ if(count($z)) {
+ foreach($z as $zz) {
+ if($zz['seen'] == 0)
+ $sysnotify ++;
+ }
+ }
+
+ echo ' <notif count="'. $sysnotify .'">';
+ if(count($z)) {
+ foreach($z as $zz) {
+ echo xmlize($a->get_baseurl() . '/notify/view/' . $zz['id'], $zz['name'],$zz['url'],$zz['photo'],relative_date($zz['date']), ($zz['seen'] ? 'notify-seen' : 'notify-unseen'), ($zz['seen'] ? '' : '&rarr; ') .strip_tags(bbcode($zz['msg'])));
+ }
}
}
+ if($firehose) {
+ if ($intro>0){
+ foreach ($intros as $i) {
+ echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), 'notify-unseen',t("{0} wants to be your friend") );
+ };
+ }
+ if ($mail>0){
+ foreach ($mails as $i) {
+ echo xmlize( $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), 'notify-unseen',t("{0} sent you a message") );
+ };
+ }
+ if ($register>0){
+ foreach ($regs as $i) {
+ echo xmlize( $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), 'notify-unseen',t("{0} requested registration") );
+ };
+ }
+ if (count($comments)){
+ foreach ($comments as $i) {
+ echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} commented %s's post"), $i['pname'] ) );
+ };
+ }
+ if (count($likes)){
+ foreach ($likes as $i) {
+ echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} liked %s's post"), $i['pname'] ) );
+ };
+ }
+ if (count($dislikes)){
+ foreach ($dislikes as $i) {
+ echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} disliked %s's post"), $i['pname'] ) );
+ };
+ }
+ if (count($friends)){
+ foreach ($friends as $i) {
+ echo xmlize($a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'],$i['author-name'],$i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} is now friends with %s"), $i['fname'] ) );
+ };
+ }
+ if (count($posts)){
+ foreach ($posts as $i) {
+ echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} posted") ) );
+ };
+ }
+ if (count($tags)){
+ foreach ($tags as $i) {
+ echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} tagged %s's post with #%s"), $i['pname'], $i['tname'] ) );
+ };
+ }
-
-
-/*
-
- if ($intro>0){
- foreach ($intros as $i) {
- echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") );
- };
- }
- if ($mail>0){
- foreach ($mails as $i) {
- echo xmlize( $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), t("{0} sent you a message") );
- };
- }
- if ($register>0){
- foreach ($regs as $i) {
- echo xmlize( $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), t("{0} requested registration") );
- };
- }
-
- if (count($comments)){
- foreach ($comments as $i) {
- echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} commented %s's post"), $i['pname'] ) );
- };
- }
- if (count($likes)){
- foreach ($likes as $i) {
- echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} liked %s's post"), $i['pname'] ) );
- };
- }
- if (count($dislikes)){
- foreach ($dislikes as $i) {
- echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} disliked %s's post"), $i['pname'] ) );
- };
- }
- if (count($friends)){
- foreach ($friends as $i) {
- echo xmlize($a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'],$i['author-name'],$i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friends with %s"), $i['fname'] ) );
- };
- }
- if (count($posts)){
- foreach ($posts as $i) {
- echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} posted") ) );
- };
- }
- if (count($tags)){
- foreach ($tags as $i) {
- echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} tagged %s's post with #%s"), $i['pname'], $i['tname'] ) );
- };
- }
-
- if (count($cit)){
- foreach ($cit as $i) {
- echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), t("{0} mentioned you in a post") );
- };
+ if (count($cit)){
+ foreach ($cit as $i) {
+ echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',t("{0} mentioned you in a post") );
+ };
+ }
}
-*/
-
echo " </notif>";
}
echo " <sysmsgs>";
- if(x($_SESSION,'sysmsg')){
- foreach ($_SESSION['sysmsg'] as $m){
- echo "<notice>".xmlify($m)."</notice>";
- }
- unset($_SESSION['sysmsg']);
+ if(x($_SESSION,'sysmsg')){
+ foreach ($_SESSION['sysmsg'] as $m){
+ echo "<notice>".xmlify($m)."</notice>";
}
- if(x($_SESSION,'sysmsg_info')){
- foreach ($_SESSION['sysmsg_info'] as $m){
- echo "<info>".xmlify($m)."</info>";
- }
- unset($_SESSION['sysmsg_info']);
+ unset($_SESSION['sysmsg']);
+ }
+ if(x($_SESSION,'sysmsg_info')){
+ foreach ($_SESSION['sysmsg_info'] as $m){
+ echo "<info>".xmlify($m)."</info>";
}
+ unset($_SESSION['sysmsg_info']);
+ }
echo " </sysmsgs>";
echo"</result>
diff --git a/mod/settings.php b/mod/settings.php
index 57a4e6db0..91f4325da 100755
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -210,7 +210,7 @@ function settings_post(&$a) {
}
}
- $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
+ $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']);
$username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : '');
$email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : '');
$timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : '');
@@ -728,13 +728,23 @@ function settings_content(&$a) {
$default_theme = get_config('system','theme');
if(! $default_theme)
$default_theme = 'default';
+
+ $allowed_themes_str = get_config('system','allowed_themes');
+ $allowed_themes_raw = explode(',',$allowed_themes_str);
+ $allowed_themes = array();
+ if(count($allowed_themes_raw))
+ foreach($allowed_themes_raw as $x)
+ if(strlen(trim($x)))
+ $allowed_themes[] = trim($x);
+
$themes = array();
$files = glob('view/theme/*');
- if($files) {
- foreach($files as $file) {
- $f = basename($file);
- $is_experimental = file_exists($file . '/experimental');
+ if($allowed_themes) {
+ foreach($allowed_themes as $th) {
+ $f = $th;
+ $is_experimental = file_exists('view/theme/' . $th . '/experimental');
+ $unsupported = file_exists('view/theme/' . $th . '/unsupported');
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
$theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
$themes[$f]=$theme_name;