aboutsummaryrefslogtreecommitdiffstats
path: root/mod/admin.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/admin.php')
-rw-r--r--mod/admin.php103
1 files changed, 41 insertions, 62 deletions
diff --git a/mod/admin.php b/mod/admin.php
index beb629396..a884b7658 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -1,7 +1,7 @@
<?php
/**
* @file mod/admin.php
- * @brief RedMatrix's admin controller.
+ * @brief Hubzilla's admin controller.
*
* Controller for the /admin/ area.
*/
@@ -84,46 +84,6 @@ function admin_content(&$a) {
return login(false);
}
- /*
- * Side bar links
- */
-
- // array( url, name, extra css classes )
- $aside = array(
- 'site' => array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"),
- 'users' => array($a->get_baseurl(true)."/admin/users/", t("Accounts") , "users"),
- 'channels' => array($a->get_baseurl(true)."/admin/channels/", t("Channels") , "channels"),
- 'plugins' => array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
- 'themes' => array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
- 'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'),
-// 'hubloc' => array($a->get_baseurl(true)."/admin/hubloc/", t("Server") , "server"),
- 'profs' => array(z_root() . '/admin/profs', t('Profile Config'), 'profs'),
- 'dbsync' => array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync")
- );
-
- /* get plugins admin page */
-
- $r = q("SELECT * FROM addon WHERE plugin_admin = 1");
- $aside['plugins_admin'] = array();
- foreach ($r as $h){
- $plugin = $h['name'];
- $aside['plugins_admin'][] = array($a->get_baseurl(true) . '/admin/plugins/' . $plugin, $plugin, 'plugin');
- // temp plugins with admin
- $a->plugins_admin[] = $plugin;
- }
-
- $aside['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs");
-
- $t = get_markup_template("admin_aside.tpl");
- $a->page['aside'] .= replace_macros( $t, array(
- '$admin' => $aside,
- '$admtxt' => t('Admin'),
- '$plugadmtxt' => t('Plugin Features'),
- '$logtxt' => t('Logs'),
- '$h_pending' => t('User registrations waiting for confirmation'),
- '$admurl'=> $a->get_baseurl(true)."/admin/"
- ));
-
/*
* Page content
@@ -148,9 +108,9 @@ function admin_content(&$a) {
case 'themes':
$o = admin_page_themes($a);
break;
- case 'hubloc':
- $o = admin_page_hubloc($a);
- break;
+// case 'hubloc':
+// $o = admin_page_hubloc($a);
+// break;
case 'logs':
$o = admin_page_logs($a);
break;
@@ -209,9 +169,7 @@ function admin_page_summary(&$a) {
// available channels, primary and clones
$channels = array();
- $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE NOT (channel_pageflags & %d)>0",
- intval(PAGE_REMOVED)
- );
+ $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE channel_removed = 0");
if ($r) {
$channels['total'] = array('label' => t('# Channels'), 'val' => $r[0]['total']);
$channels['main'] = array('label' => t('# primary'), 'val' => $r[0]['main']);
@@ -279,7 +237,7 @@ function admin_page_site_post(&$a){
$register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
$frontpage = ((x($_POST,'frontpage')) ? notags(trim($_POST['frontpage'])) : '');
$mirror_frontpage = ((x($_POST,'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0);
-
+ $directory_server = ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : '');
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
$not_allowed_email = ((x($_POST,'not_allowed_email')) ? notags(trim($_POST['not_allowed_email'])) : '');
@@ -296,15 +254,15 @@ function admin_page_site_post(&$a){
$proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['proxy'])) : '');
$timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
$delivery_interval = ((x($_POST,'delivery_interval'))? intval(trim($_POST['delivery_interval'])) : 0);
+ $delivery_batch_count = ((x($_POST,'delivery_batch_count') && $_POST['delivery_batch_count'] > 0)? intval(trim($_POST['delivery_batch_count'])) : 1);
$poll_interval = ((x($_POST,'poll_interval')) ? intval(trim($_POST['poll_interval'])) : 0);
$maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
$feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0);
- $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? intval($_POST['diaspora_enabled']) : 0);
$verify_email = ((x($_POST,'verify_email')) ? 1 : 0);
set_config('system', 'feed_contacts', $feed_contacts);
- set_config('system', 'diaspora_enabled', $diaspora_enabled);
set_config('system', 'delivery_interval', $delivery_interval);
+ set_config('system', 'delivery_batch_count', $delivery_batch_count);
set_config('system', 'poll_interval', $poll_interval);
set_config('system', 'maxloadavg', $maxloadavg);
set_config('system', 'frontpage', $frontpage);
@@ -314,6 +272,9 @@ function admin_page_site_post(&$a){
set_config('system', 'verify_email', $verify_email);
set_config('system', 'default_expire_days', $default_expire_days);
+ if($directory_server)
+ set_config('system','directory_server',$directory_server);
+
if ($banner == '') {
del_config('system', 'banner');
} else {
@@ -374,10 +335,10 @@ function admin_page_site(&$a) {
/* Installed langs */
$lang_choices = array();
- $langs = glob('view/*/strings.php');
+ $langs = glob('view/*/hstrings.php');
if(is_array($langs) && count($langs)) {
- if(! in_array('view/en/strings.php',$langs))
+ if(! in_array('view/en/hstrings.php',$langs))
$langs[] = 'view/en/';
asort($langs);
foreach($langs as $l) {
@@ -413,6 +374,26 @@ function admin_page_site(&$a) {
}
}
+ $dir_choices = null;
+ $dirmode = get_config('system','directory_mode');
+ $realm = get_directory_realm();
+
+ // directory server should not be set or settable unless we are a directory client
+
+ if($dirmode == DIRECTORY_MODE_NORMAL) {
+ $x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s'",
+ intval(DIRECTORY_MODE_SECONDARY),
+ intval(DIRECTORY_MODE_PRIMARY),
+ dbesc($realm)
+ );
+ if($x) {
+ $dir_choices = array();
+ foreach($x as $xx) {
+ $dir_choices[$xx['site_url']] = $xx['site_url'];
+ }
+ }
+ }
+
/* Banner */
$banner = get_config('system', 'banner');
if($banner == false)
@@ -465,7 +446,6 @@ function admin_page_site(&$a) {
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
'$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
- '$diaspora_enabled' => array('diaspora_enabled',t('Enable Diaspora Protocol'), get_config('system','diaspora_enabled'), t('Communicate with Diaspora and Friendica - experimental')),
'$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')),
'$maximagesize' => array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
'$register_policy' => array('register_policy', t("Does this site allow new member registration?"), get_config('system','register_policy'), "", $register_choices),
@@ -483,10 +463,13 @@ function admin_page_site(&$a) {
'$disable_discover_tab' => array('disable_discover_tab', t("Disable discovery tab"), get_config('system','disable_discover_tab'), t("Remove the tab in the network view with public content pulled from sources chosen for this site.")),
'$login_on_homepage' => array('login_on_homepage', t("login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
+ '$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), get_config('system','directory_server'), t("Default directory server"), $dir_choices) : null),
+
'$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
'$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
+ '$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (matrix/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
@@ -599,7 +582,7 @@ function admin_page_dbsync(&$a) {
}
}
if(! count($failed))
- return '<h3>' . t('No failed updates.') . '</h3>';
+ 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),
@@ -786,11 +769,10 @@ function admin_page_users(&$a){
$users = q("SELECT `account_id` , `account_email`, `account_lastlog`, `account_created`, `account_expires`, " . "`account_service_class`, ( account_flags & %d )>0 as `blocked`, " .
"(SELECT %s FROM channel as ch " .
- "WHERE ch.channel_account_id = ac.account_id and not (ch.channel_pageflags & %d )>0) as `channels` " .
+ "WHERE ch.channel_account_id = ac.account_id and ch.channel_removed = 0 ) as `channels` " .
"FROM account as ac where true $serviceclass $order limit %d offset %d ",
intval(ACCOUNT_BLOCKED),
db_concat('ch.channel_address', ' '),
- intval(PAGE_REMOVED),
intval($a->pager['itemspage']),
intval($a->pager['start'])
);
@@ -948,9 +930,7 @@ function admin_page_channels(&$a){
/* get channels */
- $total = q("SELECT count(*) as total FROM channel where not (channel_pageflags & %d)>0",
- intval(PAGE_REMOVED|PAGE_SYSTEM)
- );
+ $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);
@@ -958,8 +938,7 @@ function admin_page_channels(&$a){
$order = " order by channel_name asc ";
- $channels = q("SELECT * from channel where not ( channel_pageflags & %d )>0 $order limit %d offset %d ",
- intval(PAGE_REMOVED|PAGE_SYSTEM),
+ $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'])
);
@@ -1477,4 +1456,4 @@ function admin_page_profs(&$a) {
'$submit' => t('Save')
));
}
-} \ No newline at end of file
+}