added spaces

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Haeder 2017-04-05 19:24:22 +02:00
parent 03571f6e74
commit 64cf909ca2
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78

View file

@ -88,18 +88,20 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$networks = array(NETWORK_DFRN); $networks = array(NETWORK_DFRN);
break; break;
case 'PRIVATE': case 'PRIVATE':
if (is_array($a->user) && $a->user['prvnets']) if (is_array($a->user) && $a->user['prvnets']) {
$networks = array(NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA); $networks = array(NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA);
else } else {
$networks = array(NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA); $networks = array(NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA);
}
break; break;
case 'TWO_WAY': case 'TWO_WAY':
if (is_array($a->user) && $a->user['prvnets']) if (is_array($a->user) && $a->user['prvnets']) {
$networks = array(NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA); $networks = array(NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA);
else } else {
$networks = array(NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA, NETWORK_OSTATUS); $networks = array(NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA, NETWORK_OSTATUS);
}
break; break;
default: default: /// @TODO Maybe log this call?
break; break;
} }
} }
@ -117,10 +119,12 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND)); $sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND));
} }
if (intval($x['exclude'])) if (intval($x['exclude'])) {
$sql_extra .= sprintf(" AND `id` != %d ", intval($x['exclude'])); $sql_extra .= sprintf(" AND `id` != %d ", intval($x['exclude']));
}
if (is_array($x['networks']) && count($x['networks'])) { if (is_array($x['networks']) && count($x['networks'])) {
/// @TODO rewrite to foreach()
for ($y = 0; $y < count($x['networks']) ; $y ++) { for ($y = 0; $y < count($x['networks']) ; $y ++) {
$x['networks'][$y] = "'" . dbesc($x['networks'][$y]) . "'"; $x['networks'][$y] = "'" . dbesc($x['networks'][$y]) . "'";
} }
@ -130,10 +134,11 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$tabindex = (x($options, 'tabindex') ? "tabindex=\"" . $options["tabindex"] . "\"" : ""); $tabindex = (x($options, 'tabindex') ? "tabindex=\"" . $options["tabindex"] . "\"" : "");
if ($x['single']) if ($x['single']) {
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" $tabindex >\r\n"; $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" $tabindex >\r\n";
else } else {
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n"; $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n";
}
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != '' WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
@ -175,7 +180,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) { function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) {
require_once("include/bbcode.php"); require_once "include/bbcode.php";
$a = get_app(); $a = get_app();
@ -190,25 +195,28 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND)); $sql_extra .= sprintf(" AND `rel` = %d ", intval(CONTACT_IS_FRIEND));
} }
if ($privmail) if ($privmail) {
$sql_extra .= sprintf(" AND `network` IN ('%s' , '%s') ", $sql_extra .= sprintf(" AND `network` IN ('%s' , '%s') ",
NETWORK_DFRN, NETWORK_DIASPORA); NETWORK_DFRN, NETWORK_DIASPORA);
elseif ($privatenet) } elseif ($privatenet) {
$sql_extra .= sprintf(" AND `network` IN ('%s' , '%s', '%s', '%s') ", $sql_extra .= sprintf(" AND `network` IN ('%s' , '%s', '%s', '%s') ",
NETWORK_DFRN, NETWORK_MAIL, NETWORK_FACEBOOK, NETWORK_DIASPORA); NETWORK_DFRN, NETWORK_MAIL, NETWORK_FACEBOOK, NETWORK_DIASPORA);
}
$tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : ""); $tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : "");
if ($privmail AND $preselected) { if ($privmail AND $preselected) {
$sql_extra .= " AND `id` IN (".implode(",", $preselected).")"; $sql_extra .= " AND `id` IN (".implode(",", $preselected).")";
$hidepreselected = ' style="display: none;"'; $hidepreselected = ' style="display: none;"';
} else } else {
$hidepreselected = ""; $hidepreselected = "";
}
if ($privmail) if ($privmail) {
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex $hidepreselected>\r\n"; $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex $hidepreselected>\r\n";
else } else {
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n"; $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n";
}
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != '' WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
@ -230,8 +238,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
foreach ($r as $rr) { foreach ($r as $rr) {
if ((is_array($preselected)) && in_array($rr['id'], $preselected)) { if ((is_array($preselected)) && in_array($rr['id'], $preselected)) {
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
} } else {
else {
$selected = ''; $selected = '';
} }
@ -250,8 +257,9 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$o .= "</select>\r\n"; $o .= "</select>\r\n";
if ($privmail AND $preselected) if ($privmail AND $preselected) {
$o .= implode(", ", $receiverlist); $o .= implode(", ", $receiverlist);
}
call_hooks($a->module . '_post_' . $selname, $o); call_hooks($a->module . '_post_' . $selname, $o);
@ -331,10 +339,11 @@ function populate_acl($user = null, $show_jotnets = false) {
); );
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
$mail_enabled = true; $mail_enabled = true;
if (intval($r[0]['pubmail'])) if (intval($r[0]['pubmail'])) {
$pubmail_enabled = true; $pubmail_enabled = true;
} }
} }
}
if (!$user['hidewall']) { if (!$user['hidewall']) {
if ($mail_enabled) { if ($mail_enabled) {
@ -343,10 +352,11 @@ function populate_acl($user = null, $show_jotnets = false) {
} }
call_hooks('jot_networks', $jotnets); call_hooks('jot_networks', $jotnets);
} else } else {
$jotnets .= sprintf(t('Connectors disabled, since "%s" is enabled.'), $jotnets .= sprintf(t('Connectors disabled, since "%s" is enabled.'),
t('Hide your profile details from unknown viewers?')); t('Hide your profile details from unknown viewers?'));
} }
}
$tpl = get_markup_template("acl_selector.tpl"); $tpl = get_markup_template("acl_selector.tpl");
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
@ -364,7 +374,7 @@ function populate_acl($user = null, $show_jotnets = false) {
'$aclModalTitle' => t('Permissions'), '$aclModalTitle' => t('Permissions'),
'$aclModalDismiss' => t('Close'), '$aclModalDismiss' => t('Close'),
'$features' => array( '$features' => array(
"aclautomention"=>(feature_enabled($user['uid'],"aclautomention")?"true":"false") 'aclautomention' => (feature_enabled($user['uid'],"aclautomention")?"true":"false")
), ),
)); ));
@ -432,6 +442,7 @@ function acl_lookup(App $a, $out_type = 'json') {
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'"; $sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
$sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')"; $sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
} else { } else {
/// @TODO Avoid these needless else blocks by putting variable-initialization atop of if()
$sql_extra = $sql_extra2 = ""; $sql_extra = $sql_extra2 = "";
} }
@ -447,8 +458,8 @@ function acl_lookup(App $a, $out_type = 'json') {
$sql_extra2 .= " ".unavailable_networks(); $sql_extra2 .= " ".unavailable_networks();
// autocomplete for editor mentions
if ($type == '' || $type == 'c') { if ($type == '' || $type == 'c') {
// autocomplete for editor mentions
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND NOT `self` WHERE `uid` = %d AND NOT `self`
AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND NOT `blocked` AND NOT `pending` AND NOT `archive`