mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-16 09:49:54 +09:00
merge from branch luminous (version 1.5.4.2, ~r12561)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@12611 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
2263200ce4
commit
cc47d2b247
196 changed files with 3655 additions and 2033 deletions
|
|
@ -97,6 +97,7 @@ class Argument {
|
|||
}
|
||||
|
||||
function getUnescapedValue() {
|
||||
if($this->value === 'null') return null;
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
|
|
@ -163,19 +164,47 @@ class Argument {
|
|||
* @return string
|
||||
*/
|
||||
function _escapeStringValue($value) {
|
||||
// Remove non-utf8 chars.
|
||||
$regex = '@((?:[\x00-\x7F]|[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}){1,100})|([\xF0-\xF7][\x80-\xBF]{3})|([\x80-\xBF])|([\xC0-\xFF])@x';
|
||||
|
||||
$value = preg_replace_callback($regex, array($this, 'utf8Replacer'), $value);
|
||||
$db = &DB::getInstance();
|
||||
$value = $db->addQuotes($value);
|
||||
return '\'' . $value . '\'';
|
||||
}
|
||||
|
||||
function utf8Replacer($captures) {
|
||||
if (!empty($captures[1]))
|
||||
{
|
||||
// Valid byte sequence. Return unmodified.
|
||||
return $captures[1];
|
||||
}
|
||||
elseif(!empty($captures[2]))
|
||||
{
|
||||
// Remove user defined area
|
||||
if("\xF3\xB0\x80\x80" <= $captures[2])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return $captures[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function isValid() {
|
||||
return $this->isValid;
|
||||
}
|
||||
|
||||
function isColumnName(){
|
||||
$type = $this->getType();
|
||||
$value = $this->getUnescapedValue();
|
||||
if($type == 'column_name') return true;
|
||||
if($type == 'number' && !is_numeric($this->value) && $this->uses_default_value) return true;
|
||||
if($type == 'number' && is_null($value)) return false;
|
||||
if($type == 'number' && !is_numeric($value) && $this->uses_default_value) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue