Continued with coding convention:
- added curly braces around conditional code blocks - added space between if/foreach/... and brace - rewrote a code block so if dbm::is_result() fails it will abort, else the id is fetched from INSERT statement - made some SQL keywords upper-cased and added back-ticks to columns/table names Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
af2909bf8f
commit
6e44acfed6
|
@ -129,10 +129,12 @@ function contacts_batch_actions(App &$a){
|
|||
info ( sprintf( tt("%d contact edited.", "%d contacts edited.", $count_actions), $count_actions) );
|
||||
}
|
||||
|
||||
if(x($_SESSION,'return_url'))
|
||||
if (x($_SESSION,'return_url')) {
|
||||
goaway('' . $_SESSION['return_url']);
|
||||
else
|
||||
}
|
||||
else {
|
||||
goaway('contacts');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -450,18 +452,22 @@ function contacts_content(App &$a) {
|
|||
}
|
||||
// Now check how the user responded to the confirmation query
|
||||
if ($_REQUEST['canceled']) {
|
||||
if(x($_SESSION,'return_url'))
|
||||
if (x($_SESSION,'return_url')) {
|
||||
goaway('' . $_SESSION['return_url']);
|
||||
else
|
||||
}
|
||||
else {
|
||||
goaway('contacts');
|
||||
}
|
||||
}
|
||||
|
||||
_contact_drop($contact_id, $orig_record[0]);
|
||||
info( t('Contact has been removed.') . EOL );
|
||||
if(x($_SESSION,'return_url'))
|
||||
if (x($_SESSION,'return_url')) {
|
||||
goaway('' . $_SESSION['return_url']);
|
||||
else
|
||||
}
|
||||
else {
|
||||
goaway('contacts');
|
||||
}
|
||||
return; // NOTREACHED
|
||||
}
|
||||
if ($cmd === 'posts') {
|
||||
|
|
|
@ -92,10 +92,12 @@ function directory_content(App &$a) {
|
|||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit);
|
||||
if (dbm::is_result($r)) {
|
||||
|
||||
if(in_array('small', $a->argv))
|
||||
if (in_array('small', $a->argv)) {
|
||||
$photo = 'thumb';
|
||||
else
|
||||
}
|
||||
else {
|
||||
$photo = 'photo';
|
||||
}
|
||||
|
||||
foreach ($r as $rr) {
|
||||
|
||||
|
|
|
@ -10,18 +10,21 @@ function filerm_content(App &$a) {
|
|||
$cat = unxmlify(trim($_GET['cat']));
|
||||
|
||||
$category = (($cat) ? true : false);
|
||||
if($category)
|
||||
if ($category) {
|
||||
$term = $cat;
|
||||
}
|
||||
|
||||
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
||||
|
||||
logger('filerm: tag ' . $term . ' item ' . $item_id);
|
||||
|
||||
if($item_id && strlen($term))
|
||||
if ($item_id && strlen($term)) {
|
||||
file_tag_unsave_file(local_user(),$item_id,$term, $category);
|
||||
}
|
||||
|
||||
if(x($_SESSION,'return_url'))
|
||||
if (x($_SESSION,'return_url')) {
|
||||
goaway(App::get_baseurl() . '/' . $_SESSION['return_url']);
|
||||
}
|
||||
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -157,8 +157,9 @@ function follow_post(App &$a) {
|
|||
// NOTREACHED
|
||||
}
|
||||
|
||||
if ($_REQUEST['cancel'])
|
||||
if ($_REQUEST['cancel']) {
|
||||
goaway($_SESSION['return_url']);
|
||||
}
|
||||
|
||||
$uid = local_user();
|
||||
$url = notags(trim($_REQUEST['url']));
|
||||
|
@ -171,16 +172,20 @@ function follow_post(App &$a) {
|
|||
$result = new_contact($uid,$url,true);
|
||||
|
||||
if ($result['success'] == false) {
|
||||
if($result['message'])
|
||||
if ($result['message']) {
|
||||
notice($result['message']);
|
||||
}
|
||||
goaway($return_url);
|
||||
} elseif ($result['cid'])
|
||||
}
|
||||
elseif ($result['cid']) {
|
||||
goaway(App::get_baseurl().'/contacts/'.$result['cid']);
|
||||
}
|
||||
|
||||
info( t('Contact added').EOL);
|
||||
|
||||
if(strstr($return_url,'contacts'))
|
||||
if (strstr($return_url,'contacts')) {
|
||||
goaway(App::get_baseurl().'/contacts/'.$contact_id);
|
||||
}
|
||||
|
||||
goaway($return_url);
|
||||
// NOTREACHED
|
||||
|
|
|
@ -4,8 +4,9 @@ function hcard_init(App &$a) {
|
|||
|
||||
$blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
|
||||
|
||||
if($a->argc > 1)
|
||||
if ($a->argc > 1) {
|
||||
$which = $a->argv[1];
|
||||
}
|
||||
else {
|
||||
notice( t('No profile') . EOL );
|
||||
$a->error = 404;
|
||||
|
@ -23,8 +24,9 @@ function hcard_init(App &$a) {
|
|||
if ((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
|
||||
$a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
|
||||
}
|
||||
if(x($a->profile,'openidserver'))
|
||||
if (x($a->profile,'openidserver')) {
|
||||
$a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
|
||||
}
|
||||
if (x($a->profile,'openid')) {
|
||||
$delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']);
|
||||
$a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
|
||||
|
@ -33,9 +35,10 @@ function hcard_init(App &$a) {
|
|||
if (! $blocked) {
|
||||
$keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
|
||||
$keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords);
|
||||
if(strlen($keywords))
|
||||
if (strlen($keywords)) {
|
||||
$a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n" ;
|
||||
}
|
||||
}
|
||||
|
||||
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
|
||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . App::get_baseurl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
|
||||
|
|
|
@ -523,16 +523,19 @@ function check_htaccess(&$checks) {
|
|||
if (function_exists('curl_init')) {
|
||||
$test = fetch_url(App::get_baseurl()."/install/testrewrite");
|
||||
|
||||
if ($test!="ok")
|
||||
if ($test!="ok") {
|
||||
$test = fetch_url(normalise_link(App::get_baseurl()."/install/testrewrite"));
|
||||
}
|
||||
|
||||
if ($test!="ok") {
|
||||
$status = false;
|
||||
$help = t('Url rewrite in .htaccess is not working. Check your server configuration.');
|
||||
}
|
||||
check_add($checks, t('Url rewrite is working'), $status, true, $help);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// cannot check modrewrite if libcurl is not installed
|
||||
/// @TODO Maybe issue warning here?
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,12 +116,14 @@ function invite_content(App &$a) {
|
|||
|
||||
$dirloc = get_config('system','directory');
|
||||
if(strlen($dirloc)) {
|
||||
if($a->config['register_policy'] == REGISTER_CLOSED)
|
||||
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');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$o = t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
|
||||
return $o;
|
||||
|
|
18
mod/item.php
18
mod/item.php
|
@ -64,9 +64,10 @@ function item_post(App &$a) {
|
|||
logger("item post: duplicate post", LOGGER_DEBUG);
|
||||
item_post_return(App::get_baseurl(), $api_source, $return_path);
|
||||
}
|
||||
else
|
||||
else {
|
||||
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a reply to something?
|
||||
|
@ -86,14 +87,16 @@ function item_post(App &$a) {
|
|||
|
||||
$objecttype = ACTIVITY_OBJ_COMMENT;
|
||||
|
||||
if(! x($_REQUEST,'type'))
|
||||
if (! x($_REQUEST,'type')) {
|
||||
$_REQUEST['type'] = 'net-comment';
|
||||
}
|
||||
|
||||
if ($parent) {
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
|
||||
intval($parent)
|
||||
);
|
||||
} elseif($parent_uri && local_user()) {
|
||||
}
|
||||
elseif ($parent_uri && local_user()) {
|
||||
// This is coming from an API source, and we are logged in
|
||||
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($parent_uri),
|
||||
|
@ -114,8 +117,9 @@ function item_post(App &$a) {
|
|||
|
||||
if (! dbm::is_result($r)) {
|
||||
notice( t('Unable to locate original post.') . EOL);
|
||||
if(x($_REQUEST,'return'))
|
||||
if (x($_REQUEST,'return')) {
|
||||
goaway($return_path);
|
||||
}
|
||||
killme();
|
||||
}
|
||||
$parent_item = $r[0];
|
||||
|
@ -450,12 +454,14 @@ function item_post(App &$a) {
|
|||
$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);
|
||||
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
|
||||
if(! strlen($image_uri))
|
||||
if (! strlen($image_uri)) {
|
||||
continue;
|
||||
}
|
||||
$srch = '<' . intval($contact_id) . '>';
|
||||
|
||||
$r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
|
||||
|
|
|
@ -44,8 +44,9 @@ function noscrape_init(App &$a) {
|
|||
if (is_array($a->profile) AND !$a->profile['hide-friends']) {
|
||||
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
|
||||
intval($a->profile['uid']));
|
||||
if (dbm::is_result($r))
|
||||
if (dbm::is_result($r)) {
|
||||
$json_info["updated"] = date("c", strtotime($r[0]['updated']));
|
||||
}
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
|
||||
AND `network` IN ('%s', '%s', '%s', '')",
|
||||
|
@ -54,9 +55,10 @@ function noscrape_init(App &$a) {
|
|||
dbesc(NETWORK_DIASPORA),
|
||||
dbesc(NETWORK_OSTATUS)
|
||||
);
|
||||
if (dbm::is_result($r))
|
||||
if (dbm::is_result($r)) {
|
||||
$json_info["contacts"] = intval($r[0]['total']);
|
||||
}
|
||||
}
|
||||
|
||||
//These are optional fields.
|
||||
$profile_fields = array('pdesc', 'locality', 'region', 'postal-code', 'country-name', 'gender', 'marital', 'about');
|
||||
|
|
|
@ -66,29 +66,39 @@ function openid_content(App &$a) {
|
|||
$attr = $openid->getAttributes();
|
||||
if (is_array($attr) && count($attr)) {
|
||||
foreach ($attr as $k => $v) {
|
||||
if($k === 'namePerson/friendly')
|
||||
if ($k === 'namePerson/friendly') {
|
||||
$nick = notags(trim($v));
|
||||
if($k === 'namePerson/first')
|
||||
}
|
||||
if($k === 'namePerson/first') {
|
||||
$first = notags(trim($v));
|
||||
if($k === 'namePerson')
|
||||
}
|
||||
if($k === 'namePerson') {
|
||||
$args .= '&username=' . notags(trim($v));
|
||||
if($k === 'contact/email')
|
||||
}
|
||||
if ($k === 'contact/email') {
|
||||
$args .= '&email=' . notags(trim($v));
|
||||
if($k === 'media/image/aspect11')
|
||||
}
|
||||
if ($k === 'media/image/aspect11') {
|
||||
$photosq = bin2hex(trim($v));
|
||||
if($k === 'media/image/default')
|
||||
}
|
||||
if ($k === 'media/image/default') {
|
||||
$photo = bin2hex(trim($v));
|
||||
}
|
||||
}
|
||||
if($nick)
|
||||
}
|
||||
if ($nick) {
|
||||
$args .= '&nickname=' . $nick;
|
||||
elseif($first)
|
||||
}
|
||||
elseif ($first) {
|
||||
$args .= '&nickname=' . $first;
|
||||
}
|
||||
|
||||
if($photosq)
|
||||
if ($photosq) {
|
||||
$args .= '&photo=' . $photosq;
|
||||
elseif($photo)
|
||||
}
|
||||
elseif ($photo) {
|
||||
$args .= '&photo=' . $photo;
|
||||
}
|
||||
|
||||
$args .= '&openid_url=' . notags(trim($authid));
|
||||
|
||||
|
|
|
@ -780,6 +780,8 @@ function profiles_content(App &$a) {
|
|||
if (dbm::is_result($r)) {
|
||||
|
||||
$tpl = get_markup_template('profile_entry.tpl');
|
||||
|
||||
$profiles = '';
|
||||
foreach ($r as $rr) {
|
||||
$profiles .= replace_macros($tpl, array(
|
||||
'$photo' => $a->remove_baseurl($rr['thumb']),
|
||||
|
|
|
@ -77,8 +77,10 @@ function viewcontacts_content(App &$a) {
|
|||
$contacts = array();
|
||||
|
||||
foreach ($r as $rr) {
|
||||
if($rr['self'])
|
||||
/// @TODO This triggers an E_NOTICE if 'self' is not there
|
||||
if ($rr['self']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$url = $rr['url'];
|
||||
|
||||
|
|
Loading…
Reference in a new issue