mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 05:37:32 +02:00
SimplerParse() fix. Db-verify fix for MPREFIX inclusion in xxxx_sql.php files.
This commit is contained in:
@@ -707,14 +707,33 @@ class db_verify
|
|||||||
|
|
||||||
$sql_data = preg_replace("#\/\*.*?\*\/#mis", '', $sql_data); // remove comments
|
$sql_data = preg_replace("#\/\*.*?\*\/#mis", '', $sql_data); // remove comments
|
||||||
|
|
||||||
// $regex = "/CREATE TABLE `?([\w]*)`?\s*?\(([\sa-z0-9_\(\),' `]*)\)\s*(ENGINE|TYPE)\s*?=\s?([\w]*)[\w =]*;/i";
|
// $regex = "/CREATE TABLE `?([\w]*)`?\s*?\(([\s\w\+\-_\(\),'\. `]*)\)\s*(ENGINE|TYPE)\s*?=\s?([\w]*)[\w =]*;/i";
|
||||||
$regex = "/CREATE TABLE `?([\w]*)`?\s*?\(([\s\w\+\-_\(\),'\. `]*)\)\s*(ENGINE|TYPE)\s*?=\s?([\w]*)[\w =]*;/i";
|
|
||||||
|
$regex = "/CREATE TABLE (?:IF NOT EXISTS )?`?([\w]*)`?\s*?\(([\s\w\+\-_\(\),'\. `]*)\)\s*(ENGINE|TYPE)\s*?=\s?([\w]*)[\w =]*;/i";
|
||||||
|
|
||||||
$table = preg_match_all($regex,$sql_data,$match);
|
$table = preg_match_all($regex,$sql_data,$match);
|
||||||
|
|
||||||
$ret['tables'] = $match[1];
|
|
||||||
|
|
||||||
|
$tables = array();
|
||||||
|
|
||||||
|
foreach($match[1] as $c=>$k)
|
||||||
|
{
|
||||||
|
if(substr($k,0, 5) == 'e107_') // remove prefix if found in sql dump.
|
||||||
|
{
|
||||||
|
$k = substr($k, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tables[$c] = $k;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$ret['tables'] = $tables;
|
||||||
$ret['data'] = $match[2];
|
$ret['data'] = $match[2];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -734,9 +734,12 @@ class e_parse
|
|||||||
return preg_replace_callback("#\{([a-zA-Z0-9_]+)\}#", array($this, 'simpleReplace'), $template);
|
return preg_replace_callback("#\{([a-zA-Z0-9_]+)\}#", array($this, 'simpleReplace'), $template);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function simpleReplace($tmp) {
|
protected function simpleReplace($tmp)
|
||||||
|
{
|
||||||
$unset = ($this->replaceUnset !== false ? $this->replaceUnset : $tmp[0]);
|
$unset = ($this->replaceUnset !== false ? $this->replaceUnset : $tmp[0]);
|
||||||
return ($this->replaceVars->$tmp[1] !== null ? $this->replaceVars->$tmp[1] : $unset);
|
$key = $tmp[1];
|
||||||
|
return ($this->replaceVars[$key] !== null ? $this->replaceVars[$key]: $unset);
|
||||||
|
// return ($this->replaceVars->$tmp[1] !== null ? $this->replaceVars->$tmp[1] : $unset); // Doesn't work.
|
||||||
}
|
}
|
||||||
|
|
||||||
function htmlwrap($str, $width, $break = "\n", $nobreak = "a", $nobr = "pre", $utf = FALSE)
|
function htmlwrap($str, $width, $break = "\n", $nobreak = "a", $nobr = "pre", $utf = FALSE)
|
||||||
|
@@ -545,7 +545,7 @@ class e_form
|
|||||||
*/
|
*/
|
||||||
function datepicker($name, $datestamp = false, $options = null)
|
function datepicker($name, $datestamp = false, $options = null)
|
||||||
{
|
{
|
||||||
if(vartrue($options) && !is_array($options))
|
if(vartrue($options) && is_string($options))
|
||||||
{
|
{
|
||||||
parse_str($options,$options);
|
parse_str($options,$options);
|
||||||
}
|
}
|
||||||
@@ -614,6 +614,7 @@ class e_form
|
|||||||
|
|
||||||
$class = (isset($classes[$type])) ? $classes[$type] : "tbox e-date";
|
$class = (isset($classes[$type])) ? $classes[$type] : "tbox e-date";
|
||||||
$size = vartrue($options['size']) ? intval($options['size']) : 40;
|
$size = vartrue($options['size']) ? intval($options['size']) : 40;
|
||||||
|
$required = vartrue($options['required']) ? "required" : "";
|
||||||
|
|
||||||
if(vartrue($options['inline']))
|
if(vartrue($options['inline']))
|
||||||
{
|
{
|
||||||
@@ -623,7 +624,7 @@ class e_form
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$text .= "<input class='{$class}' type='text' size='{$size}' name='{$name}' id='{$id}' value='{$value}' data-date-format='{$dformat}' data-time-format='{$tformat}' data-date-ampm='{$ampm}' />";
|
$text .= "<input class='{$class}' type='text' size='{$size}' name='{$name}' id='{$id}' value='{$value}' data-date-format='{$dformat}' data-time-format='{$tformat}' data-date-ampm='{$ampm}' {$required} />";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
Reference in New Issue
Block a user