]> git.mxchange.org Git - friendica.git/blobdiff - mod/admin.php
Bugfixing after adding timestamps
[friendica.git] / mod / admin.php
index 69b2896772cf8189286424aa5ed25db3fbb28fb2..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();
@@ -241,14 +240,14 @@ function admin_page_site_post(&$a){
        $maximagesize           =       ((x($_POST,'maximagesize'))             ? intval(trim($_POST['maximagesize']))          :  0);
        $maximagelength         =       ((x($_POST,'maximagelength'))           ? intval(trim($_POST['maximagelength']))        :  MAX_IMAGE_LENGTH);
        $jpegimagequality       =       ((x($_POST,'jpegimagequality'))         ? intval(trim($_POST['jpegimagequality']))      :  JPEG_QUALITY);
-       
-       
+
+
        $register_policy        =       ((x($_POST,'register_policy'))          ? intval(trim($_POST['register_policy']))       :  0);
-       $daily_registrations    =       ((x($_POST,'max_daily_registrations'))  ? intval(trim($_POST['max_daily_registrations']))       :0);    
+       $daily_registrations    =       ((x($_POST,'max_daily_registrations'))  ? intval(trim($_POST['max_daily_registrations']))       :0);
        $abandon_days           =       ((x($_POST,'abandon_days'))             ? intval(trim($_POST['abandon_days']))          :  0);
 
-       $register_text          =       ((x($_POST,'register_text'))            ? notags(trim($_POST['register_text']))         : '');  
-       
+       $register_text          =       ((x($_POST,'register_text'))            ? notags(trim($_POST['register_text']))         : '');
+
        $allowed_sites          =       ((x($_POST,'allowed_sites'))            ? notags(trim($_POST['allowed_sites']))         : '');
        $allowed_email          =       ((x($_POST,'allowed_email'))            ? notags(trim($_POST['allowed_email']))         : '');
        $block_public           =       ((x($_POST,'block_public'))             ? True                                          : False);
@@ -273,6 +272,13 @@ function admin_page_site_post(&$a){
        $ostatus_disabled       =       !((x($_POST,'ostatus_disabled'))        ? True                                          : False);
        $diaspora_enabled       =       ((x($_POST,'diaspora_enabled'))         ? True                                          : False);
        $ssl_policy             =       ((x($_POST,'ssl_policy'))               ? intval($_POST['ssl_policy'])                  : 0);
+       $new_share              =       ((x($_POST,'new_share'))                ? True                                          : False);
+       $use_fulltext_engine    =       ((x($_POST,'use_fulltext_engine'))      ? True                                          : False);
+       $itemcache              =       ((x($_POST,'itemcache'))                ? notags(trim($_POST['itemcache']))             : '');
+       $itemcache_duration     =       ((x($_POST,'itemcache_duration'))       ? intval($_POST['itemcache_duration'])          : 0);
+       $lockpath               =       ((x($_POST,'lockpath'))                 ? notags(trim($_POST['lockpath']))              : '');
+       $temppath               =       ((x($_POST,'temppath'))                 ? notags(trim($_POST['temppath']))              : '');
+       $basepath               =       ((x($_POST,'basepath'))                 ? notags(trim($_POST['basepath']))              : '');
 
        if($ssl_policy != intval(get_config('system','ssl_policy'))) {
                if($ssl_policy == SSL_POLICY_FULL) {
@@ -372,10 +378,19 @@ function admin_page_site_post(&$a){
        set_config('system','ostatus_disabled', $ostatus_disabled);
        set_config('system','diaspora_enabled', $diaspora_enabled);
 
+       set_config('system','new_share', $new_share);
+       set_config('system','use_fulltext_engine', $use_fulltext_engine);
+       set_config('system','itemcache', $itemcache);
+       set_config('system','itemcache_duration', $itemcache_duration);
+       set_config('system','lockpath', $lockpath);
+       set_config('system','temppath', $temppath);
+       set_config('system','basepath', $basepath);
+
+
        info( t('Site settings updated.') . EOL);
        goaway($a->get_baseurl(true) . '/admin/site' );
-       return; // NOTREACHED   
-       
+       return; // NOTREACHED
+
 }
 
 /**
@@ -415,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 */
@@ -439,16 +454,7 @@ function admin_page_site(&$a) {
        );
 
        $t = get_markup_template("admin_site.tpl");
-
-       $includes = array(
-               '$field_checkbox'       => 'field_checkbox.tpl',
-               '$field_input'          => 'field_input.tpl',
-               '$field_select'         => 'field_select.tpl',
-               '$field_textarea'       => 'field_textarea.tpl',
-       );
-       $includes = set_template_includes($a->theme['template_engine'], $includes);
-
-       return replace_macros($t, $includes + array(
+       return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Site'),
                '$submit' => t('Submit'),
@@ -456,6 +462,7 @@ function admin_page_site(&$a) {
                '$upload' => t('File upload'),
                '$corporate' => t('Policies'),
                '$advanced' => t('Advanced'),
+               '$performance' => t('Performance'),
                
                '$baseurl' => $a->get_baseurl(true),
                // name, label, value, help string, extra data...
@@ -465,6 +472,7 @@ function admin_page_site(&$a) {
                '$theme'                => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
                '$theme_mobile'         => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile-theme'), t("Theme for mobile devices"), $theme_choices_mobile),
                '$ssl_policy'           => array('ssl_policy', t("SSL link policy"), (string) intval(get_config('system','ssl_policy')), t("Determines whether generated links should be forced to use SSL"), $ssl_choices),
+               '$new_share'            => array('new_share', t("'Share' element"), get_config('system','new_share'), t("Activates the bbcode element 'share' for repeating items.")),
                '$maximagesize'         => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
                '$maximagelength'               => array('maximagelength', t("Maximum image length"), get_config('system','max_image_length'), t("Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.")),
                '$jpegimagequality'             => array('jpegimagequality', t("JPEG image quality"), get_config('system','jpeg_quality'), t("Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.")),
@@ -480,7 +488,7 @@ function admin_page_site(&$a) {
                '$global_directory'     => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), t("URL to update the global directory. If this is not set, the global directory is completely unavailable to the application.")),
                '$thread_allow'         => array('thread_allow', t("Allow threaded items"), get_config('system','thread_allow'), t("Allow infinite level threading for items on this site.")),
                '$newuser_private'      => array('newuser_private', t("Private posts by default for new users"), get_config('system','newuser_private'), t("Set default post permissions for all new members to the default privacy group rather than public.")),
-                       
+
                '$no_multi_reg'         => array('no_multi_reg', t("Block multiple registrations"),  get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
                '$no_openid'            => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),
                '$no_regfullname'       => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")),
@@ -496,6 +504,14 @@ function admin_page_site(&$a) {
                '$delivery_interval'    => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
                '$poll_interval'        => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
                '$maxloadavg'           => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
+
+               '$use_fulltext_engine'  => array('use_fulltext_engine', t("Use MySQL full text engine"), get_config('system','use_fulltext_engine'), t("Activates the full text engine. Speeds up search - but can only search for four and more characters.")),
+               '$itemcache'            => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), "The item caches buffers generated bbcode and external images."),
+               '$itemcache_duration'   => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day).")),
+               '$lockpath'             => array('lockpath', t("Path for lock file"), get_config('system','lockpath'), "The lock file is used to avoid multiple pollers at one time. Only define a folder here."),
+               '$temppath'             => array('temppath', t("Temp path"), get_config('system','temppath'), "If you have a restricted system where the webserver can't access the system temp path, enter another path here."),
+               '$basepath'             => array('basepath', t("Base path to installation"), get_config('system','basepath'), "If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."),
+
         '$form_security_token' => get_form_security_token("admin_site"),
 
        ));
@@ -693,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 //
@@ -736,7 +762,7 @@ function admin_page_users(&$a){
  * @return string
  */
 function admin_page_plugins(&$a){
-       
+
        /**
         * Single plugin
         */
@@ -746,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);
@@ -773,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) {
@@ -830,7 +857,7 @@ function admin_page_plugins(&$a){
                        }
                }
        }
-       
+
        $t = get_markup_template("admin_plugins.tpl");
        return replace_macros($t, array(
                '$title' => t('Administration'),
@@ -901,7 +928,7 @@ function rebuild_theme_table($themes) {
        return $o;
 }
 
-       
+
 /**
  * Themes admin page
  *
@@ -909,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();
@@ -945,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
 
@@ -971,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(
@@ -1001,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,
@@ -1015,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'),
@@ -1118,14 +1142,7 @@ readable.");
                }
        }                       
 
-       $includes = array(
-               '$field_checkbox'       => 'field_checkbox.tpl',
-               '$field_input'          => 'field_input.tpl',
-               '$field_select'         => 'field_select.tpl',
-       );
-       $includes = set_template_includes($a->theme['template_engine'], $includes);
-
-       return replace_macros($t, $includes + array(
+       return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Logs'),
                '$submit' => t('Submit'),
@@ -1184,14 +1201,7 @@ function admin_page_remoteupdate(&$a) {
        }
        
        $tpl = get_markup_template("admin_remoteupdate.tpl");
-
-       $includes = array(
-               '$field_input'          => 'field_input.tpl',
-               '$field_password'       => 'field_password.tpl',
-       );
-       $includes = set_template_includes($a->theme['template_engine'], $includes);
-
-       return replace_macros($tpl, $includes + array(
+       return replace_macros($tpl, array(
                '$baseurl' => $a->get_baseurl(true),
                '$submit' => t("Update now"),
                '$close' => t("Close"),