Remove "magic quotes" code and avoid wrong order implode

"Magic quotes" were removed in PHP 5.4, no need to mitigate it anymore.

Avoid implode() with the join()-like order of arguments which was deprecated
since PHP 7.4 and implicitly since PHP 5.3.
Also avoid implode() with an implicit separator for stylistic reasons.

mktime() with no arguments has been deprecated since PHP 5.1.
This commit is contained in:
Alexei Sorokin
2020-09-15 14:59:27 +03:00
parent 2ef944d5c4
commit 8079a476b6
6 changed files with 95 additions and 156 deletions

View File

@@ -175,9 +175,9 @@ class DB_DataObject_Cast
$args = func_get_args();
switch (count($args)) {
case 0: // no args = now!
$datetime = date('Y-m-d G:i:s', mktime());
$datetime = date('Y-m-d G:i:s', time());
// no break
// no break
case 1:
// continue on from 0 args.
if (!isset($datetime)) {
@@ -300,9 +300,9 @@ class DB_DataObject_Cast
$args = func_get_args();
switch (count($args)) {
case 0: // no args = now!
$time = date('G:i:s', mktime());
$time = date('G:i:s', time());
// no break
// no break
case 1:
// continue on from 0 args.
if (!isset($time)) {
@@ -440,10 +440,10 @@ class DB_DataObject_Cast
case 'mssql':
// copied from the old DB mssql code...?? not sure how safe this is.
return "'" . str_replace(
array("'", "\\\r\n", "\\\n"),
array("''", "\\\\\r\n\r\n", "\\\\\n\n"),
$this->value
) . "'";
array("'", "\\\r\n", "\\\n"),
array("''", "\\\\\r\n\r\n", "\\\\\n\n"),
$this->value
) . "'";
default: