$summary = '';
for ($l = 0; $l < $nb_max; $l++) {
$summary .= '<br />';
- if ($truncate == true && $nb_max < $nb_line && $l == $nb_max - 1) {
+ if ($truncate === true && $nb_max < $nb_line && $l == $nb_max - 1) {
$nb_char = $nb_char * ($nb_line - $nb_max + 1);
}
- $summary .= util_make_links((($truncate == true && strlen($arr[$l]) > $nb_char)?
+ $summary .= util_make_links((($truncate === true && strlen($arr[$l]) > $nb_char)?
preg_replace('/[^\s]*$/', ' <b>...</b>', substr($arr[$l], 0, $nb_char), 1) :
$arr[$l]));
}
}
// Make sure they are both 0 if never set before
- if ($old_count == false) {
+ if (!$old_count) {
$old_count = 0;
}
- if ($old_hide == false) {
+ if (!$old_hide) {
$old_hide = 0;
}
if ($item_id == $db_item_id) {
if ($old_pref_value) {
list($old_hide, $old_count) = explode('|', $old_pref_value);
}
- if (!isset($old_hide)) {
- $old_hide = false;
- }
- // Make sure they are both 0 if never set before
- if ($old_hide == false) {
+ // Make sure $old_hide is 0 if never set before
+ if (!isset($old_hide) || !$old_hide) {
$old_hide = 0;
}
+
if ($item_id == $db_item_id) {
if (!isset($hide)) {
$hide = $old_hide;
break;
}
}
- if ($seen == false) {
+ if (!$seen) {
return '';
}
}
if ($x == '/') {
$rv = 0;
$ok = true;
- } elseif ($ok == false) {
+ } elseif (!$ok) {
/* need reset using slash */
} elseif ((ord($x) >= 48) && (ord($x) <= 57)) {
$rv = $rv * 10 + ord($x) - 48;
return false;
}
$handle = fopen($path, "x+");
- if ($handle == false) {
+ if (!$handle) {
return false;
}
fwrite($handle, $contents);
if ($arr) {
/* Copy questions only if it is not in question string */
for ($i=0; $i<count($this->all_question_array); $i++) {
- if (array_search($this->all_question_array[$i]->getID(), $arr) == false &&
+ if (!array_search($this->all_question_array[$i]->getID(), $arr) &&
$this->all_question_array[$i]->getID()!=$arr[0]) {
$ret[] = $this->all_question_array[$i];
}
} else {
if ($arr_to_add && is_array($arr_to_add) && !empty($arr_to_add)) {
for ($i = 0; $i < count($arr_to_add); $i++) {
- /* Avoid double question */
- if ($arr_to_add[$i] && array_search($arr_to_add[$i], $arr) == false && $arr_to_add[$i]!=$arr[0]) {
+ /* Avoid double question */
+ if ($arr_to_add[$i] && !array_search($arr_to_add[$i], $arr) && $arr_to_add[$i]!=$arr[0]) {
$arr[] = $arr_to_add[$i];
}
}
$new_arr = array();
for ($i = 0; $i < count($arr); $i++) {
/* If the value is no in the delete array, copy it into new array */
- if ($arr[$i] && array_search($arr[$i], $arr_to_del)==false && $arr_to_del[0]!=$arr[$i]) {
+ if ($arr[$i] && !array_search($arr[$i], $arr_to_del) && $arr_to_del[0]!=$arr[$i]) {
$new_arr[] = $arr[$i];
}
}
/* The question number is not in the array
* We have nothing to change
*/
- if ($index==false && $question_number!=$arr[0]) {
+ if (!$index && $question_number != $arr[0]) {
return $this->getQuestionString();
}
return $this->_makeQuestionString($arr);
}
}
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
require $gfcommon.'include/cron_utils.php';
-$options=$GLOBALS['argv'];
-if ($options!=FALSE){
- $option=$options[1];
- if (($option=='pm')|| ($option=='all')){
+$options = $GLOBALS['argv'];
+if ($options){
+ $option = $options[1];
+ if (($option == 'pm') || ($option == 'all')) {
echo "running pm";
send_pending_pm_items_mail();
}
- if (($option=='tracker')|| ($option=='all')){
+ if (($option == 'tracker') || ($option == 'all')) {
echo "\nrunning tracker";
send_pending_tracker_items_mail();
}
}
-function send_pending_pm_items_mail(){
+function send_pending_pm_items_mail() {
$time = time();
/* first we check the tasks from the project_manager */
if (!$repo_exists) {
$tmp_repo = util_mkdtemp('.bzr', $project_name);
- if ($tmp_repo == false) {
+ if ($tmp_repo === false) {
return false;
}
if (!is_dir($main_repo) || (!is_file("$main_repo/HEAD") &&
!is_dir("$main_repo/objects") && !is_dir("$main_repo/refs"))) {
$tmp_repo = util_mkdtemp('.git', $project_name);
- if ($tmp_repo == false) {
+ if ($tmp_repo === false) {
return false;
}
$result = '';
$group_id = $task['group_id'];
$user_name = $task['user_name'];
// Run as the requesting user to avoid symlinks attacks
- if (util_sudo_effective_user($user_name, 'install_hooks', array($group_id)) == false) {
+ if (!util_sudo_effective_user($user_name, 'install_hooks', array($group_id))) {
cron_debug("ERROR scmhook: couldn't run install_hooks as user $user_name");
}
}
if (isset($Configs) && is_array($Configs)) {
foreach ($Configs as $Config) {
$Result = parseConfig($Config);
- if ($Result['check'] == false) {
+ if (!$Result['check']) {
exit_error('Check_error:' . $Result['error']);
}
if (isset($Configs) && is_array($Configs)) {
foreach ($Configs as $Config) {
$Result = parseConfig($Config);
- if ($Result['check'] == false) {
+ if (!$Result['check']) {
exit_error('Check_error', $Result['error']);
}
// ArtifactNumbers
if (isset($Configs) && is_array($Configs)) {
foreach ($Configs as $Config) {
$Result = parseConfig($Config);
- if ($Result['check'] == false) {
+ if (!$Result['check']) {
exit_error('Check_error:' . $Result['error']);
}
if ($attachid) {
//update existing one
$attachok = $am->attach($attach,$group_id,$attachid,$msg_id);
- if ($attachok!=false) {
+ if ($attachok) {
$fm->fetchData($msg_id);
$fm->sendAttachNotice($attachok);
}
} else {
//add new one
$attachok = $am->attach($attach,$group_id,false,$msg_id);
- if ($attachok!=false) {
+ if ($attachok) {
$fm->fetchData($msg_id);
$fm->sendAttachNotice($attachok);
}
// evaluate postfix notation
function pfx($tokens, $vars = array()) {
$binaryOperator = array ('+', '-', '*', '/', '^', '<', '>', '<=', '>=', '==', '&&', '||', '!=', '=~', '%');
- if ($tokens == false) {
+ if ($tokens === false) {
return false;
}
$stack = new ExpressionStack ();
$pg_arr = $pgf->getProjectGroups();
- if ($pg_arr == false || empty($pg_arr)) {
+ if ($pg_arr === false || empty($pg_arr)) {
echo $HTML->information(_('No Subprojects Found in this Project'));
echo '<p>' . _('You may add new Subprojects using the “Add a Subproject” link above.') . '</p>';
echo db_error();
plugin_hook('blocks', 'tasks index');
-if ($pg_arr == false || empty($pg_arr)) {
+if ($pg_arr === false || empty($pg_arr)) {
echo $HTML->information(_('No Subprojects Found'));
echo '<p>'._('No subprojects have been set up, or you cannot view them.').'</p>';
echo '<p class="important">'._('The Admin for this project will have to set up subprojects using the admin page.').'</p>';
global $linktypedependenton;
$tag_aux = $name;
- if ($tasks == true){
+ if ($tasks){
//ID TASK
if ($name == "TASK") {
/* $task_id = $attrib["ID"];
$parent_project_id = $attrib["PARENT_PROJECT_ID"];
$isnew = $attrib["ISNEW"];
*/
- if ($fdependenton == true){
+ if ($fdependenton){
$iddependenton = $attrib["ID"];
$projectiddependenton = $attrib["PROJECTID"];
$linktypedependenton= $attrib["LINKTYPE"];
global $adependenton;
global $result;
- if ($name == "TASK" && $principal_tag=="upload" && ($fdependenton == false)){
+ if ($name == "TASK" && $principal_tag=="upload" && ($fdependenton === false)){
$task_count++;
$atasks["resources"] = $resourcename;
$resourcename = array();
}
- if ($name == "TASK" && $principal_tag=="upload" &&($fdependenton == false)) {
+ if ($name == "TASK" && $principal_tag=="upload" &&($fdependenton === false)) {
$result["tasks"][] = $atasks;
$atasks=array();
}
break;
}
case $tag_aux == "TASK": {
- if ($fdependenton == true) {
+ if ($fdependenton) {
$adependenton[] = array("task_id"=>$iddependenton,"msproj_id"=>$projectiddependenton,"link_type"=>$linktypedependenton,"task_name"=>$data);
} else {
$atasks = Array();
switch ($result["REQUEST"]) {
//MSPLogin
case $result["REQUEST"] == "GetSubprojects": {
- $gforgeresult = MSPLogin($result["loginid"],$result["password"]);
+ $fforgeresult = MSPLogin($result["loginid"],$result["password"]);
print('<?xml version="1.0"?>');
print('<xml>');
- if ($gforgeresult["success"] == true) {
+ if ($fforgeresult["success"] === true) {
print('<response handle="result">');
print('<session_id>');
- print($gforgeresult["session_hash"]);
+ print($fforgeresult["session_hash"]);
print('</session_id>');
- $subprojects = $gforgeresult["subprojects"];
+ $subprojects = $fforgeresult["subprojects"];
print('<subprojects>');
if (count($subprojects) > 0 ) {
foreach($subprojects as $k => $v) {
print('</subprojects>');
} else {
print('<response handle="error">');
- print('<error><description>'.$gforgeresult["errormessage"].'</description></error>');
+ print('<error><description>'.$fforgeresult["errormessage"].'</description></error>');
}
print('</response>');
print('</xml>');
//MSPDownload
case $result["REQUEST"] == "download": {
if ((trim($result["ACTION"]) == "GetLatestVersion") || (trim($result["ACTION"]) == "Checkout")) {
- $gforgeresult =& MSPDownload($result["session_id"],$result["subproject"][0]["id"]);
+ $fforgeresult =& MSPDownload($result["session_id"],$result["subproject"][0]["id"]);
$return = ('<?xml version="1.0"?>');
$return .= ('<xml>');
- if ($gforgeresult["success"] == true) {
+ if ($fforgeresult["success"] === true) {
$return .= ('<response handle="result">');
- $tasks =& $gforgeresult["tasks"];
+ $tasks =& $fforgeresult["tasks"];
$return .= ('<sync_time>'.date('Y-m-d H:i:s').'</sync_time>');
$return .= ('<tasks>');
for ($tc=0; $tc<count($tasks); $tc++) {
print $return;
} else {
print($return.'<response handle="error">');
- print('<error><description>'.$gforgeresult["errormessage"].'</description></error>');
+ print('<error><description>'.$fforgeresult["errormessage"].'</description></error>');
}
print('</response>');
print('</xml>');
//MSPCheckin
case $result["REQUEST"] == "upload": {
if (trim($result["ACTION"]) == "Checkin") {
- $gforgeresult = MSPCheckin($result["session_id"],$result["subproject"][0]["id"],$result["tasks"]);
+ $fforgeresult = MSPCheckin($result["session_id"],$result["subproject"][0]["id"],$result["tasks"]);
print('<?xml version="1.0"?>');
print('<xml>');
- if (!isset($gforgeresult["success"]) || ($gforgeresult["success"] == false)) {
- if ($gforgeresult["errormessage"] == "Invalid Resource Name") {
+ if (!isset($fforgeresult["success"]) || ($fforgeresult["success"] === false)) {
+ if ($fforgeresult["errormessage"] == "Invalid Resource Name") {
print('<response handle="mapuser">');
- $resourcenames = $gforgeresult["resourcename"];
+ $resourcenames = $fforgeresult["resourcename"];
print('<resourcenames>');
if (count($resourcenames) > 0 ) {
foreach($resourcenames as $k => $resourcename) {
}
print('</resourcenames>');
print('<usernames>');
- $usernames = $gforgeresult["usernames"];
+ $usernames = $fforgeresult["usernames"];
if (count($usernames) > 0 ) {
foreach($usernames as $k => $username) {
print('<user id ="'.$k.'">'.$username.'</user>');
} else {
print('<response handle="error">');
print('<error>');
- print('<description>'.$gforgeresult["errormessage"].'</description>');
+ print('<description>'.$fforgeresult["errormessage"].'</description>');
print('</error>');
}
print('</response>');
//GetProjects
case $result["REQUEST"] == "GetProjects": {
//Call GetProjects
- $gforgeresult = MSPGetProjects($result["session_id"]);
+ $fforgeresult = MSPGetProjects($result["session_id"]);
print('<?xml version="1.0"?>');
print('<xml>');
- if ($gforgeresult) {
+ if ($fforgeresult) {
print('<response handle="result">');
print('<projects>');
- for ($c=0;$c<count($gforgeresult);$c++) {
- $cgroup=$gforgeresult[$c];
+ for ($c=0;$c<count($fforgeresult);$c++) {
+ $cgroup=$fforgeresult[$c];
print('<project id ="'.$cgroup->getID().'">'.$cgroup->getPublicName().'</project>');
}
print('</projects>');
}
case $result["REQUEST"] == "CreateProject": {
- if($result["ispublic"]==1 || $result["ispublic"]==true) {
- $result["ispublic"]=1;
+ if($result["ispublic"] == 1 || $result["ispublic"] === true) {
+ $result["ispublic"] = 1;
} else {
- $result["ispublic"]=0;
+ $result["ispublic"] = 0;
}
- $gforgeresult = MSPCreateProject($result["GROUPID"],$result["session_id"],$result["name"],$result["ispublic"],$result["description"]);
+ $fforgeresult = MSPCreateProject($result["GROUPID"],$result["session_id"],$result["name"],$result["ispublic"],$result["description"]);
print('<?xml version="1.0"?>');
print('<xml>');
- if (!is_object($gforgeresult) && $gforgeresult['code'] == "error") {
+ if (!is_object($fforgeresult) && $fforgeresult['code'] == "error") {
print('<response handle="error">');
print('<error>');
- print('<description>'.$gforgeresult['description'].'</description>');
+ print('<description>'.$fforgeresult['description'].'</description>');
print('</error>');
} else {
print('<response handle="result">');
print('<Group_ID>'.$result["GROUPID"].'</Group_ID>');
- print('<Group_Project_ID>'.$gforgeresult->getID().'</Group_Project_ID>');
+ print('<Group_Project_ID>'.$fforgeresult->getID().'</Group_Project_ID>');
}
print('</response>');
print('</xml>');
continue_session($session_ser);
$user_object = user_get_object_by_name($user_unix_name);
- if ($user_object == false) {
+ if ($user_object === false) {
return new soap_fault('addUserToGroup', 'Could Not Get User', 'Could Not Get User');
}
$user_id = $user_object->getID();
$roles = array () ;
$user = user_get_object($user_id);
- if ($user == false) {
+ if ($user === false) {
$errMsg = 'Could not get user: '.$user->getErrorMessage();
return new soap_fault('2006', 'user', $errMsg, $errMsg);
}