wrong download link #28

Merged
MrPetovan merged 7 commits from issue/#25 into master 2017-08-04 03:43:25 +02:00
15 changed files with 120 additions and 67 deletions

View file

@ -1,5 +1,7 @@
<?php
require_once 'include/session.php';
require_once 'vendor/autoload.php';
set_time_limit(0);

View file

@ -70,7 +70,7 @@ class dba
$r = array();
if ($result->num_rows) {
while ($x = $result->fetch_array(MYSQL_ASSOC)) {
while ($x = $result->fetch_array(MYSQLI_ASSOC)) {
$r[] = $x;
}
$result->free_result();

View file

@ -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) {

View file

@ -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';

View file

@ -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'));

View file

@ -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;
}

View file

@ -24,8 +24,6 @@ unset($db_host, $db_user, $db_pass, $db_data);
$a->init_pagehead();
$a->page['aside'] = '<div id="logo"><img src="images/friendica-32.png" alt="friendica logo" /> <a href="http://friendica.com">Friendica</a></div><div id="slogan">Your friends. Your web.</div>';
require_once 'session.php';
session_start();
if ((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || ($a->module === 'login')) {

38
maintenance.html Normal file
View file

@ -0,0 +1,38 @@
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1">
<link rel="search" type="application/opensearchdescription+xml" title="Friendica Directory" href="/opensearch" />
<title>Friendica Directory</title>
<link rel="shortcut icon" href="/images/friendica-32.png" />
<link rel="apple-touch-icon" href="/images/friendica-128.png"/>
<link href="/assets/css/style.css" rel="stylesheet" type="text/css" />
<link href="/assets/css/awesome/font-awesome.min.css?v=4.3.0" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/assets/js/jquery/jquery.min.js?v=1.11.2"></script>
<script type="text/javascript" src="/assets/js/main.js"></script>
</head>
<body>
<a class="hamburger mobile"><i class="fa fa-bars"></i></a>
<nav id="links">
<div class="viewport">
</div>
</nav>
<div class="homepage-wrapper">
<h1 class="header">
Friendica &nbsp; &nbsp;<br>&nbsp; &nbsp; Directory
</h1>
<h2>
Directory under maintenance
</h2>
<p class="about">
The Friendica Directory is unavailable at this time, please connect with <a href="https://friendica.mrpetovan.com/profile/hypolite">hypolite@friendica.mrpetovan.com</a> for updates about its status.
tobiasd commented 2017-08-02 05:53:16 +02:00 (Migrated from github.com)

Can we make this link configurable? So that other people running a directory server can change it to another contact account.

Can we make this link configurable? So that other people running a directory server can change it to another contact account.
MrPetovan commented 2017-08-02 20:17:17 +02:00 (Migrated from github.com)

I'm not sure, this is supposed to be an always working page even when nothing else does.

I'm not sure, this is supposed to be an always working page even when nothing else does.
tobiasd commented 2017-08-03 10:10:54 +02:00 (Migrated from github.com)

My bad. When I looked at the code yesterday I had the impression it was a template.

My bad. When I looked at the code yesterday I had the impression it was a template.
</p>
</div>
</body>
</html>

View file

@ -79,4 +79,6 @@ function directory_content(App $a)
'results' => $r,
'filter' => $forums ? 'forums' : '',
));
killme();
}

View file

@ -1,10 +1,13 @@
<?php
use Friendica\Directory\Rendering\View;
if(! function_exists('help_content')) {
function help_content(&$a) {
$view = new View('help');
$view->output();
}
}
if (!function_exists('help_content')) {
function help_content(&$a)
{
$view = new View('help');
$view->output();
killme();
}
}

View file

@ -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();
}}

View file

@ -94,4 +94,6 @@ function search_content(App $a)
'filter' => $filter,
'query' => x($_GET, 'query') ? $_GET['query'] : ''
));
killme();
}

View file

@ -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();
}

View file

@ -1,10 +1,14 @@
<?php
use Friendica\Directory\Rendering\View;
if(! function_exists('stats_content')) {
function stats_content(&$a) {
$view = new View('stats');
$view->output();
}
if (!function_exists('stats_content')) {
function stats_content(&$a)
{
$view = new View('stats');
$view->output();
killme();
}
annando commented 2017-08-02 19:53:34 +02:00 (Migrated from github.com)

Weren't these linefeeds only in classes?

Weren't these linefeeds only in classes?
MrPetovan commented 2017-08-02 20:20:13 +02:00 (Migrated from github.com)

It's possible, this is my IDE formatting setup, I must have had a good reason to set it up like that, or it was like that by default. I'll revert to the most common way across friendica's repos.

It's possible, this is my IDE formatting setup, I must have had a good reason to set it up like that, or it was like that by default. I'll revert to the most common way across friendica's repos.
}

View file

@ -2,7 +2,7 @@
<div class="sites">
<h1>Public servers</h1>
<p class="intro">
If you are not interested in <a href="http://friendica.com/download">hosting your own server</a>, you can still use Friendica.
If you are not interested in <a href="http://friendi.ca/installation/">hosting your own server</a>, you can still use Friendica.
Here are some public server run by enthousiasts that you can join.
We recommend these based on their <abbr title="Decent speed, proper security, recent version, etc.">health</abbr>.
</p>
@ -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.
</p>
<div class="feeling-lucky">
<a class="btn surprise" href="/servers/surprise">Surprise me &raquo;</a>
</div>
<h3>Recommending <?php echo $total; ?> public servers</h3>
<?php
foreach ($sites as $site)