From 123ad846893b0005a79da5e2a1b31ef687862cb7 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 23 Aug 2015 11:05:10 +0200 Subject: [PATCH] Make the hardcoded path to dir.friendica.com configurable --- boot.php | 9 +++++++++ include/discover_poco.php | 2 +- include/socgraph.php | 2 +- mod/admin.php | 2 +- mod/dfrn_request.php | 2 +- mod/dirfind.php | 2 +- mod/match.php | 6 +++--- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/boot.php b/boot.php index ce02ca8b0..7fb459141 100644 --- a/boot.php +++ b/boot.php @@ -1708,6 +1708,15 @@ function random_digits($digits) { return $rn; } +function get_server() { + $server = get_config("system", "directory"); + + if ($server == "") + $server = "http://dir.friendi.ca"; + + return($server); +} + function get_cachefile($file, $writemode = true) { $cache = get_itemcachepath(); diff --git a/include/discover_poco.php b/include/discover_poco.php index a4cf5db54..4a17b4927 100644 --- a/include/discover_poco.php +++ b/include/discover_poco.php @@ -146,7 +146,7 @@ function discover_directory($search) { } } - $x = fetch_url("http://dir.friendica.com/lsearch?p=1&n=500&search=".urlencode($search)); + $x = fetch_url(get_server()."/lsearch?p=1&n=500&search=".urlencode($search)); $j = json_decode($x); if(count($j->results)) diff --git a/include/socgraph.php b/include/socgraph.php index d114ef09c..c6c4f5ea8 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -1184,7 +1184,7 @@ function update_suggestions() { $done[] = $a->get_baseurl() . '/poco'; if(strlen(get_config('system','directory_submit_url'))) { - $x = fetch_url('http://dir.friendica.com/pubsites'); + $x = fetch_url(get_server()."/pubsites"); if($x) { $j = json_decode($x); if($j->entries) { diff --git a/mod/admin.php b/mod/admin.php index ff8cedc0c..e9d128369 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -693,7 +693,7 @@ function admin_page_site(&$a) { '$banner' => array('banner', t("Banner/Logo"), $banner, ""), '$shortcut_icon' => array('shortcut_icon', t("Shortcut icon"), get_config('system','shortcut_icon'), "Link to an icon that will be used for browsers."), '$touch_icon' => array('touch_icon', t("Touch icon"), get_config('system','touch_icon'), "Link to an icon that will be used for tablets and mobiles."), - '$info' => array('info',t('Additional Info'), $info, t('For public servers: you can add additional information here that will be listed at dir.friendica.com/siteinfo.')), + '$info' => array('info',t('Additional Info'), $info, sprintf(t('For public servers: you can add additional information here that will be listed at %s/siteinfo.'), get_server())), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), '$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - change theme settings"), $theme_choices), '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile-theme'), t("Theme for mobile devices"), $theme_choices_mobile), diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 62b6f4bd7..3316cb0b0 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -836,7 +836,7 @@ function dfrn_request_content(&$a) { //$emailnet = (($mail_disabled) ? '' : t("Connect as an email follower \x28Coming soon\x29")); $emailnet = ""; - $invite_desc = t('If you are not yet a member of the free social web, follow this link to find a public Friendica site and join us today.'); + $invite_desc = sprintf(t('If you are not yet a member of the free social web, follow this link to find a public Friendica site and join us today.', get_server())); $o .= replace_macros($tpl,array( '$header' => t('Friend/Connection Request'), diff --git a/mod/dirfind.php b/mod/dirfind.php index 516742c24..e70dfe968 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -98,7 +98,7 @@ function dirfind_content(&$a) { $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : ''); if(strlen(get_config('system','directory_submit_url'))) - $x = fetch_url('http://dir.friendica.com/lsearch?f=' . $p . '&search=' . urlencode($search)); + $x = fetch_url(get_server().'/lsearch?f=' . $p . '&search=' . urlencode($search)); $j = json_decode($x); } diff --git a/mod/match.php b/mod/match.php index 777363642..199ad9ed7 100644 --- a/mod/match.php +++ b/mod/match.php @@ -26,14 +26,14 @@ function match_content(&$a) { $params = array(); $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']); - + if($tags) { $params['s'] = $tags; if($a->pager['page'] != 1) $params['p'] = $a->pager['page']; - + if(strlen(get_config('system','directory_submit_url'))) - $x = post_url('http://dir.friendica.com/msearch', $params); + $x = post_url(get_server().'/msearch', $params); else $x = post_url($a->get_baseurl() . '/msearch', $params);