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 0920f71c793b5e6cee321f02e0b39345468c05fb (commit)
from c05c78a43982d84a1bd7b9841a9ee3cba60b080f (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=0920f71c793b5e6cee321f02e0b39345468c05fb
commit 0920f71c793b5e6cee321f02e0b39345468c05fb
Author: Marc-Etienne Vargenau <[email protected]>
Date: Tue Jul 12 16:34:23 2016 +0200
Consistent return; add curly braces
diff --git a/src/common/include/Navigation.class.php
b/src/common/include/Navigation.class.php
index 79b7d58..b1fe5bb 100644
--- a/src/common/include/Navigation.class.php
+++ b/src/common/include/Navigation.class.php
@@ -155,8 +155,9 @@ class Navigation extends FFError {
for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
$searchEngine =& $searchEngines[$i];
$attrs = array('value' => $searchEngine->getType());
- if ( $type_of_search == $searchEngine->getType())
+ if ( $type_of_search == $searchEngine->getType()) {
$attrs['selected'] = 'selected';
+ }
$res .= html_e('option', $attrs,
$searchEngine->getLabel($parameters), false);
}
$res .= html_ac(html_ap() - 1);
@@ -342,7 +343,7 @@ class Navigation extends FFError {
* $result['tooltips']: list of tooltips (html title) of the menu
entries;
* $result['urls']: list of urls of the menu entries;
* $result['adminurls']: list of urls to the admin pages of the
menu entries.
- * If the user has no admin permissions, the correpsonding
adminurl is false.
+ * If the user has no admin permissions, the corresponding
adminurl is false.
* $result['selected']: number of the menu entry that is currently
selected.
*/
function getProjectMenu($group_id, $toptab = "") {
@@ -360,7 +361,7 @@ class Navigation extends FFError {
return null;
}
if (!$group->isProject()) {
- return;
+ return null;
}
$selected = 0;
diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index 16f2af3..e5024da 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -49,15 +49,21 @@ function htpasswd_apr1_md5($plainpasswd) {
$bin = pack("H32", md5($text));
for ($i = 0; $i < 1000; $i++) {
$new = ($i & 1)? $plainpasswd : $bin;
- if ($i % 3) $new .= $salt;
- if ($i % 7) $new .= $plainpasswd;
+ if ($i % 3) {
+ $new .= $salt;
+ }
+ if ($i % 7) {
+ $new .= $plainpasswd;
+ }
$new .= ($i & 1)? $bin : $plainpasswd;
$bin = pack("H32", md5($new));
}
for ($i = 0; $i < 5; $i++) {
$k = $i + 6;
$j = $i + 12;
- if ($j == 16) $j = 5;
+ if ($j == 16) {
+ $j = 5;
+ }
$tmp = $bin[$i].$bin[$k].$bin[$j].$tmp;
}
$tmp = chr(0).chr(0).$bin[11].$tmp;
@@ -652,15 +658,18 @@ function validate_email($address) {
* @return array Array of invalid e-mail addresses (if empty, all
addresses are OK)
*/
function validate_emails($addresses, $separator = ',') {
- if (strlen($addresses) == 0) return array();
-
+ if (strlen($addresses) == 0) {
+ return array();
+ }
$emails = explode($separator, $addresses);
$ret = array();
if (is_array($emails)) {
foreach ($emails as $email) {
$email = trim($email); // This is done so we can
validate lists like "[email protected], [email protected]"
- if (!validate_email($email)) $ret[] = $email;
+ if (!validate_email($email)) {
+ $ret[] = $email;
+ }
}
}
return $ret;
@@ -876,10 +885,10 @@ function util_is_dot_or_dotdot($dir) {
*/
function util_containts_dot_or_dotdot($dir) {
foreach (explode('/', $dir) as $sub_dir) {
- if (util_is_dot_or_dotdot($sub_dir))
+ if (util_is_dot_or_dotdot($sub_dir)) {
return true;
+ }
}
-
return false;
}
@@ -891,10 +900,12 @@ function util_containts_dot_or_dotdot($dir) {
*/
function util_secure_filename($file) {
$f = preg_replace("/[^-A-Z0-9_\.]/i", '', $file);
- if (util_containts_dot_or_dotdot($f))
+ if (util_containts_dot_or_dotdot($f)) {
$f = preg_replace("/\./", '_', $f);
- if (!$f)
+ }
+ if (!$f) {
$f = md5($file);
+ }
return $f;
}
@@ -922,8 +933,9 @@ function normalized_urlprefix() {
$prefix = preg_replace("/^\//", "", $prefix);
$prefix = preg_replace("/\/$/", "", $prefix);
$prefix = "/$prefix/";
- if ($prefix == '//')
+ if ($prefix == '//') {
$prefix = '/';
+ }
return $prefix;
}
@@ -968,8 +980,7 @@ function util_make_base_url($prefix = '') {
* @return string URL
*/
function util_make_url($path = '', $prefix = '') {
- $url = util_make_base_url($prefix).util_make_uri($path);
- return $url;
+ return util_make_base_url($prefix).util_make_uri($path);
}
/**
@@ -1240,9 +1251,9 @@ if (!function_exists('json_encode')) {
/* returns an integer from http://forge/foo/bar.php/123 or false */
function util_path_info_last_numeric_component() {
- if (!isset($_SERVER['PATH_INFO']))
+ if (!isset($_SERVER['PATH_INFO'])) {
return false;
-
+ }
$ok = false;
foreach (str_split($_SERVER['PATH_INFO']) as $x) {
if ($x == '/') {
@@ -1256,8 +1267,9 @@ function util_path_info_last_numeric_component() {
$ok = false;
}
}
- if ($ok)
+ if ($ok) {
return $rv;
+ }
return false;
}
@@ -1383,9 +1395,15 @@ function util_randnum($min = 0, $max = 32767) {
// sys_get_temp_dir() is only available for PHP >= 5.2.1
if (!function_exists('sys_get_temp_dir')) {
function sys_get_temp_dir() {
- if ($temp = getenv('TMP')) return $temp;
- if ($temp = getenv('TEMP')) return $temp;
- if ($temp = getenv('TMPDIR')) return $temp;
+ if ($temp = getenv('TMP')) {
+ return $temp;
+ }
+ if ($temp = getenv('TEMP')) {
+ return $temp;
+ }
+ if ($temp = getenv('TMPDIR')) {
+ return $temp;
+ }
return '/tmp';
}
}
@@ -1409,15 +1427,17 @@ function util_uri_grabber($unencoded_string, $tryaidtid
= false) {
$s = preg_replace(
'|([a-zA-Z][a-zA-Z0-9+.-]*:[#0-9a-zA-Z;/?:@&=+$,_.!~*\'()%-]+)|',
"\x01\$1\x01", $s);
- if (!$s)
+ if (!$s) {
return htmlentities($unencoded_string, ENT_QUOTES, "UTF-8");
+ }
/* encode the string */
$s = htmlentities($s, ENT_QUOTES, "UTF-8");
/* convert ć^Afoo^Ać to ć<a href="foo">foo</a>ć */
$s = preg_replace('|\x01([^\x01]+)\x01|',
'<a href="$1">$1</a>', $s);
- if (!$s)
+ if (!$s) {
return htmlentities($unencoded_string, ENT_QUOTES, "UTF-8");
+ }
// /* convert [#123] to links if found */
// if ($tryaidtid)
// $s = util_tasktracker_links($s);
@@ -1570,13 +1590,19 @@ function util_init_messages() {
$feedback = $warning_msg = $error_msg = '';
} else {
$feedback = getStringFromCookie('feedback', '');
- if ($feedback) setcookie('feedback', '', time()-3600, '/');
+ if ($feedback) {
+ setcookie('feedback', '', time()-3600, '/');
+ }
$warning_msg = getStringFromCookie('warning_msg', '');
- if ($warning_msg) setcookie('warning_msg', '', time()-3600,
'/');
+ if ($warning_msg) {
+ setcookie('warning_msg', '', time()-3600, '/');
+ }
$error_msg = getStringFromCookie('error_msg', '');
- if ($error_msg) setcookie('error_msg', '', time()-3600, '/');
+ if ($error_msg) {
+ setcookie('error_msg', '', time()-3600, '/');
+ }
}
}
@@ -1706,9 +1732,9 @@ function utils_headers_download($filename, $mimetype,
$size) {
/* Disarm XSS-able text/html, and inline common text files (*.c,
*.pl...) */
$force_text_plain =
',^(text/html|text/.*|application/x-perl|application/x-ruby)$,';
- if (preg_match($force_text_plain, $mimetype))
+ if (preg_match($force_text_plain, $mimetype)) {
$mimetype = 'text/plain';
-
+ }
if (preg_match($authorized_inline, $mimetype)) {
header('Content-Disposition: inline; filename="' .
str_replace('"', '', $filename) . '"');
header('Content-Type: '. $mimetype);
diff --git a/src/www/include/my_utils.php b/src/www/include/my_utils.php
index 87e9b9f..f49578a 100644
--- a/src/www/include/my_utils.php
+++ b/src/www/include/my_utils.php
@@ -30,7 +30,7 @@
Input:
$svc : service name to hide/show (sr, bug, pm...)
$db_item_id : the item (group, forum, task sub-project,...) from the
- database that we are curently processing and about to display
+ database that we are currently processing and about to display
$item_id : the item_id as given in the URL and on which the show/hide switch
is going to apply.
$hide = hide param as given in the script URL (-1 means no param was given)
@@ -52,9 +52,12 @@ function my_hide_url ($svc, $db_item_id, $item_id, $count,
$hide) {
}
// Make sure they are both 0 if never set before
- if ($old_count == false) { $old_count = 0; }
- if ($old_hide == false) { $old_hide = 0; }
-
+ if ($old_count == false) {
+ $old_count = 0;
+ }
+ if ($old_hide == false) {
+ $old_hide = 0;
+ }
if ($item_id == $db_item_id) {
if (isset($hide)) {
$pref_value = "$hide|$count";
@@ -93,15 +96,16 @@ function my_hide_url ($svc, $db_item_id, $item_id, $count,
$hide) {
function my_hide($svc, $db_item_id, $item_id, $hide) {
$pref_name = 'my_hide_'.$svc.$db_item_id;
$old_pref_value =
UserManager::instance()->getCurrentUser()->getPreference($pref_name);
- if ($old_pref_value)
+ if ($old_pref_value) {
list($old_hide, $old_count) = explode('|', $old_pref_value);
-
- if (!isset($old_hide))
+ }
+ if (!isset($old_hide)) {
$old_hide = false;
-
+ }
// Make sure they are both 0 if never set before
- if ($old_hide == false) { $old_hide = 0; }
-
+ if ($old_hide == false) {
+ $old_hide = 0;
+ }
if ($item_id == $db_item_id) {
if (!isset($hide)) {
$hide = $old_hide;
@@ -127,20 +131,24 @@ function my_format_as_flag($assigned_to, $submitted_by,
$multi_assigned_to=null)
if ($submitted_by == user_getid()) {
$AS_flag .= 'S';
}
- if ($AS_flag) { $AS_flag = '[<b>'.$AS_flag.'</b>]'; }
-
+ if ($AS_flag) {
+ $AS_flag = '[<b>'.$AS_flag.'</b>]';
+ }
return $AS_flag;
}
/* second case */
function my_format_as_flag2($assignee, $submitter) {
$AS_flag = '';
- if ($assignee) $AS_flag = 'A';
-
- if ($submitter) $AS_flag .= 'S';
-
- if ($AS_flag != '') $AS_flag = '[<b>'.$AS_flag.'</b>]';
-
+ if ($assignee) {
+ $AS_flag = 'A';
+ }
+ if ($submitter) {
+ $AS_flag .= 'S';
+ }
+ if ($AS_flag != '') {
+ $AS_flag = '[<b>'.$AS_flag.'</b>]';
+ }
return $AS_flag;
}
-----------------------------------------------------------------------
Summary of changes:
src/common/include/Navigation.class.php | 7 +--
src/common/include/utils.php | 78 ++++++++++++++++++++++-----------
src/www/include/my_utils.php | 44 +++++++++++--------
3 files changed, 82 insertions(+), 47 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits