]> git.mxchange.org Git - friendica.git/blobdiff - mod/admin.php
Check for user name in deleted user list and unset account expiration before importin...
[friendica.git] / mod / admin.php
index e4677b29c8b4136e0af6bbccc93b3d90165a522a..4539e4192b8f6f5a436a7c2f1ffe7a3baf4d70c6 100644 (file)
@@ -274,6 +274,7 @@ function admin_page_site_post(&$a){
        $maxloadavg             =       ((x($_POST,'maxloadavg'))               ? intval(trim($_POST['maxloadavg']))            : 50);
        $dfrn_only              =       ((x($_POST,'dfrn_only'))                ? True                                          : False);
        $ostatus_disabled       =       !((x($_POST,'ostatus_disabled'))        ? True                                          : False);
+       $ostatus_poll_interval  =       ((x($_POST,'ostatus_poll_interval'))    ? intval(trim($_POST['ostatus_poll_interval']))         :  0);
        $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);
@@ -388,6 +389,7 @@ function admin_page_site_post(&$a){
        set_config('system','curl_timeout', $timeout);
        set_config('system','dfrn_only', $dfrn_only);
        set_config('system','ostatus_disabled', $ostatus_disabled);
+        set_config('system','ostatus_poll_interval', $ostatus_poll_interval);
        set_config('system','diaspora_enabled', $diaspora_enabled);
        set_config('config','private_addons', $private_addons);
        
@@ -442,7 +444,16 @@ function admin_page_site(&$a) {
                 $theme_choices[$f] = $theme_name;
                        }
                }
-       }
+        }
+
+        /* OStatus conversation poll choices */
+        $ostatus_poll_choices = array(
+                "-1" => t("Never"),
+                "0" => t("Frequently"),
+                "60" => t("Hourly"),
+                "720" => t("Twice daily"),
+                "1440" => t("Daily")
+            );
 
         /* get user names to make the install a personal install of X */
         $user_names = array();
