From b4d38f6eed93b944b58f36c454a1f483d7db74ac Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 23 Feb 2012 16:50:29 -0800 Subject: [PATCH 01/32] implement firehose notify in ping, strip links so notify popup displays correctly in all themes --- boot.php | 2 +- mod/ping.php | 255 +++++++++++++++++++++++---------------------------- 2 files changed, 116 insertions(+), 141 deletions(-) diff --git a/boot.php b/boot.php index 8b78c0ee53..9219d5cfa0 100755 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1260' ); +define ( 'FRIENDICA_VERSION', '2.3.1261' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DB_UPDATE_VERSION', 1123 ); diff --git a/mod/ping.php b/mod/ping.php index 2898042a3d..3581253473 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()){ + $firehose = intval(get_pconfig(local_user(),'system','notify_full')); + $z = q("select * from notify where seen = 0 and uid = %d order by date desc", 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; - } + + 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; + } + } } } - $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; - } - } - - $intros1 = q("SELECT `intro`.`id`, `intro`.`datetime`, `fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo` FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id` @@ -122,11 +99,13 @@ 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"; } @@ -135,11 +114,10 @@ function ping_init(&$a) { function xmlize($href, $name, $url, $photo, $date, $message){ $notsxml = '%s'; 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($message) + ); } - echo "$intro $mail $network @@ -147,95 +125,92 @@ function ping_init(&$a) { if ($register!=0) echo "$register"; $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags); - - echo ' '; 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'])); - + + if($firehose) { + echo ' '; + } + else { + echo ' '; + 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']), 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']), 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 ($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 (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 ($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") ); - }; - } - -*/ echo " "; } echo " "; - if(x($_SESSION,'sysmsg')){ - foreach ($_SESSION['sysmsg'] as $m){ - echo "".xmlify($m).""; - } - unset($_SESSION['sysmsg']); + if(x($_SESSION,'sysmsg')){ + foreach ($_SESSION['sysmsg'] as $m){ + echo "".xmlify($m).""; } - if(x($_SESSION,'sysmsg_info')){ - foreach ($_SESSION['sysmsg_info'] as $m){ - echo "".xmlify($m).""; - } - unset($_SESSION['sysmsg_info']); + unset($_SESSION['sysmsg']); + } + if(x($_SESSION,'sysmsg_info')){ + foreach ($_SESSION['sysmsg_info'] as $m){ + echo "".xmlify($m).""; } + unset($_SESSION['sysmsg_info']); + } echo " "; echo" From 65ddefe9c5db4f5af9495377cd7e4463e8f68ef6 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 23 Feb 2012 17:37:03 -0800 Subject: [PATCH 02/32] system notifications to notify module, untranslated string in notifications.tpl --- mod/notifications.php | 8 ++++---- mod/notify.php | 32 ++++++++++++++++++++++++++++++++ view/notifications.tpl | 2 +- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/mod/notifications.php b/mod/notifications.php index 5831c1b7ab..99031a1d59 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 229020f4a7..e6a7a88596 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/view/notifications.tpl b/view/notifications.tpl index 487f8b480c..1a13b68b90 100755 --- a/view/notifications.tpl +++ b/view/notifications.tpl @@ -1,5 +1,5 @@ -

Notifications

+

$notif_header

{{ inc common_tabs.tpl }}{{ endinc }} From 44c23cda8edcde0ad6f904b8333f563b6d5ebc39 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 23 Feb 2012 20:29:09 -0800 Subject: [PATCH 03/32] theme shakeup commences - themes are now administered in admin panel. --- boot.php | 2 +- htconfig.php | 7 ++ mod/admin.php | 179 ++++++++++++++++++++++++++++++++- mod/follow.php | 5 + mod/settings.php | 20 +++- update.php | 8 +- view/admin_aside.tpl | 1 + view/admin_plugins.tpl | 4 +- view/admin_plugins_details.tpl | 2 +- 9 files changed, 215 insertions(+), 13 deletions(-) diff --git a/boot.php b/boot.php index 9219d5cfa0..3cf8f8e3cb 100755 --- a/boot.php +++ b/boot.php @@ -11,7 +11,7 @@ require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_VERSION', '2.3.1261' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); -define ( 'DB_UPDATE_VERSION', 1123 ); +define ( 'DB_UPDATE_VERSION', 1124 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/htconfig.php b/htconfig.php index cb6e7b7840..01f56f2c42 100755 --- a/htconfig.php +++ b/htconfig.php @@ -32,6 +32,9 @@ $a->config['sitename'] = "Friendica Social Network"; // to the email address of an already registered person who can authorise // and/or approve/deny the request. +// In order to perform system administration via the admin panel, admin_email +// must precisely match the email address of the person logged in. + $a->config['register_policy'] = REGISTER_OPEN; $a->config['register_text'] = ''; $a->config['admin_email'] = ''; @@ -64,6 +67,10 @@ $a->config['system']['huburl'] = 'http://pubsubhubbub.appspot.com'; $a->config['system']['rino_encrypt'] = true; +// allowed themes (change this from admin panel after installation) + +$a->config['system']['allowed_themes'] = 'dispy,quattro,testbubble,vier,darkbubble,darkzero,duepuntozero,greenzero,purplezero,quattro-green,slackr'; + // default system theme $a->config['system']['theme'] = 'duepuntozero'; diff --git a/mod/admin.php b/mod/admin.php index 028ed8624d..d9864dc6af 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,177 @@ 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 plugin 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 = "
". file_get_contents("view/$theme/README") ."
"; + } + + $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' => array('name' => $theme,'version' => '','description' => ''), + '$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"),array('name' => $th['name'],'version' => '','description' => '')); + } + } + + $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 + )); +} + /** * Logs admin page diff --git a/mod/follow.php b/mod/follow.php index f8964885e1..ae8cb200c7 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/settings.php b/mod/settings.php index 57a4e6db03..91f4325dad 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; diff --git a/update.php b/update.php index 16c1d78488..07555bc019 100755 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ $admin.site.1 +