From e09b49288fa415c85d5ee1e77218c0b4c2b54a1d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 3 Nov 2015 18:34:16 -0800 Subject: provide admin setting to change directory server --- mod/admin.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'mod/admin.php') diff --git a/mod/admin.php b/mod/admin.php index 8fe9c8336..a884b7658 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -237,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'])) : ''); @@ -272,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 { @@ -371,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) @@ -440,6 +463,8 @@ 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).")), -- cgit v1.2.3