From fe02619114e30198e1360e41b4c7cd385c1ed8ba Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sun, 7 Sep 2014 11:31:42 +0200 Subject: [PATCH] fix indentation --- mod/admin.php | 133 +++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 66 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 24069c5d9..5da07b33e 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -419,9 +419,9 @@ function admin_page_site_post(&$a){ set_config('system','banner', $banner); } if ($info=="") { - del_config('config','info'); + del_config('config','info'); } else { - set_config('config','info',$info); + set_config('config','info',$info); } set_config('system','language', $language); set_config('system','theme', $theme); @@ -429,12 +429,12 @@ function admin_page_site_post(&$a){ del_config('system','mobile-theme'); } else { set_config('system','mobile-theme', $theme_mobile); - } - if ( $singleuser === '---' ) { - del_config('system','singleuser'); - } else { - set_config('system','singleuser', $singleuser); - } + } + if ( $singleuser === '---' ) { + del_config('system','singleuser'); + } else { + set_config('system','singleuser', $singleuser); + } set_config('system','maximagesize', $maximagesize); set_config('system','max_image_length', $maximagelength); set_config('system','jpeg_quality', $jpegimagequality); @@ -473,7 +473,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','ostatus_poll_interval', $ostatus_poll_interval); set_config('system','diaspora_enabled', $diaspora_enabled); set_config('config','private_addons', $private_addons); @@ -524,32 +524,32 @@ function admin_page_site(&$a) { foreach($files as $file) { $f = basename($file); $theme_name = ((file_exists($file . '/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f); - if (file_exists($file . '/mobile')) { - $theme_choices_mobile[$f] = $theme_name; - } + if (file_exists($file . '/mobile')) { + $theme_choices_mobile[$f] = $theme_name; + } else { - $theme_choices[$f] = $theme_name; + $theme_choices[$f] = $theme_name; } } - } + } - /* OStatus conversation poll choices */ - $ostatus_poll_choices = array( + /* OStatus conversation poll choices */ + $ostatus_poll_choices = array( "-2" => t("Never"), "-1" => t("At post arrival"), "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(); - $user_names['---'] = t('Multi user instance'); - $users = q("SELECT username, nickname FROM `user`"); - foreach ($users as $user) { - $user_names[$user['nickname']] = $user['username']; - } + /* get user names to make the install a personal install of X */ + $user_names = array(); + $user_names['---'] = t('Multi user instance'); + $users = q("SELECT username, nickname FROM `user`"); + foreach ($users as $user) { + $user_names[$user['nickname']] = $user['username']; + } /* Banner */ $banner = get_config('system','banner'); @@ -626,9 +626,9 @@ function admin_page_site(&$a) { '$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")), '$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 \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")), + '$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social 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.")), + '$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.")), '$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""), @@ -651,7 +651,7 @@ function admin_page_site(&$a) { '$relocate_url' => array('relocate_url', t("New base url"), $a->get_baseurl(), "Change base url for this server. Sends relocate message to all DFRN contacts of all users."), '$enable_noscrape'=> array('enable_noscrape', t("Enable noscrape"), get_config('system','enable_noscrape'), t("The noscrape feature speeds up directory submissions by using JSON data instead of HTML scraping.")), - '$form_security_token' => get_form_security_token("admin_site") + '$form_security_token' => get_form_security_token("admin_site") )); @@ -744,39 +744,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() ); - $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'] : ''); + $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'); + 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 (!($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){ @@ -825,7 +826,7 @@ function admin_page_users(&$a){ } switch($a->argv[2]){ case "delete":{ - check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't'); + check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't'); // delete user require_once("include/Contact.php"); user_remove($uid); @@ -833,7 +834,7 @@ function admin_page_users(&$a){ notice( sprintf(t("User '%s' deleted"), $user[0]['username']) . EOL); }; break; case "block":{ - check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't'); + check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't'); q("UPDATE `user` SET `blocked`=%d WHERE `uid`=%s", intval( 1-$user[0]['blocked'] ), intval( $uid ) @@ -889,7 +890,7 @@ function admin_page_users(&$a){ t('Normal Account'), t('Soapbox Account'), t('Community/Celebrity Account'), - t('Automatic Friend Account') + t('Automatic Friend Account') ); $e['page-flags'] = $accounts[$e['page-flags']]; $e['register_date'] = relative_date($e['register_date']); @@ -1094,7 +1095,7 @@ function admin_page_plugins(&$a){ '$baseurl' => $a->get_baseurl(true), '$function' => 'plugins', '$plugins' => $plugins, - '$form_security_token' => get_form_security_token("admin_themes"), + '$form_security_token' => get_form_security_token("admin_themes"), )); } @@ -1296,7 +1297,7 @@ function admin_page_themes(&$a){ '$plugins' => $xthemes, '$experimental' => t('[Experimental]'), '$unsupported' => t('[Unsupported]'), - '$form_security_token' => get_form_security_token("admin_themes"), + '$form_security_token' => get_form_security_token("admin_themes"), )); } @@ -1309,7 +1310,7 @@ function admin_page_themes(&$a){ function admin_page_logs_post(&$a) { if (x($_POST,"page_logs")) { - check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs'); + check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs'); $logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : ''); $debugging = ((x($_POST,'debugging')) ? true : false); @@ -1348,7 +1349,7 @@ function admin_page_logs(&$a){ $data = ''; if(!file_exists($f)) { - $data = t("Error trying to open $f log file.\r\n
Check to see if file $f exist and is + $data = t("Error trying to open $f log file.\r\n
Check to see if file $f exist and is readable."); } else { @@ -1388,7 +1389,7 @@ readable."); '$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), - '$form_security_token' => get_form_security_token("admin_logs"), + '$form_security_token' => get_form_security_token("admin_logs"), )); }