本文整理匯總了PHP中JCckDatabase::escape方法的典型用法代碼示例。如果您正苦於以下問題:PHP JCckDatabase::escape方法的具體用法?PHP JCckDatabase::escape怎麽用?PHP JCckDatabase::escape使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JCckDatabase
的用法示例。
在下文中一共展示了JCckDatabase::escape方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: g_onCCK_PaymentValidate
public static function g_onCCK_PaymentValidate($data, $success, &$config)
{
$update = 'pay_return = "' . JCckDatabase::escape(json_encode($data['order'])) . '",' . 'pay_return_payments = "' . JCckDatabase::escape(json_encode($data['payments'])) . '",' . 'state = ' . $data['order_state'];
JCckDatabase::execute('UPDATE #__cck_more_ecommerce_orders SET ' . $update . ' WHERE pay_key = "' . $config['pay_key'] . '"');
if (!$success) {
return;
}
// Cart
$cart_id = (int) JCckDatabase::loadResult('SELECT a.id FROM #__cck_more_ecommerce_carts AS a WHERE a.pay_key = "' . $config['pay_key'] . '"');
if ($cart_id) {
JCckDatabase::execute('UPDATE #__cck_more_ecommerce_carts SET pay_key = "" WHERE id = ' . $cart_id);
JCckDatabase::execute('DELETE a.* FROM #__cck_more_ecommerce_cart_product AS a WHERE a.cart_id = ' . $cart_id);
}
// Execute Processings (Invoice, Notifications, ...)
if (JCckToolbox::getConfig()->get('processing', 0)) {
$event = 'onCckPaymentSuccess';
$processing = JCckDatabaseCache::loadObjectListArray('SELECT type, scriptfile, options FROM #__cck_more_processings WHERE published = 1 ORDER BY ordering', 'type');
if (isset($processing[$event])) {
foreach ($processing[$event] as $p) {
if (is_file(JPATH_SITE . $p->scriptfile)) {
$options = new JRegistry($p->options);
include_once JPATH_SITE . $p->scriptfile;
}
}
}
}
}
示例2: _replace
public static function _replace($name, $value, $value_old, $string, &$config = array())
{
return str_replace(self::_format($name, JCckDatabase::escape($value_old)), self::_format($name, JCckDatabase::escape($value)), $string);
}
示例3: ajaxSaveIntegration
public function ajaxSaveIntegration()
{
$app = JFactory::getApplication();
$json = JCck::on() ? $app->input->JSON->getRaw() : $app->input->getRaw('integration');
$objects = json_decode($json);
if (count($objects)) {
$query = 'UPDATE #__cck_core_objects SET options = CASE name';
foreach ($objects as $k => $v) {
$query .= ' WHEN "' . $k . '" THEN "' . JCckDatabase::escape(json_encode($v)) . '"';
$in .= '"' . $k . '",';
}
$in = substr($in, 0, -1);
$query .= ' ELSE options END WHERE name IN (' . $in . ')';
JCckDatabase::execute($query);
}
}
示例4: IN
$and = '';
$column = $app->input->getString('avColumn', '');
$key = $app->input->getString('avKey', '');
$where = $app->input->getString('avWhere', '');
$table = $app->input->getString('avTable', '');
// Process
if ($where) {
$fields = JCckDatabase::loadObjectList('SELECT name, storage, storage_table, storage_field FROM #__cck_core_fields WHERE name IN ("' . str_replace(',', '","', $where) . '")', 'name');
$where = explode(',', $where);
foreach ($where as $w) {
if (isset($fields[$w]) && $fields[$w]->storage == 'standard' && $fields[$w]->storage_table == '#__' . $table) {
$v = $app->input->get($w);
if ($v != '') {
$and .= ' ' . $fields[$w]->storage_field . '="' . JCckDatabase::escape($v) . '"';
}
}
}
$and = $and ? ' AND' . $and : '';
}
if ($key) {
$pk = $app->input->getInt('avPk', 0);
$pv = $app->input->getString('avPv', '');
$pv = str_replace(array('%26lt;', '%26gt;', '%27'), array('<', '>', "'"), $pv);
$count = (int) JCckDatabase::loadResult('SELECT ' . $key . ' FROM #__' . $table . ' WHERE ' . $column . ' = "' . JCckDatabase::escape($value) . '"' . $and);
$res[1] = $count > 0 && $count != $pk ? false : true;
} else {
$count = (int) JCckDatabase::loadResult('SELECT COUNT(' . $column . ') FROM #__' . $table . ' WHERE ' . $column . ' = "' . JCckDatabase::escape($value) . '"' . $and);
$res[1] = $count > 0 ? false : true;
}
// Set
echo json_encode($res);
示例5: onCCK_StoragePrepareSearch
public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target, $fields = array(), &$config = array())
{
$sql = '';
switch ($match) {
case 'exact':
$sql = $target . ' = ' . JCckDatabase::quote($value);
break;
case 'empty':
$sql = $target . ' = ""';
break;
case 'alpha':
$sql = $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
break;
case 'zeta':
/* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
$sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
break;
case 'any':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
}
}
if (count($fragments)) {
$sql = '((' . implode(') OR (', $fragments) . '))';
}
}
break;
case 'any_exact':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
$var_type = $field->match_options ? $field->match_options->get('var_type', 1) : 1;
if (!$var_type) {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $v;
}
}
} else {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = JCckDatabase::quote($v);
}
}
}
if (count($fragments)) {
$sql = $target . ' IN (' . implode(',', $fragments) . ')';
}
}
break;
case 'each':
case 'each_exact':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
if ($match == 'each_exact') {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' = ' . JCckDatabase::quote($v) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($v, true) . $separator . '%', false) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote('%' . $separator . JCckDatabase::escape($v, true) . $separator . '%', false) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote('%' . $separator . JCckDatabase::escape($v, true), false);
}
}
} else {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
}
}
}
if (count($fragments)) {
$sql = '((' . implode(') AND (', $fragments) . '))';
}
}
break;
case 'date_past_only':
$sql = $target . ' < ' . JCckDatabase::quote($value);
break;
case 'date_past':
$sql = $target . ' <= ' . JCckDatabase::quote($value);
break;
case 'date_future':
$sql = $target . ' >= ' . JCckDatabase::quote($value);
break;
case 'date_future_only':
$sql = $target . ' > ' . JCckDatabase::quote($value);
break;
case 'nested_exact':
$table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
$column = 'id';
$values = JCckDevHelper::getBranch($table, $value);
if ($column != 'id') {
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
//.........這裏部分代碼省略.........
示例6: _where
protected static function _where($table, $fieldnames, $values, $method = 'array')
{
$and = '';
$fields = JCckDatabase::loadObjectList('SELECT name, storage, storage_table, storage_field FROM #__cck_core_fields WHERE name IN ("' . str_replace('||', '","', $fieldnames) . '")', 'name');
$s_fields = array();
$where = explode('||', $fieldnames);
if ($method == 'object') {
foreach ($where as $w) {
if (isset($fields[$w]) && $fields[$w]->storage == 'standard' && $fields[$w]->storage_table == $table) {
$s_field = $fields[$w]->storage_field;
$v = isset($values->{$s_field}) ? $values->{$s_field} : '';
if ($v != '' && !isset($s_fields[$s_field])) {
$s_fields[$s_field] = '';
$and .= ' AND ' . $s_field . '="' . JCckDatabase::escape($v) . '"';
}
}
}
} else {
foreach ($where as $w) {
if (isset($fields[$w]) && $fields[$w]->storage == 'standard' && $fields[$w]->storage_table == $table) {
$v = $fields[$w]->value;
if ($v != '' && !isset($s_fields[$s_field])) {
$s_fields[$s_field] = '';
$and .= ' ' . $values[$w]->storage_field . '="' . JCckDatabase::escape($v) . '"';
}
}
}
}
return $and;
}
示例7: onCCK_StoragePrepareSearch
public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target)
{
$sql = '';
switch ($match) {
case 'exact':
$sql = $target . ' = ' . JCckDatabase::quote($value);
break;
case 'alpha':
$sql = $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
break;
case 'zeta':
/* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
$sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
break;
case 'any':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
}
}
if (count($fragments)) {
$sql = '((' . implode(') OR (', $fragments) . '))';
}
}
break;
case 'any_exact':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
$var_type = $field->match_options ? $field->match_options->get('var_type', 1) : 1;
if (!$var_type) {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $v;
}
}
} else {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = JCckDatabase::quote($v);
}
}
}
if (count($fragments)) {
$sql = $target . ' IN (' . implode(',', $fragments) . ')';
}
}
break;
case 'each':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
}
}
if (count($fragments)) {
$sql = '((' . implode(') AND (', $fragments) . '))';
}
}
break;
case 'date_past_only':
$sql = $target . ' < ' . JCckDatabase::quote($value);
break;
case 'date_past':
$sql = $target . ' <= ' . JCckDatabase::quote($value);
break;
case 'date_future':
$sql = $target . ' >= ' . JCckDatabase::quote($value);
break;
case 'date_future_only':
$sql = $target . ' > ' . JCckDatabase::quote($value);
break;
case 'nested_exact':
$table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
$column = 'id';
$values = JCckDevHelper::getBranch($table, $value);
if ($column != 'id') {
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
if ($v != '') {
$fragments[] = JCckDatabase::quote($v);
}
}
if (count($fragments)) {
$sql = $target . ' IN (' . implode(',', $fragments) . ')';
}
}
} else {
if (count($values)) {
$sql = $target . ' IN (' . implode(',', $values) . ')';
}
//.........這裏部分代碼省略.........