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();
require_once('include/datetime.php');
$matches = false;
$terms = array();
- $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
- if($cnt) {
+ $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
+ if ($cnt) {
foreach($matches as $mtch) {
$unescaped = xmlify(file_tag_decode($mtch[1]));
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
$a = get_app();
- if(! feature_enabled($a->profile['profile_uid'],'categories'))
+ if (! feature_enabled($a->profile['profile_uid'],'categories')) {
return '';
+ }
$saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
- if(! strlen($saved))
+ if (! strlen($saved)) {
return;
+ }
$matches = false;
$terms = array();
if ($interactive) {
if (strlen($a->path)) {
$myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
- }
- else {
+ } else {
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
}
// NOTREACHED
}
- }
- else {
- if(get_config('system','dfrn_only')) {
+ } else {
+ if (get_config('system','dfrn_only')) {
$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;
return $result;
}
}
-
-
-
-
-
// 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']);
-
+ }
// 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;
- if(! x($ret,'poll'))
+ if (! x($ret,'poll')) {
$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;
- if(! x($ret,'url'))
+ }
+ if (! x($ret,'url')) {
$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('Use mailto: in front of address to force email check.') . EOL;
}
return $result;
}
- if($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
+ if ($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
$result['message'] .= t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
$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;
}
$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;
+ }
// check if we already have a contact
// the poll url is more reliable than the profile url, as we may have
if (dbm::is_result($r)) {
// update contact
- if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
+ if ($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d",
intval(CONTACT_IS_FRIEND),
intval($subhub),
);
}
} else {
-
-
// 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)
);
if (dbm::is_result($r))
$total_contacts = $r[0]['total'];
- if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
+ if (! service_class_allows($uid,'total_contacts',$total_contacts)) {
$result['message'] .= upgrade_message();
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),
dbesc($network)
);
- if (dbm::is_result($r))
+ if (dbm::is_result($r)) {
$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();
return $result;
}
$result['cid'] = $contact_id;
$def_gid = get_default_group($uid, $contact["network"]);
- if (intval($def_gid))
+ if (intval($def_gid)) {
group_add_member($uid, '', $contact_id, $def_gid);
+ }
// Update the avatar
update_contact_avatar($ret['photo'],$uid,$contact_id);
if (dbm::is_result($r)) {
if (($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
-
// create a follow slap
$item = array();
$item['verb'] = ACTIVITY_FOLLOW;
if ($connect AND local_user()) {
if (isset($profile["url"])) {
$profile_url = normalise_link($profile["url"]);
- }
- else {
+ } else {
$profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]);
}
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') {
- $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
+ 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'));
}
- 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
if (feature_enabled($uid,'forumlist_profile')) {
$profile['forumlist'] = array( t('Forums:'), ForumManager::profile_advanced($uid));
function profile_tabs($a, $is_owner=False, $nickname=Null){
//echo "<pre>"; var_dump($a->user); killme();
- if (is_null($nickname))
+ if (is_null($nickname)) {
$nickname = $a->user['nickname'];
+ }
- if(x($_GET,'tab'))
+ if (x($_GET,'tab')) {
$tab = notags(trim($_GET['tab']));
+ }
$url = App::get_baseurl() . '/profile/' . $nickname;
libxml_use_internal_errors(true);
$x = @simplexml_load_string($s2);
- if(! $x) {
+ if (! $x) {
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);
+ }
libxml_clear_errors();
}
return $x;
function scale_external_images($srctext, $include_link = true, $scale_replace = false) {
// 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;
+ }
$a = get_app();
$matches = null;
$c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER);
- if($c) {
+ if ($c) {
require_once('include/Photo.php');
- foreach($matches as $mtch) {
+ foreach ($matches as $mtch) {
logger('scale_external_image: ' . $mtch[1]);
$hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3));
- if(stristr($mtch[1],$hostname))
+ if (stristr($mtch[1],$hostname)) {
continue;
+ }
// $scale_replace, if passed, is an array of two elements. 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.
// This allows Friendica to display the smaller remote image if
// 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]);
- else
+ } else {
$scaled = $mtch[1];
- $i = @fetch_url($scaled);
- if(! $i)
+ }
+ $i = fetch_url($scaled);
+ if (! $i) {
return $srctext;
+ }
// guess mimetype from headers or filename
$type = guess_image_type($mtch[1],true);
- if($i) {
+ if ($i) {
$ph = new Photo($i, $type);
- if($ph->is_valid()) {
+ if ($ph->is_valid()) {
$orig_width = $ph->getWidth();
$orig_height = $ph->getHeight();
- if($orig_width > 640 || $orig_height > 640) {
+ if ($orig_width > 640 || $orig_height > 640) {
$ph->scaleImage(640);
$new_width = $ph->getWidth();
function fix_contact_ssl_policy(&$contact,$new_policy) {
$ssl_changed = false;
- if((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
+ if ((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
$ssl_changed = true;
$contact['url'] = str_replace('https:','http:',$contact['url']);
$contact['request'] = str_replace('https:','http:',$contact['request']);
$contact['poco'] = str_replace('https:','http:',$contact['poco']);
}
- if((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
+ if ((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
$ssl_changed = true;
$contact['url'] = str_replace('http:','https:',$contact['url']);
$contact['request'] = str_replace('http:','https:',$contact['request']);
$contact['poco'] = str_replace('http:','https:',$contact['poco']);
}
- if($ssl_changed) {
- q("update contact set
- url = '%s',
- request = '%s',
- notify = '%s',
- poll = '%s',
- confirm = '%s',
- poco = '%s'
- where id = %d limit 1",
+ if ($ssl_changed) {
+ q("UPDATE `contact` SET
+ `url` = '%s',
+ `request` = '%s',
+ `notify` = '%s',
+ `poll` = '%s',
+ `confirm` = '%s',
+ `poco` = '%s'
+ WHERE `id` = %d LIMIT 1",
dbesc($contact['url']),
dbesc($contact['request']),
dbesc($contact['notify']),
function get_theme_screenshot($theme) {
$exts = array('.png','.jpg');
foreach($exts as $ext) {
- if(file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
+ if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
}
}
function uninstall_theme($theme){
logger("Addons: uninstalling theme " . $theme);
- @include_once("view/theme/$theme/theme.php");
- if(function_exists("{$theme}_uninstall")) {
+ include_once("view/theme/$theme/theme.php");
+ if (function_exists("{$theme}_uninstall")) {
$func = "{$theme}_uninstall";
$func();
}
function install_theme($theme) {
// silently fail if theme was removed
- if(! file_exists("view/theme/$theme/theme.php"))
+ if (! file_exists("view/theme/$theme/theme.php")) {
return false;
+ }
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();
return true;
- }
- else {
+ } else {
logger("Addons: FAILED installing theme $theme");
return false;
}
function service_class_allows($uid,$property,$usage = false) {
- if($uid == local_user()) {
+ if ($uid == local_user()) {
$service_class = $a->user['service_class'];
- }
- else {
+ } else {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
$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);
- if(! is_array($arr) || (! count($arr)))
+ if (! is_array($arr) || (! count($arr))) {
return true;
+ }
- if($usage === false)
+ if ($usage === false) {
return ((x($arr[$property])) ? (bool) $arr['property'] : true);
- else {
- if(! array_key_exists($property,$arr))
+ } else {
+ if (! array_key_exists($property,$arr)) {
return true;
+ }
return (((intval($usage)) < intval($arr[$property])) ? true : false);
}
}
function service_class_fetch($uid,$property) {
- if($uid == local_user()) {
+ if ($uid == local_user()) {
$service_class = $a->user['service_class'];
- }
- else {
+ } else {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
$r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
);
- if (dbm::is_result($r))
+ if (dbm::is_result($r)) {
$network = $r[0]["network"];
+ }
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",
* @param App $a
*/
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');
- $logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
- $debugging = ((x($_POST,'debugging')) ? true : false);
- $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
+ $logfile = (x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
+ $debugging = ((x($_POST,'debugging')) ? true : false);
+ $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
set_config('system','logfile', $logfile);
set_config('system','debugging', $debugging);
goaway(App::get_baseurl() . '/delegate');
}
-
$id = $a->argv[2];
$r = q("select `nickname` from user where uid = %d limit 1",
if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions
-
if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
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(local_user())
);
// At first look if an address was provided
// Otherwise take the local address
- if (x($_GET,'addr') AND ($_GET['addr'] != ""))
+ if (x($_GET,'addr') AND ($_GET['addr'] != "")) {
$myaddr = hex2bin($_GET['addr']);
- elseif (x($_GET,'address') AND ($_GET['address'] != ""))
+ } elseif (x($_GET,'address') AND ($_GET['address'] != "")) {
$myaddr = $_GET['address'];
- elseif (local_user()) {
+ } elseif (local_user()) {
if (strlen($a->path)) {
$myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname'];
- }
- else {
+ } else {
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
}
- }
- else {
+ } else {
// last, try a zrl
$myaddr = get_my_url();
}
if ($a->profile['page-flags'] == PAGE_NORMAL) {
$tpl = get_markup_template('dfrn_request.tpl');
- }
- else {
+ } else {
$tpl = get_markup_template('auto_request.tpl');
}
// see if we are allowed to have NETWORK_MAIL2 contacts
$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;
+ }
- if(! $mail_disabled) {
+ if (! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($a->profile['uid'])
);
}
}
- $events=array();
+ $events = array();
// transform the event in a usable array
if (dbm::is_result($r)) {
if ($r) {
goaway(App::get_baseurl() . '/group/' . $r);
}
- }
- else {
+ } else {
notice( t('Could not create group.') . EOL );
}
goaway(App::get_baseurl() . '/group');
'$submit' => t('Save Group'),
);
- if(($a->argc == 2) && ($a->argv[1] === 'new')) {
+ if (($a->argc == 2) && ($a->argv[1] === 'new')) {
return replace_macros($tpl, $context + array(
'$title' => t('Create a group of contacts/friends.'),
if (strlen($dirloc)) {
if ($a->config['register_policy'] == REGISTER_CLOSED) {
$linktxt = sprintf( t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), $dirloc . '/siteinfo');
- } elseif($a->config['register_policy'] != REGISTER_CLOSED) {
+ } elseif ($a->config['register_policy'] != REGISTER_CLOSED) {
$linktxt = sprintf( t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), App::get_baseurl())
. "\r\n" . "\r\n" . sprintf( t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.'),$dirloc . '/siteinfo');
}
$objecttype = ACTIVITY_OBJ_IMAGE;
foreach ($images as $image) {
- if (! stristr($image,App::get_baseurl() . '/photo/')) {
+ if (! stristr($image,App::get_baseurl() . '/photo/'))
continue;
}
$image_uri = substr($image,strrpos($image,'/') + 1);
continue;
$success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network);
- if($success['replaced'])
+ if ($success['replaced']) {
$tagged[] = $tag;
- if(is_array($success['contact']) && intval($success['contact']['prv'])) {
+ }
+ if (is_array($success['contact']) && intval($success['contact']['prv'])) {
$private_forum = true;
$private_id = $success['contact']['id'];
}
}
}
- if(($private_forum) && (! $parent) && (! $private)) {
+ if (($private_forum) && (! $parent) && (! $private)) {
// we tagged a private forum in a top level post and the message was public.
// Restrict it.
$private = 1;
$attachments = '';
$match = false;
- if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
- foreach($match[2] as $mtch) {
+ if (preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
+ foreach ($match[2] as $mtch) {
$r = q("SELECT `id`,`filename`,`filesize`,`filetype` FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid),
intval($mtch)
$category = $datequery = $datequery2 = '';
- if($a->argc > 2) {
- for($x = 2; $x < $a->argc; $x ++) {
- if(is_a_date_arg($a->argv[$x])) {
- if($datequery)
+ if ($a->argc > 2) {
+ for ($x = 2; $x < $a->argc; $x ++) {
+ if (is_a_date_arg($a->argv[$x])) {
+ if ($datequery) {
$datequery2 = escape_tags($a->argv[$x]);
- else
+ } else {
$datequery = escape_tags($a->argv[$x]);
- }
- else
+ } else {
$category = $a->argv[$x];
+ }
}
}
- if(! x($category)) {
+ if (! x($category)) {
$category = ((x($_GET,'category')) ? $_GET['category'] : '');
}
- if(get_config('system','block_public') && (! local_user()) && (! remote_user())) {
+ if (get_config('system','block_public') && (! local_user()) && (! remote_user())) {
return login();
}
$tab = 'posts';
$o = '';
- if($update) {
+ if ($update) {
// Ensure we've got a profile owner if updating.
$a->profile['profile_uid'] = $update;
- }
- else {
- if($a->profile['profile_uid'] == local_user()) {
+ } else {
+ if ($a->profile['profile_uid'] == local_user()) {
nav_set_selected('home');
}
}
-
$contact = null;
$remote_contact = false;
$contact_id = 0;
- if(is_array($_SESSION['remote'])) {
- foreach($_SESSION['remote'] as $v) {
- if($v['uid'] == $a->profile['profile_uid']) {
+ if (is_array($_SESSION['remote'])) {
+ foreach ($_SESSION['remote'] as $v) {
+ if ($v['uid'] == $a->profile['profile_uid']) {
$contact_id = $v['cid'];
break;
}
}
}
- if($contact_id) {
+ if ($contact_id) {
$groups = init_groups_visitor($contact_id);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
}
}
- if(! $remote_contact) {
- if(local_user()) {
+ if (! $remote_contact) {
+ if (local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
- if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
+ if ($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
notice( t('Access to this profile has been restricted.') . EOL);
return;
}
- if(! $update) {
-
-
- if(x($_GET,'tab'))
+ if (! $update) {
+ if (x($_GET,'tab'))
$tab = notags(trim($_GET['tab']));
$o.=profile_tabs($a, $is_owner, $a->profile['nickname']);
- if($tab === 'profile') {
+ if ($tab === 'profile') {
$o .= advanced_profile($a);
call_hooks('profile_advanced',$o);
return $o;
}
-
$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;
+ }
$commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false);
$commvisitor = (($commpage && $remote_contact == true) ? true : false);
$a->page['aside'] .= posted_date_widget(App::get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true);
$a->page['aside'] .= categories_widget(App::get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : ''));
- if(can_write_wall($a,$a->profile['profile_uid'])) {
+ if (can_write_wall($a,$a->profile['profile_uid'])) {
$x = array(
'is_owner' => $is_owner,
$sql_extra = item_permissions_sql($a->profile['profile_uid'],$remote_contact,$groups);
- if($update) {
+ if ($update) {
$r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network`
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
} else {
$sql_post_table = "";
- if(x($category)) {
+ if (x($category)) {
$sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
dbesc(protect_sprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($a->profile['profile_uid']));
//$sql_extra .= protect_sprintf(file_tag_file_query('item',$category,'category'));
}
- if($datequery) {
+ if ($datequery) {
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
}
- if($datequery2) {
+ if ($datequery2) {
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
require_once('include/profile_update.php');
profile_change();
- }
- else
+ } else {
notice( t('Unable to process image') . EOL);
+ }
}
goaway(App::get_baseurl() . '/profiles');
$filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type'];
- if ($filetype=="") $filetype=guess_image_type($filename);
-
+ if ($filetype == "") {
+ $filetype = guess_image_type($filename);
+ }
+
$maximagesize = get_config('system','maximagesize');
- if(($maximagesize) && ($filesize > $maximagesize)) {
+ if (($maximagesize) && ($filesize > $maximagesize)) {
notice( sprintf(t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL);
@unlink($src);
return;
$imagedata = @file_get_contents($src);
$ph = new Photo($imagedata, $filetype);
- if(! $ph->is_valid()) {
+ if (! $ph->is_valid()) {
notice( t('Unable to process image.') . EOL );
@unlink($src);
return;
$ph->orient($src);
@unlink($src);
return profile_photo_crop_ui_head($a, $ph);
-
}
if (($a->argc == 2) && x($_POST,'delete') && x($_POST, 'id')) {
// Check if we should do HTML-based delete confirmation
- if(!x($_REQUEST,'confirm')) {
+ if (!x($_REQUEST,'confirm')) {
if (x($_REQUEST,'canceled')) {
goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']);
}
$video_id = $_POST['id'];
-
$r = q("SELECT `id` FROM `attach` WHERE `uid` = %d AND `id` = '%s' LIMIT 1",
intval(local_user()),
dbesc($video_id)
$o .= paginate($a);
return $o;
}
-
/// @TODO $a is no longer used
function clean_form(&$a, &$colorset, $user){
$colorset = array(
- 'default'=>t('default'),
- 'greenzero'=>t('greenzero'),
- 'purplezero'=>t('purplezero'),
- 'easterbunny'=>t('easterbunny'),
- 'darkzero'=>t('darkzero'),
- 'comix'=>t('comix'),
- 'slackr'=>t('slackr'),
+ 'default' =>t('default'),
+ 'greenzero' =>t('greenzero'),
+ 'purplezero' =>t('purplezero'),
+ 'easterbunny' =>t('easterbunny'),
+ 'darkzero' =>t('darkzero'),
+ 'comix' =>t('comix'),
+ 'slackr' =>t('slackr'),
);
if ($user) {
$o .= replace_macros($t, array(
'$submit' => t('Submit'),
'$baseurl' => App::get_baseurl(),
- '$title'=> t("Theme settings"),
+ '$title' => t("Theme settings"),
'$colorset' => array('duepuntozero_colorset', t('Variations'), $color, '', $colorset),
));