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


PHP JDatabaseDriver::quote方法代码示例

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


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

示例1: load

 /**
  * This method loads data about category from a database.
  *
  * <code>
  * $db         = JFactory::getDbo();
  * $categoryId = 1;
  *
  * $category   = new UserIdeasCategory();
  * $category->setDb($db);
  * $category->load($categoryId);
  * </code>
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.title, a.description," . $query->concatenate(array("a.id", "a.alias"), ":") . " AS slug")->from($this->db->quoteName("#__categories", "a"))->where("a.id = " . (int) $id)->where("a.extension = " . $this->db->quote("com_userideas"));
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         $this->bind($result);
     }
 }
开发者ID:pippogsm,项目名称:UserIdeas,代码行数:22,代码来源:category.php

示例2: updateGamificationPlatform

 /**
  * Update schemas of com_gamification.
  *
  * @param array $results
  * @param JDatabaseDriver $db
  *
  * @throws Exception
  */
 protected function updateGamificationPlatform($results, $db)
 {
     $extensions = 'com_gamification';
     JLoader::import('Gamification.Version');
     $version = new Gamification\Version();
     if (version_compare($results[$extensions]['version_id'], $version->getShortVersion(), '<')) {
         $query = $db->getQuery(true);
         $query->update($db->quoteName('#__schemas'))->set($db->quoteName('version_id') . '=' . $db->quote($version->getShortVersion()))->where($db->quoteName('extension_id') . ' = ' . $db->quote($results[$extensions]['extension_id']));
         $db->setQuery($query);
         $db->execute();
         $msg = JText::sprintf('PLG_SYSTEM_DISTRIBUTION_MIGRATION_UPDATED_SCHEMAS_S', $extensions, $results[$extensions]['extension_id'], $results[$extensions]['version_id'], $version->getShortVersion());
         JFactory::getApplication()->enqueueMessage($msg);
     }
 }
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:22,代码来源:distributionmigration.php

示例3: getEnabled

 /**
  * Return a list with names of enabled extensions.
  *
  * <code>
  * $extensionsNames = array(
  *     "com_crowdfunding",
  *     "com_gamification"
  * );
  *
  * $extensions = new Prism\Extensions(\JFactory::getDbo(), $extensionsNames);
  *
  * $enabled = $extensions->getEnabled();
  * </code>
  *
  * @return array
  */
 public function getEnabled()
 {
     $extensions = array();
     if (!$this->extensions) {
         return $extensions;
     }
     foreach ($this->extensions as $extension) {
         $extensions[] = $this->db->quote($extension);
     }
     $query = $this->db->getQuery(true);
     $query->select('a.element')->from($this->db->quoteName('#__extensions', 'a'))->where('a.element IN (' . implode(',', $extensions) . ')')->where('a.enabled = 1');
     $this->db->setQuery($query);
     $extensions = (array) $this->db->loadColumn();
     return $extensions;
 }
开发者ID:bellodox,项目名称:PrismLibrary,代码行数:31,代码来源:Extensions.php