@@ -512,7 +523,7 @@ function admin_page_site(&$a) {
                '$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.")),
                '$enotify_no_content'   => array('enotify_no_content', t("Don't include post content in email notifications"), get_config('system','enotify_no_content'), t("Don't include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.")),
                '$private_addons'       => array('private_addons', t("Disallow public access to addons listed in the apps menu."), get_config('config','private_addons'), t("Checking this box will restrict addons listed in the apps menu to members only.")),
-               '$disable_embedded'     => array('disable_embedded', t("Don't embed private images in posts"), get_config('system','disable_embedded'), t("Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos won't be able to see them unless they first visit the owner's profile page, or unless they have the redir_private_img plugin enabled.")),
+               '$disable_embedded'     => array('disable_embedded', t("Don't embed private images in posts"), get_config('system','disable_embedded'), t("Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.")),
                
                '$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.")),
@@ -520,6 +531,7 @@ function admin_page_site(&$a) {
                '$no_utf'               => array('no_utf', t("UTF-8 Regular expressions"), !get_config('system','no_utf'), t("Use PHP UTF8 regular expressions")),
                '$no_community_page'    => array('no_community_page', t("Show Community Page"), !get_config('system','no_community_page'), t("Display a Community page showing all recent public postings on this site.")),
                '$ostatus_disabled'     => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disabled'), t("Provide built-in OStatus \x28identi.ca, status.net, etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")),    
+               '$ostatus_poll_interval'        => array('ostatus_poll_interval', t("OStatus conversation completion interval"), (string) intval(get_config('system','ostatus_poll_interval')), t("How often shall the poller check for new entries in OStatus conversations? This can be a very ressource task."), $ostatus_poll_choices),
                '$diaspora_enabled'     => array('diaspora_enabled', t("Enable Diaspora support"), get_config('system','diaspora_enabled'), t("Provide built-in Diaspora network compatibility.")),     
                '$dfrn_only'            => array('dfrn_only', t('Only allow Friendica contacts'), get_config('system','dfrn_only'), t("All contacts must use Friendica protocols. All other built-in communication protocols disabled.")),
                '$verifyssl'            => array('verifyssl', t("Verify SSL"), get_config('system','verifyssl'), t("If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites.")),
@@ -610,9 +622,40 @@ function admin_page_dbsync(&$a) {
 function admin_page_users_post(&$a){
        $pending = ( x($_POST, 'pending') ? $_POST['pending'] : Array() );
        $users = ( x($_POST, 'user') ? $_POST['user'] : Array() );
-
-    check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
-
+       $nu_name = ( x($_POST, 'new_user_name') ? $_POST['new_user_name'] : ''); 
+  $nu_nickname = ( x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : ''); 
+  $nu_email = ( x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
+
+  check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
+    
+  if (!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) { 
+      require_once('include/user.php'); 
+      require_once('include/email.php'); 
+      $result = create_user( array('username'=>$nu_name, 'email'=>$nu_email, 'nickname'=>$nu_nickname, 'verified'=>1)  ); 
+      if(! $result['success']) { 
+                   notice($result['message']); 
+                   return; 
+      } 
+      $nu = $result['user']; 
+      $email_tpl = get_intltext_template("register_adminadd_eml.tpl"); 
+      $email_tpl = replace_macros($email_tpl, array( 
+                   '$sitename' => $a->config['sitename'], 
+                   '$siteurl' =>  $a->get_baseurl(), 
+                   '$username' => $nu['username'], 
+                   '$email' => $nu['email'], 
+                   '$password' => $result['password'], 
+                   '$uid' => $nu['uid'] )); 
+      $res = mail($nu['email'], email_header_encode( sprintf( t('Registration details for %s'), $a->config['sitename']),'UTF-8'), 
+                   $email_tpl,  
+                   'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n" 
+                   . 'Content-type: text/plain; charset=UTF-8' . "\n" 
+                   . 'Content-transfer-encoding: 8bit' ); 
+      if ($res) { 
+                   info( t('Registration successful. Email send to user').EOL ); 
+      } 
+  }
+       
        if (x($_POST,'page_users_block')){
                foreach($users as $uid){
                        q("UPDATE `user` SET `blocked`=1-`blocked` WHERE `uid`=%s",
@@ -728,19 +771,35 @@ function admin_page_users(&$a){
                $e['login_date'] = relative_date($e['login_date']);
                $e['lastitem_date'] = relative_date($e['lastitem_date']);
         $e['is_admin'] = ($e['email'] === $a->config['admin_email']);
+        $e['deleted'] = ($e['account_removed']?relative_date($e['account_expires_on']):False);
                return $e;
        }
        $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) {
+       // and extracting deleted users
+       
+       $tmp_users = Array();
+       $deleted = Array();
+       
+       while(count($users)) {
+               $new_user = Array();
+               foreach( array_pop($users) as $k => $v) {
                        $k = str_replace('-','_',$k);
                        $new_user[$k] = $v;
                }
-               $users[$key] = $new_user;
+               if($new_user['deleted']) {
+                       array_push($deleted, $new_user);
+               }
+               else {
+                       array_push($tmp_users, $new_user);
+               }
+       }
+       //Reversing the two array, and moving $tmp_users to $users
+       array_reverse($deleted);
+       while(count($tmp_users)) {
+               array_push($users, array_pop($tmp_users));
        }
 
        $t = get_markup_template("admin_users.tpl");
@@ -751,6 +810,7 @@ function admin_page_users(&$a){
                '$submit' => t('Submit'),
                '$select_all' => t('select all'),
                '$h_pending' => t('User registrations waiting for confirm'),
+               '$h_deleted' => t('User waiting for permanent deletion'),
                '$th_pending' => array( t('Request date'), t('Name'), t('Email') ),
                '$no_pending' =>  t('No registrations.'),
                '$approve' => t('Approve'),
@@ -762,6 +822,8 @@ function admin_page_users(&$a){
         '$accountexpired' => t('Account expired'),
                
                '$h_users' => t('Users'),
+               '$h_newuser' => t('New User'),
+               '$th_deleted' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since') ),
                '$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'),  t('Account') ),
 
                '$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
@@ -773,7 +835,11 @@ function admin_page_users(&$a){
                '$baseurl' => $a->get_baseurl(true),
 
                '$pending' => $pending,
+               'deleted' => $deleted,
                '$users' => $users,
+               '$newusername'  => array('new_user_name', t("Name"), '', t("Name of the new user.")), 
+    '$newusernickname'  => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")), 
+    '$newuseremail'  => array('new_user_email', t("Email"), '', t("Email address of the new user.")),
        ));
        $o .= paginate($a);
        return $o;
@@ -1181,7 +1247,7 @@ readable.");
                '$logname' =>  get_config('system','logfile'),
                
                                                                        // name, label, value, help string, extra data...
-               '$debugging'            => array('debugging', t("Debugging"),get_config('system','debugging'), ""),
+               '$debugging'            => array('debugging', t("Enable Debugging"),get_config('system','debugging'), ""),
                '$logfile'                      => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
                '$loglevel'             => array('loglevel', t("Log level"), get_config('system','loglevel'), "", $log_choices),