added more curly braces + space between "if" and brace
Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
f334f9e61f
commit
70a042fd04
15 changed files with 225 additions and 167 deletions
15
boot.php
15
boot.php
|
@ -670,22 +670,23 @@ class App {
|
||||||
|
|
||||||
#set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path());
|
#set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path());
|
||||||
|
|
||||||
if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,9) === "pagename=") {
|
if ((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,9) === "pagename=") {
|
||||||
$this->query_string = substr($_SERVER['QUERY_STRING'],9);
|
$this->query_string = substr($_SERVER['QUERY_STRING'],9);
|
||||||
// removing trailing / - maybe a nginx problem
|
// removing trailing / - maybe a nginx problem
|
||||||
if (substr($this->query_string, 0, 1) == "/")
|
if (substr($this->query_string, 0, 1) == "/")
|
||||||
$this->query_string = substr($this->query_string, 1);
|
$this->query_string = substr($this->query_string, 1);
|
||||||
} elseif((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") {
|
} elseif ((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") {
|
||||||
$this->query_string = substr($_SERVER['QUERY_STRING'],2);
|
$this->query_string = substr($_SERVER['QUERY_STRING'],2);
|
||||||
// removing trailing / - maybe a nginx problem
|
// removing trailing / - maybe a nginx problem
|
||||||
if (substr($this->query_string, 0, 1) == "/")
|
if (substr($this->query_string, 0, 1) == "/")
|
||||||
$this->query_string = substr($this->query_string, 1);
|
$this->query_string = substr($this->query_string, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_GET,'pagename'))
|
if (x($_GET,'pagename')) {
|
||||||
$this->cmd = trim($_GET['pagename'],'/\\');
|
$this->cmd = trim($_GET['pagename'],'/\\');
|
||||||
elseif (x($_GET,'q'))
|
} elseif (x($_GET,'q')) {
|
||||||
$this->cmd = trim($_GET['q'],'/\\');
|
$this->cmd = trim($_GET['q'],'/\\');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// fix query_string
|
// fix query_string
|
||||||
|
@ -694,13 +695,15 @@ class App {
|
||||||
|
|
||||||
// unix style "homedir"
|
// unix style "homedir"
|
||||||
|
|
||||||
if(substr($this->cmd,0,1) === '~')
|
if (substr($this->cmd,0,1) === '~') {
|
||||||
$this->cmd = 'profile/' . substr($this->cmd,1);
|
$this->cmd = 'profile/' . substr($this->cmd,1);
|
||||||
|
}
|
||||||
|
|
||||||
// Diaspora style profile url
|
// Diaspora style profile url
|
||||||
|
|
||||||
if(substr($this->cmd,0,2) === 'u/')
|
if (substr($this->cmd,0,2) === 'u/') {
|
||||||
$this->cmd = 'profile/' . substr($this->cmd,2);
|
$this->cmd = 'profile/' . substr($this->cmd,2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -77,12 +77,12 @@ function new_contact($uid,$url,$interactive = false) {
|
||||||
|
|
||||||
$url = str_replace('/#!/','/',$url);
|
$url = str_replace('/#!/','/',$url);
|
||||||
|
|
||||||
if(! allowed_url($url)) {
|
if (! allowed_url($url)) {
|
||||||
$result['message'] = t('Disallowed profile URL.');
|
$result['message'] = t('Disallowed profile URL.');
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! $url) {
|
if (! $url) {
|
||||||
$result['message'] = t('Connect URL missing.');
|
$result['message'] = t('Connect URL missing.');
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -91,17 +91,21 @@ function new_contact($uid,$url,$interactive = false) {
|
||||||
|
|
||||||
call_hooks('follow', $arr);
|
call_hooks('follow', $arr);
|
||||||
|
|
||||||
if(x($arr['contact'],'name'))
|
if (x($arr['contact'],'name')) {
|
||||||
$ret = $arr['contact'];
|
$ret = $arr['contact'];
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$ret = probe_url($url);
|
$ret = probe_url($url);
|
||||||
|
}
|
||||||
|
|
||||||
if($ret['network'] === NETWORK_DFRN) {
|
if ($ret['network'] === NETWORK_DFRN) {
|
||||||
if($interactive) {
|
if ($interactive) {
|
||||||
if(strlen($a->path))
|
if (strlen($a->path)) {
|
||||||
$myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
|
$myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
|
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
|
||||||
|
}
|
||||||
|
|
||||||
goaway($ret['request'] . "&addr=$myaddr");
|
goaway($ret['request'] . "&addr=$myaddr");
|
||||||
|
|
||||||
|
|
|
@ -24,22 +24,24 @@ function get_salmon_key($uri,$keyhash) {
|
||||||
// We have found at least one key URL
|
// We have found at least one key URL
|
||||||
// If it's inline, parse it - otherwise get the key
|
// If it's inline, parse it - otherwise get the key
|
||||||
|
|
||||||
if(count($ret) > 0) {
|
if (count($ret) > 0) {
|
||||||
for($x = 0; $x < count($ret); $x ++) {
|
for ($x = 0; $x < count($ret); $x ++) {
|
||||||
if(substr($ret[$x],0,5) === 'data:') {
|
if (substr($ret[$x],0,5) === 'data:') {
|
||||||
if(strstr($ret[$x],','))
|
if (strstr($ret[$x],',')) {
|
||||||
$ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
|
$ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
|
||||||
else
|
} else {
|
||||||
$ret[$x] = substr($ret[$x],5);
|
$ret[$x] = substr($ret[$x],5);
|
||||||
} elseif (normalise_link($ret[$x]) == 'http://')
|
}
|
||||||
|
} elseif (normalise_link($ret[$x]) == 'http://') {
|
||||||
$ret[$x] = fetch_url($ret[$x]);
|
$ret[$x] = fetch_url($ret[$x]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
logger('Key located: ' . print_r($ret,true));
|
logger('Key located: ' . print_r($ret,true));
|
||||||
|
|
||||||
if(count($ret) == 1) {
|
if (count($ret) == 1) {
|
||||||
|
|
||||||
// We only found one one key so we don't care if the hash matches.
|
// We only found one one key so we don't care if the hash matches.
|
||||||
// If it's the wrong key we'll find out soon enough because
|
// If it's the wrong key we'll find out soon enough because
|
||||||
|
@ -50,10 +52,11 @@ function get_salmon_key($uri,$keyhash) {
|
||||||
return $ret[0];
|
return $ret[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach($ret as $a) {
|
foreach ($ret as $a) {
|
||||||
$hash = base64url_encode(hash('sha256',$a));
|
$hash = base64url_encode(hash('sha256',$a));
|
||||||
if($hash == $keyhash)
|
if ($hash == $keyhash) {
|
||||||
return $a;
|
return $a;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,11 +94,12 @@ function authenticate_success($user_record, $login_initial = false, $interactive
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if($login_initial) {
|
if ($login_initial) {
|
||||||
call_hooks('logged_in', $a->user);
|
call_hooks('logged_in', $a->user);
|
||||||
|
|
||||||
if(($a->module !== 'home') && isset($_SESSION['return_url']))
|
if (($a->module !== 'home') && isset($_SESSION['return_url'])) {
|
||||||
goaway(App::get_baseurl() . '/' . $_SESSION['return_url']);
|
goaway(App::get_baseurl() . '/' . $_SESSION['return_url']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,16 +110,17 @@ function can_write_wall(&$a,$owner) {
|
||||||
|
|
||||||
static $verified = 0;
|
static $verified = 0;
|
||||||
|
|
||||||
if((! (local_user())) && (! (remote_user())))
|
if ((! (local_user())) && (! (remote_user()))) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
|
|
||||||
if(($uid) && ($uid == $owner)) {
|
if (($uid) && ($uid == $owner)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(remote_user()) {
|
if (remote_user()) {
|
||||||
|
|
||||||
// use remembered decision and avoid a DB lookup for each and every display item
|
// use remembered decision and avoid a DB lookup for each and every display item
|
||||||
// DO NOT use this function if there are going to be multiple owners
|
// DO NOT use this function if there are going to be multiple owners
|
||||||
|
@ -126,25 +128,25 @@ function can_write_wall(&$a,$owner) {
|
||||||
// We have a contact-id for an authenticated remote user, this block determines if the contact
|
// We have a contact-id for an authenticated remote user, this block determines if the contact
|
||||||
// belongs to this page owner, and has the necessary permissions to post content
|
// belongs to this page owner, and has the necessary permissions to post content
|
||||||
|
|
||||||
if($verified === 2)
|
if ($verified === 2) {
|
||||||
return true;
|
return true;
|
||||||
elseif($verified === 1)
|
} elseif ($verified === 1) {
|
||||||
return false;
|
return false;
|
||||||
else {
|
} else {
|
||||||
$cid = 0;
|
$cid = 0;
|
||||||
|
|
||||||
if(is_array($_SESSION['remote'])) {
|
if (is_array($_SESSION['remote'])) {
|
||||||
foreach($_SESSION['remote'] as $visitor) {
|
foreach ($_SESSION['remote'] as $visitor) {
|
||||||
if($visitor['uid'] == $owner) {
|
if ($visitor['uid'] == $owner) {
|
||||||
$cid = $visitor['cid'];
|
$cid = $visitor['cid'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! $cid)
|
if (! $cid) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `user`.`uid` = `contact`.`uid`
|
$r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `user`.`uid` = `contact`.`uid`
|
||||||
WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||||
|
|
|
@ -91,8 +91,8 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
||||||
|
|
||||||
$name = $entry->displayName;
|
$name = $entry->displayName;
|
||||||
|
|
||||||
if(isset($entry->urls)) {
|
if (isset($entry->urls)) {
|
||||||
foreach($entry->urls as $url) {
|
foreach ($entry->urls as $url) {
|
||||||
if ($url->type == 'profile') {
|
if ($url->type == 'profile') {
|
||||||
$profile_url = $url->value;
|
$profile_url = $url->value;
|
||||||
continue;
|
continue;
|
||||||
|
@ -104,7 +104,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($entry->photos)) {
|
if (isset($entry->photos)) {
|
||||||
foreach($entry->photos as $photo) {
|
foreach ($entry->photos as $photo) {
|
||||||
if ($photo->type == 'profile') {
|
if ($photo->type == 'profile') {
|
||||||
$profile_photo = $photo->value;
|
$profile_photo = $photo->value;
|
||||||
continue;
|
continue;
|
||||||
|
@ -112,29 +112,37 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($entry->updated))
|
if (isset($entry->updated)) {
|
||||||
$updated = date("Y-m-d H:i:s", strtotime($entry->updated));
|
$updated = date("Y-m-d H:i:s", strtotime($entry->updated));
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->network))
|
if (isset($entry->network)) {
|
||||||
$network = $entry->network;
|
$network = $entry->network;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->currentLocation))
|
if (isset($entry->currentLocation)) {
|
||||||
$location = $entry->currentLocation;
|
$location = $entry->currentLocation;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->aboutMe))
|
if (isset($entry->aboutMe)) {
|
||||||
$about = html2bbcode($entry->aboutMe);
|
$about = html2bbcode($entry->aboutMe);
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->gender))
|
if (isset($entry->gender)) {
|
||||||
$gender = $entry->gender;
|
$gender = $entry->gender;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->generation) AND ($entry->generation > 0))
|
if (isset($entry->generation) AND ($entry->generation > 0)) {
|
||||||
$generation = ++$entry->generation;
|
$generation = ++$entry->generation;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->tags))
|
if (isset($entry->tags)) {
|
||||||
foreach($entry->tags as $tag)
|
foreach($entry->tags as $tag) {
|
||||||
$keywords = implode(", ", $tag);
|
$keywords = implode(", ", $tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->contactType) AND ($entry->contactType >= 0))
|
if (isset($entry->contactType) AND ($entry->contactType >= 0))
|
||||||
$contact_type = $entry->contactType;
|
$contact_type = $entry->contactType;
|
||||||
|
|
||||||
// If you query a Friendica server for its profiles, the network has to be Friendica
|
// If you query a Friendica server for its profiles, the network has to be Friendica
|
||||||
|
@ -171,8 +179,6 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
||||||
|
|
||||||
function poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid = 0, $uid = 0, $zcid = 0) {
|
function poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid = 0, $uid = 0, $zcid = 0) {
|
||||||
|
|
||||||
$a = get_app();
|
|
||||||
|
|
||||||
// Generation:
|
// Generation:
|
||||||
// 0: No definition
|
// 0: No definition
|
||||||
// 1: Profiles on this server
|
// 1: Profiles on this server
|
||||||
|
@ -1186,12 +1192,12 @@ function update_suggestions() {
|
||||||
|
|
||||||
$done[] = App::get_baseurl() . '/poco';
|
$done[] = App::get_baseurl() . '/poco';
|
||||||
|
|
||||||
if(strlen(get_config('system','directory'))) {
|
if (strlen(get_config('system','directory'))) {
|
||||||
$x = fetch_url(get_server()."/pubsites");
|
$x = fetch_url(get_server()."/pubsites");
|
||||||
if ($x) {
|
if ($x) {
|
||||||
$j = json_decode($x);
|
$j = json_decode($x);
|
||||||
if ($j->entries) {
|
if ($j->entries) {
|
||||||
foreach($j->entries as $entry) {
|
foreach ($j->entries as $entry) {
|
||||||
|
|
||||||
poco_check_server($entry->url);
|
poco_check_server($entry->url);
|
||||||
|
|
||||||
|
@ -1210,7 +1216,7 @@ function update_suggestions() {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
foreach($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
|
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
|
||||||
if(! in_array($base,$done))
|
if(! in_array($base,$done))
|
||||||
poco_load(0,0,0,$base);
|
poco_load(0,0,0,$base);
|
||||||
|
@ -1221,7 +1227,7 @@ function update_suggestions() {
|
||||||
function poco_discover_federation() {
|
function poco_discover_federation() {
|
||||||
$last = get_config('poco','last_federation_discovery');
|
$last = get_config('poco','last_federation_discovery');
|
||||||
|
|
||||||
if($last) {
|
if ($last) {
|
||||||
$next = $last + (24 * 60 * 60);
|
$next = $last + (24 * 60 * 60);
|
||||||
if($next > time())
|
if($next > time())
|
||||||
return;
|
return;
|
||||||
|
@ -1377,7 +1383,7 @@ function poco_discover_server($data, $default_generation = 0) {
|
||||||
|
|
||||||
$name = $entry->displayName;
|
$name = $entry->displayName;
|
||||||
|
|
||||||
if(isset($entry->urls)) {
|
if (isset($entry->urls)) {
|
||||||
foreach($entry->urls as $url) {
|
foreach($entry->urls as $url) {
|
||||||
if ($url->type == 'profile') {
|
if ($url->type == 'profile') {
|
||||||
$profile_url = $url->value;
|
$profile_url = $url->value;
|
||||||
|
@ -1390,39 +1396,48 @@ function poco_discover_server($data, $default_generation = 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($entry->photos)) {
|
if (isset($entry->photos)) {
|
||||||
foreach($entry->photos as $photo) {
|
foreach ($entry->photos as $photo) {
|
||||||
if($photo->type == 'profile') {
|
if ($photo->type == 'profile') {
|
||||||
$profile_photo = $photo->value;
|
$profile_photo = $photo->value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($entry->updated))
|
if (isset($entry->updated)) {
|
||||||
$updated = date("Y-m-d H:i:s", strtotime($entry->updated));
|
$updated = date("Y-m-d H:i:s", strtotime($entry->updated));
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->network))
|
if(isset($entry->network)) {
|
||||||
$network = $entry->network;
|
$network = $entry->network;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->currentLocation))
|
if(isset($entry->currentLocation)) {
|
||||||
$location = $entry->currentLocation;
|
$location = $entry->currentLocation;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->aboutMe))
|
if(isset($entry->aboutMe)) {
|
||||||
$about = html2bbcode($entry->aboutMe);
|
$about = html2bbcode($entry->aboutMe);
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->gender))
|
if(isset($entry->gender)) {
|
||||||
$gender = $entry->gender;
|
$gender = $entry->gender;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->generation) AND ($entry->generation > 0))
|
if(isset($entry->generation) AND ($entry->generation > 0)) {
|
||||||
$generation = ++$entry->generation;
|
$generation = ++$entry->generation;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->contactType) AND ($entry->contactType >= 0))
|
if(isset($entry->contactType) AND ($entry->contactType >= 0)) {
|
||||||
$contact_type = $entry->contactType;
|
$contact_type = $entry->contactType;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($entry->tags))
|
if(isset($entry->tags)) {
|
||||||
foreach($entry->tags as $tag)
|
foreach ($entry->tags as $tag) {
|
||||||
$keywords = implode(", ", $tag);
|
$keywords = implode(", ", $tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($generation > 0) {
|
if ($generation > 0) {
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
39
index.php
39
index.php
|
@ -152,22 +152,26 @@ if((x($_GET,'zrl')) && (!$install && !$maintenance)) {
|
||||||
|
|
||||||
// header('Link: <' . App::get_baseurl() . '/amcd>; rel="acct-mgmt";');
|
// header('Link: <' . App::get_baseurl() . '/amcd>; rel="acct-mgmt";');
|
||||||
|
|
||||||
if(x($_COOKIE["Friendica"]) || (x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login'))
|
if (x($_COOKIE["Friendica"]) || (x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login')) {
|
||||||
require("include/auth.php");
|
require("include/auth.php");
|
||||||
|
}
|
||||||
|
|
||||||
if(! x($_SESSION,'authenticated'))
|
if (! x($_SESSION,'authenticated')) {
|
||||||
header('X-Account-Management-Status: none');
|
header('X-Account-Management-Status: none');
|
||||||
|
}
|
||||||
|
|
||||||
/* set up page['htmlhead'] and page['end'] for the modules to use */
|
/* set up page['htmlhead'] and page['end'] for the modules to use */
|
||||||
$a->page['htmlhead'] = '';
|
$a->page['htmlhead'] = '';
|
||||||
$a->page['end'] = '';
|
$a->page['end'] = '';
|
||||||
|
|
||||||
|
|
||||||
if(! x($_SESSION,'sysmsg'))
|
if (! x($_SESSION,'sysmsg')) {
|
||||||
$_SESSION['sysmsg'] = array();
|
$_SESSION['sysmsg'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
if(! x($_SESSION,'sysmsg_info'))
|
if (! x($_SESSION,'sysmsg_info')) {
|
||||||
$_SESSION['sysmsg_info'] = array();
|
$_SESSION['sysmsg_info'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check_config() is responsible for running update scripts. These automatically
|
* check_config() is responsible for running update scripts. These automatically
|
||||||
|
@ -177,11 +181,11 @@ if(! x($_SESSION,'sysmsg_info'))
|
||||||
|
|
||||||
// in install mode, any url loads install module
|
// in install mode, any url loads install module
|
||||||
// but we need "view" module for stylesheet
|
// but we need "view" module for stylesheet
|
||||||
if($install && $a->module!="view")
|
if ($install && $a->module!="view") {
|
||||||
$a->module = 'install';
|
$a->module = 'install';
|
||||||
elseif($maintenance && $a->module!="view")
|
} elseif ($maintenance && $a->module!="view") {
|
||||||
$a->module = 'maintenance';
|
$a->module = 'maintenance';
|
||||||
else {
|
} else {
|
||||||
check_url($a);
|
check_url($a);
|
||||||
check_db();
|
check_db();
|
||||||
check_plugins($a);
|
check_plugins($a);
|
||||||
|
@ -191,8 +195,7 @@ nav_set_selected('nothing');
|
||||||
|
|
||||||
//Don't populate apps_menu if apps are private
|
//Don't populate apps_menu if apps are private
|
||||||
$privateapps = get_config('config','private_addons');
|
$privateapps = get_config('config','private_addons');
|
||||||
if((local_user()) || (! $privateapps === "1"))
|
if ((local_user()) || (! $privateapps === "1")) {
|
||||||
{
|
|
||||||
$arr = array('app_menu' => $a->apps);
|
$arr = array('app_menu' => $a->apps);
|
||||||
|
|
||||||
call_hooks('app_menu', $arr);
|
call_hooks('app_menu', $arr);
|
||||||
|
@ -238,9 +241,9 @@ if(strlen($a->module)) {
|
||||||
|
|
||||||
$privateapps = get_config('config','private_addons');
|
$privateapps = get_config('config','private_addons');
|
||||||
|
|
||||||
if(is_array($a->plugins) && in_array($a->module,$a->plugins) && file_exists("addon/{$a->module}/{$a->module}.php")) {
|
if (is_array($a->plugins) && in_array($a->module,$a->plugins) && file_exists("addon/{$a->module}/{$a->module}.php")) {
|
||||||
//Check if module is an app and if public access to apps is allowed or not
|
//Check if module is an app and if public access to apps is allowed or not
|
||||||
if((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") {
|
if ((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") {
|
||||||
info( t("You must be logged in to use addons. "));
|
info( t("You must be logged in to use addons. "));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -254,7 +257,7 @@ if(strlen($a->module)) {
|
||||||
* If not, next look for a 'standard' program module in the 'mod' directory
|
* If not, next look for a 'standard' program module in the 'mod' directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if((! $a->module_loaded) && (file_exists("mod/{$a->module}.php"))) {
|
if ((! $a->module_loaded) && (file_exists("mod/{$a->module}.php"))) {
|
||||||
include_once("mod/{$a->module}.php");
|
include_once("mod/{$a->module}.php");
|
||||||
$a->module_loaded = true;
|
$a->module_loaded = true;
|
||||||
}
|
}
|
||||||
|
@ -272,14 +275,14 @@ if(strlen($a->module)) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(! $a->module_loaded) {
|
if (! $a->module_loaded) {
|
||||||
|
|
||||||
// Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
|
// Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
|
||||||
if((x($_SERVER,'QUERY_STRING')) && preg_match('/{[0-9]}/',$_SERVER['QUERY_STRING']) !== 0) {
|
if ((x($_SERVER,'QUERY_STRING')) && preg_match('/{[0-9]}/',$_SERVER['QUERY_STRING']) !== 0) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
if((x($_SERVER,'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
|
if ((x($_SERVER,'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
|
||||||
logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
|
logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
|
||||||
goaway(App::get_baseurl() . $_SERVER['REQUEST_URI']);
|
goaway(App::get_baseurl() . $_SERVER['REQUEST_URI']);
|
||||||
}
|
}
|
||||||
|
@ -304,11 +307,13 @@ if (file_exists($theme_info_file)){
|
||||||
|
|
||||||
/* initialise content region */
|
/* initialise content region */
|
||||||
|
|
||||||
if(! x($a->page,'content'))
|
if (! x($a->page,'content')) {
|
||||||
$a->page['content'] = '';
|
$a->page['content'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
if(!$install && !$maintenance)
|
if (!$install && !$maintenance) {
|
||||||
call_hooks('page_content_top',$a->page['content']);
|
call_hooks('page_content_top',$a->page['content']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call module functions
|
* Call module functions
|
||||||
|
|
|
@ -1129,19 +1129,19 @@ function admin_page_dbsync(App &$a) {
|
||||||
$failed[] = $upd;
|
$failed[] = $upd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(! count($failed)) {
|
if (! count($failed)) {
|
||||||
$o = replace_macros(get_markup_template('structure_check.tpl'),array(
|
$o = replace_macros(get_markup_template('structure_check.tpl'),array(
|
||||||
'$base' => App::get_baseurl(true),
|
'$base' => App::get_baseurl(true),
|
||||||
'$banner' => t('No failed updates.'),
|
'$banner' => t('No failed updates.'),
|
||||||
'$check' => t('Check database structure'),
|
'$check' => t('Check database structure'),
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
|
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
|
||||||
'$base' => App::get_baseurl(true),
|
'$base' => App::get_baseurl(true),
|
||||||
'$banner' => t('Failed Updates'),
|
'$banner' => t('Failed Updates'),
|
||||||
'$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
|
'$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
|
||||||
'$mark' => t('Mark success (if update was manually applied)'),
|
'$mark' => t('Mark success (if update was manually applied)'),
|
||||||
'$apply' => t('Attempt to execute this update step automatically'),
|
'$apply' => t('Attempt to execute this update step automatically'),
|
||||||
'$failed' => $failed
|
'$failed' => $failed
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -1156,11 +1156,11 @@ function admin_page_dbsync(App &$a) {
|
||||||
* @param App $a
|
* @param App $a
|
||||||
*/
|
*/
|
||||||
function admin_page_users_post(App &$a){
|
function admin_page_users_post(App &$a){
|
||||||
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
|
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
|
||||||
$users = (x($_POST, 'user') ? $_POST['user'] : array());
|
$users = (x($_POST, 'user') ? $_POST['user'] : array());
|
||||||
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
|
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
|
||||||
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
|
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
|
||||||
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
|
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
|
||||||
$nu_language = get_config('system', 'language');
|
$nu_language = get_config('system', 'language');
|
||||||
|
|
||||||
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
|
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
|
||||||
|
@ -1546,7 +1546,7 @@ function admin_page_plugins(App &$a){
|
||||||
* List plugins
|
* List plugins
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(x($_GET,"a") && $_GET['a']=="r") {
|
if (x($_GET,"a") && $_GET['a']=="r") {
|
||||||
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/plugins', 'admin_themes', 't');
|
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/plugins', 'admin_themes', 't');
|
||||||
reload_plugins();
|
reload_plugins();
|
||||||
info("Plugins reloaded");
|
info("Plugins reloaded");
|
||||||
|
@ -1555,23 +1555,26 @@ function admin_page_plugins(App &$a){
|
||||||
|
|
||||||
$plugins = array();
|
$plugins = array();
|
||||||
$files = glob("addon/*/");
|
$files = glob("addon/*/");
|
||||||
if($files) {
|
if ($files) {
|
||||||
foreach($files as $file) {
|
foreach ($files as $file) {
|
||||||
if(is_dir($file)) {
|
if (is_dir($file)) {
|
||||||
list($tmp, $id)=array_map("trim", explode("/",$file));
|
list($tmp, $id)=array_map("trim", explode("/",$file));
|
||||||
$info = get_plugin_info($id);
|
$info = get_plugin_info($id);
|
||||||
$show_plugin = true;
|
$show_plugin = true;
|
||||||
|
|
||||||
// If the addon is unsupported, then only show it, when it is enabled
|
// If the addon is unsupported, then only show it, when it is enabled
|
||||||
if((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins))
|
if ((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins)) {
|
||||||
$show_plugin = false;
|
$show_plugin = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Override the above szenario, when the admin really wants to see outdated stuff
|
// Override the above szenario, when the admin really wants to see outdated stuff
|
||||||
if(get_config("system", "show_unsupported_addons"))
|
if (get_config("system", "show_unsupported_addons")) {
|
||||||
$show_plugin = true;
|
$show_plugin = true;
|
||||||
|
}
|
||||||
|
|
||||||
if($show_plugin)
|
if ($show_plugin) {
|
||||||
$plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
|
$plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1798,11 +1801,11 @@ function admin_page_themes(App &$a){
|
||||||
|
|
||||||
|
|
||||||
// reload active themes
|
// reload active themes
|
||||||
if(x($_GET,"a") && $_GET['a']=="r") {
|
if (x($_GET,"a") && $_GET['a']=="r") {
|
||||||
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/themes', 'admin_themes', 't');
|
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/themes', 'admin_themes', 't');
|
||||||
if($themes) {
|
if ($themes) {
|
||||||
foreach($themes as $th) {
|
foreach ($themes as $th) {
|
||||||
if($th['allowed']) {
|
if ($th['allowed']) {
|
||||||
uninstall_theme($th['name']);
|
uninstall_theme($th['name']);
|
||||||
install_theme($th['name']);
|
install_theme($th['name']);
|
||||||
}
|
}
|
||||||
|
@ -1817,7 +1820,7 @@ function admin_page_themes(App &$a){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$xthemes = array();
|
$xthemes = array();
|
||||||
if($themes) {
|
if ($themes) {
|
||||||
foreach($themes as $th) {
|
foreach($themes as $th) {
|
||||||
$xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
|
$xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
|
||||||
}
|
}
|
||||||
|
@ -1826,17 +1829,17 @@ function admin_page_themes(App &$a){
|
||||||
|
|
||||||
$t = get_markup_template("admin_plugins.tpl");
|
$t = get_markup_template("admin_plugins.tpl");
|
||||||
return replace_macros($t, array(
|
return replace_macros($t, array(
|
||||||
'$title' => t('Administration'),
|
'$title' => t('Administration'),
|
||||||
'$page' => t('Themes'),
|
'$page' => t('Themes'),
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$reload' => t('Reload active themes'),
|
'$reload' => t('Reload active themes'),
|
||||||
'$baseurl' => App::get_baseurl(true),
|
'$baseurl' => App::get_baseurl(true),
|
||||||
'$function' => 'themes',
|
'$function' => 'themes',
|
||||||
'$plugins' => $xthemes,
|
'$plugins' => $xthemes,
|
||||||
'$pcount' => count($themes),
|
'$pcount' => count($themes),
|
||||||
'$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'<code>/view/themes</code>'),
|
'$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'<code>/view/themes</code>'),
|
||||||
'$experimental' => t('[Experimental]'),
|
'$experimental' => t('[Experimental]'),
|
||||||
'$unsupported' => t('[Unsupported]'),
|
'$unsupported' => t('[Unsupported]'),
|
||||||
'$form_security_token' => get_form_security_token("admin_themes"),
|
'$form_security_token' => get_form_security_token("admin_themes"),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ function allfriends_content(App &$a) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! count($c)) {
|
if (! count($c)) {
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$a->page['aside'] = "";
|
$a->page['aside'] = "";
|
||||||
profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));
|
profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));
|
||||||
|
|
|
@ -231,7 +231,7 @@ function cal_content(App &$a) {
|
||||||
$r = sort_by_date($r);
|
$r = sort_by_date($r);
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
||||||
if(! x($links,$j)) {
|
if (! x($links,$j)) {
|
||||||
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
|
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ function delegate_content(App &$a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
|
if ($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
|
||||||
|
|
||||||
// delegated admins can view but not change delegation permissions
|
// delegated admins can view but not change delegation permissions
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ function delegate_content(App &$a) {
|
||||||
goaway(App::get_baseurl() . '/delegate');
|
goaway(App::get_baseurl() . '/delegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
|
if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
|
||||||
|
|
||||||
// delegated admins can view but not change delegation permissions
|
// delegated admins can view but not change delegation permissions
|
||||||
|
|
||||||
|
|
|
@ -506,10 +506,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
// Let's send our user to the contact editor in case they want to
|
// Let's send our user to the contact editor in case they want to
|
||||||
// do anything special with this new friend.
|
// do anything special with this new friend.
|
||||||
|
|
||||||
if($handsfree === null)
|
if ($handsfree === null) {
|
||||||
goaway(App::get_baseurl() . '/contacts/' . intval($contact_id));
|
goaway(App::get_baseurl() . '/contacts/' . intval($contact_id));
|
||||||
else
|
} else {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
//NOTREACHED
|
//NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +526,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(x($_POST,'source_url')) {
|
if (x($_POST,'source_url')) {
|
||||||
|
|
||||||
// We are processing an external confirmation to an introduction created by our user.
|
// We are processing an external confirmation to an introduction created by our user.
|
||||||
|
|
||||||
|
@ -546,7 +547,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
|
|
||||||
// If $aes_key is set, both of these items require unpacking from the hex transport encoding.
|
// If $aes_key is set, both of these items require unpacking from the hex transport encoding.
|
||||||
|
|
||||||
if(x($aes_key)) {
|
if (x($aes_key)) {
|
||||||
$aes_key = hex2bin($aes_key);
|
$aes_key = hex2bin($aes_key);
|
||||||
$public_key = hex2bin($public_key);
|
$public_key = hex2bin($public_key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,17 +120,19 @@ function dfrn_request_post(App &$a) {
|
||||||
|
|
||||||
$parms = Probe::profile($dfrn_url);
|
$parms = Probe::profile($dfrn_url);
|
||||||
|
|
||||||
if(! count($parms)) {
|
if (! count($parms)) {
|
||||||
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
|
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(! x($parms,'fn'))
|
if (! x($parms,'fn')) {
|
||||||
notice( t('Warning: profile location has no identifiable owner name.') . EOL );
|
notice( t('Warning: profile location has no identifiable owner name.') . EOL );
|
||||||
if(! x($parms,'photo'))
|
}
|
||||||
|
if (! x($parms,'photo')) {
|
||||||
notice( t('Warning: profile location has no profile photo.') . EOL );
|
notice( t('Warning: profile location has no profile photo.') . EOL );
|
||||||
|
}
|
||||||
$invalid = Probe::valid_dfrn($parms);
|
$invalid = Probe::valid_dfrn($parms);
|
||||||
if($invalid) {
|
if ($invalid) {
|
||||||
notice( sprintf( tt("%d required parameter was not found at the given location",
|
notice( sprintf( tt("%d required parameter was not found at the given location",
|
||||||
"%d required parameters were not found at the given location",
|
"%d required parameters were not found at the given location",
|
||||||
$invalid), $invalid) . EOL );
|
$invalid), $invalid) . EOL );
|
||||||
|
@ -502,13 +504,13 @@ function dfrn_request_post(App &$a) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(! validate_url($url)) {
|
if (! validate_url($url)) {
|
||||||
notice( t('Invalid profile URL.') . EOL);
|
notice( t('Invalid profile URL.') . EOL);
|
||||||
goaway(App::get_baseurl() . '/' . $a->cmd);
|
goaway(App::get_baseurl() . '/' . $a->cmd);
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! allowed_url($url)) {
|
if (! allowed_url($url)) {
|
||||||
notice( t('Disallowed profile URL.') . EOL);
|
notice( t('Disallowed profile URL.') . EOL);
|
||||||
goaway(App::get_baseurl() . '/' . $a->cmd);
|
goaway(App::get_baseurl() . '/' . $a->cmd);
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
|
@ -519,17 +521,19 @@ function dfrn_request_post(App &$a) {
|
||||||
|
|
||||||
$parms = Probe::profile(($hcard) ? $hcard : $url);
|
$parms = Probe::profile(($hcard) ? $hcard : $url);
|
||||||
|
|
||||||
if(! count($parms)) {
|
if (! count($parms)) {
|
||||||
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
|
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
|
||||||
goaway(App::get_baseurl() . '/' . $a->cmd);
|
goaway(App::get_baseurl() . '/' . $a->cmd);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(! x($parms,'fn'))
|
if (! x($parms,'fn')) {
|
||||||
notice( t('Warning: profile location has no identifiable owner name.') . EOL );
|
notice( t('Warning: profile location has no identifiable owner name.') . EOL );
|
||||||
if(! x($parms,'photo'))
|
}
|
||||||
|
if (! x($parms,'photo')) {
|
||||||
notice( t('Warning: profile location has no profile photo.') . EOL );
|
notice( t('Warning: profile location has no profile photo.') . EOL );
|
||||||
|
}
|
||||||
$invalid = Probe::valid_dfrn($parms);
|
$invalid = Probe::valid_dfrn($parms);
|
||||||
if($invalid) {
|
if ($invalid) {
|
||||||
notice( sprintf( tt("%d required parameter was not found at the given location",
|
notice( sprintf( tt("%d required parameter was not found at the given location",
|
||||||
"%d required parameters were not found at the given location",
|
"%d required parameters were not found at the given location",
|
||||||
$invalid), $invalid) . EOL );
|
$invalid), $invalid) . EOL );
|
||||||
|
@ -810,15 +814,18 @@ function dfrn_request_content(App &$a) {
|
||||||
$myaddr = hex2bin($_GET['addr']);
|
$myaddr = hex2bin($_GET['addr']);
|
||||||
elseif (x($_GET,'address') AND ($_GET['address'] != ""))
|
elseif (x($_GET,'address') AND ($_GET['address'] != ""))
|
||||||
$myaddr = $_GET['address'];
|
$myaddr = $_GET['address'];
|
||||||
elseif(local_user()) {
|
elseif (local_user()) {
|
||||||
if(strlen($a->path)) {
|
if (strlen($a->path)) {
|
||||||
$myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname'];
|
$myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
|
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
|
||||||
}
|
}
|
||||||
} else // last, try a zrl
|
}
|
||||||
|
else {
|
||||||
|
// last, try a zrl
|
||||||
$myaddr = get_my_url();
|
$myaddr = get_my_url();
|
||||||
|
}
|
||||||
|
|
||||||
$target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
|
$target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
|
||||||
|
|
||||||
|
@ -831,10 +838,12 @@ function dfrn_request_content(App &$a) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if($a->profile['page-flags'] == PAGE_NORMAL)
|
if ($a->profile['page-flags'] == PAGE_NORMAL) {
|
||||||
$tpl = get_markup_template('dfrn_request.tpl');
|
$tpl = get_markup_template('dfrn_request.tpl');
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$tpl = get_markup_template('auto_request.tpl');
|
$tpl = get_markup_template('auto_request.tpl');
|
||||||
|
}
|
||||||
|
|
||||||
$page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:");
|
$page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:");
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@ function dirfind_init(App &$a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! x($a->page,'aside'))
|
if (! x($a->page,'aside')) {
|
||||||
$a->page['aside'] = '';
|
$a->page['aside'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
$a->page['aside'] .= findpeople_widget();
|
$a->page['aside'] .= findpeople_widget();
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@ function dirfind_content(&$a, $prefix = "") {
|
||||||
|
|
||||||
$search = $prefix.notags(trim($_REQUEST['search']));
|
$search = $prefix.notags(trim($_REQUEST['search']));
|
||||||
|
|
||||||
if(strpos($search,'@') === 0) {
|
if (strpos($search,'@') === 0) {
|
||||||
$search = substr($search,1);
|
$search = substr($search,1);
|
||||||
$header = sprintf( t('People Search - %s'), $search);
|
$header = sprintf( t('People Search - %s'), $search);
|
||||||
if ((valid_email($search) AND validate_email($search)) OR
|
if ((valid_email($search) AND validate_email($search)) OR
|
||||||
|
@ -41,7 +42,7 @@ function dirfind_content(&$a, $prefix = "") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strpos($search,'!') === 0) {
|
if (strpos($search,'!') === 0) {
|
||||||
$search = substr($search,1);
|
$search = substr($search,1);
|
||||||
$community = true;
|
$community = true;
|
||||||
$header = sprintf( t('Forum Search - %s'), $search);
|
$header = sprintf( t('Forum Search - %s'), $search);
|
||||||
|
@ -49,7 +50,7 @@ function dirfind_content(&$a, $prefix = "") {
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
if($search) {
|
if ($search) {
|
||||||
|
|
||||||
if ($discover_user) {
|
if ($discover_user) {
|
||||||
$j = new stdClass();
|
$j = new stdClass();
|
||||||
|
@ -85,15 +86,19 @@ function dirfind_content(&$a, $prefix = "") {
|
||||||
$perpage = 80;
|
$perpage = 80;
|
||||||
$startrec = (($a->pager['page']) * $perpage) - $perpage;
|
$startrec = (($a->pager['page']) * $perpage) - $perpage;
|
||||||
|
|
||||||
if (get_config('system','diaspora_enabled'))
|
if (get_config('system','diaspora_enabled')) {
|
||||||
$diaspora = NETWORK_DIASPORA;
|
$diaspora = NETWORK_DIASPORA;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$diaspora = NETWORK_DFRN;
|
$diaspora = NETWORK_DFRN;
|
||||||
|
}
|
||||||
|
|
||||||
if (!get_config('system','ostatus_disabled'))
|
if (!get_config('system','ostatus_disabled')) {
|
||||||
$ostatus = NETWORK_OSTATUS;
|
$ostatus = NETWORK_OSTATUS;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$ostatus = NETWORK_DFRN;
|
$ostatus = NETWORK_DFRN;
|
||||||
|
}
|
||||||
|
|
||||||
$search2 = "%".$search."%";
|
$search2 = "%".$search."%";
|
||||||
|
|
||||||
|
@ -133,8 +138,9 @@ function dirfind_content(&$a, $prefix = "") {
|
||||||
$j->items_page = $perpage;
|
$j->items_page = $perpage;
|
||||||
$j->page = $a->pager['page'];
|
$j->page = $a->pager['page'];
|
||||||
foreach ($results AS $result) {
|
foreach ($results AS $result) {
|
||||||
if (poco_alternate_ostatus_url($result["url"]))
|
if (poco_alternate_ostatus_url($result["url"])) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$result = get_contact_details_by_url($result["url"], local_user(), $result);
|
$result = get_contact_details_by_url($result["url"], local_user(), $result);
|
||||||
|
|
||||||
|
@ -167,16 +173,16 @@ function dirfind_content(&$a, $prefix = "") {
|
||||||
$j = json_decode($x);
|
$j = json_decode($x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($j->total) {
|
if ($j->total) {
|
||||||
$a->set_pager_total($j->total);
|
$a->set_pager_total($j->total);
|
||||||
$a->set_pager_itemspage($j->items_page);
|
$a->set_pager_itemspage($j->items_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($j->results)) {
|
if (count($j->results)) {
|
||||||
|
|
||||||
$id = 0;
|
$id = 0;
|
||||||
|
|
||||||
foreach($j->results as $jj) {
|
foreach ($j->results as $jj) {
|
||||||
|
|
||||||
$alt_text = "";
|
$alt_text = "";
|
||||||
|
|
||||||
|
@ -194,8 +200,10 @@ function dirfind_content(&$a, $prefix = "") {
|
||||||
$photo_menu = contact_photo_menu($contact[0]);
|
$photo_menu = contact_photo_menu($contact[0]);
|
||||||
$details = _contact_detail_for_template($contact[0]);
|
$details = _contact_detail_for_template($contact[0]);
|
||||||
$alt_text = $details['alt_text'];
|
$alt_text = $details['alt_text'];
|
||||||
} else
|
}
|
||||||
|
else {
|
||||||
$photo_menu = array();
|
$photo_menu = array();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$connlnk = App::get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
|
$connlnk = App::get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
|
||||||
$conntxt = t('Connect');
|
$conntxt = t('Connect');
|
||||||
|
|
|
@ -254,15 +254,15 @@ function events_content(App &$a) {
|
||||||
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
|
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
|
||||||
|
|
||||||
if($a->argc > 1) {
|
if($a->argc > 1) {
|
||||||
if($a->argc > 2 && $a->argv[1] == 'event') {
|
if ($a->argc > 2 && $a->argv[1] == 'event') {
|
||||||
$mode = 'edit';
|
$mode = 'edit';
|
||||||
$event_id = intval($a->argv[2]);
|
$event_id = intval($a->argv[2]);
|
||||||
}
|
}
|
||||||
if($a->argv[1] === 'new') {
|
if ($a->argv[1] === 'new') {
|
||||||
$mode = 'new';
|
$mode = 'new';
|
||||||
$event_id = 0;
|
$event_id = 0;
|
||||||
}
|
}
|
||||||
if($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
|
if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
|
||||||
$mode = 'view';
|
$mode = 'view';
|
||||||
$y = intval($a->argv[1]);
|
$y = intval($a->argv[1]);
|
||||||
$m = intval($a->argv[2]);
|
$m = intval($a->argv[2]);
|
||||||
|
@ -270,23 +270,27 @@ function events_content(App &$a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The view mode part is similiar to /mod/cal.php
|
// The view mode part is similiar to /mod/cal.php
|
||||||
if($mode == 'view') {
|
if ($mode == 'view') {
|
||||||
|
|
||||||
|
|
||||||
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
|
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
|
||||||
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
|
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
|
||||||
if(! $y)
|
if (! $y) {
|
||||||
$y = intval($thisyear);
|
$y = intval($thisyear);
|
||||||
if(! $m)
|
}
|
||||||
|
if (! $m) {
|
||||||
$m = intval($thismonth);
|
$m = intval($thismonth);
|
||||||
|
}
|
||||||
|
|
||||||
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
|
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
|
||||||
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
|
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
|
||||||
|
|
||||||
if($y < 1901)
|
if ($y < 1901) {
|
||||||
$y = 1900;
|
$y = 1900;
|
||||||
if($y > 2099)
|
}
|
||||||
|
if ($y > 2099) {
|
||||||
$y = 2100;
|
$y = 2100;
|
||||||
|
}
|
||||||
|
|
||||||
$nextyear = $y;
|
$nextyear = $y;
|
||||||
$nextmonth = $m + 1;
|
$nextmonth = $m + 1;
|
||||||
|
@ -342,7 +346,7 @@ function events_content(App &$a) {
|
||||||
$r = sort_by_date($r);
|
$r = sort_by_date($r);
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
||||||
if(! x($links,$j)) {
|
if (! x($links,$j)) {
|
||||||
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
|
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1170,13 +1170,14 @@ function settings_content(App &$a) {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(get_config('system','directory'))) {
|
if (strlen(get_config('system','directory'))) {
|
||||||
$profile_in_net_dir = replace_macros($opt_tpl,array(
|
$profile_in_net_dir = replace_macros($opt_tpl,array(
|
||||||
'$field' => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'),t('Yes'))),
|
'$field' => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'),t('Yes'))),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
$profile_in_net_dir = '';
|
$profile_in_net_dir = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$hide_friends = replace_macros($opt_tpl,array(
|
$hide_friends = replace_macros($opt_tpl,array(
|
||||||
|
|
Loading…
Reference in a new issue