Index: branches/5.0.x/core/units/helpers/category_helper.php =================================================================== diff -u -N -r12632 -r12706 --- branches/5.0.x/core/units/helpers/category_helper.php (.../category_helper.php) (revision 12632) +++ branches/5.0.x/core/units/helpers/category_helper.php (.../category_helper.php) (revision 12706) @@ -1,6 +1,6 @@ Application->IsAdmin()) { $page_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $page_url); }*/ - $text = preg_replace('/@@' . $page_id . '@@/', $page_url, $text); + + $text = str_replace('@@' . $page_id . '@@', $page_url, $text); } return $text; Index: branches/5.0.x/core/units/helpers/language_import_helper.php =================================================================== diff -u -N -r12641 -r12706 --- branches/5.0.x/core/units/helpers/language_import_helper.php (.../language_import_helper.php) (revision 12641) +++ branches/5.0.x/core/units/helpers/language_import_helper.php (.../language_import_helper.php) (revision 12706) @@ -1,6 +1,6 @@ Conn->GetCol($sql); Index: branches/5.0.x/core/units/statistics/statistics_event_handler.php =================================================================== diff -u -N -r12299 -r12706 --- branches/5.0.x/core/units/statistics/statistics_event_handler.php (.../statistics_event_handler.php) (revision 12299) +++ branches/5.0.x/core/units/statistics/statistics_event_handler.php (.../statistics_event_handler.php) (revision 12706) @@ -1,6 +1,6 @@ Application->ModuleInfo as $module_name => $module_info) { $module_list .= $this->Conn->qstr($module_name).','; } - $module_list = preg_replace('/(.*),$/', '\\1', $module_list); + $module_list = substr($module_list, 0, -1); $object->addFilter('status_filter', '%1$s.Module IN ('.$module_list.')'); } Index: branches/5.0.x/core/units/permissions/permissions_tag_processor.php =================================================================== diff -u -N -r12511 -r12706 --- branches/5.0.x/core/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 12511) +++ branches/5.0.x/core/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 12706) @@ -1,6 +1,6 @@ $category_pos) { $pos_sql .= '(#TABLE_PREFIX#.Permission = "'.$perm_name.'" AND #TABLE_PREFIX#.CatId = '.$categories[$category_pos].') OR '; } - $pos_sql = $pos_sql ? preg_replace('/(.*) OR $/', '\\1', $pos_sql) : '0'; + $pos_sql = $pos_sql ? substr($pos_sql, 0, -4) : '0'; // get all permissions list with iheritence status, inherited category id and permission value $sql = 'SELECT pc.PermissionName, Index: branches/5.0.x/core/units/helpers/cat_dbitem_export_helper.php =================================================================== diff -u -N -r12511 -r12706 --- branches/5.0.x/core/units/helpers/cat_dbitem_export_helper.php (.../cat_dbitem_export_helper.php) (revision 12511) +++ branches/5.0.x/core/units/helpers/cat_dbitem_export_helper.php (.../cat_dbitem_export_helper.php) (revision 12706) @@ -1,6 +1,6 @@ Conn->qstr($var_name), $this->Conn->qstr($var_value) ); } } - $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql); + + $values_sql = substr($values_sql, 0, -1); + if ($values_sql) { $sql = 'INSERT INTO '.$this->cacheTable.'(`CacheName`,`VarName`,`VarValue`) VALUES '.$values_sql; $this->Conn->Query($sql); @@ -391,7 +393,7 @@ $custom_sql .= 'custom_data.'.$ml_formatter->LangFieldName('cust_'.$custom_id).' AS cust_'.$custom_name.', '; } - return preg_replace('/(.*), /', '\\1', $custom_sql); + return substr($custom_sql, 0, -2); } function getPlainExportSQL($count_only = false) { @@ -464,7 +466,7 @@ foreach ($this->exportOptions['export_cats_ids'] as $category_id) { $sql .= '(c.ParentPath LIKE "%|'.$category_id.'|%") OR '; } - $sql = preg_replace('/(.*) OR $/', '\\1', $sql); + $sql = substr($sql, 0, -4); } $sql .= ' ORDER BY ci.PrimaryCat DESC'; // NEW @@ -841,7 +843,7 @@ } } - $where_clause = preg_replace('/(.*) AND $/', '\\1', $where_clause); + $where_clause = substr($where_clause, 0, -5); $item_id = $this->getFromCache('new_ids', crc32($where_clause)); if (!$item_id) { @@ -1105,7 +1107,7 @@ foreach ($this->exportOptions['export_cats_ids'] as $category_id) { $where_clause .= '(c.ParentPath LIKE "%|'.$category_id.'|%") OR '; } - $where_clause = preg_replace('/(.*) OR $/', '\\1', $where_clause); + $where_clause = substr($where_clause, 0, -4); } } else { Index: branches/5.0.x/core/units/helpers/spam_helper.php =================================================================== diff -u -N -r12306 -r12706 --- branches/5.0.x/core/units/helpers/spam_helper.php (.../spam_helper.php) (revision 12306) +++ branches/5.0.x/core/units/helpers/spam_helper.php (.../spam_helper.php) (revision 12706) @@ -1,6 +1,6 @@ Conn->qstr($field_value).') AND '; } - return preg_replace('/(.*) AND $/', '\\1', $ret); + return substr($ret, 0, -5); } /** Index: branches/5.0.x/core/kernel/db/dbitem.php =================================================================== diff -u -N -r12368 -r12706 --- branches/5.0.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 12368) +++ branches/5.0.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 12706) @@ -1,6 +1,6 @@ IDField => $this->ID); + if (!isset($keys_hash)) { + $keys_hash = Array ($this->IDField => $this->ID); + } $ret = ''; - foreach($keys_hash as $field => $value) - { + + foreach ($keys_hash as $field => $value) { if (!preg_match('/\./', $field)) { - $ret .= '(`'.$this->TableName.'`.'.$field.' = '.$this->Conn->qstr($value).') AND '; + $ret .= '(`' . $this->TableName . '`.' . $field . ' = ' . $this->Conn->qstr($value) . ') AND '; } else { - $ret .= '('.$field.' = '.$this->Conn->qstr($value).') AND '; + $ret .= '(' . $field . ' = ' . $this->Conn->qstr($value) . ') AND '; } } - return preg_replace('/(.*) AND $/', '\\1', $ret); + return substr($ret, 0, -5); } /** Index: branches/5.0.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r12637 -r12706 --- branches/5.0.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 12637) +++ branches/5.0.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 12706) @@ -1,6 +1,6 @@ $field_value) { $values_sql .= $this->Conn->qstr($field_value).','; } - $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql); + $values_sql = substr($values_sql, 0, -1); $sql = 'INSERT INTO '.$table.' ('.$fields_sql.') VALUES ('.$values_sql.');'; $sql = str_replace("\n", "\\n", $sql); $sql = str_replace("\r", "\\r", $sql); Index: branches/5.0.x/core/units/helpers/multilanguage_helper.php =================================================================== diff -u -N -r12321 -r12706 --- branches/5.0.x/core/units/helpers/multilanguage_helper.php (.../multilanguage_helper.php) (revision 12321) +++ branches/5.0.x/core/units/helpers/multilanguage_helper.php (.../multilanguage_helper.php) (revision 12706) @@ -1,6 +1,6 @@ Conn->Query($sql); + + $this->Conn->Query( substr($sql, 0, -2) ); } /** Index: branches/5.0.x/core/kernel/utility/email_send.php =================================================================== diff -u -N -r12299 -r12706 --- branches/5.0.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 12299) +++ branches/5.0.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 12706) @@ -1,6 +1,6 @@ $address) { $value .= $this->QuotedPrintableEncode($name, $this->charset).' <'.$address.'>, '; } - $value = preg_replace('/(.*),$/', '\\1', $value); - $this->SetHeader($header, $value); + $this->SetHeader($header, substr($value, 0, -2)); } @@ -1903,10 +1902,9 @@ } $value = isset($this->headers[$header_name]) ? $this->headers[$header_name] : ''; - $value .= ', '.$this->QuotedPrintableEncode($name, $this->charset).' <'.$email.'>'; + $value .= ', ' . $this->QuotedPrintableEncode($name, $this->charset) . ' <' . $email . '>'; - $value = preg_replace('/^,(.*)/', '\\1', $value); // remove first comma - $this->SetHeader($header_name, $value); + $this->SetHeader($header_name, substr($value, 2)); } /**