Fix mod/admin.php formatting
This commit is contained in:
parent
a5e9117524
commit
3cebdee867
1 changed files with 291 additions and 295 deletions
172
mod/admin.php
172
mod/admin.php
|
@ -5,7 +5,6 @@
|
||||||
*
|
*
|
||||||
* @brief Friendica admin
|
* @brief Friendica admin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
@ -30,7 +29,8 @@ require_once 'include/items.php';
|
||||||
* @param App $a
|
* @param App $a
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function admin_post(App $a) {
|
function admin_post(App $a)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
if (!is_site_admin()) {
|
if (!is_site_admin()) {
|
||||||
|
@ -75,7 +75,9 @@ function admin_post(App $a) {
|
||||||
|
|
||||||
$theme = $a->argv[2];
|
$theme = $a->argv[2];
|
||||||
if (is_file("view/theme/$theme/config.php")) {
|
if (is_file("view/theme/$theme/config.php")) {
|
||||||
function __call_theme_admin_post(App $a, $theme) {
|
|
||||||
|
function __call_theme_admin_post(App $a, $theme)
|
||||||
|
{
|
||||||
$orig_theme = $a->theme;
|
$orig_theme = $a->theme;
|
||||||
$orig_page = $a->page;
|
$orig_page = $a->page;
|
||||||
$orig_session_theme = $_SESSION['theme'];
|
$orig_session_theme = $_SESSION['theme'];
|
||||||
|
@ -145,7 +147,8 @@ function admin_post(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_content(App $a) {
|
function admin_content(App $a)
|
||||||
|
{
|
||||||
|
|
||||||
if (!is_site_admin()) {
|
if (!is_site_admin()) {
|
||||||
return login(false);
|
return login(false);
|
||||||
|
@ -160,7 +163,6 @@ function admin_content(App $a) {
|
||||||
// $toDelete = new APCIterator('user', APC_ITER_VALUE);
|
// $toDelete = new APCIterator('user', APC_ITER_VALUE);
|
||||||
// apc_delete($toDelete);
|
// apc_delete($toDelete);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// Header stuff
|
// Header stuff
|
||||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('admin_settings_head.tpl'), array());
|
$a->page['htmlhead'] .= replace_macros(get_markup_template('admin_settings_head.tpl'), array());
|
||||||
|
|
||||||
|
@ -283,7 +285,8 @@ function admin_content(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_blocklist(App $a) {
|
function admin_page_blocklist(App $a)
|
||||||
|
{
|
||||||
$blocklist = Config::get('system', 'blocklist');
|
$blocklist = Config::get('system', 'blocklist');
|
||||||
$blocklistform = array();
|
$blocklistform = array();
|
||||||
if (is_array($blocklist)) {
|
if (is_array($blocklist)) {
|
||||||
|
@ -322,7 +325,8 @@ function admin_page_blocklist(App $a) {
|
||||||
*
|
*
|
||||||
* @param App $a
|
* @param App $a
|
||||||
*/
|
*/
|
||||||
function admin_page_blocklist_post(App $a) {
|
function admin_page_blocklist_post(App $a)
|
||||||
|
{
|
||||||
if (!x($_POST, "page_blocklist_save") && (!x($_POST['page_blocklist_edit']))) {
|
if (!x($_POST, "page_blocklist_save") && (!x($_POST['page_blocklist_edit']))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +374,8 @@ function admin_page_blocklist_post(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_deleteitem(App $a) {
|
function admin_page_deleteitem(App $a)
|
||||||
|
{
|
||||||
$t = get_markup_template("admin_deleteitem.tpl");
|
$t = get_markup_template("admin_deleteitem.tpl");
|
||||||
|
|
||||||
return replace_macros($t, array(
|
return replace_macros($t, array(
|
||||||
|
@ -384,6 +389,7 @@ function admin_page_deleteitem(App $a) {
|
||||||
'$form_security_token' => get_form_security_token("admin_deleteitem")
|
'$form_security_token' => get_form_security_token("admin_deleteitem")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Process send data from Admin Delete Item Page
|
* @brief Process send data from Admin Delete Item Page
|
||||||
*
|
*
|
||||||
|
@ -392,7 +398,8 @@ function admin_page_deleteitem(App $a) {
|
||||||
*
|
*
|
||||||
* @param App $a
|
* @param App $a
|
||||||
*/
|
*/
|
||||||
function admin_page_deleteitem_post(App $a) {
|
function admin_page_deleteitem_post(App $a)
|
||||||
|
{
|
||||||
if (!x($_POST['page_deleteitem_submit'])) {
|
if (!x($_POST['page_deleteitem_submit'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +442,8 @@ function admin_page_deleteitem_post(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_federation(App $a) {
|
function admin_page_federation(App $a)
|
||||||
|
{
|
||||||
// get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
|
// get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
|
||||||
// social and statusnet nodes this node is knowing
|
// social and statusnet nodes this node is knowing
|
||||||
//
|
//
|
||||||
|
@ -445,7 +453,8 @@ function admin_page_federation(App $a) {
|
||||||
// Add more platforms if you like, when one returns 0 known nodes it is not
|
// Add more platforms if you like, when one returns 0 known nodes it is not
|
||||||
// displayed on the stats page.
|
// displayed on the stats page.
|
||||||
$platforms = array('Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon', 'Pleroma');
|
$platforms = array('Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon', 'Pleroma');
|
||||||
$colors = array('Friendi%%a' => '#ffc018', // orange from the logo
|
$colors = array(
|
||||||
|
'Friendi%%a' => '#ffc018', // orange from the logo
|
||||||
'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
|
'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
|
||||||
'%%red%%' => '#c50001', // fire red from the logo
|
'%%red%%' => '#c50001', // fire red from the logo
|
||||||
'Hubzilla' => '#43488a', // blue from the logo
|
'Hubzilla' => '#43488a', // blue from the logo
|
||||||
|
@ -453,7 +462,8 @@ function admin_page_federation(App $a) {
|
||||||
'GNU Social' => '#a22430', // dark red from the logo
|
'GNU Social' => '#a22430', // dark red from the logo
|
||||||
'StatusNet' => '#789240', // the green from the logo (red and blue have already others
|
'StatusNet' => '#789240', // the green from the logo (red and blue have already others
|
||||||
'Mastodon' => '#1a9df9', // blue from the Mastodon logo
|
'Mastodon' => '#1a9df9', // blue from the Mastodon logo
|
||||||
'Pleroma' => '#E46F0F'); // Orange from the text that is used on Pleroma instances
|
'Pleroma' => '#E46F0F' // Orange from the text that is used on Pleroma instances
|
||||||
|
);
|
||||||
$counts = array();
|
$counts = array();
|
||||||
$total = 0;
|
$total = 0;
|
||||||
|
|
||||||
|
@ -574,7 +584,8 @@ function admin_page_federation(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_queue(App $a) {
|
function admin_page_queue(App $a)
|
||||||
|
{
|
||||||
// get content from the queue table
|
// get content from the queue table
|
||||||
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
|
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
|
||||||
FROM `queue` AS `q`, `contact` AS `c`
|
FROM `queue` AS `q`, `contact` AS `c`
|
||||||
|
@ -608,10 +619,10 @@ function admin_page_queue(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_summary(App $a) {
|
function admin_page_summary(App $a)
|
||||||
|
{
|
||||||
// are there MyISAM tables in the DB? If so, trigger a warning message
|
// 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",
|
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(dba::database_name()));
|
||||||
dbesc(dba::database_name()));
|
|
||||||
$showwarning = false;
|
$showwarning = false;
|
||||||
$warningtext = array();
|
$warningtext = array();
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
|
@ -702,7 +713,8 @@ function admin_page_summary(App $a) {
|
||||||
*
|
*
|
||||||
* @param App $a
|
* @param App $a
|
||||||
*/
|
*/
|
||||||
function admin_page_site_post(App $a) {
|
function admin_page_site_post(App $a)
|
||||||
|
{
|
||||||
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
|
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
|
||||||
|
|
||||||
if (!empty($_POST['republish_directory'])) {
|
if (!empty($_POST['republish_directory'])) {
|
||||||
|
@ -736,7 +748,8 @@ function admin_page_site_post(App $a) {
|
||||||
$new_host = str_replace("http://", "@", normalise_link($new_url));
|
$new_host = str_replace("http://", "@", normalise_link($new_url));
|
||||||
$old_host = str_replace("http://", "@", normalise_link($old_url));
|
$old_host = str_replace("http://", "@", normalise_link($old_url));
|
||||||
|
|
||||||
function update_table($table_name, $fields, $old_url, $new_url) {
|
function update_table($table_name, $fields, $old_url, $new_url)
|
||||||
|
{
|
||||||
global $a;
|
global $a;
|
||||||
|
|
||||||
$dbold = dbesc($old_url);
|
$dbold = dbesc($old_url);
|
||||||
|
@ -758,7 +771,6 @@ function admin_page_site_post(App $a) {
|
||||||
goaway('admin/site');
|
goaway('admin/site');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update tables
|
// update tables
|
||||||
// update profile links in the format "http://server.tld"
|
// update profile links in the format "http://server.tld"
|
||||||
update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
|
update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
|
||||||
|
@ -933,9 +945,7 @@ function admin_page_site_post(App $a) {
|
||||||
|
|
||||||
if ($banner == "") {
|
if ($banner == "") {
|
||||||
// don't know why, but del_config doesn't work...
|
// don't know why, but del_config doesn't work...
|
||||||
q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
|
q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", dbesc("system"), dbesc("banner")
|
||||||
dbesc("system"),
|
|
||||||
dbesc("banner")
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Config::set('system', 'banner', $banner);
|
Config::set('system', 'banner', $banner);
|
||||||
|
@ -1026,7 +1036,6 @@ function admin_page_site_post(App $a) {
|
||||||
info(t('Site settings updated.') . EOL);
|
info(t('Site settings updated.') . EOL);
|
||||||
goaway('admin/site');
|
goaway('admin/site');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1037,8 +1046,8 @@ function admin_page_site_post(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_site(App $a) {
|
function admin_page_site(App $a)
|
||||||
|
{
|
||||||
/* Installed langs */
|
/* Installed langs */
|
||||||
$lang_choices = get_available_languages();
|
$lang_choices = get_available_languages();
|
||||||
|
|
||||||
|
@ -1058,8 +1067,9 @@ function admin_page_site(App $a) {
|
||||||
$allowed_theme_list = Config::get('system', 'allowed_themes');
|
$allowed_theme_list = Config::get('system', 'allowed_themes');
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (intval(file_exists($file.'/unsupported')))
|
if (intval(file_exists($file . '/unsupported'))) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$f = basename($file);
|
$f = basename($file);
|
||||||
|
|
||||||
|
@ -1264,9 +1274,7 @@ function admin_page_site(App $a) {
|
||||||
'$worker_frontend' => array('worker_frontend', t('Enable frontend worker'), Config::get('system','frontend_worker'), sprintf(t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.'), System::baseUrl())),
|
'$worker_frontend' => array('worker_frontend', t('Enable frontend worker'), Config::get('system','frontend_worker'), sprintf(t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.'), System::baseUrl())),
|
||||||
|
|
||||||
'$form_security_token' => get_form_security_token("admin_site")
|
'$form_security_token' => get_form_security_token("admin_site")
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1281,8 +1289,8 @@ function admin_page_site(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
* */
|
* */
|
||||||
function admin_page_dbsync(App $a) {
|
function admin_page_dbsync(App $a)
|
||||||
|
{
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
if ($a->argc > 3 && intval($a->argv[3]) && $a->argv[2] === 'mark') {
|
if ($a->argc > 3 && intval($a->argv[3]) && $a->argv[2] === 'mark') {
|
||||||
|
@ -1302,8 +1310,7 @@ function admin_page_dbsync(App $a) {
|
||||||
$o .= sprintf(t("Database structure update %s was successfully applied."), DB_UPDATE_VERSION) . "<br />";
|
$o .= sprintf(t("Database structure update %s was successfully applied."), DB_UPDATE_VERSION) . "<br />";
|
||||||
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
|
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
|
||||||
} else {
|
} else {
|
||||||
$o .= sprintf(t("Executing of database structure update %s failed with error: %s"),
|
$o .= sprintf(t("Executing of database structure update %s failed with error: %s"), DB_UPDATE_VERSION, $retval) . "<br />";
|
||||||
DB_UPDATE_VERSION, $retval)."<br />";
|
|
||||||
}
|
}
|
||||||
if ($a->argv[2] === 'check') {
|
if ($a->argv[2] === 'check') {
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -1311,14 +1318,13 @@ function admin_page_dbsync(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->argc > 2 && intval($a->argv[2])) {
|
if ($a->argc > 2 && intval($a->argv[2])) {
|
||||||
require_once('update.php');
|
require_once 'update.php';
|
||||||
$func = 'update_' . intval($a->argv[2]);
|
$func = 'update_' . intval($a->argv[2]);
|
||||||
if (function_exists($func)) {
|
if (function_exists($func)) {
|
||||||
$retval = $func();
|
$retval = $func();
|
||||||
if ($retval === UPDATE_FAILED) {
|
if ($retval === UPDATE_FAILED) {
|
||||||
$o .= sprintf(t("Executing %s failed with error: %s"), $func, $retval);
|
$o .= sprintf(t("Executing %s failed with error: %s"), $func, $retval);
|
||||||
}
|
} elseif ($retval === UPDATE_SUCCESS) {
|
||||||
elseif ($retval === UPDATE_SUCCESS) {
|
|
||||||
$o .= sprintf(t('Update %s was successfully applied.', $func));
|
$o .= sprintf(t('Update %s was successfully applied.', $func));
|
||||||
Config::set('database', $func, 'success');
|
Config::set('database', $func, 'success');
|
||||||
} else {
|
} else {
|
||||||
|
@ -1360,7 +1366,6 @@ function admin_page_dbsync(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1368,7 +1373,8 @@ function admin_page_dbsync(App $a) {
|
||||||
*
|
*
|
||||||
* @param App $a
|
* @param App $a
|
||||||
*/
|
*/
|
||||||
function admin_page_users_post(App $a) {
|
function admin_page_users_post(App $a)
|
||||||
|
{
|
||||||
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
|
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
|
||||||
$users = (x($_POST, 'user') ? $_POST['user'] : array());
|
$users = (x($_POST, 'user') ? $_POST['user'] : array());
|
||||||
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
|
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
|
||||||
|
@ -1379,7 +1385,7 @@ function admin_page_users_post(App $a) {
|
||||||
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 === "")) {
|
if (!($nu_name === "") && !($nu_email === "") && !($nu_nickname === "")) {
|
||||||
require_once('include/user.php');
|
require_once 'include/user.php';
|
||||||
|
|
||||||
$result = create_user(array('username' => $nu_name, 'email' => $nu_email,
|
$result = create_user(array('username' => $nu_name, 'email' => $nu_email,
|
||||||
'nickname' => $nu_nickname, 'verified' => 1, 'language' => $nu_language));
|
'nickname' => $nu_nickname, 'verified' => 1, 'language' => $nu_language));
|
||||||
|
@ -1426,13 +1432,11 @@ function admin_page_users_post(App $a) {
|
||||||
'subject' => sprintf(t('Registration details for %s'), $a->config['sitename']),
|
'subject' => sprintf(t('Registration details for %s'), $a->config['sitename']),
|
||||||
'preamble' => $preamble,
|
'preamble' => $preamble,
|
||||||
'body' => $body));
|
'body' => $body));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_POST, 'page_users_block')) {
|
if (x($_POST, 'page_users_block')) {
|
||||||
foreach ($users as $uid) {
|
foreach ($users as $uid) {
|
||||||
q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s",
|
q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s", intval($uid)
|
||||||
intval($uid)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
notice(sprintf(tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)), count($users)));
|
notice(sprintf(tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)), count($users)));
|
||||||
|
@ -1472,7 +1476,8 @@ function admin_page_users_post(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_users(App $a) {
|
function admin_page_users(App $a)
|
||||||
|
{
|
||||||
if ($a->argc > 2) {
|
if ($a->argc > 2) {
|
||||||
$uid = $a->argv[3];
|
$uid = $a->argv[3];
|
||||||
$user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
|
$user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
|
||||||
|
@ -1491,16 +1496,13 @@ function admin_page_users(App $a) {
|
||||||
break;
|
break;
|
||||||
case "block":
|
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",
|
q("UPDATE `user` SET `blocked` = %d WHERE `uid` = %s", intval(1 - $user[0]['blocked']), intval($uid)
|
||||||
intval(1-$user[0]['blocked']),
|
|
||||||
intval($uid)
|
|
||||||
);
|
);
|
||||||
notice(sprintf(($user[0]['blocked'] ? t("User '%s' unblocked") : t("User '%s' blocked")), $user[0]['username']) . EOL);
|
notice(sprintf(($user[0]['blocked'] ? t("User '%s' unblocked") : t("User '%s' blocked")), $user[0]['username']) . EOL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
goaway('admin/users');
|
goaway('admin/users');
|
||||||
return ''; // NOTREACHED
|
return ''; // NOTREACHED
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get pending */
|
/* get pending */
|
||||||
|
@ -1550,9 +1552,7 @@ function admin_page_users(App $a) {
|
||||||
FROM `user`
|
FROM `user`
|
||||||
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
|
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
|
||||||
WHERE `user`.`verified`
|
WHERE `user`.`verified`
|
||||||
ORDER BY $sql_order $sql_order_direction LIMIT %d, %d",
|
ORDER BY $sql_order $sql_order_direction LIMIT %d, %d", intval($a->pager['start']), intval($a->pager['itemspage'])
|
||||||
intval($a->pager['start']),
|
|
||||||
intval($a->pager['itemspage'])
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//echo "<pre>$users"; killme();
|
//echo "<pre>$users"; killme();
|
||||||
|
@ -1602,9 +1602,7 @@ function admin_page_users(App $a) {
|
||||||
array_push($users, array_pop($tmp_users));
|
array_push($users, array_pop($tmp_users));
|
||||||
}
|
}
|
||||||
|
|
||||||
$th_users = array_map(null,
|
$th_users = array_map(null, array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')), $valid_orders
|
||||||
array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')),
|
|
||||||
$valid_orders
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$t = get_markup_template("admin_users.tpl");
|
$t = get_markup_template("admin_users.tpl");
|
||||||
|
@ -1653,7 +1651,6 @@ function admin_page_users(App $a) {
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Plugins admin page
|
* @brief Plugins admin page
|
||||||
*
|
*
|
||||||
|
@ -1670,8 +1667,8 @@ function admin_page_users(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_plugins(App $a) {
|
function admin_page_plugins(App $a)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Single plugin
|
* Single plugin
|
||||||
*/
|
*/
|
||||||
|
@ -1705,9 +1702,11 @@ function admin_page_plugins(App $a) {
|
||||||
require_once('library/markdown.php');
|
require_once('library/markdown.php');
|
||||||
|
|
||||||
if (in_array($plugin, $a->plugins)) {
|
if (in_array($plugin, $a->plugins)) {
|
||||||
$status="on"; $action= t("Disable");
|
$status = "on";
|
||||||
|
$action = t("Disable");
|
||||||
} else {
|
} else {
|
||||||
$status="off"; $action= t("Enable");
|
$status = "off";
|
||||||
|
$action = t("Enable");
|
||||||
}
|
}
|
||||||
|
|
||||||
$readme = Null;
|
$readme = Null;
|
||||||
|
@ -1750,12 +1749,9 @@ function admin_page_plugins(App $a) {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List plugins
|
* List plugins
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (x($_GET, "a") && $_GET['a'] == "r") {
|
if (x($_GET, "a") && $_GET['a'] == "r") {
|
||||||
check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/plugins', 'admin_themes', 't');
|
check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/plugins', 'admin_themes', 't');
|
||||||
reload_plugins();
|
reload_plugins();
|
||||||
|
@ -1809,14 +1805,14 @@ function admin_page_plugins(App $a) {
|
||||||
* @param string $th
|
* @param string $th
|
||||||
* @param int $result
|
* @param int $result
|
||||||
*/
|
*/
|
||||||
function toggle_theme(&$themes,$th,&$result) {
|
function toggle_theme(&$themes, $th, &$result)
|
||||||
|
{
|
||||||
for ($x = 0; $x < count($themes); $x ++) {
|
for ($x = 0; $x < count($themes); $x ++) {
|
||||||
if ($themes[$x]['name'] === $th) {
|
if ($themes[$x]['name'] === $th) {
|
||||||
if ($themes[$x]['allowed']) {
|
if ($themes[$x]['allowed']) {
|
||||||
$themes[$x]['allowed'] = 0;
|
$themes[$x]['allowed'] = 0;
|
||||||
$result = 0;
|
$result = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$themes[$x]['allowed'] = 1;
|
$themes[$x]['allowed'] = 1;
|
||||||
$result = 1;
|
$result = 1;
|
||||||
}
|
}
|
||||||
|
@ -1829,13 +1825,13 @@ function toggle_theme(&$themes,$th,&$result) {
|
||||||
* @param string $th
|
* @param string $th
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function theme_status($themes,$th) {
|
function theme_status($themes, $th)
|
||||||
|
{
|
||||||
for ($x = 0; $x < count($themes); $x ++) {
|
for ($x = 0; $x < count($themes); $x ++) {
|
||||||
if ($themes[$x]['name'] === $th) {
|
if ($themes[$x]['name'] === $th) {
|
||||||
if ($themes[$x]['allowed']) {
|
if ($themes[$x]['allowed']) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1843,12 +1839,12 @@ function theme_status($themes,$th) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $themes
|
* @param array $themes
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function rebuild_theme_table($themes) {
|
function rebuild_theme_table($themes)
|
||||||
|
{
|
||||||
$o = '';
|
$o = '';
|
||||||
if (count($themes)) {
|
if (count($themes)) {
|
||||||
foreach ($themes as $th) {
|
foreach ($themes as $th) {
|
||||||
|
@ -1863,7 +1859,6 @@ function rebuild_theme_table($themes) {
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Themes admin page
|
* @brief Themes admin page
|
||||||
*
|
*
|
||||||
|
@ -1880,8 +1875,8 @@ function rebuild_theme_table($themes) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_themes(App $a) {
|
function admin_page_themes(App $a)
|
||||||
|
{
|
||||||
$allowed_themes_str = Config::get('system', 'allowed_themes');
|
$allowed_themes_str = Config::get('system', 'allowed_themes');
|
||||||
$allowed_themes_raw = explode(',', $allowed_themes_str);
|
$allowed_themes_raw = explode(',', $allowed_themes_str);
|
||||||
$allowed_themes = array();
|
$allowed_themes = array();
|
||||||
|
@ -1954,12 +1949,14 @@ function admin_page_themes(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// display theme details
|
// display theme details
|
||||||
require_once('library/markdown.php');
|
require_once 'library/markdown.php';
|
||||||
|
|
||||||
if (theme_status($themes, $theme)) {
|
if (theme_status($themes, $theme)) {
|
||||||
$status="on"; $action= t("Disable");
|
$status = "on";
|
||||||
|
$action = t("Disable");
|
||||||
} else {
|
} else {
|
||||||
$status="off"; $action= t("Enable");
|
$status = "off";
|
||||||
|
$action = t("Enable");
|
||||||
}
|
}
|
||||||
|
|
||||||
$readme = Null;
|
$readme = Null;
|
||||||
|
@ -1972,7 +1969,9 @@ function admin_page_themes(App $a) {
|
||||||
|
|
||||||
$admin_form = "";
|
$admin_form = "";
|
||||||
if (is_file("view/theme/$theme/config.php")) {
|
if (is_file("view/theme/$theme/config.php")) {
|
||||||
function __get_theme_admin_form(App $a, $theme) {
|
|
||||||
|
function __get_theme_admin_form(App $a, $theme)
|
||||||
|
{
|
||||||
$orig_theme = $a->theme;
|
$orig_theme = $a->theme;
|
||||||
$orig_page = $a->page;
|
$orig_page = $a->page;
|
||||||
$orig_session_theme = $_SESSION['theme'];
|
$orig_session_theme = $_SESSION['theme'];
|
||||||
|
@ -2051,7 +2050,6 @@ function admin_page_themes(App $a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$t = get_markup_template("admin_plugins.tpl");
|
$t = get_markup_template("admin_plugins.tpl");
|
||||||
return replace_macros($t, array(
|
return replace_macros($t, array(
|
||||||
'$title' => t('Administration'),
|
'$title' => t('Administration'),
|
||||||
|
@ -2069,13 +2067,13 @@ function admin_page_themes(App $a) {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prosesses data send by Logs admin page
|
* @brief Prosesses data send by Logs admin page
|
||||||
*
|
*
|
||||||
* @param App $a
|
* @param App $a
|
||||||
*/
|
*/
|
||||||
function admin_page_logs_post(App $a) {
|
function admin_page_logs_post(App $a)
|
||||||
|
{
|
||||||
if (x($_POST, "page_logs")) {
|
if (x($_POST, "page_logs")) {
|
||||||
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
|
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
|
||||||
|
|
||||||
|
@ -2109,8 +2107,8 @@ function admin_page_logs_post(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_logs(App $a) {
|
function admin_page_logs(App $a)
|
||||||
|
{
|
||||||
$log_choices = array(
|
$log_choices = array(
|
||||||
LOGGER_NORMAL => 'Normal',
|
LOGGER_NORMAL => 'Normal',
|
||||||
LOGGER_TRACE => 'Trace',
|
LOGGER_TRACE => 'Trace',
|
||||||
|
@ -2134,12 +2132,10 @@ function admin_page_logs(App $a) {
|
||||||
'$clear' => t('Clear'),
|
'$clear' => t('Clear'),
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
'$logname' => Config::get('system', 'logfile'),
|
'$logname' => Config::get('system', 'logfile'),
|
||||||
|
|
||||||
// name, label, value, help string, extra data...
|
// name, label, value, help string, extra data...
|
||||||
'$debugging' => array('debugging', t("Enable Debugging"), Config::get('system', 'debugging'), ""),
|
'$debugging' => array('debugging', t("Enable Debugging"), Config::get('system', 'debugging'), ""),
|
||||||
'$logfile' => array('logfile', t("Log file"), Config::get('system', 'logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
|
'$logfile' => array('logfile', t("Log file"), Config::get('system', 'logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
|
||||||
'$loglevel' => array('loglevel', t("Log level"), Config::get('system', 'loglevel'), "", $log_choices),
|
'$loglevel' => array('loglevel', t("Log level"), Config::get('system', 'loglevel'), "", $log_choices),
|
||||||
|
|
||||||
'$form_security_token' => get_form_security_token("admin_logs"),
|
'$form_security_token' => get_form_security_token("admin_logs"),
|
||||||
'$phpheader' => t("PHP logging"),
|
'$phpheader' => t("PHP logging"),
|
||||||
'$phphint' => t("To enable logging of PHP errors and warnings you can add the following to the .htconfig.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
|
'$phphint' => t("To enable logging of PHP errors and warnings you can add the following to the .htconfig.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
|
||||||
|
@ -2166,7 +2162,8 @@ function admin_page_logs(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_viewlogs(App $a) {
|
function admin_page_viewlogs(App $a)
|
||||||
|
{
|
||||||
$t = get_markup_template("admin_viewlogs.tpl");
|
$t = get_markup_template("admin_viewlogs.tpl");
|
||||||
$f = Config::get('system', 'logfile');
|
$f = Config::get('system', 'logfile');
|
||||||
$data = '';
|
$data = '';
|
||||||
|
@ -2208,8 +2205,8 @@ function admin_page_viewlogs(App $a) {
|
||||||
*
|
*
|
||||||
* @param App $a
|
* @param App $a
|
||||||
*/
|
*/
|
||||||
function admin_page_features_post(App $a) {
|
function admin_page_features_post(App $a)
|
||||||
|
{
|
||||||
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
|
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
|
||||||
|
|
||||||
logger('postvars: ' . print_r($_POST, true), LOGGER_DATA);
|
logger('postvars: ' . print_r($_POST, true), LOGGER_DATA);
|
||||||
|
@ -2256,8 +2253,8 @@ function admin_page_features_post(App $a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function admin_page_features(App $a) {
|
function admin_page_features(App $a)
|
||||||
|
{
|
||||||
if ((argc() > 1) && (argv(1) === 'features')) {
|
if ((argc() > 1) && (argv(1) === 'features')) {
|
||||||
$arr = array();
|
$arr = array();
|
||||||
$features = get_features(false);
|
$features = get_features(false);
|
||||||
|
@ -2266,7 +2263,6 @@ function admin_page_features(App $a) {
|
||||||
$arr[$fname] = array();
|
$arr[$fname] = array();
|
||||||
$arr[$fname][0] = $fdata[0];
|
$arr[$fname][0] = $fdata[0];
|
||||||
foreach (array_slice($fdata, 1) as $f) {
|
foreach (array_slice($fdata, 1) as $f) {
|
||||||
|
|
||||||
$set = Config::get('feature', $f[0], $f[3]);
|
$set = Config::get('feature', $f[0], $f[3]);
|
||||||
$arr[$fname][1][] = array(
|
$arr[$fname][1][] = array(
|
||||||
array('feature_' . $f[0], $f[1], $set, $f[2], array(t('Off'), t('On'))),
|
array('feature_' . $f[0], $f[1], $set, $f[2], array(t('Off'), t('On'))),
|
||||||
|
|
Loading…
Reference in a new issue