*much* more usage of App::get_baseurl() instead of $a->get_baseurl() (coding convention applied)

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2016-12-19 14:26:13 +01:00 committed by Roland Haeder
parent 97c507e763
commit f8a213e23b
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
19 changed files with 226 additions and 196 deletions

View file

@ -85,7 +85,7 @@ function contact_remove($id) {
function terminate_friendship($user,$self,$contact) { function terminate_friendship($user,$self,$contact) {
/// @TODO Get rid of this, include/datetime.php should care about by itself /// @TODO Get rid of this, include/datetime.php should care about it by itself
$a = get_app(); $a = get_app();
require_once('include/datetime.php'); require_once('include/datetime.php');

View file

@ -158,12 +158,14 @@ function categories_widget($baseurl,$selected = '') {
$a = get_app(); $a = get_app();
if(! feature_enabled($a->profile['profile_uid'],'categories')) if (! feature_enabled($a->profile['profile_uid'],'categories')) {
return ''; return '';
}
$saved = get_pconfig($a->profile['profile_uid'],'system','filetags'); $saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
if(! strlen($saved)) if (! strlen($saved)) {
return; return;
}
$matches = false; $matches = false;
$terms = array(); $terms = array();

View file

@ -102,8 +102,7 @@ function new_contact($uid,$url,$interactive = false) {
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());
} }
@ -111,8 +110,7 @@ function new_contact($uid,$url,$interactive = false) {
// NOTREACHED // NOTREACHED
} }
} } else {
else {
if (get_config('system','dfrn_only')) { if (get_config('system','dfrn_only')) {
$result['message'] = t('This site is not configured to allow communications with other networks.') . EOL; $result['message'] = t('This site is not configured to allow communications with other networks.') . EOL;
$result['message'] != t('No compatible communication protocols or feeds were discovered.') . EOL; $result['message'] != t('No compatible communication protocols or feeds were discovered.') . EOL;
@ -120,26 +118,24 @@ function new_contact($uid,$url,$interactive = false) {
} }
} }
// This extra param just confuses things, remove it // This extra param just confuses things, remove it
if($ret['network'] === NETWORK_DIASPORA) if ($ret['network'] === NETWORK_DIASPORA) {
$ret['url'] = str_replace('?absolute=true','',$ret['url']); $ret['url'] = str_replace('?absolute=true','',$ret['url']);
}
// do we have enough information? // do we have enough information?
if (! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) { if (! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) {
$result['message'] .= t('The profile address specified does not provide adequate information.') . EOL; $result['message'] .= t('The profile address specified does not provide adequate information.') . EOL;
if(! x($ret,'poll')) if (! x($ret,'poll')) {
$result['message'] .= t('No compatible communication protocols or feeds were discovered.') . EOL; $result['message'] .= t('No compatible communication protocols or feeds were discovered.') . EOL;
if(! x($ret,'name')) }
if (! x($ret,'name')) {
$result['message'] .= t('An author or name was not found.') . EOL; $result['message'] .= t('An author or name was not found.') . EOL;
if(! x($ret,'url')) }
if (! x($ret,'url')) {
$result['message'] .= t('No browser URL could be matched to this address.') . EOL; $result['message'] .= t('No browser URL could be matched to this address.') . EOL;
}
if (strpos($url,'@') !== false) { if (strpos($url,'@') !== false) {
$result['message'] .= t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL; $result['message'] .= t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL;
$result['message'] .= t('Use mailto: in front of address to force email check.') . EOL; $result['message'] .= t('Use mailto: in front of address to force email check.') . EOL;
@ -152,11 +148,6 @@ function new_contact($uid,$url,$interactive = false) {
$ret['notify'] = ''; $ret['notify'] = '';
} }
if (! $ret['notify']) { if (! $ret['notify']) {
$result['message'] .= t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL; $result['message'] .= t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
} }
@ -167,8 +158,9 @@ function new_contact($uid,$url,$interactive = false) {
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0); $hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
if(in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) if (in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) {
$writeable = 1; $writeable = 1;
}
// check if we already have a contact // check if we already have a contact
// the poll url is more reliable than the profile url, as we may have // the poll url is more reliable than the profile url, as we may have
@ -197,11 +189,9 @@ function new_contact($uid,$url,$interactive = false) {
); );
} }
} else { } else {
// check service class limits // check service class limits
$r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0", $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `pending` = 0 AND `self` = 0",
intval($uid) intval($uid)
); );
if (dbm::is_result($r)) if (dbm::is_result($r))
@ -212,12 +202,13 @@ function new_contact($uid,$url,$interactive = false) {
return $result; return $result;
} }
$r = q("select count(network) as total from contact where uid = %d and network = '%s' and pending = 0 and self = 0", $r = q("SELECT COUNT(`network`) AS `total` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND `pending` = 0 AND `self` = 0",
intval($uid), intval($uid),
dbesc($network) dbesc($network)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$total_network = $r[0]['total']; $total_network = $r[0]['total'];
}
if (! service_class_allows($uid,'total_contacts_' . $network,$total_network)) { if (! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
$result['message'] .= upgrade_message(); $result['message'] .= upgrade_message();
@ -268,8 +259,9 @@ function new_contact($uid,$url,$interactive = false) {
$result['cid'] = $contact_id; $result['cid'] = $contact_id;
$def_gid = get_default_group($uid, $contact["network"]); $def_gid = get_default_group($uid, $contact["network"]);
if (intval($def_gid)) if (intval($def_gid)) {
group_add_member($uid, '', $contact_id, $def_gid); group_add_member($uid, '', $contact_id, $def_gid);
}
// Update the avatar // Update the avatar
update_contact_avatar($ret['photo'],$uid,$contact_id); update_contact_avatar($ret['photo'],$uid,$contact_id);
@ -285,7 +277,6 @@ function new_contact($uid,$url,$interactive = false) {
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
if (($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) { if (($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
// create a follow slap // create a follow slap
$item = array(); $item = array();
$item['verb'] = ACTIVITY_FOLLOW; $item['verb'] = ACTIVITY_FOLLOW;

View file

@ -231,8 +231,7 @@ function profile_sidebar($profile, $block = 0) {
if ($connect AND local_user()) { if ($connect AND local_user()) {
if (isset($profile["url"])) { if (isset($profile["url"])) {
$profile_url = normalise_link($profile["url"]); $profile_url = normalise_link($profile["url"]);
} } else {
else {
$profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]); $profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]);
} }
@ -638,49 +637,86 @@ function advanced_profile(App &$a) {
if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']); if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']);
/// @TODO Maybe use x() here, plus below?
if($a->profile['with']) $profile['marital']['with'] = $a->profile['with']; if ($a->profile['with']) {
$profile['marital']['with'] = $a->profile['with'];
}
if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') { if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
$profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s')); $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
} }
if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] ); if ($a->profile['sexual']) {
$profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] );
}
if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) ); if ($a->profile['homepage']) {
$profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) );
}
if($a->profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) ); if ($a->profile['hometown']) {
$profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) );
}
if($a->profile['pub_keywords']) $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']); if ($a->profile['pub_keywords']) {
$profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']);
}
if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']); if ($a->profile['politic']) {
$profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
}
if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']); if ($a->profile['religion']) {
$profile['religion'] = array( t('Religion:'), $a->profile['religion']);
}
if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); if ($txt = prepare_text($a->profile['about'])) {
$profile['about'] = array( t('About:'), $txt );
}
if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); if ($txt = prepare_text($a->profile['interest'])) {
$profile['interest'] = array( t('Hobbies/Interests:'), $txt);
}
if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); if ($txt = prepare_text($a->profile['likes'])) {
$profile['likes'] = array( t('Likes:'), $txt);
}
if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); if ($txt = prepare_text($a->profile['dislikes'])) {
$profile['dislikes'] = array( t('Dislikes:'), $txt);
}
if ($txt = prepare_text($a->profile['contact'])) {
$profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
}
if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); if ($txt = prepare_text($a->profile['music'])) {
$profile['music'] = array( t('Musical interests:'), $txt);
}
if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); if ($txt = prepare_text($a->profile['book'])) {
$profile['book'] = array( t('Books, literature:'), $txt);
}
if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); if ($txt = prepare_text($a->profile['tv'])) {
$profile['tv'] = array( t('Television:'), $txt);
}
if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); if ($txt = prepare_text($a->profile['film'])) {
$profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt);
}
if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); if ($txt = prepare_text($a->profile['romance'])) {
$profile['romance'] = array( t('Love/Romance:'), $txt);
}
if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); if ($txt = prepare_text($a->profile['work'])) {
$profile['work'] = array( t('Work/employment:'), $txt);
}
if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); if ($txt = prepare_text($a->profile['education'])) {
$profile['education'] = array( t('School/education:'), $txt );
if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); }
//show subcribed forum if it is enabled in the usersettings //show subcribed forum if it is enabled in the usersettings
if (feature_enabled($uid,'forumlist_profile')) { if (feature_enabled($uid,'forumlist_profile')) {
@ -705,11 +741,13 @@ function advanced_profile(App &$a) {
function profile_tabs($a, $is_owner=False, $nickname=Null){ function profile_tabs($a, $is_owner=False, $nickname=Null){
//echo "<pre>"; var_dump($a->user); killme(); //echo "<pre>"; var_dump($a->user); killme();
if (is_null($nickname)) if (is_null($nickname)) {
$nickname = $a->user['nickname']; $nickname = $a->user['nickname'];
}
if(x($_GET,'tab')) if (x($_GET,'tab')) {
$tab = notags(trim($_GET['tab'])); $tab = notags(trim($_GET['tab']));
}
$url = App::get_baseurl() . '/profile/' . $nickname; $url = App::get_baseurl() . '/profile/' . $nickname;

View file

@ -543,8 +543,9 @@ function parse_xml_string($s,$strict = true) {
$x = @simplexml_load_string($s2); $x = @simplexml_load_string($s2);
if (! $x) { if (! $x) {
logger('libxml: parse: error: ' . $s2, LOGGER_DATA); logger('libxml: parse: error: ' . $s2, LOGGER_DATA);
foreach(libxml_get_errors() as $err) foreach (libxml_get_errors() as $err) {
logger('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA); logger('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA);
}
libxml_clear_errors(); libxml_clear_errors();
} }
return $x; return $x;
@ -553,8 +554,9 @@ function parse_xml_string($s,$strict = true) {
function scale_external_images($srctext, $include_link = true, $scale_replace = false) { function scale_external_images($srctext, $include_link = true, $scale_replace = false) {
// Suppress "view full size" // Suppress "view full size"
if (intval(get_config('system','no_view_full_size'))) if (intval(get_config('system','no_view_full_size'))) {
$include_link = false; $include_link = false;
}
$a = get_app(); $a = get_app();
@ -569,21 +571,24 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
logger('scale_external_image: ' . $mtch[1]); logger('scale_external_image: ' . $mtch[1]);
$hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3)); $hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3));
if(stristr($mtch[1],$hostname)) if (stristr($mtch[1],$hostname)) {
continue; continue;
}
// $scale_replace, if passed, is an array of two elements. The // $scale_replace, if passed, is an array of two elements. The
// first is the name of the full-size image. The second is the // first is the name of the full-size image. The second is the
// name of a remote, scaled-down version of the full size image. // name of a remote, scaled-down version of the full size image.
// This allows Friendica to display the smaller remote image if // This allows Friendica to display the smaller remote image if
// one exists, while still linking to the full-size image // one exists, while still linking to the full-size image
if($scale_replace) if ($scale_replace) {
$scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[1]); $scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[1]);
else } else {
$scaled = $mtch[1]; $scaled = $mtch[1];
$i = @fetch_url($scaled); }
if(! $i) $i = fetch_url($scaled);
if (! $i) {
return $srctext; return $srctext;
}
// guess mimetype from headers or filename // guess mimetype from headers or filename
$type = guess_image_type($mtch[1],true); $type = guess_image_type($mtch[1],true);
@ -641,14 +646,14 @@ function fix_contact_ssl_policy(&$contact,$new_policy) {
} }
if ($ssl_changed) { if ($ssl_changed) {
q("update contact set q("UPDATE `contact` SET
url = '%s', `url` = '%s',
request = '%s', `request` = '%s',
notify = '%s', `notify` = '%s',
poll = '%s', `poll` = '%s',
confirm = '%s', `confirm` = '%s',
poco = '%s' `poco` = '%s'
where id = %d limit 1", WHERE `id` = %d LIMIT 1",
dbesc($contact['url']), dbesc($contact['url']),
dbesc($contact['request']), dbesc($contact['request']),
dbesc($contact['notify']), dbesc($contact['notify']),

View file

@ -425,7 +425,7 @@ if (! function_exists('uninstall_theme')){
function uninstall_theme($theme){ function uninstall_theme($theme){
logger("Addons: uninstalling theme " . $theme); logger("Addons: uninstalling theme " . $theme);
@include_once("view/theme/$theme/theme.php"); include_once("view/theme/$theme/theme.php");
if (function_exists("{$theme}_uninstall")) { if (function_exists("{$theme}_uninstall")) {
$func = "{$theme}_uninstall"; $func = "{$theme}_uninstall";
$func(); $func();
@ -436,19 +436,19 @@ if (! function_exists('install_theme')){
function install_theme($theme) { function install_theme($theme) {
// silently fail if theme was removed // silently fail if theme was removed
if(! file_exists("view/theme/$theme/theme.php")) if (! file_exists("view/theme/$theme/theme.php")) {
return false; return false;
}
logger("Addons: installing theme $theme"); logger("Addons: installing theme $theme");
@include_once("view/theme/$theme/theme.php"); include_once("view/theme/$theme/theme.php");
if (function_exists("{$theme}_install")) { if (function_exists("{$theme}_install")) {
$func = "{$theme}_install"; $func = "{$theme}_install";
$func(); $func();
return true; return true;
} } else {
else {
logger("Addons: FAILED installing theme $theme"); logger("Addons: FAILED installing theme $theme");
return false; return false;
} }
@ -469,8 +469,7 @@ function service_class_allows($uid,$property,$usage = false) {
if ($uid == local_user()) { if ($uid == local_user()) {
$service_class = $a->user['service_class']; $service_class = $a->user['service_class'];
} } else {
else {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
@ -478,18 +477,23 @@ function service_class_allows($uid,$property,$usage = false) {
$service_class = $r[0]['service_class']; $service_class = $r[0]['service_class'];
} }
} }
if(! x($service_class))
return true; // everything is allowed if (! x($service_class)) [
// everything is allowed
return true;
}
$arr = get_config('service_class',$service_class); $arr = get_config('service_class',$service_class);
if(! is_array($arr) || (! count($arr))) if (! is_array($arr) || (! count($arr))) {
return true; return true;
}
if($usage === false) if ($usage === false) {
return ((x($arr[$property])) ? (bool) $arr['property'] : true); return ((x($arr[$property])) ? (bool) $arr['property'] : true);
else { } else {
if(! array_key_exists($property,$arr)) if (! array_key_exists($property,$arr)) {
return true; return true;
}
return (((intval($usage)) < intval($arr[$property])) ? true : false); return (((intval($usage)) < intval($arr[$property])) ? true : false);
} }
} }
@ -499,8 +503,7 @@ function service_class_fetch($uid,$property) {
if ($uid == local_user()) { if ($uid == local_user()) {
$service_class = $a->user['service_class']; $service_class = $a->user['service_class'];
} } else {
else {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );

View file

@ -220,8 +220,9 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
$r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1", $r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET) dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$network = $r[0]["network"]; $network = $r[0]["network"];
}
if (($network == "") OR ($network == NETWORK_OSTATUS)) { if (($network == "") OR ($network == NETWORK_OSTATUS)) {
$r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1", $r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",

View file

@ -1854,7 +1854,7 @@ function admin_page_logs_post(App &$a) {
if (x($_POST,"page_logs")) { if (x($_POST,"page_logs")) {
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs'); check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
$logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : ''); $logfile = (x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
$debugging = ((x($_POST,'debugging')) ? true : false); $debugging = ((x($_POST,'debugging')) ? true : false);
$loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0); $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);

View file

@ -21,7 +21,6 @@ function delegate_content(App &$a) {
goaway(App::get_baseurl() . '/delegate'); goaway(App::get_baseurl() . '/delegate');
} }
$id = $a->argv[2]; $id = $a->argv[2];
$r = q("select `nickname` from user where uid = %d limit 1", $r = q("select `nickname` from user where uid = %d limit 1",
@ -45,12 +44,11 @@ function delegate_content(App &$a) {
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
if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) { if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
goaway(App::get_baseurl() . '/delegate'); goaway(App::get_baseurl() . '/delegate');
} }
q("delete from manage where uid = %d and mid = %d limit 1", q("DELETE FROM `manage` WHERE `uid` = %d AND `mid` = %d LIMIT 1",
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );

View file

@ -810,19 +810,17 @@ function dfrn_request_content(App &$a) {
// At first look if an address was provided // At first look if an address was provided
// Otherwise take the local address // Otherwise take the local address
if (x($_GET,'addr') AND ($_GET['addr'] != "")) if (x($_GET,'addr') AND ($_GET['addr'] != "")) {
$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 {
else {
// last, try a zrl // last, try a zrl
$myaddr = get_my_url(); $myaddr = get_my_url();
} }
@ -840,8 +838,7 @@ 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');
} }
@ -850,8 +847,10 @@ function dfrn_request_content(App &$a) {
// see if we are allowed to have NETWORK_MAIL2 contacts // see if we are allowed to have NETWORK_MAIL2 contacts
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(get_config('system','dfrn_only'))
if (get_config('system','dfrn_only')) {
$mail_disabled = 1; $mail_disabled = 1;
}
if (! $mail_disabled) { if (! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",

View file

@ -31,8 +31,7 @@ function group_post(App &$a) {
if ($r) { if ($r) {
goaway(App::get_baseurl() . '/group/' . $r); goaway(App::get_baseurl() . '/group/' . $r);
} }
} } else {
else {
notice( t('Could not create group.') . EOL ); notice( t('Could not create group.') . EOL );
} }
goaway(App::get_baseurl() . '/group'); goaway(App::get_baseurl() . '/group');

View file

@ -52,4 +52,3 @@ function hcard_init(App &$a) {
} }
} }

View file

@ -454,7 +454,7 @@ function item_post(App &$a) {
$objecttype = ACTIVITY_OBJ_IMAGE; $objecttype = ACTIVITY_OBJ_IMAGE;
foreach ($images as $image) { foreach ($images as $image) {
if (! stristr($image,App::get_baseurl() . '/photo/')) { if (! stristr($image,App::get_baseurl() . '/photo/'))
continue; continue;
} }
$image_uri = substr($image,strrpos($image,'/') + 1); $image_uri = substr($image,strrpos($image,'/') + 1);
@ -620,8 +620,9 @@ function item_post(App &$a) {
continue; continue;
$success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network); $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network);
if($success['replaced']) if ($success['replaced']) {
$tagged[] = $tag; $tagged[] = $tag;
}
if (is_array($success['contact']) && intval($success['contact']['prv'])) { if (is_array($success['contact']) && intval($success['contact']['prv'])) {
$private_forum = true; $private_forum = true;
$private_id = $success['contact']['id']; $private_id = $success['contact']['id'];

View file

@ -77,15 +77,15 @@ function profile_content(&$a, $update = 0) {
if ($a->argc > 2) { if ($a->argc > 2) {
for ($x = 2; $x < $a->argc; $x ++) { for ($x = 2; $x < $a->argc; $x ++) {
if (is_a_date_arg($a->argv[$x])) { if (is_a_date_arg($a->argv[$x])) {
if($datequery) if ($datequery) {
$datequery2 = escape_tags($a->argv[$x]); $datequery2 = escape_tags($a->argv[$x]);
else } else {
$datequery = escape_tags($a->argv[$x]); $datequery = escape_tags($a->argv[$x]);
} } else {
else
$category = $a->argv[$x]; $category = $a->argv[$x];
} }
} }
}
if (! x($category)) { if (! x($category)) {
$category = ((x($_GET,'category')) ? $_GET['category'] : ''); $category = ((x($_GET,'category')) ? $_GET['category'] : '');
@ -109,14 +109,12 @@ function profile_content(&$a, $update = 0) {
if ($update) { if ($update) {
// Ensure we've got a profile owner if updating. // Ensure we've got a profile owner if updating.
$a->profile['profile_uid'] = $update; $a->profile['profile_uid'] = $update;
} } else {
else {
if ($a->profile['profile_uid'] == local_user()) { if ($a->profile['profile_uid'] == local_user()) {
nav_set_selected('home'); nav_set_selected('home');
} }
} }
$contact = null; $contact = null;
$remote_contact = false; $remote_contact = false;
@ -158,8 +156,6 @@ function profile_content(&$a, $update = 0) {
} }
if (! $update) { if (! $update) {
if (x($_GET,'tab')) if (x($_GET,'tab'))
$tab = notags(trim($_GET['tab'])); $tab = notags(trim($_GET['tab']));
@ -172,12 +168,11 @@ function profile_content(&$a, $update = 0) {
return $o; return $o;
} }
$o .= common_friends_visitor_widget($a->profile['profile_uid']); $o .= common_friends_visitor_widget($a->profile['profile_uid']);
if (x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner) {
if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
$o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL; $o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL;
}
$commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false); $commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false);
$commvisitor = (($commpage && $remote_contact == true) ? true : false); $commvisitor = (($commpage && $remote_contact == true) ? true : false);

View file

@ -133,10 +133,10 @@ function profile_photo_post(App &$a) {
require_once('include/profile_update.php'); require_once('include/profile_update.php');
profile_change(); profile_change();
} } else {
else
notice( t('Unable to process image') . EOL); notice( t('Unable to process image') . EOL);
} }
}
goaway(App::get_baseurl() . '/profiles'); goaway(App::get_baseurl() . '/profiles');
return; // NOTREACHED return; // NOTREACHED
@ -146,7 +146,9 @@ function profile_photo_post(App &$a) {
$filename = basename($_FILES['userfile']['name']); $filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']); $filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type']; $filetype = $_FILES['userfile']['type'];
if ($filetype=="") $filetype=guess_image_type($filename); if ($filetype == "") {
$filetype = guess_image_type($filename);
}
$maximagesize = get_config('system','maximagesize'); $maximagesize = get_config('system','maximagesize');
@ -168,7 +170,6 @@ function profile_photo_post(App &$a) {
$ph->orient($src); $ph->orient($src);
@unlink($src); @unlink($src);
return profile_photo_crop_ui_head($a, $ph); return profile_photo_crop_ui_head($a, $ph);
} }

View file

@ -138,7 +138,6 @@ function videos_post(App &$a) {
$video_id = $_POST['id']; $video_id = $_POST['id'];
$r = q("SELECT `id` FROM `attach` WHERE `uid` = %d AND `id` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `attach` WHERE `uid` = %d AND `id` = '%s' LIMIT 1",
intval(local_user()), intval(local_user()),
dbesc($video_id) dbesc($video_id)
@ -409,4 +408,3 @@ function videos_content(App &$a) {
$o .= paginate($a); $o .= paginate($a);
return $o; return $o;
} }