added spaces + some curly braces

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-01-26 16:01:56 +01:00
parent 3228bb614c
commit bc259cdc44
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
2 changed files with 16 additions and 10 deletions

View file

@ -299,9 +299,10 @@ function permissions_sql($owner_id, $remote_verified = false, $groups = null)
$gs = '<<>>'; // should be impossible to match $gs = '<<>>'; // should be impossible to match
if (is_array($groups) && count($groups)) { if (is_array($groups) && count($groups)) {
foreach ($groups as $g) foreach ($groups as $g) {
$gs .= '|<' . intval($g) . '>'; $gs .= '|<' . intval($g) . '>';
} }
}
$sql = sprintf( $sql = sprintf(
" AND ( NOT (deny_cid REGEXP '<%d>' OR deny_gid REGEXP '%s') " AND ( NOT (deny_cid REGEXP '<%d>' OR deny_gid REGEXP '%s')

View file

@ -1660,10 +1660,11 @@ function bb_translate_video($s) {
$r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER); $r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER);
if ($r) { if ($r) {
foreach ($matches as $mtch) { foreach ($matches as $mtch) {
if ((stristr($mtch[1],'youtube')) || (stristr($mtch[1],'youtu.be'))) if ((stristr($mtch[1], 'youtube')) || (stristr($mtch[1], 'youtu.be'))) {
$s = str_replace($mtch[0],'[youtube]' . $mtch[1] . '[/youtube]',$s); $s = str_replace($mtch[0], '[youtube]' . $mtch[1] . '[/youtube]', $s);
elseif (stristr($mtch[1],'vimeo')) } elseif (stristr($mtch[1], 'vimeo')) {
$s = str_replace($mtch[0],'[vimeo]' . $mtch[1] . '[/vimeo]',$s); $s = str_replace($mtch[0], '[vimeo]' . $mtch[1] . '[/vimeo]', $s);
}
} }
} }
return $s; return $s;
@ -1781,7 +1782,7 @@ function file_tag_file_query($table,$s,$type = 'file') {
} }
// ex. given music,video return <music><video> or [music][video] // ex. given music,video return <music><video> or [music][video]
function file_tag_list_to_file($list,$type = 'file') { function file_tag_list_to_file($list, $type = 'file') {
$tag_list = ''; $tag_list = '';
if (strlen($list)) { if (strlen($list)) {
$list_array = explode(",",$list); $list_array = explode(",",$list);
@ -1803,7 +1804,7 @@ function file_tag_list_to_file($list,$type = 'file') {
} }
// ex. given <music><video>[friends], return music,video or friends // ex. given <music><video>[friends], return music,video or friends
function file_tag_file_to_list($file,$type = 'file') { function file_tag_file_to_list($file, $type = 'file') {
$matches = false; $matches = false;
$list = ''; $list = '';
if ($type == 'file') { if ($type == 'file') {
@ -1853,9 +1854,10 @@ function file_tag_update_pconfig($uid, $file_old, $file_new, $type = 'file') {
$check_new_tags = explode(",",file_tag_file_to_list($file_new,$type)); $check_new_tags = explode(",",file_tag_file_to_list($file_new,$type));
foreach ($check_new_tags as $tag) { foreach ($check_new_tags as $tag) {
if (! stristr($saved,$lbracket . file_tag_encode($tag) . $rbracket)) if (! stristr($saved,$lbracket . file_tag_encode($tag) . $rbracket)) {
$new_tags[] = $tag; $new_tags[] = $tag;
} }
}
$filetags_updated .= file_tag_list_to_file(implode(",",$new_tags),$type); $filetags_updated .= file_tag_list_to_file(implode(",",$new_tags),$type);
@ -1864,9 +1866,10 @@ function file_tag_update_pconfig($uid, $file_old, $file_new, $type = 'file') {
$check_deleted_tags = explode(",",file_tag_file_to_list($file_old,$type)); $check_deleted_tags = explode(",",file_tag_file_to_list($file_old,$type));
foreach ($check_deleted_tags as $tag) { foreach ($check_deleted_tags as $tag) {
if (! stristr($file_new,$lbracket . file_tag_encode($tag) . $rbracket)) if (! stristr($file_new,$lbracket . file_tag_encode($tag) . $rbracket)) {
$deleted_tags[] = $tag; $deleted_tags[] = $tag;
} }
}
foreach ($deleted_tags as $key => $tag) { foreach ($deleted_tags as $key => $tag) {
$r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d", $r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d",
@ -1981,11 +1984,12 @@ function is_a_date_arg($s) {
if ($i > 1900) { if ($i > 1900) {
$y = date('Y'); $y = date('Y');
if ($i <= $y + 1 && strpos($s, '-') == 4) { if ($i <= $y + 1 && strpos($s, '-') == 4) {
$m = intval(substr($s,5)); $m = intval(substr($s, 5));
if ($m > 0 && $m <= 12) if ($m > 0 && $m <= 12)
return true; return true;
} }
} }
}
return false; return false;
} }
@ -2003,6 +2007,7 @@ function deindent($text, $chr = "[\t ]", $count = NULL) {
preg_match("|^" . $chr . "*|", $lines[$k], $m); preg_match("|^" . $chr . "*|", $lines[$k], $m);
$count = strlen($m[0]); $count = strlen($m[0]);
} }
for ($k = 0; $k < count($lines); $k++) { for ($k = 0; $k < count($lines); $k++) {
$lines[$k] = preg_replace("|^" . $chr . "{" . $count . "}|", "", $lines[$k]); $lines[$k] = preg_replace("|^" . $chr . "{" . $count . "}|", "", $lines[$k]);
} }