auto_redir($a, $a->argv[1]);
}
- if ((Config::get('system', 'block_public')) && (! local_user()) && (! remote_user())) {
+ if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
return;
}
dbesc($nick)
);
- if (! DBM::is_result($user)) {
+ if (!DBM::is_result($user)) {
return;
}
$albums = photo_albums($a->data['user']['uid']);
- $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
+ $albums_visible = ((intval($a->data['user']['hidewall']) && !local_user() && !remote_user()) ? false : true);
// add various encodings to the array so we can just loop through and pick them out in a template
$ret = array('success' => false);
$ret['albums'] = array();
foreach ($albums as $k => $album) {
//hide profile photos to others
- if ((! $is_owner) && (! remote_user()) && ($album['album'] == t('Profile Photos')))
+ if (!$is_owner && !remote_user() && ($album['album'] == t('Profile Photos')))
continue;
$entry = array(
'text' => $album['album'],
}
- if (! x($a->page, 'aside')) {
+ if (!x($a->page, 'aside')) {
$a->page['aside'] = '';
}
$a->page['aside'] .= $vcard_widget;
$page_owner_uid = $a->data['user']['uid'];
$community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false);
- if ((local_user()) && (local_user() == $page_owner_uid)) {
+ if (local_user() && (local_user() == $page_owner_uid)) {
$can_post = true;
} else {
if ($community_page && remote_user()) {
}
}
- if (! $can_post) {
+ if (!$can_post) {
notice( t('Permission denied.') . EOL );
killme();
}
intval($page_owner_uid)
);
- if (! DBM::is_result($r)) {
+ if (!DBM::is_result($r)) {
notice( t('Contact information unavailable') . EOL);
logger('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
killme();
if (($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
- $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
- $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
- $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
- $albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
- $origaname = ((x($_POST,'origaname')) ? notags(trim($_POST['origaname'])) : '');
+ $desc = (x($_POST,'desc') ? notags(trim($_POST['desc'])) : '');
+ $rawtags = (x($_POST,'newtag') ? notags(trim($_POST['newtag'])) : '');
+ $item_id = (x($_POST,'item_id') ? intval($_POST['item_id']) : 0);
+ $albname = (x($_POST,'albname') ? notags(trim($_POST['albname'])) : '');
+ $origaname = (x($_POST,'origaname') ? notags(trim($_POST['origaname'])) : '');
$str_group_allow = perms2str($_POST['group_allow']);
$str_contact_allow = perms2str($_POST['contact_allow']);
$str_group_deny = perms2str($_POST['group_deny']);
$resource_id = $a->argv[2];
- if (! strlen($albname)) {
+ if (!strlen($albname)) {
$albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
}
$visibility = 1;
}
- if (! $item_id) {
+ if (!$item_id) {
// Create item container
intval($page_owner_uid)
);
- if (! DBM::is_result($r)) {
+ if (!DBM::is_result($r)) {
//select someone by attag or nick and the name passed in
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
logger('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , LOGGER_DEBUG);
- if (! strlen($album)) {
+ if (!strlen($album)) {
if (strlen($newalbum)) {
$album = $newalbum;
} else {
dbesc($album),
intval($page_owner_uid)
);
- if ((! DBM::is_result($r)) || ($album == t('Profile Photos'))) {
+ if (!DBM::is_result($r) || ($album == t('Profile Photos'))) {
$visible = 1;
} else {
$visible = 0;
$visible = 0;
}
- $str_group_allow = perms2str(((is_array($_REQUEST['group_allow'])) ? $_REQUEST['group_allow'] : explode(',', $_REQUEST['group_allow'])));
- $str_contact_allow = perms2str(((is_array($_REQUEST['contact_allow'])) ? $_REQUEST['contact_allow'] : explode(',', $_REQUEST['contact_allow'])));
- $str_group_deny = perms2str(((is_array($_REQUEST['group_deny'])) ? $_REQUEST['group_deny'] : explode(',', $_REQUEST['group_deny'])));
- $str_contact_deny = perms2str(((is_array($_REQUEST['contact_deny'])) ? $_REQUEST['contact_deny'] : explode(',', $_REQUEST['contact_deny'])));
+ $str_group_allow = perms2str((is_array($_REQUEST['group_allow']) ? $_REQUEST['group_allow'] : explode(',', $_REQUEST['group_allow'])));
+ $str_contact_allow = perms2str((is_array($_REQUEST['contact_allow']) ? $_REQUEST['contact_allow'] : explode(',', $_REQUEST['contact_allow'])));
+ $str_group_deny = perms2str((is_array($_REQUEST['group_deny']) ? $_REQUEST['group_deny'] : explode(',', $_REQUEST['group_deny'])));
+ $str_contact_deny = perms2str((is_array($_REQUEST['contact_deny']) ? $_REQUEST['contact_deny'] : explode(',', $_REQUEST['contact_deny'])));
$ret = array('src' => '', 'filename' => '', 'filesize' => 0, 'type' => '');
$maximagesize = Config::get('system','maximagesize');
- if (($maximagesize) && ($filesize > $maximagesize)) {
+ if ($maximagesize && ($filesize > $maximagesize)) {
notice( sprintf(t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL);
@unlink($src);
$foo = 0;
return;
}
- if (! $filesize) {
+ if (!$filesize) {
notice( t('Image file is empty.') . EOL);
@unlink($src);
$foo = 0;
$Image = new Image($imagedata, $type);
- if (! $Image->isValid()) {
+ if (!$Image->isValid()) {
logger('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
notice( t('Unable to process image.') . EOL );
@unlink($src);
@unlink($src);
$max_length = Config::get('system', 'max_image_length');
- if (! $max_length) {
+ if (!$max_length) {
$max_length = MAX_IMAGE_LENGTH;
}
if ($max_length > 0) {
$r = Photo::store($Image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
- if (! $r) {
+ if (!$r) {
logger('mod/photos.php: photos_post(): image store failed' , LOGGER_DEBUG);
notice( t('Image upload failed.') . EOL );
killme();
// photos/name/image/xxxxx/edit
- if ((Config::get('system', 'block_public')) && (! local_user()) && (! remote_user())) {
+ if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
notice( t('Public access denied.') . EOL);
return;
}
require_once 'include/security.php';
require_once 'include/conversation.php';
- if (! x($a->data,'user')) {
+ if (!x($a->data,'user')) {
notice( t('No photos selected') . EOL );
return;
}
$community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false);
- if ((local_user()) && (local_user() == $owner_uid)) {
+ if (local_user() && (local_user() == $owner_uid)) {
$can_post = true;
} else {
if ($community_page && remote_user()) {
// perhaps they're visiting - but not a community page, so they wouldn't have write access
- if (remote_user() && (! $visitor)) {
+ if (remote_user() && !$visitor) {
$contact_id = 0;
if (is_array($_SESSION['remote'])) {
foreach ($_SESSION['remote'] as $v) {
}
/// @TODO merge these 2 if() into one?
- if (! $remote_contact) {
+ if (!$remote_contact) {
if (local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
}
- if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) {
+ if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
notice( t('Access to this item is restricted.') . EOL);
return;
}
*/
if ($datatype === 'upload') {
- if (! ($can_post)) {
+ if (!$can_post) {
notice(t('Permission denied.'));
return;
}
- $selname = (($datum) ? hex2bin($datum) : '');
+ $selname = ($datum ? hex2bin($datum) : '');
$albumselect = '';
- $albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '> </option>';
+ $albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '> </option>';
if (count($a->data['albums'])) {
foreach ($a->data['albums'] as $album) {
if (($album['album'] === '') || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos'))) {
$tpl = get_markup_template('photos_upload.tpl');
$albumselect_e = $albumselect;
- $aclselect_e = (($visitor) ? '' : populate_acl($a->user));
+ $aclselect_e = ($visitor ? '' : populate_acl($a->user));
$o .= replace_macros($tpl,array(
'$pagename' => t('Upload Photos'),
'$permissions' => t('Permissions'),
'$aclselect' => $aclselect_e,
'$alt_uploader' => $ret['addon_text'],
- '$default_upload_box' => (($ret['default_upload']) ? $default_upload_box : ''),
- '$default_upload_submit' => (($ret['default_upload']) ? $default_upload_submit : ''),
+ '$default_upload_box' => ($ret['default_upload'] ? $default_upload_box : ''),
+ '$default_upload_submit' => ($ret['default_upload'] ? $default_upload_submit : ''),
'$uploadurl' => $ret['post_url'],
// ACL permissions box
$photos = array();
if (DBM::is_result($r))
- $twist = 'rotright';
+ $twist = false;
foreach ($r as $rr) {
- if ($twist == 'rotright') {
- $twist = 'rotleft';
- } else {
- $twist = 'rotright';
- }
+ $twist = !$twist;
$ext = $phototypes[$rr['type']];
$photos[] = array(
'id' => $rr['id'],
- 'twist' => ' ' . $twist . rand(2,4),
+ 'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
. (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''),
'title' => t('View Photo'),
dbesc($datum)
);
- if (! DBM::is_result($ph)) {
+ if (!DBM::is_result($ph)) {
$ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'
LIMIT 1",
intval($owner_uid),
// The query leads to a really intense used index.
// By now we hide it if someone wants to.
if (!Config::get('system', 'no_count', false)) {
- if ($_GET['order'] === 'posted')
+ if ($_GET['order'] === 'posted') {
$order = 'ASC';
- else
+ } else {
$order = 'DESC';
+ }
$prvnxt = q("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
$sql_extra ORDER BY `created` $order ",
break;
}
}
- $edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
+ $edit_suffix = ((($cmd === 'edit') && $can_post) ? '/edit' : '');
$prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
$nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
}
);
- if ((local_user()) && (local_user() == $link_item['uid'])) {
+ if (local_user() && (local_user() == $link_item['uid'])) {
q("UPDATE `item` SET `unseen` = 0 WHERE `parent` = %d and `uid` = %d",
intval($link_item['parent']),
intval(local_user())
$edit = Null;
- if (($cmd === 'edit') && ($can_post)) {
+ if (($cmd === 'edit') && $can_post) {
$edit_tpl = get_markup_template('photo_edit.tpl');
// Private/public post links for the non-JS ACL form
'$permissions' => t('Permissions'),
'$aclselect' => $aclselect_e,
- '$item_id' => ((count($linked_items)) ? $link_item['id'] : 0),
+ '$item_id' => (count($linked_items) ? $link_item['id'] : 0),
'$submit' => t('Submit'),
'$delete' => t('Delete Photo'),
}
$comments = '';
- if (! DBM::is_result($r)) {
+ if (!DBM::is_result($r)) {
if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) {
$comments .= replace_macros($cmnt_tpl, array(
'$return_path' => '',
builtin_activity_puller($item, $conv_responses);
}
- $like = ((x($conv_responses['like'], $link_item['uri'])) ? format_like($conv_responses['like'][$link_item['uri']], $conv_responses['like'][$link_item['uri'] . '-l'], 'like',$link_item['id']) : '');
- $dislike = ((x($conv_responses['dislike'], $link_item['uri'])) ? format_like($conv_responses['dislike'][$link_item['uri']], $conv_responses['dislike'][$link_item['uri'] . '-l'], 'dislike',$link_item['id']) : '');
+ $like = (x($conv_responses['like'], $link_item['uri']) ? format_like($conv_responses['like'][$link_item['uri']], $conv_responses['like'][$link_item['uri'] . '-l'], 'like',$link_item['id']) : '');
+ $dislike = (x($conv_responses['dislike'], $link_item['uri']) ? format_like($conv_responses['dislike'][$link_item['uri']], $conv_responses['dislike'][$link_item['uri'] . '-l'], 'dislike',$link_item['id']) : '');
if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) {
$comments .= replace_macros($cmnt_tpl,array(
$template = $tpl;
$sparkle = '';
- if (((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
+ if ((activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent']))
continue;
$redirect_url = 'redir/' . $item['cid'];
if (local_user() && ($item['contact-uid'] == local_user())
- && ($item['network'] == NETWORK_DFRN) && (! $item['self'] )) {
+ && ($item['network'] == NETWORK_DFRN) && !$item['self']) {
$profile_url = $redirect_url;
$sparkle = ' sparkle';
} else {
$diff_author = (($item['url'] !== $item['author-link']) ? true : false);
- $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
- $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']);
+ $profile_name = ((strlen($item['author-name']) && $diff_author) ? $item['author-name'] : $item['name']);
+ $profile_avatar = ((strlen($item['author-avatar']) && $diff_author) ? $item['author-avatar'] : $item['thumb']);
$profile_link = $profile_url;
$photos = array();
if (DBM::is_result($r)) {
- $twist = 'rotright';
+ $twist = false;
foreach ($r as $rr) {
//hide profile photos to others
- if ((! $is_owner) && (! remote_user()) && ($rr['album'] == t('Profile Photos')))
- continue;
+ if (!$is_owner && !remote_user() && ($rr['album'] == t('Profile Photos')))
+ continue;
- if ($twist == 'rotright')
- $twist = 'rotleft';
- else
- $twist = 'rotright';
+ $twist = !$twist;
$ext = $phototypes[$rr['type']];
$photos[] = array(
'id' => $rr['id'],
- 'twist' => ' ' . $twist . rand(2,4),
+ 'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
'title' => t('View Photo'),
'src' => 'photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,