diff --git a/mod/directory.php b/mod/directory.php index 5ef83b3a..9f1aa9c3 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -79,4 +79,6 @@ function directory_content(App $a) 'results' => $r, 'filter' => $forums ? 'forums' : '', )); + + killme(); } diff --git a/mod/help.php b/mod/help.php index db14e7a6..2d8764ac 100644 --- a/mod/help.php +++ b/mod/help.php @@ -1,10 +1,13 @@ output(); - } -} +if (!function_exists('help_content')) { + function help_content(&$a) + { + $view = new View('help'); + $view->output(); + killme(); + } +} diff --git a/mod/home.php b/mod/home.php index 28c9432c..65aad378 100644 --- a/mod/home.php +++ b/mod/home.php @@ -5,13 +5,14 @@ use Friendica\Directory\Helper\Profile as ProfileHelper; if(! function_exists('home_content')) { function home_content(&$a) { - + $profiles = q("SELECT * FROM profile WHERE comm=1 AND LENGTH(pdesc)>0 ORDER BY RAND() LIMIT 3"); - + $view = new View('homepage', 'minimal'); $view->addHelper('photoUrl', ProfileHelper::get('photoUrl')); $view->output(array( 'profiles' => $profiles )); - + + killme(); }} diff --git a/mod/search.php b/mod/search.php index 9847f14b..c88795c7 100644 --- a/mod/search.php +++ b/mod/search.php @@ -94,4 +94,6 @@ function search_content(App $a) 'filter' => $filter, 'query' => x($_GET, 'query') ? $_GET['query'] : '' )); + + killme(); } diff --git a/mod/servers.php b/mod/servers.php index 8ad4776a..15f4da89 100644 --- a/mod/servers.php +++ b/mod/servers.php @@ -5,17 +5,17 @@ use Friendica\Directory\Rendering\View; require_once 'include/site-health.php'; function servers_content(&$a) { - $sites = array(); //Find the user count per site. $r = q("SELECT `homepage` FROM `profile`"); - if(count($r)) { - foreach($r as $rr) { + if (count($r)) { + foreach ($r as $rr) { $site = parse_site_from_url($rr['homepage']); - if($site) { - if(!isset($sites[$site])) + if ($site) { + if (!isset($sites[$site])) { $sites[$site] = 0; + } $sites[$site] ++; } } @@ -26,8 +26,8 @@ function servers_content(&$a) { $site_healths = array(); $r = q("SELECT * FROM `site-health` WHERE `reg_policy`='REGISTER_OPEN' AND `ssl_state` = 1"); - if(count($r)) { - foreach($r as $rr) { + if (count($r)) { + foreach ($r as $rr) { if (isset($sites[$rr['base_url']])) { $sites_with_health[$rr['base_url']] = (($sites[$rr['base_url']] / 100) + 10) * intval($rr['health_score']); $site_healths[$rr['base_url']] = $rr; @@ -38,17 +38,20 @@ function servers_content(&$a) { arsort($sites_with_health); $total = 0; $public_sites = array(); - foreach($sites_with_health as $k => $v) - { + foreach ($sites_with_health as $k => $v) { //Stop at unhealthy sites. $site = $site_healths[$k]; - if($site['health_score'] <= 20) break; + if ($site['health_score'] <= 20) { + break; + } //Skip small sites. $users = $sites[$k]; - if($users < 5) continue; + if ($users < 5) { + continue; + } //Add health score name and user count. $site['health_score_name'] = health_score_to_name($site['health_score']); @@ -57,33 +60,33 @@ function servers_content(&$a) { //Figure out what this server supports. $plugins = explode("\r\n", $site['plugins']); $site['plugins'] = $plugins; - $hasPlugin = function(array $input)use($plugins){ + $hasPlugin = function (array $input) use ($plugins) { return !!count(array_intersect($input, $plugins)); }; $site['supports'] = array( - 'HTTPS' => $site['ssl_state'] == 1, - 'Twitter' => $hasPlugin(array('buffer', 'twitter')), - 'Facebook' => $hasPlugin(array('buffer')), - 'Google+' => $hasPlugin(array('buffer', 'gpluspost')), - 'RSS/Atom' => true, //Built-in. - 'Diaspora*' => $hasPlugin(array('diaspora')), - 'pump.io' => $hasPlugin(array('pumpio')), - 'StatusNet' => $hasPlugin(array('statusnet')), - 'Tumblr' => $hasPlugin(array('tumblr')), - 'Blogger' => $hasPlugin(array('blogger')), - 'Dreamwidth' => $hasPlugin(array('dwpost')), - 'Wordpress' => $hasPlugin(array('wppost')), - 'LiveJournal' => $hasPlugin(array('ljpost')), + 'HTTPS' => $site['ssl_state'] == 1, + 'Twitter' => $hasPlugin(array('buffer', 'twitter')), + 'Facebook' => $hasPlugin(array('buffer')), + 'Google+' => $hasPlugin(array('buffer', 'gpluspost')), + 'RSS/Atom' => true, //Built-in. + 'Diaspora*' => $hasPlugin(array('diaspora')), + 'pump.io' => $hasPlugin(array('pumpio')), + 'StatusNet' => $hasPlugin(array('statusnet')), + 'Tumblr' => $hasPlugin(array('tumblr')), + 'Blogger' => $hasPlugin(array('blogger')), + 'Dreamwidth' => $hasPlugin(array('dwpost')), + 'Wordpress' => $hasPlugin(array('wppost')), + 'LiveJournal' => $hasPlugin(array('ljpost')), 'Insanejournal' => $hasPlugin(array('ijpost')), - 'Libertree' => $hasPlugin(array('libertree')) + 'Libertree' => $hasPlugin(array('libertree')) ); //Subset of the full support list, to show popular items. $site['popular_supports'] = array( - 'HTTPS' => $site['supports']['HTTPS'], - 'Twitter' => $site['supports']['Twitter'], - 'Google+' => $site['supports']['Google+'], + 'HTTPS' => $site['supports']['HTTPS'], + 'Twitter' => $site['supports']['Twitter'], + 'Google+' => $site['supports']['Google+'], 'Wordpress' => $site['supports']['Wordpress'] ); @@ -92,9 +95,9 @@ function servers_content(&$a) { //Get the difference. $site['supports_more'] = 0; - foreach ($site['supports'] as $key => $value){ - if($value && !array_key_exists($key, $site['popular_supports'])){ - $site['supports_more']++; + foreach ($site['supports'] as $key => $value) { + if ($value && !array_key_exists($key, $site['popular_supports'])) { + $site['supports_more'] ++; } } @@ -103,25 +106,24 @@ function servers_content(&$a) { //Count the result. $total ++; - } //In case we asked for a surprise, pick a random one from the top 10! :D - if($a->argc > 1 && $a->argv[1] == 'surprise'){ + if ($a->argc > 1 && $a->argv[1] == 'surprise') { $max = min(count($public_sites), 10); - $i = mt_rand(0, $max-1); + $i = mt_rand(0, $max - 1); $surpriseSite = $public_sites[$i]; - header('Location:'.$surpriseSite['base_url'].'/register'); + header('Location:' . $surpriseSite['base_url'] . '/register'); exit; } - //Show results. - $view = new View('servers'); + $view = new View('servers'); - $view->output(array( - 'total' => number_format($total), - 'sites' => $public_sites - )); + $view->output(array( + 'total' => number_format($total), + 'sites' => $public_sites + )); + killme(); } diff --git a/mod/stats.php b/mod/stats.php index 866b33cd..cc5faea5 100644 --- a/mod/stats.php +++ b/mod/stats.php @@ -1,10 +1,14 @@ output(); - } +if (!function_exists('stats_content')) { + function stats_content(&$a) + { + $view = new View('stats'); + $view->output(); + + killme(); + } } diff --git a/src/templates/view/servers.php b/src/templates/view/servers.php index 4cc8f6dc..f6c52880 100644 --- a/src/templates/view/servers.php +++ b/src/templates/view/servers.php @@ -2,7 +2,7 @@

Public servers

- If you are not interested in hosting your own server, you can still use Friendica. + If you are not interested in hosting your own server, you can still use Friendica. Here are some public server run by enthousiasts that you can join. We recommend these based on their health.

@@ -10,11 +10,11 @@ Keep in mind that different servers may support different features like communicating with additional networks besides Friendica. It's best to pick the one that best suits your needs.

- +
Surprise me »
- +

Recommending public servers