Index: branches/5.0.x/core/kernel/nparser/nparser.php =================================================================== diff -u -r12382 -r12450 --- branches/5.0.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 12382) +++ branches/5.0.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 12450) @@ -1,6 +1,6 @@ DataExists; $this->DataExists = false; Index: branches/5.0.x/core/kernel/session/session.php =================================================================== diff -u -r12399 -r12450 --- branches/5.0.x/core/kernel/session/session.php (.../session.php) (revision 12399) +++ branches/5.0.x/core/kernel/session/session.php (.../session.php) (revision 12450) @@ -1,6 +1,6 @@ Application->TableFound($this->TableName)) { @@ -180,7 +180,7 @@ FROM ' . $this->TableName . ' WHERE ' . $this->IDField . ' = ' . $this->Conn->qstr($sid); $result = $this->Conn->GetRow($sql); - + if ($result === false) { return false; } @@ -189,16 +189,16 @@ if ($this->Application->ConfigValue('SessionBrowserSignatureCheck') && ($result['BrowserSignature'] != $this->_getBrowserSignature())) { return false; } - + if ($this->Application->ConfigValue('SessionIPAddressCheck') && ($result['IpAddress'] != $_SERVER['REMOTE_ADDR'])) { // most secure, except for cases where NAT (Network Address Translation) // is used and two or more computers can have same IP address return false; } - + $this->DirectVars = $result; $this->Expiration = $result[$this->TimestampField]; - + return true; } @@ -688,7 +688,7 @@ function Check() { // don't check referer here, because it doesn't provide any security option and can be easily falsified - + $sid = $this->GetPassedSIDValue(); if (empty($sid)) { @@ -797,18 +797,21 @@ */ function GenerateSID() { - list($usec, $sec) = explode(" ",microtime()); + list ($usec, $sec) = explode(' ', microtime()); $sid_part_1 = substr($usec, 4, 4); - $sid_part_2 = mt_rand(1,9); + $sid_part_2 = mt_rand(1, 9); $sid_part_3 = substr($sec, 6, 4); $digit_one = substr($sid_part_1, 0, 1); + if ($digit_one == 0) { - $digit_one = mt_rand(1,9); - $sid_part_1 = ereg_replace("^0","",$sid_part_1); - $sid_part_1=$digit_one.$sid_part_1; + $digit_one = mt_rand(1, 9); + $sid_part_1 = preg_replace('/^0/', '', $sid_part_1); + $sid_part_1 = $digit_one . $sid_part_1; } - $this->setSID($sid_part_1.$sid_part_2.$sid_part_3); + + $this->setSID($sid_part_1 . $sid_part_2 . $sid_part_3); + return $this->SID; } @@ -1020,13 +1023,13 @@ $data_keys = array_keys($session_data); $optional_keys = array_keys($this->OptionalData); $real_keys = array_diff($data_keys, $optional_keys); - + if ($real_keys) { $ret = ''; foreach ($real_keys as $real_key) { $ret .= '[' . $real_key . '] = [' . $session_data[$real_key] . ']
'; } - + $this->Application->Debugger->appendHTML('Real Keys:
' . $ret); } } Index: branches/5.0.x/core/install/install_toolkit.php =================================================================== diff -u -r12435 -r12450 --- branches/5.0.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 12435) +++ branches/5.0.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 12450) @@ -1,6 +1,6 @@ 0) { //echo $line . " - "; - if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) { + if (preg_match('/^\[[a-z]+\]$/i', str_replace(' ', '', $line))) { //echo 'section'; $section = mb_substr($line, 1, (mb_strlen($line) - 2)); if ($parse_section) { $retval[$section] = array(); } continue; - } elseif (eregi('=',$line)) { + } elseif (strpos($line, '=') !== false) { //echo 'main element'; list ($key, $val) = explode(' = ', $line); if (!$parse_section) { Index: branches/5.0.x/core/kernel/utility/debugger.php =================================================================== diff -u -r12323 -r12450 --- branches/5.0.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 12323) +++ branches/5.0.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 12450) @@ -1,6 +1,6 @@ $error_codes) { if (in_array($error_code, $error_codes)) { return $error_name; Index: branches/5.0.x/core/kernel/globals.php =================================================================== diff -u -r12365 -r12450 --- branches/5.0.x/core/kernel/globals.php (.../globals.php) (revision 12365) +++ branches/5.0.x/core/kernel/globals.php (.../globals.php) (revision 12450) @@ -1,6 +1,6 @@ 0) { //echo $line . " - "; - if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) { + if (preg_match('/^\[[a-z]+\]$/i', str_replace(' ', '', $line))) { //echo 'section'; $section = mb_substr($line,1,(mb_strlen($line)-2)); if ($parse_section) { $retval[$section] = array(); } continue; - } elseif(eregi('=',$line)) { + } elseif(strpos($line, '=') !== false) { //echo 'main element'; list($key,$val) = explode(' = ',$line); if (!$parse_section) { Index: branches/5.0.x/core/units/admin/admin_tag_processor.php =================================================================== diff -u -r12320 -r12450 --- branches/5.0.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 12320) +++ branches/5.0.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 12450) @@ -1,6 +1,6 @@ $this->chopchop($entry), 'filesize' => filesize($dirName. '/'. $entry) @@ -956,10 +956,11 @@ function chopchop ($filename) { $p = pathinfo($filename); - $ext = '.'.$p["extension"]; + $ext = '.'.$p['extension']; $filename; - $filename= ereg_replace("dump","",$filename); - $filename= ereg_replace($ext,"",$filename); + $filename = str_replace('dump', '',$filename); + $filename = str_replace($ext, '', $filename); + return $filename; } Index: branches/5.0.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -r12323 -r12450 --- branches/5.0.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 12323) +++ branches/5.0.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 12450) @@ -1,6 +1,6 @@ 0) { + $replacements = Array ('INSERT INTO ', 'UPDATE ', 'ALTER TABLE ', 'DELETE FROM ', 'REPLACE INTO '); + foreach ($replacements as $replacement) { + $sql = str_replace($replacement, $replacement . $table_prefix, $sql); + } + } - $what = "INSERT INTO "; - $replace = "INSERT INTO ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); + $sql = str_replace('CREATE TABLE ', 'CREATE TABLE IF NOT EXISTS ' . $table_prefix, $sql); + $sql = str_replace('DROP TABLE ', 'DROP TABLE IF EXISTS ' . $table_prefix, $sql); - $what = "UPDATE "; - $replace = "UPDATE ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "ALTER TABLE "; - $replace = "ALTER TABLE ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); - } - $commands = explode("# --------------------------------------------------------",$sql); if(count($commands)>0) { @@ -1073,36 +1061,17 @@ if(strlen(trim($sql))>0 && substr($sql,0,1)!="#") { $table_prefix = 'restore'.TABLE_PREFIX; - if(strlen($table_prefix)) - { - $what = "CREATE TABLE "; - $replace = "CREATE TABLE ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); - $what = "DELETE FROM "; - $replace = "DELETE FROM ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); + if (strlen($table_prefix) > 0) { + $replacements = Array ('INSERT INTO ', 'UPDATE ', 'ALTER TABLE ', 'DELETE FROM ', 'REPLACE INTO '); + foreach ($replacements as $replacement) { + $sql = str_replace($replacement, $replacement . $table_prefix, $sql); + } + } - $what = "DROP TABLE "; - $replace = "DROP TABLE IF EXISTS ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); + $sql = str_replace('CREATE TABLE ', 'CREATE TABLE IF NOT EXISTS ' . $table_prefix, $sql); + $sql = str_replace('DROP TABLE ', 'DROP TABLE IF EXISTS ' . $table_prefix, $sql); - $what = "INSERT INTO "; - $replace = "INSERT INTO ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "REPLACE INTO "; - $replace = "REPLACE INTO ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "UPDATE "; - $replace = "UPDATE ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "ALTER TABLE "; - $replace = "ALTER TABLE ".$table_prefix; - $sql = ereg_replace($what, $replace, $sql); - } $sql = trim($sql); if(strlen($sql)>0) { Index: branches/5.0.x/core/units/users/users_tag_processor.php =================================================================== diff -u -r12299 -r12450 --- branches/5.0.x/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 12299) +++ branches/5.0.x/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 12450) @@ -1,6 +1,6 @@ 0) { - $label = substr($label, 1, -1); // cut exclamation marks - } + // cut exclamation marks - depricated form of passing phrase name from templates + $label = preg_replace('/^!(.*)!$/', '\\1', $label); if (strlen($label) == 0) { return '';