]> git.mxchange.org Git - friendica.git/blobdiff - mod/admin.php
Bugfixing after adding timestamps
[friendica.git] / mod / admin.php
index 0381fcf4cc136d53e9509abd2261fb84023678e0..dd9ff84512b3bb930c2dd4dd1a58c81bd77ed71e 100644 (file)
@@ -20,7 +20,7 @@ function admin_post(&$a){
 
        if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
                return;
-       
+
 
 
        // urls
@@ -54,7 +54,7 @@ function admin_post(&$a){
                                }
                                info(t('Theme settings updated.'));
                                if(is_ajax()) return;
-                               
+
                                goaway($a->get_baseurl(true) . '/admin/themes/' . $theme );
                                return;
                                break;
@@ -100,9 +100,9 @@ function admin_content(&$a) {
                'dbsync' => Array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync"),
                //'update' =>   Array($a->get_baseurl(true)."/admin/update/", t("Software Update") , "update")
        );
-       
+
        /* get plugins admin page */
-       
+
        $r = q("SELECT * FROM `addon` WHERE `plugin_admin`=1");
        $aside['plugins_admin']=Array();
        foreach ($r as $h){
@@ -111,7 +111,7 @@ function admin_content(&$a) {
                // temp plugins with admin
                $a->plugins_admin[] = $plugin;
        }
-               
+
        $aside['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs");
 
        $t = get_markup_template("admin_aside.tpl");
@@ -130,7 +130,6 @@ function admin_content(&$a) {
         * Page content
         */
        $o = '';
-       
        // urls
        if ($a->argc > 1){
                switch ($a->argv[1]){
@@ -161,7 +160,7 @@ function admin_content(&$a) {
        } else {
                $o = admin_page_summary($a);
        }
-       
+
        if(is_ajax()) {
                echo $o; 
                killme();
@@ -431,14 +430,14 @@ function admin_page_site(&$a) {
                        }
                }
        }
-       
-       
+
+
        /* Banner */
        $banner = get_config('system','banner');
        if($banner == false) 
                $banner = '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
        $banner = htmlspecialchars($banner);
-       
+
        //echo "<pre>"; var_dump($lang_choices); die("</pre>");
 
        /* Register policy */
@@ -710,6 +709,16 @@ function admin_page_users(&$a){
        $users = array_map("_setup_users", $users);
        
        
+       // Get rid of dashes in key names, Smarty3 can't handle them
+       foreach($users as $key => $user) {
+               $new_user = array();
+               foreach($user as $k => $v) {
+                       $k = str_replace('-','_',$k);
+                       $new_user[$k] = $v;
+               }
+               $users[$key] = $new_user;
+       }
+
        $t = get_markup_template("admin_users.tpl");
        $o = replace_macros($t, array(
                // strings //
@@ -753,7 +762,7 @@ function admin_page_users(&$a){
  * @return string
  */
 function admin_page_plugins(&$a){
-       
+
        /**
         * Single plugin
         */
@@ -763,9 +772,9 @@ function admin_page_plugins(&$a){
                        notice( t("Item not found.") );
                        return '';
                }
-               
+
                if (x($_GET,"a") && $_GET['a']=="t"){
-            check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't');
+                       check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't');
 
                        // Toggle plugin status
                        $idx = array_search($plugin, $a->plugins);
@@ -790,52 +799,53 @@ function admin_page_plugins(&$a){
                } else {
                        $status="off"; $action= t("Enable");
                }
-               
+
                $readme=Null;
                if (is_file("addon/$plugin/README.md")){
                        $readme = file_get_contents("addon/$plugin/README.md");
                        $readme = Markdown($readme);
                } else if (is_file("addon/$plugin/README")){
                        $readme = "<pre>". file_get_contents("addon/$plugin/README") ."</pre>";
-               } 
-               
+               }
+
                $admin_form="";
                if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)){
                        @require_once("addon/$plugin/$plugin.php");
                        $func = $plugin.'_plugin_admin';
                        $func($a, $admin_form);
                }
-               
+
                $t = get_markup_template("admin_plugins_details.tpl");
+
                return replace_macros($t, array(
                        '$title' => t('Administration'),
                        '$page' => t('Plugins'),
                        '$toggle' => t('Toggle'),
                        '$settings' => t('Settings'),
                        '$baseurl' => $a->get_baseurl(true),
-               
+
                        '$plugin' => $plugin,
                        '$status' => $status,
                        '$action' => $action,
                        '$info' => get_plugin_info($plugin),
                        '$str_author' => t('Author: '),
-                       '$str_maintainer' => t('Maintainer: '),                 
-               
+                       '$str_maintainer' => t('Maintainer: '),
+
                        '$admin_form' => $admin_form,
                        '$function' => 'plugins',
                        '$screenshot' => '',
                        '$readme' => $readme,
 
-            '$form_security_token' => get_form_security_token("admin_themes"),
+                       '$form_security_token' => get_form_security_token("admin_themes"),
                ));
-       } 
-        
-        
-       
+       }
+
+
+
        /**
         * List plugins
         */
-       
+
        $plugins = array();
        $files = glob("addon/*/");
        if($files) {
@@ -847,7 +857,7 @@ function admin_page_plugins(&$a){
                        }
                }
        }
-       
+
        $t = get_markup_template("admin_plugins.tpl");
        return replace_macros($t, array(
                '$title' => t('Administration'),
@@ -918,7 +928,7 @@ function rebuild_theme_table($themes) {
        return $o;
 }
 
-       
+
 /**
  * Themes admin page
  *
@@ -926,7 +936,7 @@ function rebuild_theme_table($themes) {
  * @return string
  */
 function admin_page_themes(&$a){
-       
+
        $allowed_themes_str = get_config('system','allowed_themes');
        $allowed_themes_raw = explode(',',$allowed_themes_str);
        $allowed_themes = array();
@@ -962,9 +972,9 @@ function admin_page_themes(&$a){
                        notice( t("Item not found.") );
                        return '';
                }
-               
+
                if (x($_GET,"a") && $_GET['a']=="t"){
-            check_form_security_token_redirectOnErr('/admin/themes', 'admin_themes', 't');
+                       check_form_security_token_redirectOnErr('/admin/themes', 'admin_themes', 't');
 
                        // Toggle theme status
 
@@ -988,28 +998,27 @@ function admin_page_themes(&$a){
                } else {
                        $status="off"; $action= t("Enable");
                }
-               
+
                $readme=Null;
                if (is_file("view/theme/$theme/README.md")){
                        $readme = file_get_contents("view/theme/$theme/README.md");
                        $readme = Markdown($readme);
                } else if (is_file("view/theme/$theme/README")){
                        $readme = "<pre>". file_get_contents("view/theme/$theme/README") ."</pre>";
-               } 
-               
+               }
+
                $admin_form="";
                if (is_file("view/theme/$theme/config.php")){
                        require_once("view/theme/$theme/config.php");
                        if(function_exists("theme_admin")){
                                $admin_form = theme_admin($a);
                        }
-                       
+
                }
-               
 
                $screenshot = array( get_theme_screenshot($theme), t('Screenshot'));
                if(! stristr($screenshot[0],$theme))
-                       $screenshot = null;             
+                       $screenshot = null;
 
                $t = get_markup_template("admin_plugins_details.tpl");
                return replace_macros($t, array(
@@ -1018,7 +1027,7 @@ function admin_page_themes(&$a){
                        '$toggle' => t('Toggle'),
                        '$settings' => t('Settings'),
                        '$baseurl' => $a->get_baseurl(true),
-               
+
                        '$plugin' => $theme,
                        '$status' => $status,
                        '$action' => $action,
@@ -1032,21 +1041,19 @@ function admin_page_themes(&$a){
 
                        '$form_security_token' => get_form_security_token("admin_themes"),
                ));
-       } 
-        
-        
-       
+       }
+
        /**
         * List themes
         */
-       
+
        $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'),