Redesign prototype merge #18
|
@ -5,9 +5,9 @@ use Friendica\Directory\Rendering\View;
|
|||
Gotcha. Gotcha.
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
require_once('include/site-health.php');
|
||||
|
||||
function servers_content(&$a) {
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$sites = array();
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Find the user count per site.
|
||||
$r = q("SELECT `homepage` FROM `profile`");
|
||||
if(count($r)) {
|
||||
|
@ -15,50 +15,52 @@ function servers_content(&$a) {
|
|||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$site = parse_site_from_url($rr['homepage']);
|
||||
if($site) {
|
||||
if(!isset($sites[$site]))
|
||||
$sites[$site] = 0;
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$sites[$site] = 0;
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$sites[$site] ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//See if we have a health for them AND they provide SSL.
|
||||
$sites_with_health = array();
|
||||
$site_healths = array();
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$r = q("SELECT * FROM `site-health` WHERE `reg_policy`='REGISTER_OPEN' AND `ssl_state` = 1");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
$sites_with_health[$rr['base_url']] = (($sites[$rr['base_url']] / 100) + 10) * intval($rr['health_score']);
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$site_healths[$rr['base_url']] = $rr;
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
if (isset($sites[$rr['base_url']])) {
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$sites_with_health[$rr['base_url']] = (($sites[$rr['base_url']] / 100) + 10) * intval($rr['health_score']);
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$site_healths[$rr['base_url']] = $rr;
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
}
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
}
|
||||
}
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
arsort($sites_with_health);
|
||||
$total = 0;
|
||||
$public_sites = array();
|
||||
foreach($sites_with_health as $k => $v)
|
||||
{
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Stop at unhealthy sites.
|
||||
$site = $site_healths[$k];
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
if($site['health_score'] <= 20) break;
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Skip small sites.
|
||||
$users = $sites[$k];
|
||||
if($users < 5) continue;
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Add health score name and user count.
|
||||
$site['health_score_name'] = health_score_to_name($site['health_score']);
|
||||
$site['users'] = $users;
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Figure out what this server supports.
|
||||
$plugins = explode("\r\n", $site['plugins']);
|
||||
$site['plugins'] = $plugins;
|
||||
$hasPlugin = function(array $input)use($plugins){
|
||||
return !!count(array_intersect($input, $plugins));
|
||||
};
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$site['supports'] = array(
|
||||
'HTTPS' => $site['ssl_state'] == 1,
|
||||
'Twitter' => $hasPlugin(array('buffer', 'twitter')),
|
||||
|
@ -76,7 +78,7 @@ function servers_content(&$a) {
|
|||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
'Insanejournal' => $hasPlugin(array('ijpost')),
|
||||
'Libertree' => $hasPlugin(array('libertree'))
|
||||
);
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Subset of the full support list, to show popular items.
|
||||
$site['popular_supports'] = array(
|
||||
'HTTPS' => $site['supports']['HTTPS'],
|
||||
|
@ -84,10 +86,10 @@ function servers_content(&$a) {
|
|||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
'Google+' => $site['supports']['Google+'],
|
||||
'Wordpress' => $site['supports']['Wordpress']
|
||||
);
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//For practical usage.
|
||||
$site['less_popular_supports'] = array_diff_assoc($site['supports'], $site['popular_supports']);
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Get the difference.
|
||||
$site['supports_more'] = 0;
|
||||
foreach ($site['supports'] as $key => $value){
|
||||
|
@ -95,31 +97,31 @@ function servers_content(&$a) {
|
|||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$site['supports_more']++;
|
||||
}
|
||||
}
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Push to results.
|
||||
$public_sites[] = $site;
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Count the result.
|
||||
$total ++;
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
}
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//In case we asked for a surprise, pick a random one from the top 10! :D
|
||||
if($a->argv[1] == 'surprise'){
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
if($a->argc > 1 && $a->argv[1] == 'surprise'){
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$max = min(count($public_sites), 10);
|
||||
$i = mt_rand(0, $max-1);
|
||||
$surpriseSite = $public_sites[$i];
|
||||
header('Location:'.$surpriseSite['base_url'].'/register');
|
||||
exit;
|
||||
}
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
//Show results.
|
||||
$view = new View('servers');
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
$view->output(array(
|
||||
'total' => number_format($total),
|
||||
'sites' => $public_sites
|
||||
));
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
|
||||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
||||
}
|
||||
|
|
|||
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon. You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.
Gotcha. Gotcha.
|
|
@ -1,6 +1,6 @@
|
|||
<form action="/search" method="get" class="search-form">
|
||||
<div class="search-wrapper">
|
||||
<input class="search-field" type="text" name="query" placeholder="Search your friends" tabindex="1" value="<?php echo $query; ?>" />
|
||||
<input class="search-field" type="text" name="query" placeholder="Search your friends" tabindex="1" value="<?php echo isset($query)? $query : ''; ?>" />
|
||||
<input class="reset" type="reset" value="" tabindex="3" />
|
||||
<input class="search" type="submit" value="Search" tabindex="2" />
|
||||
</div>
|
||||
|
|
You can remove App.net since it closed its doors. But you could add Facebook via the "buffer" addon.