示例4: handle

 /**
  * Count project funders.
  *
  * @param array $data
  * @param array $options
  *
  * @throws \RuntimeException
  */
 public function handle(&$data, array $options = array())
 {
     $funders = array();
     $ids = ArrayHelper::getIds($data, 'id');
     if (count($ids) > 0) {
         $query = $this->db->getQuery(true);
         $query->select('a.project_id, COUNT(*) AS funders')->from($this->db->quoteName('#__crowdf_transactions', 'a'))->where('a.project_id  IN (' . implode(',', $ids) . ')')->where('(a.txn_status = ' . $this->db->quote('completed') . ' OR a.txn_status = ' . $this->db->quote('pending') . ')')->group($this->db->quoteName('project_id'));
         $this->db->setQuery($query);
         $funders = (array) $this->db->loadObjectList('project_id');
     }
     foreach ($data as $item) {
         $item->funders = array_key_exists($item->id, $funders) ? $funders[$item->id]->funders : 0;
     }
     unset($funders);
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:23,代码来源:PrepareItemFundersHelper.php

示例5: updateObject

 protected function updateObject()
 {
     $query = $this->db->getQuery(true);
     $query->update($this->db->quoteName("#__vc_transactions"))->set($this->db->quoteName("units") . "=" . $this->db->quote($this->units))->set($this->db->quoteName("txn_id") . "=" . $this->db->quote($this->txn_id))->set($this->db->quoteName("txn_amount") . "=" . $this->db->quote($this->txn_amount))->set($this->db->quoteName("txn_currency") . "=" . $this->db->quote($this->txn_currency))->set($this->db->quoteName("txn_status") . "=" . $this->db->quote($this->txn_status))->set($this->db->quoteName("txn_date") . "=" . $this->db->quote($this->txn_date))->set($this->db->quoteName("service_provider") . "=" . $this->db->quote($this->service_provider))->set($this->db->quoteName("currency_id") . "=" . $this->db->quote($this->currency_id))->set($this->db->quoteName("sender_id") . "=" . $this->db->quote($this->sender_id))->set($this->db->quoteName("receiver_id") . "=" . $this->db->quote($this->receiver_id))->where($this->db->quoteName("id") . "=" . (int) $this->id);
     $this->db->setQuery($query);
     $this->db->execute();
 }
开发者ID:bellodox,项目名称:VirtualCurrency,代码行数:7,代码来源:transaction.php

示例6: hit

	/**
	 * Method to increment the hits for a row if the necessary property/field exists.
	 *
	 * @return bool True on success.
	 *
	 * @internal param mixed $pk An optional primary key value to increment. If not set the instance property value is used.
	 *
	 * @since    K4.0
	 */
	public function hit()
	{
		$pk = null;

		// If there is no hits field, just return true.
		if (!property_exists($this, 'hits'))
		{
			return true;
		}

		$k= static::$tbl_keys;
		$pk = (is_null($pk)) ? $this->$k : $pk;

		// If no primary key is given, return false.
		if ($pk === null)
		{
			return false;
		}

		// Check the row in by primary key.
		$query = static::$db->getQuery(true);
		$query->update(static::$tbl);
		$query->set(static::$db->quoteName('hits') . ' = (' . static::$db->quoteName('hits') . ' + 1)');
		$query->where(static::$tbl_key . ' = ' . static::$db->quote($pk));
		static::$db->setQuery($query);
		static::$db->execute();

		// Set table values in the object.
		$this->hits++;

		return true;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:41,代码来源:object.php

示例7: onUserAfterLogout

 /**
  * This is where we delete any authentication cookie when a user logs out
  *
  * @param   array  $options  Array holding options (length, timeToExpiration)
  *
  * @return  boolean  True on success
  *
  * @since   3.2
  */
 public function onUserAfterLogout($options)
 {
     // No remember me for admin
     if ($this->app->isAdmin()) {
         return false;
     }
     $cookieName = 'joomla_remember_me_' . JUserHelper::getShortHashedUserAgent();
     $cookieValue = $this->app->input->cookie->get($cookieName);
     // There are no cookies to delete.
     if (!$cookieValue) {
         return true;
     }
     $cookieArray = explode('.', $cookieValue);
     // Filter series since we're going to use it in the query
     $filter = new JFilterInput();
     $series = $filter->clean($cookieArray[1], 'ALNUM');
     // Remove the record from the database
     $query = $this->db->getQuery(true)->delete('#__user_keys')->where($this->db->quoteName('series') . ' = ' . $this->db->quote($series));
     try {
         $this->db->setQuery($query)->execute();
     } catch (RuntimeException $e) {
         // We aren't concerned with errors from this query, carry on
     }
     // Destroy the cookie
     $this->app->input->cookie->set($cookieName, false, time() - 42000, $this->app->get('cookie_path', '/'), $this->app->get('cookie_domain'));
     return true;
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:36,代码来源:cookie.php

示例8: storeInDatabase

 /**
  * Stores the login data into the database
  *
  * @param   array $data Array holding data to be stored.
  *
  * @return bool
  * @since   1.0
  */
 public function storeInDatabase($data)
 {
     $query = $this->db->getQuery(true);
     $columns = array('userid', 'username', 'ip', 'timestamp');
     $values = $this->db->quote(array($data['userid'], $data['username'], $data['ip'], $data['timestamp']));
     $query->insert($this->db->quoteName('#__userlogin_tracking'))->columns($this->db->quoteName($columns))->values(implode(',', $values));
     $this->db->setQuery($query);
     try {
         $this->db->execute();
     } catch (Exception $e) {
         throw $e;
         // Do nothing
         return false;
     }
     return true;
 }
开发者ID:Bakual,项目名称:plg_userlogintracking_v1.0.0,代码行数:24,代码来源:userlogintracking.php

示例9: onAfterInitialise

 /**
  * Remember me method to run onAfterInitialise
  *
  * @return  boolean
  *
  * @since   1.5
  * @throws  InvalidArgumentException
  */
 public function onAfterInitialise()
 {
     // No remember me for admin
     if ($this->app->isAdmin()) {
         return false;
     }
     $user = JFactory::getUser();
     $this->app->rememberCookieLifetime = $this->lifetime;
     $this->app->rememberCookieSecure = $this->secure;
     $this->app->rememberCookieLength = $this->length;
     // Check for a cookie
     if ($user->get('guest') == 1) {
         // Create the cookie name and data
         $rememberArray = JUserHelper::getRememberCookieData();
         if ($rememberArray !== false) {
             if (count($rememberArray) != 3) {
                 // Destroy the cookie in the browser.
                 $this->app->input->cookie->set(end($rememberArray), false, time() - 42000, $this->app->get('cookie_path'), $this->app->get('cookie_domain'));
                 JLog::add('Invalid cookie detected.', JLog::WARNING, 'error');
                 return false;
             }
             list($privateKey, $series, $uastring) = $rememberArray;
             if (!JUserHelper::clearExpiredTokens($this)) {
                 JLog::add('Error in deleting expired cookie tokens.', JLog::WARNING, 'error');
             }
             // Find the matching record if it exists
             $query = $this->db->getQuery(true)->select($this->db->quoteName(array('user_id', 'token', 'series', 'time', 'invalid')))->from($this->db->quoteName('#__user_keys'))->where($this->db->quoteName('series') . ' = ' . $this->db->quote(base64_encode($series)))->where($this->db->quoteName('uastring') . ' = ' . $this->db->quote($uastring))->order($this->db->quoteName('time') . ' DESC');
             $results = $this->db->setQuery($query)->loadObjectList();
             $countResults = count($results);
             // We have a user but a cookie that is not in the database, or it is invalid. This is a possible attack, so invalidate everything.
             if (($countResults === 0 || $results[0]->invalid != 0) && !empty($results[0]->user_id)) {
                 JUserHelper::invalidateCookie($results[0]->user_id, $uastring);
                 JLog::add(JText::sprintf('PLG_SYSTEM_REMEMBER_ERROR_LOG_INVALIDATED_COOKIES', $user->username), JLog::WARNING, 'security');
                 // Possibly e-mail user and admin here.
                 return false;
             }
             // We have a user with one cookie with a valid series and a corresponding record in the database.
             if ($countResults === 1) {
                 if (substr($results[0]->token, 0, 4) === '$2y$') {
                     if (JCrypt::hasStrongPasswordSupport()) {
                         $match = password_verify($privateKey, $results[0]->token);
                     }
                 } else {
                     if (JCrypt::timingSafeCompare($results[0]->token, $privateKey)) {
                         $match = true;
                     }
                 }
                 if (empty($match)) {
                     JUserHelper::invalidateCookie($results[0]->user_id, $uastring);
                     JLog::add(JText::sprintf('PLG_SYSTEM_REMEMBER_ERROR_LOG_LOGIN_FAILED', $user->username), JLog::WARNING, 'security');
                     return false;
                 }
                 // Set up the credentials array to pass to onUserAuthenticate
                 $credentials = array('username' => $results[0]->user_id);
                 return $this->app->login($credentials, array('silent' => true, 'lifetime' => $this->lifetime, 'secure' => $this->secure, 'length' => $this->length));
             }
         }
     }
     return false;
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:68,代码来源:remember.php

示例10: load

 /**
  * Load categories.
  *
  * <code>
  * $parentId = 2;
  *
  * $options = array(
  *    "offset" => 0,
  *    "limit" => 10,
  *    "order_by" => "a.name",
  *    "order_dir" => "DESC",
  * );
  *
  * $categories   = new Crowdfunding\Categories();
  * $categories->setDb(\JFactory::getDbo());
  *
  * $categories->load($parentId);
  * </code>
  *
  * @param null|int $parentId Parent ID or "root".
  * @param array $options
  *
  * @throws \RuntimeException
  */
 public function load($parentId = null, array $options = array())
 {
     $offset = array_key_exists('offset', $options) ? $options['offset'] : 0;
     $limit = array_key_exists('limit', $options) ? $options['limit'] : 0;
     $orderBy = array_key_exists('order_by', $options) ? $options['order_by'] : 'a.title';
     $orderDir = array_key_exists('order_dir', $options) ? $options['order_dir'] : 'ASC';
     $published = array_key_exists('state', $options) ? $options['state'] : null;
     $orderDir = strtoupper($orderDir);
     if (!in_array($orderDir, array('ASC', 'DESC'), true)) {
         $orderDir = 'ASC';
     }
     $query = $this->db->getQuery(true);
     $query->select('a.id, a.title, a.alias, a.description, a.params, ' . $query->concatenate(array('a.id', 'a.alias'), ':') . ' AS slug')->from($this->db->quoteName('#__categories', 'a'))->where('a.extension = ' . $this->db->quote($this->_extension));
     if ($parentId !== null) {
         $query->where('a.parent_id = ' . (int) $parentId);
     }
     // Filter by state.
     if ($published === null) {
         $query->where('a.published IN (0,1)');
     } else {
         $query->where('a.published = ' . (int) $published);
     }
     $query->order($this->db->escape($this->db->quoteName($orderBy) . ' ' . $orderDir));
     $this->db->setQuery($query, (int) $offset, (int) $limit);
     $this->data = (array) $this->db->loadAssocList('id');
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:50,代码来源:Categories.php

示例11: updateObject

 protected function updateObject()
 {
     $query = $this->db->getQuery(true);
     $query->update($this->db->quoteName("#__vc_paymentsessions"))->set($this->db->quoteName("user_id") . "=" . (int) $this->user_id)->set($this->db->quoteName("currency_id") . "=" . (int) $this->currency_id)->set($this->db->quoteName("amount") . "=" . $this->db->quote($this->amount))->where($this->db->quoteName("id") . "=" . (int) $this->id);
     $this->db->setQuery($query);
     $this->db->execute();
 }
开发者ID:bellodox,项目名称:VirtualCurrency,代码行数:7,代码来源:session.php

示例12: updateAmount

 /**
  * Update the amount of the account.
  *
  * <code>
  *  // Get user account by account ID
  *  $accountId = 1;
  *
  *  $account   = new VirtualCurrencyAccount();
  *  $account->setDb(JFactory::getDbo());
  *  $account->load($accountId);
  *
  *  // Increase the amount and store the new value.
  *  $account->increaseAmount(50);
  *  $account->updateAmount();
  * </code>
  */
 public function updateAmount()
 {
     $query = $this->db->getQuery(true);
     $query->update($this->db->quoteName("#__vc_accounts"))->set($this->db->quoteName("amount") . "=" . $this->db->quote($this->amount))->where($this->db->quoteName("id") . "=" . (int) $this->id);
     $this->db->setQuery($query);
     $this->db->execute();
 }
开发者ID:bellodox,项目名称:VirtualCurrency,代码行数:23,代码来源:account.php

示例13: createUser

 /**
  * Create user record in database.
  *
  * <code>
  * $data = array(
  *    "id"     => 1,
  *    "name"   => "John Dow",
  *    "state"  => 1,
  * );
  *
  * $user    = new IdentityProofUser(JFactory::getDbo());
  * $user->bind($data);
  * $user->createUser();
  * </code>
  */
 public function createUser()
 {
     $query = $this->db->getQuery(true);
     $query->insert($this->db->quoteName("#__identityproof_users"))->set($this->db->quoteName("id") . "=" . $this->db->quote($this->id))->set($this->db->quoteName("state") . "=" . $this->db->quote($this->state));
     $this->db->setQuery($query);
     $this->db->execute();
 }
开发者ID:xop32,项目名称:Proof-of-Identity,代码行数:22,代码来源:user.php

示例14: updateFunds

 /**
  * Update project funds record.
  *
  * <code>
  * $projectId = 1;
  * $finds = 50;
  *
  * $project   = new CrowdFundingProject(JFactory::getDbo());
  * $project->load($projectId);
  * $project->addFunds($finds);
  * $project->updateFunds();
  * </code>
  */
 public function updateFunds()
 {
     $query = $this->db->getQuery(true);
     $query->update($this->db->quoteName("#__crowdf_projects"))->set($this->db->quoteName("funded") . "=" . $this->db->quote($this->funded))->where($this->db->quoteName("id") . "=" . $this->db->quote($this->id));
     $this->db->setQuery($query);
     $this->db->execute();
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:20,代码来源:project.php

示例15: load

 /**
  * Load transactions from database.
  *
  * <code>
  * $ids = array(1,2,3);
  * $options = array(
  *  "txn_status" => "completed"
  * );
  *
  * $transactions    = new CrowdFundingTransactions();
  * $transactions->setDb(JFactory::getDbo());
  * $transactions->load($ids, $options);
  *
  * foreach($transactions as $transaction) {
  *   echo $transaction->txn_id;
  *   echo $transaction->txn_amount;
  * }
  *
  * </code>
  *
  * @param array $ids
  * @param array $options
  *
  * @throws UnexpectedValueException
  */
 public function load($ids, $options = array())
 {
     // Set the newest ids.
     if (!is_array($ids)) {
         throw new UnexpectedValueException(JText::_("LIB_CROWDFUNDING_TRANSACTIONS_IDS_ARRAY"));
     }
     JArrayHelper::toInteger($ids);
     if (!$ids) {
         return;
     }
     // Load project data
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.txn_date, a.txn_id, a.txn_amount, a.txn_currency, a.txn_status, " . "a.extra_data, a.status_reason, a.project_id, a.reward_id, a.investor_id, " . "a.receiver_id, a.service_provider, a.reward_state")->from($this->db->quoteName("#__crowdf_transactions", "a"))->where("a.id IN ( " . implode(",", $ids) . " )");
     // Filter by status.
     $status = JArrayHelper::getValue($options, "txn_status", null, "cmd");
     if (!empty($status)) {
         $query->where("a.txn_status = " . $this->db->quote($status));
     }
     $this->db->setQuery($query);
     $results = $this->db->loadObjectList();
     // Convert JSON string into an array.
     if (!empty($results)) {
         foreach ($results as $key => $result) {
             if (!empty($result->extra_data)) {
                 $result->extra_data = json_decode($result->extra_data, true);
                 $results[$key] = $result;
             }
         }
     } else {
         $results = array();
     }
     $this->items = $results;
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:58,代码来源:transactions.php


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