Tweaks to site-health and osearch. Also removed a non-directory page.
This commit is contained in:
parent
1fe9bb9b5b
commit
b803aa30a0
5 changed files with 21 additions and 176 deletions
|
@ -287,9 +287,19 @@ function health_details($a, $id)
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Nice name for registration policy.
|
||||||
|
switch ($site['reg_policy']) {
|
||||||
|
case 'REGISTER_OPEN': $policy = "Open"; break;
|
||||||
|
case 'REGISTER_APPROVE': $policy = "Admin approved"; break;
|
||||||
|
case 'REGISTER_CLOSED': $policy = "Closed"; break;
|
||||||
|
default: $policy = $site['reg_policy']; break;
|
||||||
|
}
|
||||||
|
|
||||||
$tpl .= file_get_contents('view/health_details.tpl');
|
$tpl .= file_get_contents('view/health_details.tpl');
|
||||||
return replace_macros($tpl, array(
|
return replace_macros($tpl, array(
|
||||||
'$name' => $site['name'],
|
'$name' => $site['name'],
|
||||||
|
'$policy' => $policy,
|
||||||
|
'$site_info' => $site['info'],
|
||||||
'$base_url' => $site['base_url'],
|
'$base_url' => $site['base_url'],
|
||||||
'$health_score' => $site['health_score'],
|
'$health_score' => $site['health_score'],
|
||||||
'$health_name' => health_score_to_name($site['health_score']),
|
'$health_name' => health_score_to_name($site['health_score']),
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
function opensearch_init(&$a) {
|
function opensearch_init(&$a) {
|
||||||
|
|
||||||
$r = file_get_contents('view/osearch.tpl');
|
$tpl = file_get_contents('view/osearch.tpl');
|
||||||
header("Content-type: application/opensearchdescription+xml");
|
header("Content-type: application/opensearchdescription+xml");
|
||||||
|
echo replace_macros($tpl, array(
|
||||||
echo $r;
|
'$base' => $a->get_baseurl()
|
||||||
|
));
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,169 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once("Photo.php");
|
|
||||||
|
|
||||||
function profile_photo_init(&$a) {
|
|
||||||
|
|
||||||
if(! local_user()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once("mod/profile.php");
|
|
||||||
profile_load($a,$a->user['nickname']);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function profile_photo_post(&$a) {
|
|
||||||
|
|
||||||
if(! local_user()) {
|
|
||||||
notice ( t('Permission denied.') . EOL );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) {
|
|
||||||
|
|
||||||
// phase 2 - we have finished cropping
|
|
||||||
|
|
||||||
if($a->argc != 2) {
|
|
||||||
notice( t('Image uploaded but image cropping failed.') . EOL );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$image_id = $a->argv[1];
|
|
||||||
|
|
||||||
if(substr($image_id,-2,1) == '-') {
|
|
||||||
$scale = substr($image_id,-1,1);
|
|
||||||
$image_id = substr($image_id,0,-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$srcX = $_POST['xstart'];
|
|
||||||
$srcY = $_POST['ystart'];
|
|
||||||
$srcW = $_POST['xfinal'] - $srcX;
|
|
||||||
$srcH = $_POST['yfinal'] - $srcY;
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `scale` = %d LIMIT 1",
|
|
||||||
dbesc($image_id),
|
|
||||||
intval($scale));
|
|
||||||
|
|
||||||
if(count($r)) {
|
|
||||||
|
|
||||||
$base_image = $r[0];
|
|
||||||
|
|
||||||
$im = new Photo($base_image['data']);
|
|
||||||
$im->cropImage(175,$srcX,$srcY,$srcW,$srcH);
|
|
||||||
|
|
||||||
$r = $im->store(0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, 1);
|
|
||||||
|
|
||||||
if($r === false)
|
|
||||||
notice ( t('Image size reduction (175) failed.') . EOL );
|
|
||||||
|
|
||||||
$im->scaleImage(80);
|
|
||||||
|
|
||||||
$r = $im->store(0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, 1);
|
|
||||||
|
|
||||||
if($r === false)
|
|
||||||
notice( t('Image size reduction (80) failed.') . EOL );
|
|
||||||
|
|
||||||
// Unset the profile photo flag from any other photos I own
|
|
||||||
|
|
||||||
$r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' ",
|
|
||||||
dbesc($base_image['resource-id'])
|
|
||||||
);
|
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 LIMIT 1",
|
|
||||||
dbesc(datetime_convert())
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
goaway($a->get_baseurl() . '/profiles');
|
|
||||||
return; // NOTREACHED
|
|
||||||
}
|
|
||||||
|
|
||||||
$src = $_FILES['userfile']['tmp_name'];
|
|
||||||
$filename = basename($_FILES['userfile']['name']);
|
|
||||||
$filesize = intval($_FILES['userfile']['size']);
|
|
||||||
|
|
||||||
$imagedata = @file_get_contents($src);
|
|
||||||
$ph = new Photo($imagedata);
|
|
||||||
|
|
||||||
if(! ($image = $ph->getImage())) {
|
|
||||||
notice( t('Unable to process image.') . EOL );
|
|
||||||
@unlink($src);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@unlink($src);
|
|
||||||
|
|
||||||
$width = $ph->getWidth();
|
|
||||||
$height = $ph->getHeight();
|
|
||||||
|
|
||||||
if($width < 175 || $height < 175) {
|
|
||||||
$ph->scaleImageUp(200);
|
|
||||||
$width = $ph->getWidth();
|
|
||||||
$height = $ph->getHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
$hash = hash('md5',uniqid(mt_rand(),true));
|
|
||||||
|
|
||||||
|
|
||||||
$smallest = 0;
|
|
||||||
|
|
||||||
$r = $ph->store(0 , $hash, $filename, t('Profile Photos'), 0 );
|
|
||||||
|
|
||||||
if($r)
|
|
||||||
notice( t('Image uploaded successfully.') . EOL );
|
|
||||||
else
|
|
||||||
notice( t('Image upload failed.') . EOL );
|
|
||||||
|
|
||||||
if($width > 640 || $height > 640) {
|
|
||||||
$ph->scaleImage(640);
|
|
||||||
$r = $ph->store(0 , $hash, $filename, t('Profile Photos'), 1 );
|
|
||||||
|
|
||||||
if($r === false)
|
|
||||||
notice( t('Image size reduction (640) failed.') . EOL );
|
|
||||||
else
|
|
||||||
$smallest = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->config['imagecrop'] = $hash;
|
|
||||||
$a->config['imagecrop_resolution'] = $smallest;
|
|
||||||
$a->page['htmlhead'] .= file_get_contents("view/crophead.tpl");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(! function_exists('profile_photo_content')) {
|
|
||||||
function profile_photo_content(&$a) {
|
|
||||||
|
|
||||||
if(! local_user()) {
|
|
||||||
notice( t('Permission denied.') . EOL );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(! x($a->config,'imagecrop')) {
|
|
||||||
|
|
||||||
$tpl = file_get_contents('view/profile_photo.tpl');
|
|
||||||
|
|
||||||
$o .= replace_macros($tpl,array(
|
|
||||||
|
|
||||||
));
|
|
||||||
|
|
||||||
return $o;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$filename = $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'] . '.jpg';
|
|
||||||
$resolution = $a->config['imagecrop_resolution'];
|
|
||||||
$tpl = file_get_contents("view/cropbody.tpl");
|
|
||||||
$o .= replace_macros($tpl,array(
|
|
||||||
'$filename' => $filename,
|
|
||||||
'$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'],
|
|
||||||
'$image_url' => $a->get_baseurl() . '/photo/' . $filename
|
|
||||||
));
|
|
||||||
|
|
||||||
return $o;
|
|
||||||
}
|
|
||||||
|
|
||||||
return; // NOTREACHED
|
|
||||||
}}
|
|
|
@ -8,9 +8,11 @@
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<h3>General information</h3>
|
<h3>General information</h3>
|
||||||
<div class="users">$users users</div>
|
<div class="users">$users users</div>
|
||||||
|
<div class="policy">$policy registration policy</div>
|
||||||
<div class="version">Friendica $version</div>
|
<div class="version">Friendica $version</div>
|
||||||
<div class="first_noticed">First noticed: $dt_first_noticed</div>
|
<div class="first_noticed">First noticed: $dt_first_noticed</div>
|
||||||
<div class="last_seen">Last update: $dt_last_seen</div>
|
<div class="last_seen">Last update: $dt_last_seen</div>
|
||||||
|
<pre class="site-info">$site_info</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="security">
|
<div class="security">
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
<ShortName>Friendica Global Directory</ShortName>
|
<ShortName>Friendica Global Directory</ShortName>
|
||||||
<Description>Search Friendica Global Directory</Description>
|
<Description>Search Friendica Global Directory</Description>
|
||||||
<InputEncoding>UTF-8</InputEncoding>
|
<InputEncoding>UTF-8</InputEncoding>
|
||||||
<Image width="16" height="16" type="image/x-icon">http://dir.friendica.com/images/friendica-16.ico</Image>
|
<Image width="16" height="16" type="image/x-icon">$base/images/friendica-16.ico</Image>
|
||||||
<Image width="64" height="64" type="image/png">http://dir.friendica.com/images/friendica-64.png</Image>
|
<Image width="64" height="64" type="image/png">$base/images/friendica-64.png</Image>
|
||||||
<Url type="text/html" method="GET" template="http://dir.friendica.com/directory">
|
<Url type="text/html" method="GET" template="$base/directory">
|
||||||
<Param name="search" value="{searchTerms}"/>
|
<Param name="search" value="{searchTerms}"/>
|
||||||
</Url>
|
</Url>
|
||||||
|
|
||||||
<moz:SearchForm>http://dir.friendica.com</moz:SearchForm>
|
<moz:SearchForm>$base</moz:SearchForm>
|
||||||
</OpenSearchDescription>
|
</OpenSearchDescription>
|
||||||
|
|
Loading…
Reference in a new issue