aboutsummaryrefslogtreecommitdiffstats
path: root/mod/admin.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/admin.php')
-rw-r--r--mod/admin.php106
1 files changed, 53 insertions, 53 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 6300ac027..be703f922 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -40,7 +40,7 @@ function admin_post(&$a){
$func($a);
}
}
- goaway($a->get_baseurl(true) . '/admin/plugins/' . argv(2) );
+ goaway(z_root() . '/admin/plugins/' . argv(2) );
break;
case 'themes':
$theme = argv(2);
@@ -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 );
+ goaway(z_root() . '/admin/themes/' . $theme );
break;
case 'logs':
admin_page_logs_post($a);
@@ -77,7 +77,7 @@ function admin_post(&$a){
}
}
- goaway($a->get_baseurl(true) . '/admin' );
+ goaway(z_root() . '/admin' );
}
/**
@@ -196,7 +196,7 @@ function admin_page_summary(&$a) {
$queues = array( 'label' => t('Message queues'), 'queue' => $queue );
// If no plugins active return 0, otherwise list of plugin names
- $plugins = (count($a->plugins) == 0) ? count($a->plugins) : $a->plugins;
+ $plugins = (count(App::$plugins) == 0) ? count(App::$plugins) : App::$plugins;
// Could be extended to provide also other alerts to the admin
$alertmsg = '';
@@ -337,7 +337,7 @@ function admin_page_site_post(&$a){
set_config('system','curl_timeout', $timeout);
info( t('Site settings updated.') . EOL);
- goaway($a->get_baseurl(true) . '/admin/site' );
+ goaway(z_root() . '/admin/site' );
}
/**
@@ -460,7 +460,7 @@ function admin_page_site(&$a) {
'$corporate' => t('Policies'),
'$advanced' => t('Advanced'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
// name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
@@ -514,7 +514,7 @@ function admin_page_hubloc_post(&$a){
$hublocurl = $arrhublocurl[0]['hubloc_url'] . '/post';
//perform ping
- $m = zot_build_packet($a->get_channel(),'ping');
+ $m = zot_build_packet(App::get_channel(),'ping');
$r = zot_zot($hublocurl,$m);
//handle results and set the hubloc flags in db to make results visible
$r2 = $r['body'];
@@ -536,7 +536,7 @@ function admin_page_hubloc_post(&$a){
//after repair set hubloc flags to 0
}
- goaway($a->get_baseurl(true) . '/admin/hubloc' );
+ goaway(z_root() . '/admin/hubloc' );
}
function trim_array_elems($arr) {
@@ -659,7 +659,7 @@ function admin_page_hubloc(&$a) {
if(! $hubloc){
notice( t('No server found') . EOL);
- goaway($a->get_baseurl(true) . '/admin/hubloc');
+ goaway(z_root() . '/admin/hubloc');
}
$t = get_markup_template('admin_hubloc.tpl');
@@ -671,7 +671,7 @@ function admin_page_hubloc(&$a) {
'$queues' => $queues,
//'$accounts' => $accounts, /*$accounts is empty here*/
'$pending' => array( t('Pending registrations'), $pending),
- '$plugins' => array( t('Active plugins'), $a->plugins ),
+ '$plugins' => array( t('Active plugins'), App::$plugins ),
'$form_security_token' => get_form_security_token('admin_hubloc')
));
}
@@ -733,7 +733,7 @@ function admin_page_dbsync(&$a) {
if(intval(get_config('system','db_version')) <= intval(argv(3)))
set_config('system','db_version',intval(argv(3)) + 1);
info( t('Update has been marked successful') . EOL);
- goaway($a->get_baseurl(true) . '/admin/dbsync');
+ goaway(z_root() . '/admin/dbsync');
}
if(argc() > 2 && intval(argv(2))) {
@@ -771,7 +771,7 @@ function admin_page_dbsync(&$a) {
return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
- '$base' => $a->get_baseurl(true),
+ '$base' => z_root(),
'$banner' => t('Failed Updates'),
'$desc' => '',
'$mark' => t('Mark success (if update was manually applied)'),
@@ -871,7 +871,7 @@ function admin_page_users_post($a) {
}
}
- goaway($a->get_baseurl(true) . '/admin/users' );
+ goaway(z_root() . '/admin/users' );
}
/**
@@ -893,7 +893,7 @@ function admin_page_users(&$a){
if (! $account) {
notice( t('Account not found') . EOL);
- goaway($a->get_baseurl(true) . '/admin/users' );
+ goaway(z_root() . '/admin/users' );
}
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
@@ -924,7 +924,7 @@ function admin_page_users(&$a){
break;
}
- goaway($a->get_baseurl(true) . '/admin/users' );
+ goaway(z_root() . '/admin/users' );
}
/* get pending */
@@ -936,8 +936,8 @@ function admin_page_users(&$a){
$total = q("SELECT count(*) as total FROM account");
if (count($total)) {
- $a->set_pager_total($total[0]['total']);
- $a->set_pager_itemspage(100);
+ App::set_pager_total($total[0]['total']);
+ App::set_pager_itemspage(100);
}
@@ -958,8 +958,8 @@ function admin_page_users(&$a){
"FROM account as ac where true $serviceclass $order limit %d offset %d ",
intval(ACCOUNT_BLOCKED),
db_concat('ch.channel_address', ' '),
- intval($a->pager['itemspage']),
- intval($a->pager['start'])
+ intval(App::$pager['itemspage']),
+ intval(App::$pager['start'])
);
// function _setup_users($e){
@@ -1003,7 +1003,7 @@ function admin_page_users(&$a){
'$form_security_token' => get_form_security_token("admin_users"),
// values //
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$pending' => $pending,
'$users' => $users,
@@ -1053,7 +1053,7 @@ function admin_page_channels_post(&$a) {
notice( sprintf( tt("%s channel deleted", "%s channels deleted", count($channels)), count($channels)) );
}
- goaway($a->get_baseurl(true) . '/admin/channels' );
+ goaway(z_root() . '/admin/channels' );
}
/**
@@ -1071,7 +1071,7 @@ function admin_page_channels(&$a){
if (! $channel) {
notice( t('Channel not found') . EOL);
- goaway($a->get_baseurl(true) . '/admin/channels' );
+ goaway(z_root() . '/admin/channels' );
}
switch(argv(2)) {
@@ -1110,22 +1110,22 @@ function admin_page_channels(&$a){
default:
break;
}
- goaway($a->get_baseurl(true) . '/admin/channels' );
+ goaway(z_root() . '/admin/channels' );
}
/* get channels */
$total = q("SELECT count(*) as total FROM channel where channel_removed = 0 and channel_system = 0");
if($total) {
- $a->set_pager_total($total[0]['total']);
- $a->set_pager_itemspage(100);
+ App::set_pager_total($total[0]['total']);
+ App::set_pager_itemspage(100);
}
$order = " order by channel_name asc ";
$channels = q("SELECT * from channel where channel_removed = 0 and channel_system = 0 $order limit %d offset %d ",
- intval($a->pager['itemspage']),
- intval($a->pager['start'])
+ intval(App::$pager['itemspage']),
+ intval(App::$pager['start'])
);
if($channels) {
@@ -1163,7 +1163,7 @@ function admin_page_channels(&$a){
'$form_security_token' => get_form_security_token("admin_channels"),
// values //
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$channels' => $channels,
));
$o .= paginate($a);
@@ -1183,14 +1183,14 @@ function admin_page_plugins(&$a){
/*
* Single plugin
*/
- if ($a->argc == 3){
- $plugin = $a->argv[2];
+ if (App::$argc == 3){
+ $plugin = App::$argv[2];
if (!is_file("addon/$plugin/$plugin.php")){
notice( t("Item not found.") );
return '';
}
- $enabled = in_array($plugin,$a->plugins);
+ $enabled = in_array($plugin,App::$plugins);
$info = get_plugin_info($plugin);
$x = check_plugin_versions($info);
@@ -1198,11 +1198,11 @@ function admin_page_plugins(&$a){
if($enabled && ! $x) {
$enabled = false;
- $idz = array_search($plugin, $a->plugins);
+ $idz = array_search($plugin, App::$plugins);
if ($idz !== false) {
- unset($a->plugins[$idz]);
+ unset(App::$plugins[$idz]);
uninstall_plugin($plugin);
- set_config("system","addon", implode(", ",$a->plugins));
+ set_config("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
@@ -1211,23 +1211,23 @@ function admin_page_plugins(&$a){
check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't');
// Toggle plugin status
- $idx = array_search($plugin, $a->plugins);
+ $idx = array_search($plugin, App::$plugins);
if ($idx !== false){
- unset($a->plugins[$idx]);
+ unset(App::$plugins[$idx]);
uninstall_plugin($plugin);
info( sprintf( t("Plugin %s disabled."), $plugin ) );
} else {
- $a->plugins[] = $plugin;
+ App::$plugins[] = $plugin;
install_plugin($plugin);
info( sprintf( t("Plugin %s enabled."), $plugin ) );
}
- set_config("system","addon", implode(", ",$a->plugins));
- goaway($a->get_baseurl(true) . '/admin/plugins' );
+ set_config("system","addon", implode(", ",App::$plugins));
+ goaway(z_root() . '/admin/plugins' );
}
// display plugin details
require_once('library/markdown.php');
- if (in_array($plugin, $a->plugins)){
+ if (in_array($plugin, App::$plugins)){
$status = 'on';
$action = t('Disable');
} else {
@@ -1264,7 +1264,7 @@ function admin_page_plugins(&$a){
'$page' => t('Plugins'),
'$toggle' => t('Toggle'),
'$settings' => t('Settings'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$plugin' => $plugin,
'$status' => $status,
@@ -1298,18 +1298,18 @@ function admin_page_plugins(&$a){
if (is_dir($file)){
list($tmp, $id) = array_map('trim', explode('/', $file));
$info = get_plugin_info($id);
- $enabled = in_array($id,$a->plugins);
+ $enabled = in_array($id,App::$plugins);
$x = check_plugin_versions($info);
// disable plugins which are installed but incompatible versions
if($enabled && ! $x) {
$enabled = false;
- $idz = array_search($id, $a->plugins);
+ $idz = array_search($id, App::$plugins);
if ($idz !== false) {
- unset($a->plugins[$idz]);
+ unset(App::$plugins[$idz]);
uninstall_plugin($id);
- set_config("system","addon", implode(", ",$a->plugins));
+ set_config("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
@@ -1324,7 +1324,7 @@ function admin_page_plugins(&$a){
'$title' => t('Administration'),
'$page' => t('Plugins'),
'$submit' => t('Submit'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$function' => 'plugins',
'$plugins' => $plugins,
'$disabled' => t('Disabled - version incompatibility'),
@@ -1428,8 +1428,8 @@ function admin_page_themes(&$a){
* Single theme
*/
- if ($a->argc == 3){
- $theme = $a->argv[2];
+ if (App::$argc == 3){
+ $theme = App::$argv[2];
if(! is_dir("view/theme/$theme")){
notice( t("Item not found.") );
return '';
@@ -1448,7 +1448,7 @@ function admin_page_themes(&$a){
info( sprintf('Theme %s disabled.', $theme));
set_config('system', 'allowed_themes', $s);
- goaway($a->get_baseurl(true) . '/admin/themes' );
+ goaway(z_root() . '/admin/themes' );
}
// display theme details
@@ -1486,7 +1486,7 @@ function admin_page_themes(&$a){
'$page' => t('Themes'),
'$toggle' => t('Toggle'),
'$settings' => t('Settings'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$plugin' => $theme,
'$status' => $status,
@@ -1519,7 +1519,7 @@ function admin_page_themes(&$a){
'$title' => t('Administration'),
'$page' => t('Themes'),
'$submit' => t('Submit'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$function' => 'themes',
'$plugins' => $xthemes,
'$experimental' => t('[Experimental]'),
@@ -1548,7 +1548,7 @@ function admin_page_logs_post(&$a) {
}
info( t('Log settings updated.') );
- goaway($a->get_baseurl(true) . '/admin/logs' );
+ goaway(z_root() . '/admin/logs' );
}
/**
@@ -1606,7 +1606,7 @@ readable.");
'$submit' => t('Submit'),
'$clear' => t('Clear'),
'$data' => $data,
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$logname' => get_config('system','logfile'),
// name, label, value, help string, extra data...