mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-21 04:09:55 +09:00
merge from 1.5.3 (~r10943)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@10951 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
7aa4798373
commit
54e3a72065
334 changed files with 13011 additions and 5561 deletions
|
|
@ -1,17 +1,57 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Argument class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/argument
|
||||
* @version 0.1
|
||||
*/
|
||||
class Argument {
|
||||
|
||||
/**
|
||||
* argument value
|
||||
* @var mixed
|
||||
*/
|
||||
var $value;
|
||||
/**
|
||||
* argument name
|
||||
* @var string
|
||||
*/
|
||||
var $name;
|
||||
/**
|
||||
* argument type
|
||||
* @var string
|
||||
*/
|
||||
var $type;
|
||||
/**
|
||||
* result of argument type check
|
||||
* @var bool
|
||||
*/
|
||||
var $isValid;
|
||||
/**
|
||||
* error message
|
||||
* @var Object
|
||||
*/
|
||||
var $errorMessage;
|
||||
/**
|
||||
* column operation
|
||||
*/
|
||||
var $column_operation;
|
||||
|
||||
var $uses_default_value; // Check if arg value is user submnitted or default
|
||||
var $_value; // Caches escaped and toString value so that the parsing won't happen multiple times;
|
||||
/**
|
||||
* Check if arg value is user submnitted or default
|
||||
* @var mixed
|
||||
*/
|
||||
var $uses_default_value;
|
||||
/**
|
||||
* Caches escaped and toString value so that the parsing won't happen multiple times
|
||||
* @var mixed
|
||||
*/
|
||||
var $_value; //
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
function Argument($name, $value) {
|
||||
$this->value = $value;
|
||||
$this->name = $name;
|
||||
|
|
@ -60,6 +100,11 @@ class Argument {
|
|||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* mixed value to string
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
function toString($value) {
|
||||
if (is_array($value)) {
|
||||
if (count($value) === 0)
|
||||
|
|
@ -71,6 +116,11 @@ class Argument {
|
|||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* escape value
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
function escapeValue($value) {
|
||||
$column_type = $this->getType();
|
||||
if ($column_type == 'column_name') {
|
||||
|
|
@ -80,7 +130,8 @@ class Argument {
|
|||
if (!isset($value))
|
||||
return null;
|
||||
|
||||
if (in_array($column_type, array('date', 'varchar', 'char', 'text', 'bigtext'))) {
|
||||
$columnTypeList = array('date'=>1, 'varchar'=>1, 'char'=>1, 'text'=>1, 'bigtext'=>1);
|
||||
if (isset($columnTypeList[$column_type])) {
|
||||
if (!is_array($value))
|
||||
$value = $this->_escapeStringValue($value);
|
||||
else {
|
||||
|
|
@ -106,6 +157,11 @@ class Argument {
|
|||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* escape string value
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
function _escapeStringValue($value) {
|
||||
$db = &DB::getInstance();
|
||||
$value = $db->addQuotes($value);
|
||||
|
|
@ -135,6 +191,11 @@ class Argument {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check filter by filter type
|
||||
* @param string $filter_type
|
||||
* @return void
|
||||
*/
|
||||
function checkFilter($filter_type) {
|
||||
if (isset($this->value) && $this->value != '') {
|
||||
global $lang;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ConditionArgument class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/argument
|
||||
* @version 0.1
|
||||
*/
|
||||
class ConditionArgument extends Argument {
|
||||
/**
|
||||
* Operator keyword. for example 'in', 'notint', 'between'
|
||||
* @var string
|
||||
*/
|
||||
var $operation;
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param string $operation
|
||||
* @return void
|
||||
*/
|
||||
function ConditionArgument($name, $value, $operation){
|
||||
if(isset($value) && in_array($operation, array('in', 'notin', 'between')) && !is_array($value) && $value != ''){
|
||||
$operationList = array('in'=>1, 'notin'=>1, 'not_in'=>1, 'between'=>1);
|
||||
if(isset($value) && isset($operationList[$operation]) && !is_array($value) && $value != ''){
|
||||
$value = str_replace(' ', '', $value);
|
||||
$value = str_replace('\'', '', $value);
|
||||
$value = explode(',', $value);
|
||||
|
|
@ -14,6 +31,10 @@
|
|||
$this->operation = $operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* create condition value. set $this->value
|
||||
* @return void
|
||||
*/
|
||||
function createConditionValue(){
|
||||
if(!isset($this->value)) return;
|
||||
|
||||
|
|
@ -57,22 +78,23 @@
|
|||
if(!is_array($value)) $this->value = array($value);
|
||||
break;
|
||||
case 'notin':
|
||||
case 'not_in':
|
||||
if(!is_array($value)) $this->value = array($value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Since ConditionArgument is used in WHERE clause,
|
||||
* where the argument value is compared to a table column,
|
||||
* it is assumed that all arguments have type. There are cases though
|
||||
* where the column does not have any type - if it was removed from
|
||||
* the XML schema for example - see the is_secret column in xe_documents table.
|
||||
* In this case, the column type is retrieved according to argument
|
||||
* value type (using the PHP function is_numeric).
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
* Since ConditionArgument is used in WHERE clause,
|
||||
* where the argument value is compared to a table column,
|
||||
* it is assumed that all arguments have type. There are cases though
|
||||
* where the column does not have any type - if it was removed from
|
||||
* the XML schema for example - see the is_secret column in xe_documents table.
|
||||
* In this case, the column type is retrieved according to argument
|
||||
* value type (using the PHP function is_numeric).
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
function getType(){
|
||||
if($this->type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SortArgument class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/argument
|
||||
* @version 0.1
|
||||
*/
|
||||
class SortArgument extends Argument {
|
||||
|
||||
function getValue(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue