当前位置: 首页>>代码示例>>PHP>>正文


PHP DBQuery::quote方法代码示例

本文整理汇总了PHP中DBQuery::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::quote方法的具体用法?PHP DBQuery::quote怎么用?PHP DBQuery::quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBQuery的用法示例。


在下文中一共展示了DBQuery::quote方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: afterConstruct

 public function afterConstruct()
 {
     foreach ($this->Language->findAll() as $Language) {
         $modelName = 'Text' . ucFirst($Language->id);
         $this->bind($modelName, 'hasOne', array('class' => 'MediaText', 'foreignKey' => 'media_file_id', 'dependent' => true, 'conditions' => array($modelName . '.language_id' => DBQuery::quote($Language->id))));
         $this->{$modelName}->language_id = $Language->id;
     }
     return parent::afterConstruct();
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:9,代码来源:MediaFile.php

示例2: isUnique

 /**
  *	Tests if the user is unique
  * 	@return boolean
  */
 public function isUnique()
 {
     $params = array('conditions' => array('User.email' => DBQuery::quote($this->email)));
     if ($this->exists()) {
         $params['conditions']['User.id <>'] = (int) $this->id;
     }
     if ($doubleUser = $this->find($params)) {
         return false;
     }
     return true;
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:15,代码来源:User.php

示例3: similarEntries

 public function similarEntries()
 {
     if (!$this->exists() || $this->Tags->count() == 0) {
         return false;
     }
     $queryFile = dirname(__FILE__) . '/../../console/sql/similarBlogPosts.sql';
     if (!file_exists($queryFile)) {
         return false;
     }
     $tmp = new IndexedArray();
     foreach ($this->Tags as $Tag) {
         $tmp[] = 'Tag.name = ' . DBQuery::quote($Tag->get('name'));
     }
     $tagConditions = $tmp->implode(' OR ');
     $query = sprintf(file_get_contents($queryFile), $tagConditions, $this->id);
     return $this->query($query);
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:17,代码来源:BlogPost.php

示例4: toModel

 public function toModel(Model $model, $fields = null, $ignore = null)
 {
     if ($model->behaviors->hasBehavior('Flagable')) {
         if ($this->hasField('allowComments')) {
             $model->setFlag(BlogPostFlag::ALLOW_COMMENTS, $this->allowComments->value());
         }
         if ($this->hasField('sticky')) {
             $model->setFlag(BlogPostFlag::STICKY, $this->sticky->value());
         }
     }
     // saving tags
     $this->Tags = new IndexedArray();
     $tags = array_filter(array_unique(preg_split('/\\s+/i', $this->tags->value())));
     foreach ($tags as $tag) {
         $Tag = new Tag(array('name' => $tag, 'model' => DBQuery::quote($model->name)));
         $Tag->set('BlogPostTag', array('model' => DBQuery::quote($model->name)));
         $model->Tags[] = $Tag;
     }
     return parent::toModel($model, $fields, $ignore);
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:20,代码来源:AdminBlogPostForm.php

示例5: DBQuery

}
require_once $AppUI->getModuleClass('companies');
global $dPconfig, $canEdit, $stub, $where, $orderby;
$q = new DBQuery();
$q->addTable('users', 'u');
$q->addQuery('DISTINCT(user_id), user_username, contact_last_name, contact_first_name,
	permission_user, contact_email, company_name, contact_company');
$q->addJoin('contacts', 'con', 'user_contact = contact_id');
$q->addJoin('companies', 'com', 'contact_company = company_id');
$q->addJoin('permissions', 'per', 'user_id = permission_user');
$obj = new CCompany();
$companies = $obj->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
if (count($companies) > 0) {
    $companyList = '0';
    foreach ($companies as $k => $v) {
        $companyList .= ', ' . $k;
    }
    $q->addWhere('user_company in (' . $companyList . ')');
}
if ($stub) {
    $q->addWhere("(UPPER(user_username) LIKE '{$stub}%'" . " OR UPPER(contact_first_name) LIKE '{$stub}%'" . " OR UPPER(contact_last_name) LIKE '{$stub}%')");
} else {
    if ($where) {
        $where = $q->quote("%{$where}%");
        $q->addWhere("(UPPER(user_username) LIKE {$where}" . " OR UPPER(contact_first_name) LIKE {$where}" . " OR UPPER(contact_last_name) LIKE {$where})");
    }
}
$q->addOrder($orderby);
$users = $q->loadList();
$canLogin = true;
require DP_BASE_DIR . '/modules/admin/vw_usr.php';
开发者ID:illuminate3,项目名称:dotproject,代码行数:31,代码来源:vw_active_usr.php

示例6: getDepartmentDetails

 function getDepartmentDetails()
 {
     $result = array('dept_id' => 0, 'dept_name' => '');
     if (!$this->contact_department) {
         return $result;
     }
     $sql = "select dept_id, dept_name from departments";
     $q = new DBQuery();
     $q->addTable('departments');
     $q->addQuery('dept_id, dept_name');
     if ($this->is_alpha($this->contact_department)) {
         $q->addWhere('dept_name = ' . $q->quote($this->contact_department));
     } else {
         $q->addWhere("dept_id = '" . $this->contact_department . "'");
     }
     $sql = $q->prepare();
     $q->clear();
     db_loadHash($sql, $result);
     return $result;
 }
开发者ID:magsilva,项目名称:dotproject,代码行数:20,代码来源:contacts.class.php

示例7: w2PgetUsersHashList

function w2PgetUsersHashList($stub = null, $where = null, $orderby = 'contact_first_name, contact_last_name')
{
    global $AppUI;
    $q = new DBQuery();
    $q->addTable('users');
    $q->addQuery('DISTINCT(user_id), user_username, contact_last_name, contact_first_name,
		 contact_email, company_name, contact_company, dept_id, dept_name, CONCAT(contact_first_name,\' \',contact_last_name) contact_name, user_type');
    $q->addJoin('contacts', 'con', 'contact_id = user_contact', 'inner');
    if ($stub) {
        $q->addWhere('(UPPER(user_username) LIKE \'' . $stub . '%\' or UPPER(contact_first_name) LIKE \'' . $stub . '%\' OR UPPER(contact_last_name) LIKE \'' . $stub . '%\')');
    } elseif ($where) {
        $where = $q->quote('%' . $where . '%');
        $q->addWhere('(UPPER(user_username) LIKE ' . $where . ' OR UPPER(contact_first_name) LIKE ' . $where . ' OR UPPER(contact_last_name) LIKE ' . $where . ')');
    }
    $q->addGroup('user_id');
    $q->addOrder($orderby);
    // get CCompany() to filter by company
    $obj = new CCompany();
    $companies = $obj->getAllowedSQL($AppUI->user_id, 'company_id');
    $q->addJoin('companies', 'com', 'company_id = contact_company');
    if ($companies) {
        $q->addWhere('(' . implode(' OR ', $companies) . ' OR contact_company=\'\' OR contact_company IS NULL OR contact_company = 0)');
    }
    $dpt = new CDepartment();
    $depts = $dpt->getAllowedSQL($AppUI->user_id, 'dept_id');
    $q->addJoin('departments', 'dep', 'dept_id = contact_department');
    if ($depts) {
        $q->addWhere('(' . implode(' OR ', $depts) . ' OR contact_department=0)');
    }
    return $q->loadHashList('user_id');
}
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:main_functions.php

示例8: findNode

 /**
  * Tries to find a node by the passed $idOrNodeName
  *	
  * @param integer|string $idOrNodeName
  * @return Node|boolean
  */
 public function findNode($idOrNodeName, $languageId = null)
 {
     $this->depth = 1;
     $languageId = coalesce(@$languageId, I18n::locale());
     if (is_int($idOrNodeName)) {
         $conditions = array('id' => $idOrNodeName);
     } else {
         $conditions = array('NodeText' . ucfirst(substr($languageId, 0, 2)) . '.uri' => DBQuery::quote($idOrNodeName));
     }
     return $this->find(array('conditions' => $conditions));
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:17,代码来源:Node.php

示例9: getDepartmentDetails

 public function getDepartmentDetails()
 {
     $result = array('dept_id' => 0, 'dept_name' => '');
     if (!$this->contact_department) {
         return $result;
     }
     $q = new DBQuery();
     $q->addTable('departments');
     $q->addQuery('dept_id, dept_name');
     if ($this->is_alpha($this->contact_department)) {
         $q->addWhere('dept_name = ' . $q->quote($this->contact_department));
     } else {
         $q->addWhere('dept_id = ' . (int) $this->contact_department);
     }
     return $q->loadHash();
 }
开发者ID:joly,项目名称:web2project,代码行数:16,代码来源:contacts.class.php

示例10: getModuleByName

 public function getModuleByName($name)
 {
     $q = new DBQuery();
     $name = $q->quote($name);
     $q->addTable('modules');
     $q->addQuery('mod_directory');
     $q->addWhere("permissions_item_table = '" . $name . "' OR mod_directory = '" . $name . "'");
     return $q->loadResult();
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:9,代码来源:system.class.php

示例11: search

 /**
  * Standard search action, searches for a $key $keyword match and lists
  * all matches
  * @deprecated move this to component
  * @param string $keyword
  */
 public function search($q = null, $fields = array())
 {
     $results = new IndexedArray();
     $this->data->set('q', $q);
     if (strlen($q) <= 0 || !isset($this->{$this->name}) || empty($fields)) {
         return $results;
     }
     foreach ($fields as $fieldname) {
         if (strstr($fieldname, '.') == false) {
             $conditions[] = $this->{$this->name}->name . '.' . $fieldname . ' LIKE ' . DBQuery::quote('%' . $q . '%') . ' OR';
         } else {
             $conditions[] = $fieldname . ' LIKE ' . DBQuery::quote('%' . $q . '%') . ' OR';
         }
     }
     $page = isset($this->params['page']) ? $this->params['page'] : 1;
     $pagination = $this->{$this->name}->paginate($page, null, $conditions);
     $pagination['url'] = Router::getRoute(lcfirst($this->name) . 'SearchPaged', array('q' => $q));
     $this->data->set('pagination', $pagination);
     $params = array('conditions' => $conditions, 'offset' => ($page - 1) * $this->{$this->name}->perPage, 'limit' => $this->{$this->name}->perPage);
     $results = $this->{$this->name}->findAll($params);
     $this->data->set(Inflector::pluralize($this->name), $results);
     return $results;
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:29,代码来源:AppController.php


注:本文中的DBQuery::quote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。