本文整理汇总了PHP中PearDatabase::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP PearDatabase::quote方法的具体用法?PHP PearDatabase::quote怎么用?PHP PearDatabase::quote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PearDatabase
的用法示例。
在下文中一共展示了PearDatabase::quote方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queryFilterone_of
function queryFilterone_of(&$layout_def)
{
foreach ($layout_def['input_name0'] as $key => $value) {
$layout_def['input_name0'][$key] = PearDatabase::quote($value);
}
return $this->_get_column_select($layout_def) . " IN ('" . implode("','", $layout_def['input_name0']) . "')\n";
}
示例2: add_create_assigned_user_name
function add_create_assigned_user_name()
{
// global is defined in UsersLastImport.php
global $imported_ids;
global $current_user;
if (empty($this->assigned_user_name)) {
return;
}
$user_name = $this->assigned_user_name;
// check if it already exists
$focus = new User();
$query = "select * from {$focus->table_name} WHERE user_name='{$user_name}'";
$GLOBALS['log']->info($query);
$result = $this->db->query($query) or sugar_die("Error selecting sugarbean: ");
$row = $this->db->fetchByAssoc($result, -1, false);
// we found a row with that id
if (isset($row['id']) && $row['id'] != -1) {
// if it exists but was deleted, just remove it entirely
if (isset($row['deleted']) && $row['deleted'] == 1) {
$query2 = "delete from {$focus->table_name} WHERE id='" . PearDatabase::quote($row['id']) . "'";
$GLOBALS['log']->info($query2);
$result2 = $this->db->query($query2) or sugar_die("Error deleting existing sugarbean: ");
} else {
$focus->id = $row['id'];
}
}
// now just link the account
$this->assigned_user_id = $focus->id;
$this->modified_user_id = $focus->id;
}
示例3: queryFilterone_of
function queryFilterone_of(&$layout_def)
{
$arr = array();
foreach ($layout_def['input_name0'] as $value) {
array_push($arr, "'" . PearDatabase::quote($value) . "'");
}
$str = implode(",", $arr);
return $this->_get_column_select($layout_def) . " IN (" . $str . ")\n";
}
示例4: build_generic_where_clause
/**
builds a generic search based on the query string using or
do not include any $this-> because this is called on without having the class instantiated
*/
function build_generic_where_clause($the_query_string)
{
$where_clauses = array();
$the_query_string = PearDatabase::quote(from_html($the_query_string));
array_push($where_clauses, "leads.last_name like '{$the_query_string}%'");
array_push($where_clauses, "leads.account_name like '{$the_query_string}%'");
array_push($where_clauses, "leads.first_name like '{$the_query_string}%'");
array_push($where_clauses, "leads.email1 like '{$the_query_string}%'");
array_push($where_clauses, "leads.email2 like '{$the_query_string}%'");
if (is_numeric($the_query_string)) {
array_push($where_clauses, "leads.phone_home like '%{$the_query_string}%'");
array_push($where_clauses, "leads.phone_mobile like '%{$the_query_string}%'");
array_push($where_clauses, "leads.phone_work like '%{$the_query_string}%'");
array_push($where_clauses, "leads.phone_other like '%{$the_query_string}%'");
array_push($where_clauses, "leads.phone_fax like '%{$the_query_string}%'");
}
$the_where = "";
foreach ($where_clauses as $clause) {
if ($the_where != "") {
$the_where .= " or ";
}
$the_where .= $clause;
}
return $the_where;
}
示例5: build_generic_where_clause
/**
*
*/
function build_generic_where_clause($the_query_string)
{
$where_clauses = array();
$the_query_string = PearDatabase::quote(from_html($the_query_string));
array_push($where_clauses, "ink.name LIKE '%{$the_query_string}%'");
$the_where = '';
foreach ($where_clauses as $clause) {
if ($the_where != '') {
$the_where .= " OR ";
}
$the_where .= $clause;
}
return $the_where;
}
示例6: build_generic_where_clause
/**
builds a generic search based on the query string using or
do not include any $this-> because this is called on without having the class instantiated
*/
function build_generic_where_clause($the_query_string)
{
$where_clauses = array();
$the_query_string = PearDatabase::quote(from_html($the_query_string));
array_push($where_clauses, "cases.name like '{$the_query_string}%'");
array_push($where_clauses, "accounts.name like '{$the_query_string}%'");
if (is_numeric($the_query_string)) {
array_push($where_clauses, "cases.case_number like '{$the_query_string}%'");
}
$the_where = "";
foreach ($where_clauses as $clause) {
if ($the_where != "") {
$the_where .= " or ";
}
$the_where .= $clause;
}
if ($the_where != "") {
$the_where = "(" . $the_where . ")";
}
return $the_where;
}
示例7: array
$current_user_only = $_REQUEST['current_user_only'];
}
if (isset($_REQUEST['assigned_user_id'])) {
$assigned_user_id = $_REQUEST['assigned_user_id'];
}
//if (isset($_REQUEST['spec'])) $spec = $_REQUEST['spec'];
//if (isset($_REQUEST['subordinate_only'])) $subordinate_only = $_REQUEST['subordinate_only'];
$where_clauses = array();
if (isset($name) && $name != "") {
array_push($where_clauses, "products.name like '%" . PearDatabase::quote($name) . "%'");
}
if (isset($pnum) && $pnum != "") {
array_push($where_clauses, "products.pnum like '%" . PearDatabase::quote($pnum) . "%'");
}
if (isset($category) && $category != "") {
array_push($where_clauses, "products.category like '%" . PearDatabase::quote($category) . "%'");
}
//if(isset($type) && $type != "") array_push($where_clauses, "products.type like '%".PearDatabase::quote($type)."%'");
if (isset($current_user_only) && $current_user_only != "") {
array_push($where_clauses, "products.assigned_user_id='{$current_user->id}'");
}
/*
//search by modified date.
$date_period = '';
if (isset($_REQUEST['date_period'])) $date_period = $_REQUEST['date_period'];
if($date_period == "cust"){
if (isset($_REQUEST['date_from'])) $date_from = $_REQUEST['date_from'];
if (isset($_REQUEST['date_to'])) $date_to = $_REQUEST['date_to'];
}else{
$date_from = get_date_from($date_period);
示例8: StoreQuery
require_once 'modules/MySettings/StoreQuery.php';
$storeQuery = new StoreQuery();
if ($_REQUEST['action'] == 'index') {
if (!isset($_REQUEST['query'])) {
$storeQuery->loadQuery($currentModule);
$storeQuery->populateRequest();
} else {
$storeQuery->saveFromGet($currentModule);
}
}
if (isset($_REQUEST['query'])) {
// we have a query
$searchForm->populateFromRequest();
if (!empty($_REQUEST['date_closed']) && !empty($_REQUEST['date_start'])) {
// this is to handle dashboard queries
$whereAdditional = "opportunities.date_closed >= '" . PearDatabase::quote($_REQUEST['date_start']) . "' and opportunities.date_closed <= '" . PearDatabase::quote($_REQUEST['date_closed']) . "'";
if (isset($searchForm->searchFields['date_closed'])) {
unset($searchForm->searchFields['date_closed']);
}
}
$where_clauses = $searchForm->generateSearchWhere($_REQUEST, true, "Opportunities");
// First change the query string value for sales_stage
$position = array_search("opportunities.sales_stage = 'Other'", $where_clauses);
if ($position !== false) {
$where_clauses[$position] = "opportunities.sales_stage not in ('Closed Won', 'Closed Lost')";
// Same as: ("SELECT DISTINCT sales_stage from opportunities where sales_stage not in ('Closed Won', 'Closed Lost')")
}
if (isset($whereAdditional)) {
array_push($where_clauses, $whereAdditional);
}
$where = "";
示例9: add_create_assigned_user_name
function add_create_assigned_user_name()
{
// global is defined in UsersLastImport.php
global $imported_ids;
global $current_user;
if (empty($this->assigned_real_user_name)) {
return;
}
$arr = array();
$name_arr = preg_split('/\\s+/', $this->assigned_real_user_name);
if (count($name_arr) == 1) {
$first_name = $this->assigned_real_user_name;
} else {
$first_name = array_shift($name_arr);
$last_name = join(' ', $name_arr);
}
if (empty($last_name)) {
$user_name = strtolower($first_name);
} else {
$user_name = strtolower($first_name . '_' . $last_name);
}
$user_name = preg_replace('/[^A-Za-z_]+/', '_', $user_name);
$arr = array();
// check if it already exists
$focus = new User();
$query = "select * from {$focus->table_name} WHERE (first_name='" . PearDatabase::quote($first_name) . "' AND last_name='" . PearDatabase::quote($last_name) . "') OR user_name='{$user_name}'";
$GLOBALS['log']->info($query);
$result = $this->db->query($query) or sugar_die("Error selecting sugarbean: ");
$row = $this->db->fetchByAssoc($result, -1, false);
// we found a row with that id
if (isset($row['id']) && $row['id'] != -1) {
// if it exists but was deleted, just remove it entirely
if (isset($row['deleted']) && $row['deleted'] == 1) {
$query2 = "delete from {$focus->table_name} WHERE id='" . PearDatabase::quote($row['id']) . "'";
$GLOBALS['log']->info($query2);
$result2 = $this->db->query($query2) or sugar_die("Error deleting existing sugarbean: ");
} else {
$focus->id = $row['id'];
}
}
// now just link the account
$this->assigned_user_id = $focus->id;
$this->modified_user_id = $focus->id;
}
示例10: build_generic_where_clause
/**
builds a generic search based on the query string using or
do not include any $this-> because this is called on without having the class instantiated
*/
function build_generic_where_clause($the_query_string)
{
$where_clauses = array();
$the_query_string = PearDatabase::quote(from_html($the_query_string));
array_push($where_clauses, "name like '{$the_query_string}%'");
$the_where = "";
foreach ($where_clauses as $clause) {
if ($the_where != "") {
$the_where .= " or ";
}
$the_where .= $clause;
}
return $the_where;
}
示例11: Role
if (!isset($_REQUEST['query'])) {
$storeQuery->loadQuery($currentModule);
$storeQuery->populateRequest();
} else {
$storeQuery->saveFromGet($currentModule);
}
}
$seedRole = new Role();
if (isset($_REQUEST['query'])) {
// we have a query
if (isset($_REQUEST['name'])) {
$name = $_REQUEST['name'];
}
$where_clauses = array();
if (isset($name) && $name != "") {
array_push($where_clauses, "roles.name like '" . PearDatabase::quote($name) . "%'");
}
$seedRole->custom_fields->setWhereClauses($where_clauses);
$where = "";
foreach ($where_clauses as $clause) {
if ($where != "") {
$where .= " and ";
}
$where .= $clause;
}
$GLOBALS['log']->info("Here is the where clause for the list view: {$where}");
}
if (!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
// Stick the form header out there.
$search_form = new XTemplate('modules/Roles/SearchForm.html');
$search_form->assign("MOD", $current_module_strings);
示例12: setWhereClauses
function setWhereClauses(&$where_clauses)
{
if (!array_key_exists($this->module, $this->modules)) {
return false;
}
foreach ($this->avail_fields as $name => $value) {
if (!empty($_REQUEST[$name])) {
array_push($where_clauses, $this->bean->table_name . "_cstm.{$name} LIKE '" . PearDatabase::quote($_REQUEST[$name]) . "%'");
}
}
}
示例13: queryFilterBetween_Dates
function queryFilterBetween_Dates(&$layout_def)
{
global $timedate;
if ($this->getAssignedUser()) {
$begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->dbDayFormat, false, $this->assigned_user);
$end = $timedate->handle_offset($layout_def['input_name1'], $timedate->dbDayFormat, false, $this->assigned_user);
} else {
$begin = $layout_def['input_name0'];
$end = $layout_def['input_name1'];
}
return "(" . $this->_get_column_select($layout_def) . ">='" . PearDatabase::quote($begin) . "' AND \n" . $this->_get_column_select($layout_def) . "<='" . PearDatabase::quote($end) . "')\n";
}
示例14: queryFilterBetween
function queryFilterBetween(&$layout_def)
{
return $this->_get_column_select($layout_def) . " BETWEEN '" . PearDatabase::quote($layout_def['input_name0']) . "' AND '" . PearDatabase::quote($layout_def['input_name1']) . "'\n";
}
示例15: build_generic_where_clause
/**
builds a generic search based on the query string using or
do not include any $this-> because this is called on without having the class instantiated
*/
function build_generic_where_clause($the_query_string)
{
$where_clauses = array();
$the_query_string = PearDatabase::quote(from_html($the_query_string));
array_push($where_clauses, "suppliers.name like '{$the_query_string}%'");
if (is_numeric($the_query_string)) {
array_push($where_clauses, "suppliers.phone_alternate like '%{$the_query_string}%'");
array_push($where_clauses, "suppliers.phone_fax like '%{$the_query_string}%'");
array_push($where_clauses, "suppliers.phone_office like '%{$the_query_string}%'");
}
$the_where = "";
foreach ($where_clauses as $clause) {
if (!empty($the_where)) {
$the_where .= " or ";
}
$the_where .= $clause;
}
return $the_where;
}