This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, master has been updated
via 2848045a5df9fd01c93759db05f6fb72928e012e (commit)
from e24b9ad24a32f59e2b4f60f73a15e62b246dffd2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2848045a5df9fd01c93759db05f6fb72928e012e
commit 2848045a5df9fd01c93759db05f6fb72928e012e
Author: Franck Villaume <[email protected]>
Date: Mon May 3 12:11:01 2021 +0200
curly braces
diff --git a/src/common/include/MonitorElement.class.php
b/src/common/include/MonitorElement.class.php
index 28d8fb4..9283eae 100644
--- a/src/common/include/MonitorElement.class.php
+++ b/src/common/include/MonitorElement.class.php
@@ -229,9 +229,9 @@ class MonitorElement extends FFError {
$getAllEmailsInCommatSeparatedString = '';
$comma = '';
for ($i = 0; $i <
count($getAllEmailsInCommatSeparatedArray); $i++) {
- if ( $i > 0 )
+ if ( $i > 0 ) {
$comma = ',';
-
+ }
$getAllEmailsInCommatSeparatedString .=
$comma.$getAllEmailsInCommatSeparatedArray[$i];
}
return $getAllEmailsInCommatSeparatedString;
diff --git a/src/common/include/RBACEngine.class.php
b/src/common/include/RBACEngine.class.php
index e938053..47c59f1 100644
--- a/src/common/include/RBACEngine.class.php
+++ b/src/common/include/RBACEngine.class.php
@@ -242,8 +242,9 @@ class RBACEngine extends FFError implements PFO_RBACEngine {
public function getUsersByAllowedAction ($section, $reference, $action
= NULL) {
$roles = $this->getRolesByAllowedAction ($section, $reference,
$action);
- if ($roles === false) // Error
+ if ($roles === false) { // Error
return false;
+ }
$user_ids = array ();
foreach ($roles as $role) {
foreach ($role->getUsers() as $user) {
diff --git a/src/common/include/Storage.class.php
b/src/common/include/Storage.class.php
index 6ac8b42..afa8140 100644
--- a/src/common/include/Storage.class.php
+++ b/src/common/include/Storage.class.php
@@ -110,7 +110,9 @@ class Storage extends FFError {
$key = dechex($key);
$pre = substr($key, strlen($key)-2);
$last = substr($key, 0, strlen($key)-2);
- if (!$last) $last = '0';
+ if (!$last) {
+ $last = '0';
+ }
return $this->get_storage_path().'/'.$pre.'/'.$last;
}
}
diff --git a/src/common/include/TextSanitizer.class.php
b/src/common/include/TextSanitizer.class.php
index 65923c8..3446cae 100644
--- a/src/common/include/TextSanitizer.class.php
+++ b/src/common/include/TextSanitizer.class.php
@@ -273,7 +273,9 @@ class TextSanitizer extends FFError {
$text = trim($text);
$arr = explode("\n", $text);
$nb_max = count($arr);
- if ($nb_max > $nb_line) $nb_max = $nb_line;
+ if ($nb_max > $nb_line) {
+ $nb_max = $nb_line;
+ }
$summary = '';
for ($l = 0; $l < $nb_max; $l++) {
$summary .= '<br />';
diff --git a/src/common/include/User.class.php
b/src/common/include/User.class.php
index 935801c..c1b7928 100644
--- a/src/common/include/User.class.php
+++ b/src/common/include/User.class.php
@@ -1747,9 +1747,9 @@ Email: %3$s
* @return bool
*/
function isHidden($fieldName) {
- if (!isset($this->data_array['hidden']))
+ if (!isset($this->data_array['hidden'])) {
return false;
-
+ }
$hidden = unserialize($this->data_array['hidden']);
if (is_array($hidden) && in_array($fieldName, $hidden)) {
return true;
diff --git a/src/common/include/account.php b/src/common/include/account.php
index 5d1a7a1..c80cc3e 100644
--- a/src/common/include/account.php
+++ b/src/common/include/account.php
@@ -149,8 +149,9 @@ function account_namevalid($name, $unix=false,
$check_exists=true) {
*
*/
function account_groupnamevalid($name) {
- if (!account_namevalid($name, 1)) return 0;
-
+ if (!account_namevalid($name, 1)) {
+ return 0;
+ }
// illegal names
$regExpReservedGroupNames =
"^(www[0-9]?|cvs[0-9]?|shell[0-9]?|ftp[0-9]?|"
.
"irc[0-9]?|news[0-9]?|mail[0-9]?|ns[0-9]?|download[0-9]?|pub|users|"
@@ -223,9 +224,9 @@ function account_gensalt(){
}
$salt = '';
- for ($i = 0; $i < $salt_size; $i++)
+ for ($i = 0; $i < $salt_size; $i++) {
$salt .= genchr();
-
+ }
$salt = $salt_prefix.$salt;
return $salt;
diff --git a/src/common/include/cron_utils.php
b/src/common/include/cron_utils.php
index 82755fc..d2cd44b 100644
--- a/src/common/include/cron_utils.php
+++ b/src/common/include/cron_utils.php
@@ -95,9 +95,9 @@ $locks = array();
function cron_acquire_lock($script) {
global $locks;
// Script lock: http://perl.plover.com/yak/flock/samples/slide006.html
- if (!isset($locks[$script]))
+ if (!isset($locks[$script])) {
$locks[$script] = fopen($script, 'r') or die("Failed to ask
lock.\n");
-
+ }
if (!flock($locks[$script], LOCK_EX | LOCK_NB)) {
die("There's a lock for '$script', exiting\n");
}
diff --git a/src/common/include/database-pgsql.php
b/src/common/include/database-pgsql.php
index ac848c7..e753148 100644
--- a/src/common/include/database-pgsql.php
+++ b/src/common/include/database-pgsql.php
@@ -47,10 +47,12 @@ function pg_connectstring($dbname, $user, $password = "",
$host = "", $port = ""
} else {
$string = "dbname=gforge";
}
- if ($user != "")
+ if ($user != "") {
$string .= " user=$user";
- if ($password != "")
+ }
+ if ($password != "") {
$string .= " password=$password";
+ }
if ($host != "") {
$string .= " host=$host";
}
@@ -146,12 +148,13 @@ function db_reconnect() {
*/
function db_connection_status() {
global $gfconn;
- if ($gfconn === FALSE)
+ if ($gfconn === FALSE) {
return false;
- if (pg_connection_status($gfconn) == PGSQL_CONNECTION_OK)
+ }
+ if (pg_connection_status($gfconn) == PGSQL_CONNECTION_OK) {
return true;
- else
- return false;
+ }
+ return false;
}
function db_switcher($dbserver = NULL) {
@@ -473,8 +476,9 @@ function db_commit($dbserver = NULL) {
// check for transaction stack underflow
if ($_sys_db_transaction_level == 0) {
echo "COMMIT underflow [$sysdebug_dberrors]<br />";
- if ($sysdebug_dberrors)
+ if ($sysdebug_dberrors) {
ffDebug("database", "db_commit underflow",
debug_string_backtrace());
+ }
return false;
}
@@ -500,8 +504,9 @@ function db_rollback($dbserver = NULL) {
// check for transaction stack underflow
if ($_sys_db_transaction_level == 0) {
echo "ROLLBACK underflow [$sysdebug_dberrors]<br />";
- if ($sysdebug_dberrors)
+ if ($sysdebug_dberrors) {
ffDebug("database", "db_rollback underflow",
debug_string_backtrace());
+ }
return false;
}
diff --git a/src/common/include/forms.php b/src/common/include/forms.php
index 7a66fd8..fa7bf2f 100644
--- a/src/common/include/forms.php
+++ b/src/common/include/forms.php
@@ -58,9 +58,9 @@ function form_generate_key() {
*/
function form_key_is_valid($key) {
// Fail if key is empty
- if (empty($key))
+ if (empty($key)) {
return false;
-
+ }
db_begin();
$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1 and
is_used=0 AND creation_date > $2 FOR UPDATE',
array ($key,
diff --git a/src/common/include/html.php b/src/common/include/html.php
index 4da5a5a..dbb6745 100644
--- a/src/common/include/html.php
+++ b/src/common/include/html.php
@@ -93,9 +93,9 @@ function html_error_top($msg) {
* @return string
*/
function make_user_link($username, $displayname = '') {
- if (empty($displayname))
+ if (empty($displayname)) {
$displayname = $username;
-
+ }
if (!strcasecmp($username, 'Nobody') || !strcasecmp($username, 'None'))
{
return $username;
} else {
@@ -682,8 +682,9 @@ function html_build_select_box_from_arrays($vals, $texts,
$select_name,
//we don't always want the default Any row shown
if ($show_any) {
$opt_attrs = array('value' => '');
- if ($checked_val == '')
+ if ($checked_val == '') {
$opt_attrs['selected'] = 'selected';
+ }
$return .= html_e('option', $opt_attrs,
util_html_secure($text_any), false);
$have_a_subelement = true;
}
@@ -1321,25 +1322,25 @@ function html_clean_hash_string($hashstr) {
function relative_date($date) {
$delta = max(time() - $date, 0);
- if ($delta < 60)
+ if ($delta < 60) {
return sprintf(ngettext('%d second ago', '%d seconds ago',
$delta), $delta);
-
+ }
$delta = round($delta / 60);
- if ($delta < 60)
+ if ($delta < 60) {
return sprintf(ngettext('%d minute ago', '%d minutes ago',
$delta), $delta);
-
+ }
$delta = round($delta / 60);
- if ($delta < 24)
+ if ($delta < 24) {
return sprintf(ngettext('%d hour ago', '%d hours ago', $delta),
$delta);
-
+ }
$delta = round($delta / 24);
- if ($delta < 7)
+ if ($delta < 7) {
return sprintf(ngettext('%d day ago', '%d days ago', $delta),
$delta);
-
+ }
$delta = round($delta / 7);
- if ($delta < 4)
+ if ($delta < 4) {
return sprintf(ngettext('%d week ago', '%d weeks ago', $delta),
$delta);
-
+ }
return date(_('Y-m-d H:i'), $date);
}
@@ -1426,7 +1427,9 @@ function html_e($name, $attrs = array(), $content = "",
$shortform = true, $inde
if ($content === "" && $shortform) {
$rv .= ' />';
- if ($indent) $rv .= "\n";
+ if ($indent) {
+ $rv .= "\n";
+ }
} else {
$rv .= '>';
if (preg_match('/([\<])([^\>]{1,})*([\>])/i', $content) &&
$indent) {
@@ -1437,7 +1440,9 @@ function html_e($name, $attrs = array(), $content = "",
$shortform = true, $inde
$rv .= $tab;
}
$rv .= '</'.$name.'>';
- if ($indent) $rv .= "\n";
+ if ($indent) {
+ $rv .= "\n";
+ }
}
return $rv;
}
diff --git a/src/common/include/minijson.php b/src/common/include/minijson.php
index ecb18c7..f946491 100644
--- a/src/common/include/minijson.php
+++ b/src/common/include/minijson.php
@@ -1,6 +1,7 @@
<?php
-if (!defined('__main__') && count(get_included_files()) <= 1 &&
count(debug_backtrace()) < 1)
+if (!defined('__main__') && count(get_included_files()) <= 1 &&
count(debug_backtrace()) < 1) {
define('__main__', __FILE__);
+}
/**
* Minimal complete JSON generator and parser for FusionForge/Evolvis
* and SimKolab, including for debugging output serialisation
@@ -74,9 +75,9 @@ function minijson_encode($x, $ri='', $depth=32, $truncsz=0,
$dumprsrc=false) {
* out: stdout encoded
*/
function minijson_encode_ob_string($x, $truncsz=0, $leader='"') {
- if (!is_string($x))
+ if (!is_string($x)) {
$x = strval($x);
-
+ }
$Sx = strlen($x);
if ($truncsz && ($Sx > $truncsz)) {
@@ -101,39 +102,42 @@ function minijson_encode_ob_string($x, $truncsz=0,
$leader='"') {
if ($c > 0x22 && $c < 0x7F) {
/* printable ASCII except space, !, " */
- if ($c === 0x5C)
+ if ($c === 0x5C) {
echo $ch;
+ }
echo $ch;
continue;
}
if ($c < 0x80) {
/* C0 control character, space, !, " or DEL */
- if (($c & 0x7E) === 0x20)
+ if (($c & 0x7E) === 0x20) {
echo $ch;
- elseif ($c === 0x22)
+ } elseif ($c === 0x22) {
echo '\"';
- elseif ($c === 0x08)
+ } elseif ($c === 0x08) {
echo '\b';
- elseif ($c === 0x09)
+ } elseif ($c === 0x09) {
echo '\t';
- elseif ($c === 0x0A)
+ } elseif ($c === 0x0A) {
echo '\n';
- elseif ($c === 0x0C)
+ } elseif ($c === 0x0C) {
echo '\f';
- elseif ($c === 0x0D)
+ } elseif ($c === 0x0D) {
echo '\r';
- elseif (!$c)
+ } elseif (!$c) {
$Sp = $Sx;
- else
+ } else {
printf('\u%04X', $c);
+ }
continue;
}
/* UTF-8 lead byte */
if ($c < 0xE0) {
- if ($c < 0xC2)
+ if ($c < 0xC2) {
break;
+ }
$wc = ($c & 0x1F) << 6;
$wmin = 0x80;
$Ss = 1;
@@ -150,8 +154,9 @@ function minijson_encode_ob_string($x, $truncsz=0,
$leader='"') {
}
$u = $ch;
/* UTF-8 trail bytes */
- if ($Sp + $Ss > $Sx)
+ if ($Sp + $Ss > $Sx) {
break;
+ }
while ($Ss--)
if (($c = ord(($ch = $x[$Sp++])) ^ 0x80) <= 0x3F) {
$wc |= $c << (6 * $Ss);
@@ -159,24 +164,25 @@ function minijson_encode_ob_string($x, $truncsz=0,
$leader='"') {
} else
break 2;
/* complete wide character */
- if ($wc < $wmin)
+ if ($wc < $wmin) {
break;
-
+ }
if (($wc >= 0x00A0 && $wc < 0x2028) ||
($wc > 0x2029 && $wc < 0xD800) ||
- ($wc > 0xDFFF && $wc <= 0xFFFD))
+ ($wc > 0xDFFF && $wc <= 0xFFFD)) {
echo $u;
- elseif ($wc > 0xFFFF) {
- if ($wc > 0x10FFFF)
+ } elseif ($wc > 0xFFFF) {
+ if ($wc > 0x10FFFF) {
break;
+ }
/* UTF-16 */
$wc -= 0x10000;
printf('\u%04X\u%04X',
0xD800 | ($wc >> 10),
0xDC00 | ($wc & 0x03FF));
- } else
+ } else {
printf('\u%04X', $wc);
-
+ }
/* process next char */
}
@@ -187,28 +193,29 @@ function minijson_encode_ob_string($x, $truncsz=0,
$leader='"') {
while ($Sp < $Sx && ($c = ord(($ch = $x[$Sp++])))) {
/* similar logic as above, just not as golfed for speed */
if ($c >= 0x20 && $c < 0x7F) {
- if ($c === 0x22 || $c === 0x5C)
+ if ($c === 0x22 || $c === 0x5C) {
echo "\\";
+ }
echo $ch;
} else switch ($c) {
- case 0x08:
- echo '\b';
- break;
- case 0x09:
- echo '\t';
- break;
- case 0x0A:
- echo '\n';
- break;
- case 0x0C:
- echo '\f';
- break;
- case 0x0D:
- echo '\r';
- break;
- default:
- printf('\u%04X', $c);
- break;
+ case 0x08:
+ echo '\b';
+ break;
+ case 0x09:
+ echo '\t';
+ break;
+ case 0x0A:
+ echo '\n';
+ break;
+ case 0x0C:
+ echo '\f';
+ break;
+ case 0x0D:
+ echo '\r';
+ break;
+ default:
+ printf('\u%04X', $c);
+ break;
}
}
echo '"';
@@ -248,7 +255,7 @@ function minijson_encode_ob($x, $ri, $depth, $truncsz,
$dumprsrc) {
echo $z;
return;
}
- } else if (is_nan($x) || is_infinite($x)) {
+ } elseif (is_nan($x) || is_infinite($x)) {
echo 'null';
return;
}
@@ -256,10 +263,12 @@ function minijson_encode_ob($x, $ri, $depth, $truncsz,
$dumprsrc) {
$v = explode('e', $rs);
$rs = rtrim($v[0], '0');
echo $rs;
- if ($rs[strlen($rs) - 1] === '.')
+ if ($rs[strlen($rs) - 1] === '.') {
echo '0';
- if ($v[1] !== '-0' && $v[1] !== '+0')
+ }
+ if ($v[1] !== '-0' && $v[1] !== '+0') {
echo 'E' . $v[1];
+ }
return;
}
@@ -339,30 +348,30 @@ function minijson_encode_ob($x, $ri, $depth, $truncsz,
$dumprsrc) {
'_type' => $rsrctype,
);
switch ($rsrctype) {
- case 'stream':
- $rs['info'] = stream_get_meta_data($x);
- break;
- case 'curl':
- $rs['info'] = curl_getinfo($x);
- $rs['private'] = curl_getinfo($x, CURLINFO_PRIVATE);
- break;
- case 'GMP integer':
- $rs['value'] = gmp_strval($x);
- break;
- case 'OpenSSL key':
- $rs['info'] = openssl_pkey_get_details($x);
- break;
- case 'pgsql link':
- case 'pgsql link persistent':
- $rs['err'] = pg_last_error($x); // must be first
- $rs['db'] = pg_dbname($x);
- $rs['host'] = pg_host($x);
- $rs['status'] = pg_connection_status($x);
- $rs['txn'] = pg_transaction_status($x);
- break;
- case 'pgsql result':
- $rs['status'] = pg_result_status($x,
PGSQL_STATUS_STRING);
- break;
+ case 'stream':
+ $rs['info'] = stream_get_meta_data($x);
+ break;
+ case 'curl':
+ $rs['info'] = curl_getinfo($x);
+ $rs['private'] = curl_getinfo($x,
CURLINFO_PRIVATE);
+ break;
+ case 'GMP integer':
+ $rs['value'] = gmp_strval($x);
+ break;
+ case 'OpenSSL key':
+ $rs['info'] = openssl_pkey_get_details($x);
+ break;
+ case 'pgsql link':
+ case 'pgsql link persistent':
+ $rs['err'] = pg_last_error($x); // must be first
+ $rs['db'] = pg_dbname($x);
+ $rs['host'] = pg_host($x);
+ $rs['status'] = pg_connection_status($x);
+ $rs['txn'] = pg_transaction_status($x);
+ break;
+ case 'pgsql result':
+ $rs['status'] = pg_result_status($x,
PGSQL_STATUS_STRING);
+ break;
}
echo '{'/*}*/ . $xi . '"\u0000resource:"' . $Sd;
minijson_encode_ob($rs, $si, $depth + 1, $truncsz, $dumprsrc);
@@ -385,11 +394,13 @@ function minijson_encode_ob($x, $ri, $depth, $truncsz,
$dumprsrc) {
$s = array();
foreach (array_keys($x) as $k) {
$v = $k;
- if (!is_string($v))
+ if (!is_string($v)) {
$v = strval($v);
+ }
/* protected and private members have NULs there */
- if (strpos($v, "\0") !== false)
+ if (strpos($v, "\0") !== false) {
$v = str_replace("\0", "\\", $v);
+ }
$s[$k] = $v;
}
asort($s, SORT_STRING);
@@ -415,28 +426,28 @@ function minijson_encode_ob($x, $ri, $depth, $truncsz,
$dumprsrc) {
* out: boolean false if an error occured, true if the output is valid
*/
function minijson_decode($s, &$ov, $depth=32) {
- if (!isset($s))
+ if (!isset($s)) {
$s = '';
- elseif (!is_string($s))
+ } elseif (!is_string($s)) {
$s = strval($s);
-
+ }
$Sp = 0;
$Sx = strlen($s);
$rv = false;
/* skip Byte Order Mark if present */
- if (strncmp($s, "\xEF\xBB\xBF", 3) === 0)
+ if (strncmp($s, "\xEF\xBB\xBF", 3) === 0) {
$Sp = 3;
-
+ }
/* skip leading whitespace */
minijson_skip_wsp($s, $Sp, $Sx);
/* recursively parse input */
- if ($Sp < $Sx)
+ if ($Sp < $Sx) {
$rv = minijson_decode_value($s, $Sp, $Sx, $ov, $depth);
- else
+ } else {
$ov = 'empty input';
-
+ }
/* skip trailing whitespace */
if ($rv) {
minijson_skip_wsp($s, $Sp, $Sx);
@@ -448,20 +459,23 @@ function minijson_decode($s, &$ov, $depth=32) {
}
/* amend errors by erroring offset */
- if (!$rv)
+ if (!$rv) {
$ov = sprintf('%s at offset 0x%0' . strlen(dechex($Sx)) . 'X',
$ov, $Sp);
+ }
return $rv;
}
/* skip all characters that are JSON whitespace */
function minijson_skip_wsp($s, &$Sp, $Sx) {
- while ($Sp < $Sx)
+ while ($Sp < $Sx) {
if (($c = ord($s[$Sp])) === 0x20 ||
- $c === 0x0A || $c === 0x09 || $c === 0x0D)
+ $c === 0x0A || $c === 0x09 || $c === 0x0D) {
++$Sp;
- else
+ } else {
return $c;
+ }
+ }
return -1;
}
@@ -646,43 +660,47 @@ function minijson_decode_string($s, &$Sp, $Sx) {
}
/* backslash escape? */
if ($c === 0x5C) {
- if ($Sp >= $Sx)
+ if ($Sp >= $Sx) {
return 'incomplete escape sequence';
+ }
$c = ord(($ch = $s[$Sp++]));
- if ($c === 0x22 || $c === 0x5C || $c === 0x2F)
+ if ($c === 0x22 || $c === 0x5C || $c === 0x2F) {
echo $ch;
- elseif ($c === 0x74)
+ } elseif ($c === 0x74) {
echo "\x09";
- elseif ($c === 0x6E)
+ } elseif ($c === 0x6E) {
echo "\x0A";
- elseif ($c === 0x75) {
+ } elseif ($c === 0x75) {
$c = minijson_decode_uescape($s, $Sp, $Sx, $ch);
- if ($c >= 0xD800 && $c <= 0xDFFF)
+ if ($c >= 0xD800 && $c <= 0xDFFF) {
$c = minijson_decode_surrogate($s, $Sp,
$Sx, $c, $ch);
- if ($c === 0)
+ }
+ if ($c === 0) {
return $ch;
- if ($c < 0x80)
+ }
+ if ($c < 0x80) {
echo chr($c);
- elseif ($c < 0x0800)
+ } elseif ($c < 0x0800) {
echo chr(0xC0 | ($c >> 6)) .
chr(0x80 | ($c & 0x3F));
- elseif ($c <= 0xFFFF)
+ } elseif ($c <= 0xFFFF) {
echo chr(0xE0 | ($c >> 12)) .
chr(0x80 | (($c >> 6) & 0x3F)) .
chr(0x80 | ($c & 0x3F));
- else
+ } else {
echo chr(0xF0 | ($c >> 18)) .
chr(0x80 | (($c >> 12) & 0x3F)) .
chr(0x80 | (($c >> 6) & 0x3F)) .
chr(0x80 | ($c & 0x3F));
- } elseif ($c === 0x72)
+ }
+ } elseif ($c === 0x72) {
echo "\x0D";
- elseif ($c === 0x62)
+ } elseif ($c === 0x62) {
echo "\x08";
- elseif ($c === 0x66)
+ } elseif ($c === 0x66) {
echo "\x0C";
- else {
+ } else {
$Sp -= 2;
return "invalid escape sequence “\\{$ch}”";
}
@@ -690,8 +708,9 @@ function minijson_decode_string($s, &$Sp, $Sx) {
}
echo $ch;
if ($c < 0x80) {
- if ($c >= 0x20)
+ if ($c >= 0x20) {
continue;
+ }
--$Sp;
return sprintf('unexpected C0 control 0x%02X', $c);
}
@@ -765,26 +784,26 @@ function minijson_decode_uescape($s, &$Sp, $Sx, &$e) {
for ($tmp = 1; $tmp <= 4; $tmp++) {
$wc <<= 4;
switch (ord($s[$Sp++])) {
- case 0x30: break;
- case 0x31: $wc += 1; break;
- case 0x32: $wc += 2; break;
- case 0x33: $wc += 3; break;
- case 0x34: $wc += 4; break;
- case 0x35: $wc += 5; break;
- case 0x36: $wc += 6; break;
- case 0x37: $wc += 7; break;
- case 0x38: $wc += 8; break;
- case 0x39: $wc += 9; break;
- case 0x41: case 0x61: $wc += 10; break;
- case 0x42: case 0x62: $wc += 11; break;
- case 0x43: case 0x63: $wc += 12; break;
- case 0x44: case 0x64: $wc += 13; break;
- case 0x45: case 0x65: $wc += 14; break;
- case 0x46: case 0x66: $wc += 15; break;
- default:
- --$Sp;
- $e = 'hexadecimal digit expected';
- return 0;
+ case 0x30: break;
+ case 0x31: $wc += 1; break;
+ case 0x32: $wc += 2; break;
+ case 0x33: $wc += 3; break;
+ case 0x34: $wc += 4; break;
+ case 0x35: $wc += 5; break;
+ case 0x36: $wc += 6; break;
+ case 0x37: $wc += 7; break;
+ case 0x38: $wc += 8; break;
+ case 0x39: $wc += 9; break;
+ case 0x41: case 0x61: $wc += 10; break;
+ case 0x42: case 0x62: $wc += 11; break;
+ case 0x43: case 0x63: $wc += 12; break;
+ case 0x44: case 0x64: $wc += 13; break;
+ case 0x45: case 0x65: $wc += 14; break;
+ case 0x46: case 0x66: $wc += 15; break;
+ default:
+ --$Sp;
+ $e = 'hexadecimal digit expected';
+ return 0;
}
}
if ($wc < 1 || $wc > 0xFFFD) {
@@ -809,8 +828,9 @@ function minijson_decode_surrogate($s, &$Sp, $Sx, $wc, &$e)
{
return 0;
}
$Sp += 2;
- if (($lc = minijson_decode_uescape($s, $Sp, $Sx, $e)) === 0)
+ if (($lc = minijson_decode_uescape($s, $Sp, $Sx, $e)) === 0) {
return 0;
+ }
if ($lc < 0xDC00 || $lc > 0xDFFF) {
$Sp -= 6;
$e = sprintf('unexpected \\u%04X, low surrogate expected', $lc);
@@ -834,8 +854,9 @@ function minijson_decode_number($s, &$Sp, $Sx, &$ov) {
if (strpos($matches[0], '.') === false) {
/* possible integer */
$ov = (int)$matches[0];
- if (strval($ov) === $matches[0])
+ if (strval($ov) === $matches[0]) {
return true;
+ }
}
$ov = (float)$matches[0];
return true;
@@ -856,48 +877,57 @@ if (defined('__main__') && constant('__main__') ===
__FILE__) {
while (count($argv)) {
$arg = array_shift($argv);
/* only options, no arguments (Unix filter) */
- if ($arg[0] !== '-')
+ if ($arg[0] !== '-') {
usage();
- if ($arg === '--' && count($argv))
+ }
+ if ($arg === '--' && count($argv)) {
usage();
- if ($arg === '-')
+ }
+ if ($arg === '-') {
usage();
+ }
$arg = str_split($arg);
array_shift($arg); /* initial ‘-’ */
/* parse select arguments */
while (count($arg)) {
switch ($arg[0]) {
- case 'c':
- $indent = false;
- break;
- case 'd':
- if (!count($argv))
- usage();
- $depth = array_shift($argv);
- if (!preg_match('/^[1-9][0-9]*$/', $depth))
- usage();
- if (strval((int)$depth) !== $depth)
- usage();
- $depth = (int)$depth;
- break;
- case 'h':
- case '?':
- usage(0);
- case 'r':
- $rsrc = true;
- break;
- case 't':
- if (!count($argv))
- usage();
- $truncsz = array_shift($argv);
- if (!preg_match('/^[1-9][0-9]*$/', $truncsz))
- usage();
- if (strval((int)$truncsz) !== $truncsz)
+ case 'c':
+ $indent = false;
+ break;
+ case 'd':
+ if (!count($argv)) {
+ usage();
+ }
+ $depth = array_shift($argv);
+ if (!preg_match('/^[1-9][0-9]*$/',
$depth)) {
+ usage();
+ }
+ if (strval((int)$depth) !== $depth) {
+ usage();
+ }
+ $depth = (int)$depth;
+ break;
+ case 'h':
+ case '?':
+ usage(0);
+ case 'r':
+ $rsrc = true;
+ break;
+ case 't':
+ if (!count($argv)) {
+ usage();
+ }
+ $truncsz = array_shift($argv);
+ if (!preg_match('/^[1-9][0-9]*$/',
$truncsz)) {
+ usage();
+ }
+ if (strval((int)$truncsz) !== $truncsz)
{
+ usage();
+ }
+ $truncsz = (int)$truncsz;
+ break;
+ default:
usage();
- $truncsz = (int)$truncsz;
- break;
- default:
- usage();
}
array_shift($arg);
}
@@ -913,7 +943,6 @@ if (defined('__main__') && constant('__main__') ===
__FILE__) {
)) . "\n");
exit(1);
}
- fwrite(STDOUT, minijson_encode($odat, $indent, $depth,
- $truncsz, $rsrc) . "\n");
+ fwrite(STDOUT, minijson_encode($odat, $indent, $depth, $truncsz, $rsrc)
. "\n");
exit(0);
}
diff --git a/src/common/include/pre.php b/src/common/include/pre.php
index cd81506..52def86 100644
--- a/src/common/include/pre.php
+++ b/src/common/include/pre.php
@@ -292,12 +292,18 @@ if (getenv('FUSIONFORGE_NO_DB') != 'true' and
forge_get_config('database_name')
// Mandatory login
if (!session_loggedin() && forge_get_config ('force_login') ==
1 ) {
$expl_pathinfo = explode('/',
getStringFromServer('REQUEST_URI'));
- if (getStringFromServer('REQUEST_URI')!='/' &&
$expl_pathinfo[1]!='account' && $expl_pathinfo[1]!='export' &&
$expl_pathinfo[1]!='plugins') exit_not_logged_in();
+ if (getStringFromServer('REQUEST_URI')!='/' &&
$expl_pathinfo[1]!='account' && $expl_pathinfo[1]!='export' &&
$expl_pathinfo[1]!='plugins') {
+ exit_not_logged_in();
+ }
// Show proj* export even if not logged in when force
login
// If not default web project page would be broken
- if ($expl_pathinfo[1]=='export' &&
!preg_match('/^proj/', $expl_pathinfo[2])) exit_not_logged_in();
+ if ($expl_pathinfo[1]=='export' &&
!preg_match('/^proj/', $expl_pathinfo[2])) {
+ exit_not_logged_in();
+ }
// We must let auth plugins go further
- if ($expl_pathinfo[1]=='plugins' &&
!preg_match('/^auth/', $expl_pathinfo[2])) exit_not_logged_in();
+ if ($expl_pathinfo[1]=='plugins' &&
!preg_match('/^auth/', $expl_pathinfo[2])) {
+ exit_not_logged_in();
+ }
}
// Insert this page view into the database
diff --git a/src/common/include/session.php b/src/common/include/session.php
index 3abd6bc..d9111ab 100644
--- a/src/common/include/session.php
+++ b/src/common/include/session.php
@@ -375,10 +375,11 @@ function session_cookie($name, $value, $domain='',
$expiration=0) {
*/
function session_redirect_uri($loc, $permanent = true) {
util_save_messages();
- if ($permanent)
+ if ($permanent) {
sysdebug_off("Status: 301 Moved Permanently", true, 301);
- else
+ } else {
sysdebug_off("Status: 303 See Other", true, 303);
+ }
header("Location: ${loc}", true);
header("Content-type: text/html");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"' .
diff --git a/src/common/include/tag_cloud.php b/src/common/include/tag_cloud.php
index c4522e5..433bde6 100644
--- a/src/common/include/tag_cloud.php
+++ b/src/common/include/tag_cloud.php
@@ -80,7 +80,9 @@ function tag_cloud($params = array()) {
global $SELECTED_STYLE;
global $HTML;
- if (!is_array($params)) $params = array();
+ if (!is_array($params)) {
+ $params = array();
+ }
if (!isset($params['selected'])) {
$params['selected'] = '';
}
@@ -133,18 +135,22 @@ function tag_cloud($params = array()) {
$count_max = 0;
$nb = 0;
foreach ($available_counts as $count) {
- if ($count_min == 0 || $count < $count_min) $count_min
= $count;
- if ($count > $count_max) $count_max = $count;
+ if ($count_min == 0 || $count < $count_min) {
+ $count_min = $count;
+ }
+ if ($count > $count_max) {
+ $count_max = $count;
+ }
$nb = $nb + count($count_to_tags[$count]);
- if ($params['nb_max'] && $nb >= $params['nb_max'])
break; // no limit if nb_max == 0
+ if ($params['nb_max'] && $nb >= $params['nb_max']) {
+ break; // no limit if nb_max == 0
+ }
}
// Compute 'A' parameter of the function
- if ($count_max != $count_min) // else we have a division by zero
- {
+ if ($count_max != $count_min) {// else we have a division by
zero
$a = ($params['nb_size'] - 1) / ($count_max -
$count_min);
- }
- else {
+ } else {
// Set value 0 for 'A' parameter just for initialised
variable
// but it's not realy necessary because if $count_max
== $count_min
// then $count - $count_min = 0 (see below)
@@ -153,7 +159,9 @@ function tag_cloud($params = array()) {
ksort($tag_count, SORT_STRING);
foreach ($tag_count as $name => $count) {
- if ($count < $count_min) continue;
+ if ($count < $count_min) {
+ continue;
+ }
$size = intval(1 + ($count - $count_min) * $a);
$linkAttr = array();
$linkAttr['class'] = $params['class_prefix'] . $size;
diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index f6f3b80..80c76d8 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -39,20 +39,32 @@ function is_utf8($str) {
$bits=0;
$len=strlen($str);
for($i=0; $i<$len; $i++){
- $c=ord($str[$i]);
- if($c > 128){
- if(($c >= 254)) return false;
- elseif($c >= 252) $bits=6;
- elseif($c >= 248) $bits=5;
- elseif($c >= 240) $bits=4;
- elseif($c >= 224) $bits=3;
- elseif($c >= 192) $bits=2;
- else return false;
- if(($i+$bits) > $len) return false;
- while($bits > 1){
+ $c = ord($str[$i]);
+ if ($c > 128) {
+ if ($c >= 254) {
+ return false;
+ } elseif ($c >= 252) {
+ $bits=6;
+ } elseif ($c >= 248) {
+ $bits=5;
+ } elseif ($c >= 240) {
+ $bits=4;
+ } elseif ($c >= 224) {
+ $bits=3;
+ } elseif ($c >= 192) {
+ $bits=2;
+ } else {
+ return false;
+ }
+ if (($i+$bits) > $len) {
+ return false;
+ }
+ while($bits > 1) {
$i++;
- $b=ord($str[$i]);
- if($b < 128 || $b > 191) return false;
+ $b = ord($str[$i]);
+ if ($b < 128 || $b > 191) {
+ return false;
+ }
$bits--;
}
}
@@ -711,13 +723,13 @@ function &ls($dir, $filter = false, $regex = false) {
if (is_dir($dir) && ($h = opendir($dir))) {
while (($f = readdir($h)) !== false) {
- if ($f[0] == '.')
+ if ($f[0] == '.') {
continue;
+ }
if ($filter) {
- if (!util_is_valid_filename($f) ||
- !is_file($dir."/".$f)
- )
+ if (!util_is_valid_filename($f) ||
!is_file($dir."/".$f)) {
continue;
+ }
}
if ($regex !== false) {
if (!preg_match($regex, $f)) {
diff --git a/src/common/pm/ProjectTask.class.php
b/src/common/pm/ProjectTask.class.php
index b014e7a..7d01a06 100644
--- a/src/common/pm/ProjectTask.class.php
+++ b/src/common/pm/ProjectTask.class.php
@@ -1175,18 +1175,18 @@ class ProjectTask extends FFError {
$body = "Task #". $this->getID() ." has been updated by $user.".
"\n\nProject: ".
$this->ProjectGroup->Group->getPublicName();
- if (isset($arrChangedAndInNotice['subproject']))
+ if (isset($arrChangedAndInNotice['subproject'])) {
$body .= "\n".
$arrChangedAndInNotice['subproject']."Subproject: ".
$this->ProjectGroup->getName();
-
- if (isset($arrChangedAndInNotice['summary']))
+ }
+ if (isset($arrChangedAndInNotice['summary'])) {
$body .= "\n". $arrChangedAndInNotice['summary'].
"Summary: ".util_unconvert_htmlspecialchars( $this->getSummary() );
-
- if (isset($arrChangedAndInNotice['complete']))
+ }
+ if (isset($arrChangedAndInNotice['complete'])) {
$body .= "\n". $arrChangedAndInNotice['complete'].
"Complete: ". $this->getPercentComplete() ."%";
-
- if (isset($arrChangedAndInNotice['status']))
+ }
+ if (isset($arrChangedAndInNotice['status'])) {
$body .= "\n". $arrChangedAndInNotice['status'].
"Status: ". $this->getStatusName();
-
+ }
if (isset($arrChangedAndInNotice['assigned'])) {
$assigned = array();
foreach ($this->getAssignedTo() as $user_id) {
diff --git a/src/common/pm/ProjectTaskFactory.class.php
b/src/common/pm/ProjectTaskFactory.class.php
index d7da274..ac9c632 100644
--- a/src/common/pm/ProjectTaskFactory.class.php
+++ b/src/common/pm/ProjectTaskFactory.class.php
@@ -183,8 +183,9 @@ class ProjectTaskFactory extends FFError {
}
if ($this->assigned_to) {
$tat = $this->assigned_to ;
- if (! is_array ($tat))
- $tat = array ($tat) ;
+ if (! is_array ($tat)) {
+ $tat = array ($tat);
+ }
$qpa = db_construct_qpa($qpa, 'SELECT
project_task_vw.*, project_task_external_order.external_id
FROM project_task_vw
natural left join project_task_external_order, project_assigned_to
WHERE
project_task_vw.project_task_id = project_assigned_to.project_task_id ');
diff --git a/src/common/reporting/TimeEntry.class.php
b/src/common/reporting/TimeEntry.class.php
index 26b7869..ad8f3e0 100644
--- a/src/common/reporting/TimeEntry.class.php
+++ b/src/common/reporting/TimeEntry.class.php
@@ -41,116 +41,110 @@ require_once $gfcommon.'include/FFError.class.php';
*
*/
class TimeEntry extends FFError {
- function __construct()
- {
- }
-
- /**
- * Creates a time entry record
- *
- * NOTE: this is a real hack as it uses the existing procedural code to
call on functionality.
- * The biggest drawback is that this method will not be able to return the
Primary Key for the
- * time entry record because the key is a unixtimestamp (see the way the
UI uses timeadd.php
- * to fully appreciate what I mean).
- *
- * @author Tony Bibbs <[email protected]>
- * @access public
- * @param int $projectTaskId The project task the user is reporting
time to
- * @param int $week The week the time being reported was done
- * @param int $days_adjust Represents the offset to add to the given
week to specify the day
- * @param int $timeCode The type of work that was done (general
categorization)
- * @param float $hours The actual time spent
- * @return int This will be the Artificat ID otherwise it will be false
if an error occurred
- * @todo I'm quite concerned that none of the form data is being sanitized
for things like
- * unwanted HTML, JavaSript and SQL Injection. Might be worth adding that
sort of filtering
- * as provided by the KSES Filter (search Google).
- * @todo The check that looks to see if this method works is not language
independent.
- * someone that better understands how that all works will want to remove
the hardcoded
- * 'successfully added'.
- *
- */
- function create($projectTaskId, $week, $days_adjust, $timeCode, $hours)
- {
+ /**
+ * Creates a time entry record
+ *
+ * NOTE: this is a real hack as it uses the existing procedural code to
call on functionality.
+ * The biggest drawback is that this method will not be able to return
the Primary Key for the
+ * time entry record because the key is a unixtimestamp (see the way
the UI uses timeadd.php
+ * to fully appreciate what I mean).
+ *
+ * @author Tony Bibbs <[email protected]>
+ * @access public
+ * @param int $projectTaskId The project task the user is reporting
time to
+ * @param int $week The week the time being reported was
done
+ * @param int $days_adjust Represents the offset to add to the
given week to specify the day
+ * @param int $timeCode The type of work that was done (general
categorization)
+ * @param float $hours The actual time spent
+ * @return int This will be the Artificat ID otherwise it will be
false if an error occurred
+ * @todo I'm quite concerned that none of the form data is being
sanitized for things like
+ * unwanted HTML, JavaSript and SQL Injection. Might be worth adding
that sort of filtering
+ * as provided by the KSES Filter (search Google).
+ * @todo The check that looks to see if this method works is not
language independent.
+ * someone that better understands how that all works will want to
remove the hardcoded
+ * 'successfully added'.
+ *
+ */
+ function create($projectTaskId, $week, $days_adjust, $timeCode, $hours)
{
global $feedback;
- $report_date=($week + ($days_adjust*REPORT_DAY_SPAN))+(12*60*60);
- $res = db_query_params ('INSERT INTO rep_time_tracking
(user_id,week,report_date,project_task_id,time_code,hours) VALUES
($1,$2,$3,$4,$5,$6)',
+ $report_date=($week +
($days_adjust*REPORT_DAY_SPAN))+(12*60*60);
+ $res = db_query_params ('INSERT INTO rep_time_tracking
(user_id,week,report_date,project_task_id,time_code,hours) VALUES
($1,$2,$3,$4,$5,$6)',
array (user_getid(),
$week,
$report_date,
$projectTaskId,
$timeCode,
$hours)) ;
- if (!$res) {
- exit_error(db_error(),'tracker');
- } else {
- $feedback.=_('Successfully Added');
- }
- return db_affected_rows($res);
- }
+ if (!$res) {
+ exit_error(db_error(),'tracker');
+ } else {
+ $feedback.=_('Successfully Added');
+ }
+ return db_affected_rows($res);
+ }
- /**
- * Updates a timeEntry record.
- *
- * This isn't supported by the current timeadd.php code so I'm assuming
that all
- * that is expected is that instead of changing something you'd simply
delete it
- * and readd it. Messy, IMHO, but I am still including this method here
to let
- * know I purposely left this unimplemented.
- *
- * @author Tony Bibbs <[email protected]>
- * @access public
- * @return bool Always false
- *
- */
- function update()
- {
- // Not supported in timeadd.php
- return false;
- }
+ /**
+ * Updates a timeEntry record.
+ *
+ * This isn't supported by the current timeadd.php code so I'm assuming
that all
+ * that is expected is that instead of changing something you'd simply
delete it
+ * and readd it. Messy, IMHO, but I am still including this method
here to let
+ * know I purposely left this unimplemented.
+ *
+ * @author Tony Bibbs <[email protected]>
+ * @access public
+ * @return bool Always false
+ *
+ */
+ function update() {
+ // Not supported in timeadd.php
+ return false;
+ }
- /**
- * Deletes an existing timeEntry record
- *
- * @author Tony Bibbs <[email protected]>
- * @access public
- * @param int $projectTaskId ID for the task which the time entry
record belongs to.
- * @param int $reportDate
- * @param int $oldTimeCode ID of time code that was associated with
time entry record.
- * @return bool True if delete works, otherwise false)
- *
- */
- function delete($projectTaskId, $reportDate, $oldTimeCode)
- {
- global $_POST;
+ /**
+ * Deletes an existing timeEntry record
+ *
+ * @author Tony Bibbs <[email protected]>
+ * @access public
+ * @param int $projectTaskId ID for the task which the time entry
record belongs to.
+ * @param int $reportDate
+ * @param int $oldTimeCode ID of time code that was associated
with time entry record.
+ * @return bool True if delete works, otherwise false)
+ *
+ */
+ function delete($projectTaskId, $reportDate, $oldTimeCode) {
+ global $_POST;
- // Trick procedural code into thinking this was posted via the HTML
form
- $_POST['submit'] = 1;
- $_POST['delete'] = 1;
+ // Trick procedural code into thinking this was posted via the
HTML form
+ $_POST['submit'] = 1;
+ $_POST['delete'] = 1;
- // Sanitize the data at some point.
- $project_task_id = $projectTaskId;
- $report_date = $reportDate;
- $old_time_code = $oldTimeCode;
+ // Sanitize the data at some point.
+ $project_task_id = $projectTaskId;
+ $report_date = $reportDate;
+ $old_time_code = $oldTimeCode;
- // Prepare to have the procedural code process all of this. We'll
need to buffer any
- // output so we can gracefully ignore it since this class is only used
by the SOAP
- // interface
- ob_start();
+ // Prepare to have the procedural code process all of this.
We'll need to buffer any
+ // output so we can gracefully ignore it since this class is
only used by the SOAP
+ // interface
+ ob_start();
- // Now pull in the procedural code to handle the processing.
- require_once $GLOBALS['gfwww'].'reporting/timeadd.php';
- $tmpOutput = ob_get_contents();
+ // Now pull in the procedural code to handle the processing.
+ require_once $GLOBALS['gfwww'].'reporting/timeadd.php';
+ $tmpOutput = ob_get_contents();
- // Now discard any output.
- ob_clean();
+ // Now discard any output.
+ ob_clean();
- if (!stristr($tmpOutput, 'successfully deleted')) return false;
- return true;
- }
+ if (!stristr($tmpOutput, 'successfully deleted')) {
+ return false;
+ }
+ return true;
+ }
- function getTimeCodes()
- {
- }
+ function getTimeCodes() {
+ }
}
// Local Variables:
diff --git a/src/common/survey/SurveyResponseFactory.class.php
b/src/common/survey/SurveyResponseFactory.class.php
index 21bc8c6..091f66c 100644
--- a/src/common/survey/SurveyResponseFactory.class.php
+++ b/src/common/survey/SurveyResponseFactory.class.php
@@ -238,9 +238,9 @@ class SurveyResponseFactory extends FFError {
if($is_radio) {
/* We only counts */
// ugly hack to avoid php warning, and count
correctly 'no answer' response.
- if (is_string($response) && !strlen($response))
+ if (is_string($response) && !strlen($response))
{
$response = 0;
-
+ }
$this->Result[$response]++;
} else {
/* Save response */
diff --git a/src/common/tracker/ArtifactExtraField.class.php
b/src/common/tracker/ArtifactExtraField.class.php
index 362f007..dbbb0c8 100644
--- a/src/common/tracker/ArtifactExtraField.class.php
+++ b/src/common/tracker/ArtifactExtraField.class.php
@@ -1084,7 +1084,9 @@ class ArtifactExtraField extends FFError {
'_votage'
);
- if (strlen($alias) == 0) return true; // empty alias
+ if (strlen($alias) == 0) {
+ return true; // empty alias
+ }
// invalid chars?
if (preg_match("/[^[:alnum:]_@\\-]/", $alias)) {
@@ -1162,8 +1164,7 @@ class ArtifactExtraField extends FFError {
$element_id));
if ($result && db_affected_rows($result) > 0) {
return true;
- }
- else {
+ } else {
$this->setError(db_error());
return false;
}
@@ -1190,8 +1191,9 @@ class ArtifactExtraField extends FFError {
}
}
for ($i = 0; $i < count($data); $i++) {
- if (! $this->updateOrder($data[$i], $i + 1))
+ if (! $this->updateOrder($data[$i], $i + 1)) {
return false;
+ }
}
return true;
@@ -1202,8 +1204,9 @@ class ArtifactExtraField extends FFError {
array($this->getID()));
$i = 1;
while ($row = db_fetch_array($res)) {
- if (! $this->updateOrder($row['element_id'], $i))
+ if (! $this->updateOrder($row['element_id'], $i)) {
return false;
+ }
$i++;
}
return true;
@@ -1275,8 +1278,9 @@ class ArtifactExtraField extends FFError {
if ($result) {
while ($row = db_fetch_array($result)) {
- if ($row['element_id'] > 0)
+ if ($row['element_id'] > 0) {
return $row['element_id'];
+ }
}
}
diff --git a/src/common/tracker/ArtifactQuery.class.php
b/src/common/tracker/ArtifactQuery.class.php
index bc04abd..198bc78 100644
--- a/src/common/tracker/ArtifactQuery.class.php
+++ b/src/common/tracker/ArtifactQuery.class.php
@@ -580,8 +580,9 @@ class ArtifactQuery extends FFError {
* @return string The column name.
*/
function getSortCol() {
- if (!isset($this->element_array))
+ if (!isset($this->element_array)) {
return false;
+ }
return $this->element_array[ARTIFACT_QUERY_SORTCOL][0];
}
@@ -591,8 +592,9 @@ class ArtifactQuery extends FFError {
* @return string ASC or DESC
*/
function getSortOrd() {
- if (!isset($this->element_array))
+ if (!isset($this->element_array)) {
return false;
+ }
return $this->element_array[ARTIFACT_QUERY_SORTORD][0];
}
@@ -602,8 +604,9 @@ class ArtifactQuery extends FFError {
* @return string mod date range.
*/
function getModDateRange() {
- if (!isset($this->element_array))
+ if (!isset($this->element_array)) {
return false;
+ }
if ($this->element_array[ARTIFACT_QUERY_MODDATE][0]) {
return $this->element_array[ARTIFACT_QUERY_MODDATE][0];
} else {
@@ -617,8 +620,9 @@ class ArtifactQuery extends FFError {
* @return string Open date range.
*/
function getOpenDateRange() {
- if (!isset($this->element_array))
+ if (!isset($this->element_array)) {
return false;
+ }
if (isset($this->element_array[ARTIFACT_QUERY_OPENDATE][0])) {
return $this->element_array[ARTIFACT_QUERY_OPENDATE][0];
} else {
@@ -632,8 +636,9 @@ class ArtifactQuery extends FFError {
* @return string Close date range.
*/
function getCloseDateRange() {
- if (!isset($this->element_array))
+ if (!isset($this->element_array)) {
return false;
+ }
if (isset($this->element_array[ARTIFACT_QUERY_CLOSEDATE][0])) {
return
$this->element_array[ARTIFACT_QUERY_CLOSEDATE][0];
} else {
@@ -683,8 +688,9 @@ class ArtifactQuery extends FFError {
* @return string Assignee ID
*/
function getAssignee() {
- if (!isset($this->element_array[ARTIFACT_QUERY_ASSIGNEE]))
+ if (!isset($this->element_array[ARTIFACT_QUERY_ASSIGNEE])) {
return false;
+ }
return $this->element_array[ARTIFACT_QUERY_ASSIGNEE][0];
}
@@ -694,8 +700,9 @@ class ArtifactQuery extends FFError {
* @return string Submitter ID
*/
function getSubmitter() {
- if (!isset($this->element_array[ARTIFACT_QUERY_SUBMITTER]))
+ if (!isset($this->element_array[ARTIFACT_QUERY_SUBMITTER])) {
return false;
+ }
return $this->element_array[ARTIFACT_QUERY_SUBMITTER][0];
}
@@ -705,9 +712,10 @@ class ArtifactQuery extends FFError {
* @return string Last Modifier ID
*/
function getLastModifier() {
- if (!isset($this->element_array[ARTIFACT_QUERY_LAST_MODIFIER]))
+ if (!isset($this->element_array[ARTIFACT_QUERY_LAST_MODIFIER]))
{
return false;
- return
$this->element_array[ARTIFACT_QUERY_LAST_MODIFIER][0];
+ }
+ return $this->element_array[ARTIFACT_QUERY_LAST_MODIFIER][0];
}
/**
@@ -716,8 +724,9 @@ class ArtifactQuery extends FFError {
* @return string Status ID
*/
function getStatus() {
- if (!isset($this->element_array))
+ if (!isset($this->element_array)) {
return false;
+ }
return $this->element_array[ARTIFACT_QUERY_STATE][0];
}
@@ -727,8 +736,9 @@ class ArtifactQuery extends FFError {
* @return array Complex Array
*/
function getExtraFields() {
- if (!isset($this->element_array))
+ if (!isset($this->element_array)) {
return false;
+ }
if (! isset ($this->element_array[ARTIFACT_QUERY_EXTRAFIELD])) {
$this->element_array[ARTIFACT_QUERY_EXTRAFIELD] = array
() ;
}
@@ -744,8 +754,7 @@ class ArtifactQuery extends FFError {
function validateDateRange(&$daterange) {
if(! preg_match('/([0-9]{4})-[0-9]{2}-[0-9]{2}
([0-9]{4})-[0-9]{2}-[0-9]{2}/', $daterange, $matches)) {
return false;
- }
- else {
+ } else {
# Hack to avoid exceeding the maximum value for an
integer in the database
if ($matches[1] > 2037) {
$daterange =
preg_replace('/[\d]{4}(-[\d]{2}-[\d]{2} [\d]{4}-[\d]{2}-[\d]{2})/', '2037$1',
$daterange);
diff --git a/src/common/tracker/ArtifactWorkflow.class.php
b/src/common/tracker/ArtifactWorkflow.class.php
index 058a301..c6db137 100644
--- a/src/common/tracker/ArtifactWorkflow.class.php
+++ b/src/common/tracker/ArtifactWorkflow.class.php
@@ -55,9 +55,9 @@ class ArtifactWorkflow extends FFError {
// Check if the following event is allowed or not.
// return true is allowed, false if not.
function checkEvent($from, $to) {
- if ($from === $to)
+ if ($from === $to) {
return true;
-
+ }
$res = db_query_params ('SELECT event_id FROM
artifact_workflow_event
WHERE group_artifact_id=$1
AND field_id=$2
@@ -70,9 +70,9 @@ class ArtifactWorkflow extends FFError {
$event_id = db_result($res, 0, 'event_id');
if ($event_id) {
// No role based checks for the initial transition.
- if ($from == 100)
+ if ($from == 100) {
return true;
-
+ }
// There is a transition, now check if current role is
allowed.
$rids = array () ;
$available_roles =
RBACEngine::getInstance()->getAvailableRoles() ;
diff --git a/src/common/tracker/EffortUnit.class.php
b/src/common/tracker/EffortUnit.class.php
index 168daab..e8a5ebd 100644
--- a/src/common/tracker/EffortUnit.class.php
+++ b/src/common/tracker/EffortUnit.class.php
@@ -477,8 +477,9 @@ class EffortUnit extends FFError {
}
for ($pos = 1; $pos <= count($data); $pos++) {
$unit = new
EffortUnit($this->EffortUnitSet,$data[$pos]);
- if (! $unit->updatePosition($pos))
+ if (! $unit->updatePosition($pos)) {
return false;
+ }
}
return true;
}
diff --git a/src/common/tracker/Roadmap.class.php
b/src/common/tracker/Roadmap.class.php
index 353417b..b880117 100644
--- a/src/common/tracker/Roadmap.class.php
+++ b/src/common/tracker/Roadmap.class.php
@@ -94,8 +94,9 @@ class Roadmap extends FFError {
// Public methods
public function create($name) {
- if (! $this->_isAdmin()) return false;
-
+ if (! $this->_isAdmin()) {
+ return false;
+ }
$result = db_query_params ('SELECT * FROM roadmap WHERE
group_id=$1 AND name=$2',
array ($this->group_id, $name));
if ($result && db_numrows($result)) {
@@ -119,17 +120,18 @@ class Roadmap extends FFError {
}
public function delete() {
- if (! $this->_isAdmin()) return false;
-
+ if (!$this->_isAdmin()) {
+ return false;
+ }
$result = db_query_params('DELETE FROM roadmap_list WHERE
roadmap_id=$1',
array ($this->roadmap_id));
- if (! $result) {
+ if (!$result) {
$this->setError('in delete, '.db_error());
return false;
}
$result = db_query_params('DELETE FROM roadmap WHERE
roadmap_id=$1',
array ($this->roadmap_id));
- if (! $result) {
+ if (!$result) {
$this->setError('in delete, '.db_error());
return false;
}
@@ -147,12 +149,14 @@ class Roadmap extends FFError {
}
public function rename($name) {
- if (! $this->_isAdmin()) return false;
+ if (!$this->_isAdmin()) {
+ return false;
+ }
$result = db_query_params('UPDATE roadmap SET name=$1 WHERE
roadmap_id=$2',
array ($name,
$this->roadmap_id));
- if (! $result) {
+ if (!$result) {
$this->setError('in rename, '.db_error());
return false;
}
@@ -165,20 +169,23 @@ class Roadmap extends FFError {
}
public function enable() {
- if (! $this->_isAdmin()) return false;
-
+ if (! $this->_isAdmin()) {
+ return false;
+ }
return $this->_setState(1);
}
public function disable() {
- if (! $this->_isAdmin()) return false;
-
+ if (! $this->_isAdmin()) {
+ return false;
+ }
return $this->_setState(0);
}
public function setState($state) {
- if (! $this->_isAdmin()) return false;
-
+ if (! $this->_isAdmin()) {
+ return false;
+ }
switch ($state) {
case 0:
case false:
@@ -207,8 +214,9 @@ class Roadmap extends FFError {
}
public function setReleaseOrder($release_order) {
- if (! $this->_isAdmin()) return false;
-
+ if (! $this->_isAdmin()) {
+ return false;
+ }
$result = db_query_params('UPDATE roadmap SET release_order=$1
WHERE roadmap_id=$2',
array (serialize($release_order),
$this->roadmap_id));
@@ -225,8 +233,9 @@ class Roadmap extends FFError {
}
public function setDefault($default) {
- if (! $this->_isAdmin()) return false;
-
+ if (! $this->_isAdmin()) {
+ return false;
+ }
$result = db_query_params('UPDATE roadmap SET is_default=$1
WHERE roadmap_id=$2',
array ($default,
$this->roadmap_id));
@@ -248,8 +257,9 @@ class Roadmap extends FFError {
}
public function setList($arg1, $arg2=false) {
- if (! $this->_isAdmin()) return false;
-
+ if (! $this->_isAdmin()) {
+ return false;
+ }
if (is_array($arg1)) {
db_begin();
foreach ($arg1 as $artifact_type_id => $field_id) {
@@ -366,8 +376,7 @@ class Roadmap extends FFError {
case 'release_order':
if ($value) {
$this->release_order =
unserialize($value);
- }
- else {
+ } else {
$this->release_order =
array();
}
break;
@@ -393,7 +402,9 @@ class Roadmap extends FFError {
$this->name = db_result($result, 0, 'name');
$this->enable = db_result($result, 0, 'enable');
$tmp = db_result($result, 0, 'release_order');
- if ($tmp) $this->release_order =
unserialize($tmp);
+ if ($tmp) {
+ $this->release_order =
unserialize($tmp);
+ }
$this->is_default = db_result($result, 0,
'is_default');
db_free_result($result);
}
@@ -478,8 +489,7 @@ class Roadmap extends FFError {
if (isset($this->is_admin)) {
if ($this->is_admin) {
return true;
- }
- else {
+ } else {
$this->setPermissionDeniedError();
return false;
}
diff --git a/src/common/tracker/actions/admin-updates.php
b/src/common/tracker/actions/admin-updates.php
index 447fa2b..97a5e67 100644
--- a/src/common/tracker/actions/admin-updates.php
+++ b/src/common/tracker/actions/admin-updates.php
@@ -529,16 +529,19 @@ if (getStringFromRequest('add_extrafield')) {
}
$new_pos = intval($new_pos);
if ($new_pos < 1 ) {
- if (! isset($out_before[$new_pos]))
+ if (! isset($out_before[$new_pos])) {
$out_before[$new_pos] = array();
+ }
$out_before[$new_pos][] = $field;
} elseif ($new_pos > $list_size) {
- if (! isset($out_after[$new_pos]))
+ if (! isset($out_after[$new_pos])) {
$out_after[$new_pos] = array();
+ }
$out_after[$new_pos][] = $field;
} else {
- if (! isset($changed[$new_pos - 1]))
+ if (! isset($changed[$new_pos - 1])) {
$changed[$new_pos - 1] = array();
+ }
$changed[$new_pos - 1][] = $field;
}
}
@@ -662,18 +665,20 @@ if (getStringFromRequest('add_extrafield')) {
} else {
$updated_flag = 0;
foreach ($order as $id => $new_pos) {
- if ($new_pos == '') continue;
+ if ($new_pos == '') {
+ continue;
+ }
if (!$ac->reorderValues($id, $new_pos)) {
$error_msg .= _('Update failed')._(':
').$ac->getErrorMessage();
$ac->clearError();
continue;
- }
- else {
+ } else {
$updated_flag = 1;
}
}
- if ($updated_flag)
+ if ($updated_flag) {
$feedback .= _('Tracker Updated');
+ }
}
} elseif (getStringFromRequest('post_changes_alphaorder')) {
diff --git a/src/common/tracker/actions/browse.php
b/src/common/tracker/actions/browse.php
index 4b0c3ff..698a4c9 100644
--- a/src/common/tracker/actions/browse.php
+++ b/src/common/tracker/actions/browse.php
@@ -97,9 +97,9 @@ if (session_loggedin()) {
}
}
-if(!isset($paging) || !$paging)
+if(!isset($paging) || !$paging) {
$paging = 25;
-
+}
$af = new ArtifactFactory($ath);
if (!$af || !is_object($af)) {
@@ -258,11 +258,12 @@ if ($art_arr && ($art_cnt = count($art_arr)) > 0) {
if ($art_cnt) {
if ($focus) {
- for ($i = 0; $i < $art_cnt; ++$i)
+ for ($i = 0; $i < $art_cnt; ++$i) {
if ($art_arr[$i]->getID() == $focus) {
$start = $i;
break;
}
+ }
}
$max = ($art_cnt > ($start + $paging)) ? ($start + $paging) : $art_cnt;
} else {
diff --git a/src/common/tracker/actions/tracker.php
b/src/common/tracker/actions/tracker.php
index 574a8e4..5dce4a4 100644
--- a/src/common/tracker/actions/tracker.php
+++ b/src/common/tracker/actions/tracker.php
@@ -273,10 +273,12 @@ switch (getStringFromRequest('func')) {
require_once
$gfcommon.'pm/ProjectTask.class.php';
foreach ($remlink as $tid) {
$pt = projecttask_get_object($tid);
- if (!$pt || $pt->isError())
+ if (!$pt || $pt->isError()) {
exit_error(_('Error'),
sprintf(_('Could not get Project Task for %d'), $tid));
- if
(!$pt->removeRelatedArtifacts(array($artifact_id)))
+ }
+ if
(!$pt->removeRelatedArtifacts(array($artifact_id))) {
exit_error($tid."->removeRelatedArtifacts(".$artifact_id.")",
$pt->getErrorMessage());
+ }
}
}
/*
diff --git a/src/common/tracker/include/ArtifactHtml.class.php
b/src/common/tracker/include/ArtifactHtml.class.php
index a71a77b..d936760 100644
--- a/src/common/tracker/include/ArtifactHtml.class.php
+++ b/src/common/tracker/include/ArtifactHtml.class.php
@@ -75,8 +75,9 @@ class ArtifactHtml extends Artifact {
$u = session_get_user();
$order = $u->getPreference('tracker_messages_order');
}
- if (!isset($order) || !$order) $order = 'up';
-
+ if (!isset($order) || !$order) {
+ $order = 'up';
+ }
$result = $this->getMessages($order);
$rows = db_numrows($result);
diff --git a/src/common/tracker/include/ArtifactTypeHtml.class.php
b/src/common/tracker/include/ArtifactTypeHtml.class.php
index 8c1fec5..d747f64 100644
--- a/src/common/tracker/include/ArtifactTypeHtml.class.php
+++ b/src/common/tracker/include/ArtifactTypeHtml.class.php
@@ -217,9 +217,9 @@ class ArtifactTypeHtml extends ArtifactType {
$post_name = '';
$i=$keys[$k];
- if
(!isset($selected[$efarr[$i]['extra_field_id']]))
+ if
(!isset($selected[$efarr[$i]['extra_field_id']])) {
$selected[$efarr[$i]['extra_field_id']]
= '';
-
+ }
$value =
$selected[$efarr[$i]['extra_field_id']];
$type = $efarr[$i]['field_type'];
@@ -299,9 +299,9 @@ class ArtifactTypeHtml extends ArtifactType {
}
}
- if (!isset($selected[$efarr[$i]['extra_field_id']]))
+ if (!isset($selected[$efarr[$i]['extra_field_id']])) {
$selected[$efarr[$i]['extra_field_id']] = '';
-
+ }
if ($status_show_100) {
$efarr[$i]['show100'] = $status_show_100;
}
@@ -588,8 +588,9 @@ class ArtifactTypeHtml extends ArtifactType {
$keys=array_keys($efarr);
$count=count($keys);
- if ($count == 0) return '';
-
+ if ($count == 0) {
+ return '';
+ }
for ($k=0; $k<$count; $k++) {
$i=$keys[$k];
diff --git a/src/common/tracker/views/form-adminroadmap.php
b/src/common/tracker/views/form-adminroadmap.php
index 15c06e2..d130318 100644
--- a/src/common/tracker/views/form-adminroadmap.php
+++ b/src/common/tracker/views/form-adminroadmap.php
@@ -298,16 +298,19 @@ if (getIntFromRequest('manage_release') ||
}
$new_pos = intval($new_pos);
if ($new_pos < 1) {
- if
(!isset($out_before[$new_pos]))
+ if
(!isset($out_before[$new_pos])) {
$out_before[$new_pos] =
array();
+ }
$out_before[$new_pos][] =
$field;
} elseif ($new_pos > $list_size) {
- if
(!isset($out_after[$new_pos]))
+ if
(!isset($out_after[$new_pos])) {
$out_after[$new_pos] =
array();
+ }
$out_after[$new_pos][] = $field;
} else {
- if (!isset($changed[$new_pos -
1]))
+ if (!isset($changed[$new_pos -
1])) {
$changed[$new_pos - 1]
= array();
+ }
$changed[$new_pos - 1][] =
$field;
}
}
diff --git a/src/common/tracker/views/form-updateextrafield.php
b/src/common/tracker/views/form-updateextrafield.php
index 16e65ee..938367a 100644
--- a/src/common/tracker/views/form-updateextrafield.php
+++ b/src/common/tracker/views/form-updateextrafield.php
@@ -133,8 +133,9 @@ if (!$ac || !is_object($ac)) {
$progenyField = $ac->getProgeny();
if (is_array($pfarr)) {
foreach ($pfarr as $pf) {
- if ($pf['extra_field_id'] != $id &&
!in_array($pf['extra_field_id'], $progenyField))
- $parentField[$pf['extra_field_id']] =
$pf['field_name'];
+ if ($pf['extra_field_id'] != $id &&
!in_array($pf['extra_field_id'], $progenyField)) {
+ $parentField[$pf['extra_field_id']] =
$pf['field_name'];
+ }
}
}
asort($parentField,SORT_FLAG_CASE | SORT_STRING);
diff --git a/src/common/widget/Widget_MyArtifacts.class.php
b/src/common/widget/Widget_MyArtifacts.class.php
index a359e1c..cae4ae5 100644
--- a/src/common/widget/Widget_MyArtifacts.class.php
+++ b/src/common/widget/Widget_MyArtifacts.class.php
@@ -213,14 +213,16 @@ class Widget_MyArtifacts extends Widget {
}
if ($trackers_array->getSubmittedBy()
== user_getid()) {
$AS_flag .= 'S';
- if (strlen($AS_title))
+ if (strlen($AS_title)) {
$AS_title .= ' / ';
+ }
$AS_title .= _('Submitted');
}
if ($trackers_array->isMonitoring()) {
$AS_flag .= 'M';
- if (strlen($AS_title))
+ if (strlen($AS_title)) {
$AS_title .= ' / ';
+ }
$AS_title .= _('Monitored');
}
if (!strlen($AS_flag)) {
diff --git a/src/common/widget/Widget_MyProjects.class.php
b/src/common/widget/Widget_MyProjects.class.php
index 35f68fd..bcb78e3 100644
--- a/src/common/widget/Widget_MyProjects.class.php
+++ b/src/common/widget/Widget_MyProjects.class.php
@@ -55,7 +55,9 @@ class Widget_MyProjects extends Widget {
$i = 0;
$ra = RoleAnonymous::getInstance();
foreach ($groups as $g) {
- if ($g->getStatus() != 'A') continue;
+ if ($g->getStatus() != 'A') {
+ continue;
+ }
$i++;
$html_my_projects .= '
<tr><td style="width:99%">'.
diff --git a/src/common/widget/Widget_MySystasks.class.php
b/src/common/widget/Widget_MySystasks.class.php
index 52c2dc6..667e55d 100644
--- a/src/common/widget/Widget_MySystasks.class.php
+++ b/src/common/widget/Widget_MySystasks.class.php
@@ -40,8 +40,9 @@ class Widget_MySystasks extends Widget {
$user = session_get_user();
$groups = $user->getGroups();
$gids = array();
- foreach($groups as $g)
+ foreach($groups as $g) {
$gids[] = $g->getID();
+ }
if (empty($gids)) {
return $HTML->information(_('Not member of any
project'));
}
diff --git a/src/common/widget/Widget_Rss.class.php
b/src/common/widget/Widget_Rss.class.php
index 424c703..9d4c410 100644
--- a/src/common/widget/Widget_Rss.class.php
+++ b/src/common/widget/Widget_Rss.class.php
@@ -53,9 +53,11 @@ require_once 'Widget.class.php';
return idn_to_unicode($param);
}
}
- if (!(include_once 'simplepie/autoloader.php')) //
vendor, debian
- if (!(include_once
'php-simplepie/autoloader.php')) // fedora
+ if (!(include_once 'simplepie/autoloader.php')) { //
vendor, debian
+ if (!(include_once
'php-simplepie/autoloader.php')) { // fedora
exit_error(_('Could not load the
SimplePie PHP library.'));
+ }
+ }
if (!is_dir(forge_get_config('data_path') .'/rss')) {
if (!mkdir(forge_get_config('data_path')
.'/rss')) {
$content .= $HTML->error_msg(_('Cannot
create backend directory. Contact forge administrator.'));
@@ -162,9 +164,11 @@ require_once 'Widget.class.php';
function create() {
$rss = getArrayFromRequest('rss');
- if (!(include_once 'simplepie/simplepie.inc')) // vendor,
debian
- if (!(include_once 'php-simplepie/autoloader.php')) //
fedora
+ if (!(include_once 'simplepie/simplepie.inc')) { // vendor,
debian
+ if (!(include_once 'php-simplepie/autoloader.php')) {
// fedora
exit_error(_('Could not load the SimplePie PHP
library.'));
+ }
+ }
if (!is_dir(forge_get_config('data_path') .'/rss')) {
mkdir(forge_get_config('data_path') .'/rss');
}
diff --git a/src/cronjobs/db/get_news_notapproved.php
b/src/cronjobs/db/get_news_notapproved.php
index e7aaca1..1225a5c 100755
--- a/src/cronjobs/db/get_news_notapproved.php
+++ b/src/cronjobs/db/get_news_notapproved.php
@@ -69,8 +69,9 @@ foreach ($results_array as $newsnotapprob) {
$emailformatted .= wordwrap($title, 78);
$emailformatted .=
"----------------------------------------------------------------------\n";
$t = explode("\n", wordwrap($details, 70));
- foreach ($t as $line)
+ foreach ($t as $line) {
$emailformatted .= str_repeat(' ', 8) . $line . "\n";
+ }
$emailformatted .= "\n\n";
}
}
diff --git a/src/cronjobs/db/rotate_activity.php
b/src/cronjobs/db/rotate_activity.php
index c9ce847..b53191e 100755
--- a/src/cronjobs/db/rotate_activity.php
+++ b/src/cronjobs/db/rotate_activity.php
@@ -23,18 +23,19 @@ require
dirname(__FILE__).'/../../common/include/env.inc.php';
require_once $gfcommon.'include/pre.php';
require_once $gfcommon.'include/cron_utils.php';
-$err='';
+$err = '';
-$today_formatted=date('Ymd',(time()-(30*60*60*24)));
+$today_formatted = date('Ymd',(time()-(30*60*60*24)));
db_begin();
-db_query_params ('DELETE FROM activity_log WHERE day < $1',
- array ($today_formatted));
+db_query_params('DELETE FROM activity_log WHERE day < $1',
array($today_formatted));
$err .= db_error();
db_commit();
-if (!$err) $err = 'Done';
+if (!$err) {
+ $err = 'Done';
+}
-cron_entry(10,$err);
+cron_entry(10, $err);
diff --git a/src/cronjobs/lists/mailing_lists_create.php
b/src/cronjobs/lists/mailing_lists_create.php
index c0d4cf0..11690ac 100755
--- a/src/cronjobs/lists/mailing_lists_create.php
+++ b/src/cronjobs/lists/mailing_lists_create.php
@@ -91,7 +91,9 @@ for ($i=0; $i<$rows; $i++) {
$public = db_result($res,$i,'is_public');
$status = db_result($res,$i,'status');
$description = db_result($res, $i, 'description');
- if ($coding == 'iso-8859-1') $description = utf8_decode($description);
+ if ($coding == 'iso-8859-1') {
+ $description = utf8_decode($description);
+ }
$description = str_replace('"', '\"', $description);
$listname = trim($listname);
@@ -138,7 +140,9 @@ for ($i=0; $i<$rows; $i++) {
$listConfig .= "subscribe_policy = 1\n" ;
}
fwrite($fh, $listConfig);
- if (is_readable($custom_file)) fwrite($fh,
file_get_contents($custom_file));
+ if (is_readable($custom_file)) {
+ fwrite($fh, file_get_contents($custom_file));
+ }
fclose($fh);
$config_cmd =
escapeshellcmd($path_to_mailman."/bin/config_list -i $tmp $listname");
passthru($config_cmd, $failed);
@@ -181,7 +185,9 @@ for ($i=0; $i<$rows; $i++) {
$listConfig .= "subscribe_policy = 1\n";
}
fwrite($fh, $listConfig);
- if (is_readable($custom_file)) fwrite($fh,
file_get_contents($custom_file));
+ if (is_readable($custom_file)) {
+ fwrite($fh, file_get_contents($custom_file));
+ }
fclose($fh);
$config_cmd = escapeshellcmd($path_to_mailman."/bin/config_list
-i $tmp $listname");
passthru($config_cmd, $failed);
diff --git a/src/cronjobs/misc/backup_site.php
b/src/cronjobs/misc/backup_site.php
index 08898c0..9fab226 100755
--- a/src/cronjobs/misc/backup_site.php
+++ b/src/cronjobs/misc/backup_site.php
@@ -169,9 +169,13 @@ if (file_exists($svndir_prefix)) {
mkdir($repos_backup_dir);
$dh = opendir($svndir_prefix);
while ($file = readdir($dh)) {
- if (preg_match('/^\\./', $file)) continue;
// skip files that start with a dot
+ if (preg_match('/^\\./', $file)) {
+ continue; // skip files that start with a dot
+ }
$path = $svndir_prefix.'/'.$file;
- if (!is_dir($path)) continue; // not a
repository
+ if (!is_dir($path)) {
+ continue; // not a repository
+ }
$cmd = 'SVN_PATH="'.$svn_path.'" '.$hot_backup.'
'.$path.' '.$repos_backup_dir;
@exec($cmd, $output, $retval);
if ($retval != 0) {
diff --git a/src/cronjobs/misc/forum_gateway.php
b/src/cronjobs/misc/forum_gateway.php
index 8ca67fd..afe1195 100755
--- a/src/cronjobs/misc/forum_gateway.php
+++ b/src/cronjobs/misc/forum_gateway.php
@@ -123,11 +123,12 @@ class ForumGateway extends FFError {
$this->FromEmail = $mp->getFromEmail();
$subj = $mp->getSubject();
- if ($mp->isError())
+ if ($mp->isError()) {
$this->setError($mp->getErrorMessage());
- if ($subj === false)
+ }
+ if ($subj === false) {
return false;
-
+ }
if (preg_match('/(\[)([0-9]*)(\])/',$subj,$arr)) {
$this->Parent=$arr[2];
$parent_end=(strpos($subj,'['.$arr[2].']')) +
strlen('['.$arr[2].']');
@@ -228,7 +229,9 @@ class ForumGateway extends FFError {
// Find User id using email
$from = strtolower($this->FromEmail);
// If no user id, user id is 0;
- if (! $from) return 0;
+ if (! $from) {
+ return 0;
+ }
$res = db_query_params ('SELECT user_id FROM users
WHERE lower(email) = $1 AND status = $2',
array (strtolower($from),
diff --git a/src/cronjobs/misc/mailaliases.php
b/src/cronjobs/misc/mailaliases.php
index 01dee75..8368917 100755
--- a/src/cronjobs/misc/mailaliases.php
+++ b/src/cronjobs/misc/mailaliases.php
@@ -67,16 +67,18 @@ for ($i=0; $i < count($aliases_orig); $i++) {
} while ($i < count($aliases_orig) &&
!preg_match("/^[[:blank:]]*#GFORGEEND/", $line));
// Got to end of file (shouldn't happen, means #GFORGEEND
wasn't found on file
- if ($i >= (count($aliases_orig)-1)) break;
-
+ if ($i >= (count($aliases_orig)-1)) {
+ break;
+ }
// read next line
$i++;
$line = trim($aliases_orig[$i]);
}
// empty line or comment
- if (empty($line) || preg_match('/^#/', $line)) continue;
-
+ if (empty($line) || preg_match('/^#/', $line)) {
+ continue;
+ }
list($alias_name, $alias) = explode(':', $line, 2);
$alias_name = trim($alias_name);
$alias = trim($alias);
@@ -149,7 +151,9 @@ if (forge_get_config('use_mail') &&
file_exists(forge_get_config('data_path').'/
$mailmanline = explode(":",$mailmanlines[$k], 2);
$alias = trim($mailmanline[0]);
- if (empty($alias)) continue;
+ if (empty($alias)) {
+ continue;
+ }
$command = trim($mailmanline[1]);
if (array_key_exists($alias, $aliases)) {
diff --git a/src/cronjobs/scm/gather_scm_stats.php
b/src/cronjobs/scm/gather_scm_stats.php
index 6464eac..0fa7624 100755
--- a/src/cronjobs/scm/gather_scm_stats.php
+++ b/src/cronjobs/scm/gather_scm_stats.php
@@ -93,7 +93,6 @@ if (!$res) {
return false;
}
-
$output = '';
while ($data = db_fetch_array ($res)) {
($verbose) && print 'Processing GroupId '.$data['group_id'].'
('.$data['group_name'].")\n";
@@ -124,9 +123,6 @@ while ($data = db_fetch_array ($res)) {
}
}
-if ($output) cron_entry(28, $output);
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
+if ($output) {
+ cron_entry(28, $output);
+}
-----------------------------------------------------------------------
Summary of changes:
src/common/include/MonitorElement.class.php | 4 +-
src/common/include/RBACEngine.class.php | 3 +-
src/common/include/Storage.class.php | 4 +-
src/common/include/TextSanitizer.class.php | 4 +-
src/common/include/User.class.php | 4 +-
src/common/include/account.php | 9 +-
src/common/include/cron_utils.php | 4 +-
src/common/include/database-pgsql.php | 21 +-
src/common/include/forms.php | 4 +-
src/common/include/html.php | 35 ++-
src/common/include/minijson.php | 339 +++++++++++----------
src/common/include/pre.php | 12 +-
src/common/include/session.php | 5 +-
src/common/include/tag_cloud.php | 26 +-
src/common/include/utils.php | 46 +--
src/common/pm/ProjectTask.class.php | 16 +-
src/common/pm/ProjectTaskFactory.class.php | 5 +-
src/common/reporting/TimeEntry.class.php | 180 ++++++-----
src/common/survey/SurveyResponseFactory.class.php | 4 +-
src/common/tracker/ArtifactExtraField.class.php | 16 +-
src/common/tracker/ArtifactQuery.class.php | 35 ++-
src/common/tracker/ArtifactWorkflow.class.php | 8 +-
src/common/tracker/EffortUnit.class.php | 3 +-
src/common/tracker/Roadmap.class.php | 60 ++--
src/common/tracker/actions/admin-updates.php | 19 +-
src/common/tracker/actions/browse.php | 7 +-
src/common/tracker/actions/tracker.php | 6 +-
src/common/tracker/include/ArtifactHtml.class.php | 5 +-
.../tracker/include/ArtifactTypeHtml.class.php | 13 +-
src/common/tracker/views/form-adminroadmap.php | 9 +-
src/common/tracker/views/form-updateextrafield.php | 5 +-
src/common/widget/Widget_MyArtifacts.class.php | 6 +-
src/common/widget/Widget_MyProjects.class.php | 4 +-
src/common/widget/Widget_MySystasks.class.php | 3 +-
src/common/widget/Widget_Rss.class.php | 12 +-
src/cronjobs/db/get_news_notapproved.php | 3 +-
src/cronjobs/db/rotate_activity.php | 13 +-
src/cronjobs/lists/mailing_lists_create.php | 12 +-
src/cronjobs/misc/backup_site.php | 8 +-
src/cronjobs/misc/forum_gateway.php | 11 +-
src/cronjobs/misc/mailaliases.php | 14 +-
src/cronjobs/scm/gather_scm_stats.php | 10 +-
42 files changed, 568 insertions(+), 439 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits