* @param App $a
*
*/
-function admin_post(&$a){
+function admin_post(App &$a){
if(!is_site_admin()) {
// do not allow a page manager to access the admin panel at all.
- if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
+ if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
return;
-
-
+ }
// urls
- if($a->argc > 1) {
+ if ($a->argc > 1) {
switch ($a->argv[1]){
case 'site':
admin_page_site_post($a);
* @param App $a
* @return string
*/
-function admin_content(&$a) {
+function admin_content(App &$a) {
if(!is_site_admin()) {
return login(false);
}
- if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
+ if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
return "";
+ }
// APC deactivated, since there are problems with PHP 5.5
//if (function_exists("apc_delete")) {
* @param App $a
* @return string
*/
-function admin_page_federation(&$a) {
+function admin_page_federation(App &$a) {
// get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
// social and statusnet nodes this node is knowing
//
* @param App $a
* @return string
*/
-function admin_page_queue(&$a) {
+function admin_page_queue(App &$a) {
// get content from the queue table
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
FROM `queue` AS `q`, `contact` AS `c`
* @param App $a
* @return string
*/
-function admin_page_summary(&$a) {
+function admin_page_summary(App &$a) {
global $db;
// are there MyISAM tables in the DB? If so, trigger a warning message
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1",
*
* @param App $a
*/
-function admin_page_site_post(&$a) {
+function admin_page_site_post(App &$a) {
if(!x($_POST,"page_site")) {
return;
}
* @param App $a
* @return string
*/
-function admin_page_site(&$a) {
+function admin_page_site(App &$a) {
/* Installed langs */
$lang_choices = get_available_languages();
* @param App $a
* @return string
**/
-function admin_page_dbsync(&$a) {
+function admin_page_dbsync(App &$a) {
$o = '';
$failed = array();
$r = q("SELECT `k`, `v` FROM `config` WHERE `cat` = 'database' ");
if (dbm::is_result($r)) {
- foreach($r as $rr) {
+ foreach ($r as $rr) {
$upd = intval(substr($rr['k'],7));
if($upd < 1139 || $rr['v'] === 'success')
continue;
$failed[] = $upd;
}
}
- if(! count($failed)) {
+ if (! count($failed)) {
$o = replace_macros(get_markup_template('structure_check.tpl'),array(
- '$base' => App::get_baseurl(true),
+ '$base' => App::get_baseurl(true),
'$banner' => t('No failed updates.'),
- '$check' => t('Check database structure'),
+ '$check' => t('Check database structure'),
));
} else {
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
- '$base' => App::get_baseurl(true),
+ '$base' => App::get_baseurl(true),
'$banner' => t('Failed Updates'),
- '$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
- '$mark' => t('Mark success (if update was manually applied)'),
- '$apply' => t('Attempt to execute this update step automatically'),
+ '$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
+ '$mark' => t('Mark success (if update was manually applied)'),
+ '$apply' => t('Attempt to execute this update step automatically'),
'$failed' => $failed
));
}
*
* @param App $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'] : '');
+function admin_page_users_post(App &$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_language = get_config('system', 'language');
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
- if(!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
+ if (!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
require_once('include/user.php');
$result = create_user(array('username'=>$nu_name, 'email'=>$nu_email,
'nickname'=>$nu_nickname, 'verified'=>1, 'language'=>$nu_language));
- if(! $result['success']) {
+ if (! $result['success']) {
notice($result['message']);
return;
}
* @param App $a
* @return string
*/
-function admin_page_users(&$a){
+function admin_page_users(App &$a){
if($a->argc>2) {
$uid = $a->argv[3];
$user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
* @param App $a
* @return string
*/
-function admin_page_plugins(&$a){
+function admin_page_plugins(App &$a){
/*
* Single plugin
* List plugins
*/
- if(x($_GET,"a") && $_GET['a']=="r") {
+ if (x($_GET,"a") && $_GET['a']=="r") {
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/plugins', 'admin_themes', 't');
reload_plugins();
info("Plugins reloaded");
$plugins = array();
$files = glob("addon/*/");
- if($files) {
- foreach($files as $file) {
- if(is_dir($file)) {
+ if ($files) {
+ foreach ($files as $file) {
+ if (is_dir($file)) {
list($tmp, $id)=array_map("trim", explode("/",$file));
$info = get_plugin_info($id);
$show_plugin = true;
// If the addon is unsupported, then only show it, when it is enabled
- if((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins))
+ if ((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins)) {
$show_plugin = false;
+ }
// Override the above szenario, when the admin really wants to see outdated stuff
- if(get_config("system", "show_unsupported_addons"))
+ if (get_config("system", "show_unsupported_addons")) {
$show_plugin = true;
+ }
- if($show_plugin)
+ if ($show_plugin) {
$plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
+ }
}
}
}
* @param App $a
* @return string
*/
-function admin_page_themes(&$a){
+function admin_page_themes(App &$a){
$allowed_themes_str = get_config('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str);
// reload active themes
- if(x($_GET,"a") && $_GET['a']=="r") {
+ if (x($_GET,"a") && $_GET['a']=="r") {
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/themes', 'admin_themes', 't');
- if($themes) {
- foreach($themes as $th) {
- if($th['allowed']) {
+ if ($themes) {
+ foreach ($themes as $th) {
+ if ($th['allowed']) {
uninstall_theme($th['name']);
install_theme($th['name']);
}
*/
$xthemes = array();
- if($themes) {
+ 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'),
- '$page' => t('Themes'),
- '$submit' => t('Save Settings'),
- '$reload' => t('Reload active themes'),
- '$baseurl' => App::get_baseurl(true),
- '$function' => 'themes',
- '$plugins' => $xthemes,
- '$pcount' => count($themes),
- '$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'<code>/view/themes</code>'),
- '$experimental' => t('[Experimental]'),
- '$unsupported' => t('[Unsupported]'),
+ '$title' => t('Administration'),
+ '$page' => t('Themes'),
+ '$submit' => t('Save Settings'),
+ '$reload' => t('Reload active themes'),
+ '$baseurl' => App::get_baseurl(true),
+ '$function' => 'themes',
+ '$plugins' => $xthemes,
+ '$pcount' => count($themes),
+ '$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'<code>/view/themes</code>'),
+ '$experimental' => t('[Experimental]'),
+ '$unsupported' => t('[Unsupported]'),
'$form_security_token' => get_form_security_token("admin_themes"),
));
}
*
* @param App $a
*/
-function admin_page_logs_post(&$a) {
- if(x($_POST,"page_logs")) {
+function admin_page_logs_post(App &$a) {
+ if (x($_POST,"page_logs")) {
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
- $logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
- $debugging = ((x($_POST,'debugging')) ? true : false);
- $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
+ $logfile = (x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
+ $debugging = ((x($_POST,'debugging')) ? true : false);
+ $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
set_config('system','logfile', $logfile);
set_config('system','debugging', $debugging);
* @param App $a
* @return string
*/
-function admin_page_logs(&$a){
+function admin_page_logs(App &$a){
$log_choices = array(
LOGGER_NORMAL => 'Normal',
* @param App $a
* @return string
*/
-function admin_page_viewlogs(&$a){
+function admin_page_viewlogs(App &$a){
$t = get_markup_template("admin_viewlogs.tpl");
$f = get_config('system','logfile');
$data = '';
*
* @param App $a
*/
-function admin_page_features_post(&$a) {
+function admin_page_features_post(App &$a) {
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
* @param App $a
* @return string
*/
-function admin_page_features(&$a) {
+function admin_page_features(App &$a) {
if((argc() > 1) && (argv(1) === 'features')) {
$arr = array();