diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-11-03 18:34:16 -0800 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-11-03 18:34:16 -0800 |
commit | e09b49288fa415c85d5ee1e77218c0b4c2b54a1d (patch) | |
tree | d21c82854d1dd0db719a0251019db2feb3e11b76 | |
parent | c1cfcc78fef8674430a3c20cc083b318e18a3842 (diff) | |
download | volse-hubzilla-e09b49288fa415c85d5ee1e77218c0b4c2b54a1d.tar.gz volse-hubzilla-e09b49288fa415c85d5ee1e77218c0b4c2b54a1d.tar.bz2 volse-hubzilla-e09b49288fa415c85d5ee1e77218c0b4c2b54a1d.zip |
provide admin setting to change directory server
-rw-r--r-- | include/dir_fns.php | 5 | ||||
-rw-r--r-- | mod/admin.php | 27 | ||||
-rwxr-xr-x | view/tpl/admin_site.tpl | 4 |
3 files changed, 32 insertions, 4 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php index ecc5f6d96..e5f0e1e2b 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -190,8 +190,9 @@ function sync_directories($dirmode) { intval($r[0]['site_valid']) ); - $r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s' and site_type = %d ", - intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY), + $r = q("select * from site where site_flags in (%d, %d) and site_url != '%s' and site_type = %d ", + intval(DIRECTORY_MODE_PRIMARY), + intval(DIRECTORY_MODE_SECONDARY), dbesc(z_root()), intval(SITE_TYPE_ZOT) ); 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).")), diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl index 26434b20a..4add59a0d 100755 --- a/view/tpl/admin_site.tpl +++ b/view/tpl/admin_site.tpl @@ -49,7 +49,9 @@ {{include file="field_input.tpl" field=$frontpage}} {{include file="field_checkbox.tpl" field=$mirror_frontpage}} {{include file="field_checkbox.tpl" field=$login_on_homepage}} - + {{if $directory_server}} + {{include file="field_select.tpl" field=$directory_server}} + {{/if}} <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> |