diff --git a/boot.php b/boot.php index d2f8634e..0f4f36a4 100644 --- a/boot.php +++ b/boot.php @@ -1,5 +1,7 @@ num_rows) { - while ($x = $result->fetch_array(MYSQL_ASSOC)) { + while ($x = $result->fetch_array(MYSQLI_ASSOC)) { $r[] = $x; } $result->free_result(); diff --git a/include/notifier.php b/include/notifier.php index 7972bd9a..5d678a40 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -15,7 +15,6 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data); -require_once 'session.php'; require_once 'datetime.php'; if ($argc < 3) { diff --git a/include/poller.php b/include/poller.php index 0e3092f5..335201b4 100644 --- a/include/poller.php +++ b/include/poller.php @@ -15,7 +15,6 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data); -require_once 'session.php'; require_once 'datetime.php'; require_once 'simplepie/simplepie.inc'; require_once 'include/items.php'; diff --git a/include/rockstar.php b/include/rockstar.php index 58009214..0891a043 100644 --- a/include/rockstar.php +++ b/include/rockstar.php @@ -14,7 +14,6 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data, $install); unset($db_host, $db_user, $db_pass, $db_data); -require_once 'session.php'; require_once 'datetime.php'; $a->set_baseurl(get_config('system', 'url')); diff --git a/include/session.php b/include/session.php index e51dbc1b..a125679f 100644 --- a/include/session.php +++ b/include/session.php @@ -30,10 +30,14 @@ function ref_session_write($id, $data) { global $session_exists, $session_expire; - if (!$id || !$data) { + if (!$id) { return false; } + if (!$data) { + return true; + } + $expire = time() + $session_expire; $default_expire = time() + 300; @@ -65,7 +69,7 @@ function ref_session_gc($expire) { q("DELETE FROM `session` WHERE `expire` < %d", dbesc(time())); q("OPTIMIZE TABLE `sess_data`"); - + return true; } diff --git a/index.php b/index.php index 082f0c0e..07ddb75a 100644 --- a/index.php +++ b/index.php @@ -24,8 +24,6 @@ unset($db_host, $db_user, $db_pass, $db_data); $a->init_pagehead(); $a->page['aside'] = '
Your friends. Your web.
'; -require_once 'session.php'; - session_start(); if ((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || ($a->module === 'login')) { diff --git a/maintenance.html b/maintenance.html new file mode 100644 index 00000000..5757d32d --- /dev/null +++ b/maintenance.html @@ -0,0 +1,38 @@ + + + + + + + + + Friendica Directory + + + + + + + + + + + + +
+

+ Friendica    
    Directory +

+

+ Directory under maintenance +

+ +

+ The Friendica Directory is unavailable at this time, please connect with hypolite@friendica.mrpetovan.com for updates about its status. +

+
+ + 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