Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fix warnings and deprecation notices when using php 7.4 (#1338)
Browse files Browse the repository at this point in the history
includes a BC BREAK for the unlikely case of PHP 5.4 users with activated magic_quotes
  • Loading branch information
ulrich-berkmueller authored Aug 28, 2020
1 parent 097445c commit 977c9cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion includes/func.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function createPassword($length)
$i = 0;
$password = '';
while ($i <= $length) {
$password .= $chars{mt_rand(0, strlen($chars) - 1)};
$password .= $chars[mt_rand(0, strlen($chars) - 1)];
$i++;
}
return $password;
Expand Down
10 changes: 5 additions & 5 deletions libraries/Kimai/Database/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -2495,7 +2495,7 @@ public function get_projects(array $groups = null)
FROM ${p}projects AS project
JOIN ${p}customers AS customer USING(customerID)
JOIN ${p}groups_projects USING(projectID)
WHERE ${p}groups_projects.groupID IN (" . implode($groups, ',') . ")
WHERE ${p}groups_projects.groupID IN (" . implode(',', $groups) . ")
AND project.trash=0";
}

Expand Down Expand Up @@ -2972,7 +2972,7 @@ public function initializeConfig(Kimai_Config $config)
case 'roundMinutes':
case 'roundSeconds':
$config->getSettings()->set($key, $value);
// break is not here on purpose!
// no break

case 'adminmail':
case 'loginTries':
Expand Down Expand Up @@ -3239,7 +3239,7 @@ public function get_customers(array $groups = null)
$query = "SELECT DISTINCT customerID, name, contact, visible
FROM ${p}customers
JOIN ${p}groups_customers AS g_c USING (customerID)
WHERE g_c.groupID IN (" . implode($groups, ',') . ")
WHERE g_c.groupID IN (" . implode(',', $groups) . ")
AND trash=0
ORDER BY visible DESC, name;";
}
Expand Down Expand Up @@ -3288,7 +3288,7 @@ public function get_activities(array $groups = null)
$query = "SELECT DISTINCT activityID, name, visible
FROM ${p}activities
JOIN ${p}groups_activities AS g_a USING(activityID)
WHERE g_a.groupID IN (" . implode($groups, ',') . ")
WHERE g_a.groupID IN (" . implode(',', $groups) . ")
AND trash=0
ORDER BY visible DESC, name;";
}
Expand Down Expand Up @@ -3348,7 +3348,7 @@ public function get_activities_by_project($projectID, array $groups = null)
FROM ${p}activities AS activity
JOIN ${p}groups_activities USING(activityID)
LEFT JOIN ${p}projects_activities p_a USING(activityID)
WHERE `${p}groups_activities`.`groupID` IN (" . implode($groups, ',') . ")
WHERE `${p}groups_activities`.`groupID` IN (" . implode(',', $groups) . ")
AND activity.trash=0
AND (projectID = $projectID OR projectID IS NULL)
ORDER BY visible DESC, name;";
Expand Down
5 changes: 1 addition & 4 deletions libraries/phpclasses/ultimatemysql/mysql.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1588,9 +1588,6 @@ static public function SQLValue($value, $datatype = self::SQLVALUE_TEXT) {
if (strlen($value) == 0) {
$return_value = "NULL";
} else {
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$return_value = "'" . str_replace("'", "''", $value) . "'";
}
break;
Expand Down Expand Up @@ -1813,4 +1810,4 @@ public function UpdateRows($tableName, $valuesArray, $whereArray = null) {
}
}
}
?>
?>

0 comments on commit 977c9cc

Please sign in to comment.