diff --git a/www/admin/class_test.php b/www/admin/class_test.php
index a08a2934..0f63fec4 100644
--- a/www/admin/class_test.php
+++ b/www/admin/class_test.php
@@ -1,4 +1,4 @@
-
+error_msg_prefix;
}
$script_end = $this->runningTime();
- while (list($level, $temp_debug_output) = each($this->error_msg)) {
+ foreach ($this->error_msg as $level => $temp_debug_output) {
if (($this->debug_output[$level] || $this->debug_output_all) && !$this->debug_output_not[$level]) {
if (($this->echo_output[$level] || $this->echo_output_all) && !$this->echo_output_not[$level]) {
$string_output .= '
['.$level.'] '.(($string) ? "**** ".$this->htmlent($string)." ****\n" : "").'
';
@@ -1071,7 +1072,8 @@ class Basic
// DESC : creates out of a normal db_return array an assoc array
public static function genAssocArray($db_array, $key, $value, $set_only = 0)
{
- for ($i = 0; $i < count($db_array); $i ++) {
+ // do this to only run count once
+ for ($i = 0, $iMax = count($db_array); $i < $iMax; $i ++) {
// if no key then we make an order reference
if ($key && $value && (($set_only && $db_array[$i][$value]) || (!$set_only))) {
$ret_array[$db_array[$i][$key]] = $db_array[$i][$value];
@@ -1187,7 +1189,7 @@ class Basic
$timegroups = array (86400, 3600, 60, 1);
$labels = array ('d', 'h', 'm', 's');
$time_string = '';
- for ($i = 0; $i < count($timegroups); $i ++) {
+ for ($i = 0, $iMax = count($timegroups); $i < $iMax; $i ++) {
$output = floor($timestamp / $timegroups[$i]);
$timestamp = $timestamp % $timegroups[$i];
// output has days|hours|min|sec
@@ -1496,7 +1498,7 @@ class Basic
// if string does not match anymore we have a convert problem
if ($string != $compare) {
// go through each character and find the ones that do not match
- for ($i = 0; $i < mb_strlen($string, $from_encoding); $i ++) {
+ for ($i = 0, $iMax = mb_strlen($string, $from_encoding); $i < $iMax; $i ++) {
$char = mb_substr($string, $i, 1, $from_encoding);
$r_char = mb_substr($compare, $i, 1, $from_encoding);
// the ord 194 is a hack to fix the IE7/IE8 bug with line break and illegal character
@@ -1544,7 +1546,7 @@ class Basic
// do normal hash crc32b
$string = hash('crc32b', $string);
// if bigger than 5.2.7, we need to "unfix" the fix
- if ($this->checkPHPVersion('5.2.7')) {
+ if (self::checkPHPVersion('5.2.7')) {
// flip it back to old (two char groups)
$string = preg_replace("/^([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})$/", "$4$3$2$1", $string);
}
@@ -1640,10 +1642,10 @@ class Basic
// WARNING: des is very bad, only first 6 chars get used for the password
// MD5 is a bit better but is already broken
// problem with PHP < 5.3 is that you mostly don't have access to blowfish
- if (CRYPT_BLOWFISH == 1 || $this->checkPHPVersion('5.3.0')) {
+ if (CRYPT_BLOWFISH == 1 || self::checkPHPVersion('5.3.0')) {
// blowfish salt prefix
// for < 5.3.7 use the old one for anything newer use the new version
- if ($this->checkPHPVersion('5.3.7')) {
+ if (self::checkPHPVersion('5.3.7')) {
$this->cryptSaltPrefix = '$2y$';
} else {
$this->cryptSaltPrefix = '$2a$';
@@ -1685,7 +1687,7 @@ class Basic
$min = array (46, 65, 97);
$max = array (57, 90, 122);
$chars = array ();
- for ($i = 0; $i < count($min); $i ++) {
+ for ($i = 0, $iMax = count($min); $i < $iMax; $i ++) {
for ($j = $min[$i]; $j <= $max[$i]; $j ++) {
$chars[] = chr($j);
}
diff --git a/www/lib/CoreLibs/DB/Extended/ArrayIO.inc b/www/lib/CoreLibs/DB/Extended/ArrayIO.inc
index dcb32dac..3839d983 100644
--- a/www/lib/CoreLibs/DB/Extended/ArrayIO.inc
+++ b/www/lib/CoreLibs/DB/Extended/ArrayIO.inc
@@ -1,4 +1,4 @@
-
+table_array) {
- while (list($key, $value) = each($table_array)) {
+ foreach ($table_array as $key => $value) {
if ($value["pk"]) {
$this->pk_name = $key;
}
@@ -133,7 +133,7 @@ class ArrayIO extends \CoreLibs\DB\IO
public function dbDumpArray($write = 0)
{
reset($this->table_array);
- while (list($column, $data_array) = each($this->table_array)) {
+ foreach ($this->table_array as $column => $data_array) {
$string .= "".$column." -> ".$data_array["value"]."
";
}
// add output to internal error_msg
@@ -173,7 +173,7 @@ class ArrayIO extends \CoreLibs\DB\IO
public function dbResetArray($reset_pk = 0)
{
reset($this->table_array);
- while (list($column, $data_array) = each($this->table_array)) {
+ foreach ($this->table_array as $column => $data_array) {
if (!$this->table_array[$column]["pk"]) {
unset($this->table_array[$column]["value"]);
} elseif ($reset_pk) {
@@ -200,7 +200,7 @@ class ArrayIO extends \CoreLibs\DB\IO
$q .= $this->pk_name." = ".$this->table_array[$this->pk_name]["value"]." ";
// delete files and build FK query
reset($this->table_array);
- while (list($column, $data_array) = each($this->table_array)) {
+ foreach ($this->table_array as $column => $data_array) {
// suchen nach bildern und lschen ...
if ($this->table_array[$column]["file"] && file_exists($this->table_array[$column]["url"].$this->table_array[$column]["value"])) {
if (file_exists($this->table_array[$column]["path"].$this->table_array[$column]["value"])) {
@@ -252,7 +252,7 @@ class ArrayIO extends \CoreLibs\DB\IO
}
reset($this->table_array);
// create select part & addition FK part
- while (list($column, $data_array)=each($this->table_array)) {
+ foreach ($this->table_array as $column => $data_array) {
if ($q_select) {
$q_select .= ", ";
}
@@ -279,7 +279,7 @@ class ArrayIO extends \CoreLibs\DB\IO
if ($this->dbExec($q)) {
if ($res = $this->dbFetchArray()) {
reset($this->table_array);
- while (list($column, $data_array) = each($this->table_array)) {
+ foreach ($this->table_array as $column => $data_array) {
// wenn "edit" dann gib daten wie in DB zurck, ansonten aufbereiten fr ausgabe
// ?? sollte das nicht drauen ??? man weis ja net was da drin steht --> is noch zu berlegen
// echo "EDIT: $edit | Spalte: $column | type: ".$this->table_array[$column]["type"]." | Res: ".$res[$column]."
";
@@ -326,8 +326,7 @@ class ArrayIO extends \CoreLibs\DB\IO
}
reset($this->table_array);
- while (list($column, $data_array) = each($this->table_array)) {
-
+ foreach ($this->table_array as $column => $data_array) {
/********************************* START FILE *************************************/
// file upload
if ($this->table_array[$column]["file"]) {
@@ -434,7 +433,7 @@ class ArrayIO extends \CoreLibs\DB\IO
// get it at the end, cause now we can be more sure of no double IDs, etc
reset($this->table_array);
// create select part & addition FK part
- while (list($column, $data_array) = each($this->table_array)) {
+ foreach ($this->table_array as $column => $data_array) {
// check FK ...
if ($this->table_array[$column]["fk"] && $this->table_array[$column]["value"]) {
if ($q_where) {
diff --git a/www/lib/CoreLibs/DB/IO.inc b/www/lib/CoreLibs/DB/IO.inc
index ddeea1c2..24c857b0 100644
--- a/www/lib/CoreLibs/DB/IO.inc
+++ b/www/lib/CoreLibs/DB/IO.inc
@@ -1,4 +1,4 @@
-
+