本文整理汇总了PHP中DiscussHelper::getDBO方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::getDBO方法的具体用法?PHP DiscussHelper::getDBO怎么用?PHP DiscussHelper::getDBO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::getDBO方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exists
/**
* Test if a specific rule / command already exists on the system.
*
* @access public
* @param string $command The command name to test for.
* @return boolean True if exists, false otherwise.
**/
public function exists($command)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT COUNT(1) FROM ' . $db->nameQuote($this->_tbl) . ' ' . 'WHERE ' . $db->nameQuote('command') . '=' . $db->Quote($command);
$db->setQuery($query);
return $db->loadResult() > 0;
}
示例2: getInput
protected function getInput()
{
$mainframe = JFactory::getApplication();
$doc = JFactory::getDocument();
$db = DiscussHelper::getDBO();
$options = array();
$attr = '';
$tagsList = array();
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
$attr .= ' disabled="disabled"';
}
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
$query = 'SELECT `id`, `title` FROM `#__discuss_tags`';
$query .= ' WHERE `published` = ' . $db->Quote('1');
$db->setQuery($query);
$data = $db->loadObjectList();
if (count($data) > 0) {
$optgroup = JHTML::_('select.optgroup', 'Select tag', 'id', 'title');
array_push($tagsList, $optgroup);
foreach ($data as $row) {
$opt = new stdClass();
$opt->id = $row->id;
$opt->title = '(' . $row->id . ') ' . $row->title;
array_push($tagsList, $opt);
}
}
$html = JHTML::_('select.genericlist', $tagsList, $this->name, trim($attr), 'id', 'title', $this->value);
return $html;
}
示例3: getAllRuleItems
public function getAllRuleItems()
{
$db = DiscussHelper::getDBO();
$query = 'select * from `#__discuss_category_acl_item` order by id';
$db->setQuery($query);
return $db->loadObjectList();
}
示例4: getCustomFieldsAcl
public function getCustomFieldsAcl()
{
$db = DiscussHelper::getDBO();
$query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_customfields_acl') . ' ORDER BY ' . $db->nameQuote('id');
$db->setQuery($query);
return $db->loadObjectList();
}
示例5: getTotalUsers
public function getTotalUsers($badgeId)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__discuss_badges_users') . ' ' . 'WHERE ' . $db->nameQuote('badge_id') . '=' . $db->Quote($badgeId);
$db->setQuery($query);
return $db->loadResult();
}
示例6: isLock
private static function isLock($post_id)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT `islock` FROM `#__discuss_posts` WHERE `id` = ' . $db->quote($post_id);
$db->setQuery($query);
return $db->loadResult();
}
示例7: load
/**
* Load by post id. Return Only ONE latest record
*/
public function load($keys = null, $reset = true)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT id FROM `#__discuss_assignment_map` WHERE `post_id` = ' . $db->quote($keys) . ' ORDER BY `created` DESC LIMIT 0, 1';
$db->setQuery($query);
$result = $db->loadResult();
return parent::load($result, $reset);
}
示例8: updateTopicPostType
public function updateTopicPostType($oldValue)
{
$db = DiscussHelper::getDBO();
$query = 'update `#__discuss_posts` set `post_type` = ' . $db->Quote($this->alias);
$query .= ' where `post_type` = ' . $db->Quote($oldValue);
$db->setQuery($query);
$db->query();
}
示例9: getPoints
/**
* Retrieve a list of points for the specific command
*
* @access private
* @param string $command The action string.
* @param int $userId The actor's id.
*
* @return Array An array of BadgesHistory object.
**/
public function getPoints($command)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT a.* FROM ' . $db->nameQuote('#__discuss_points') . ' AS a ' . 'INNER JOIN ' . $db->nameQuote('#__discuss_rules') . ' AS b ' . 'ON b.' . $db->nameQuote('id') . '= a.' . $db->nameQuote('rule_id') . ' ' . 'WHERE b.' . $db->nameQuote('command') . '=' . $db->Quote($command) . ' ' . 'AND a.' . $db->nameQuote('published') . '=' . $db->Quote(1);
$db->setQuery($query);
$points = $db->loadObjectList();
return $points;
}
示例10: setuped
public function setuped($type)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__discuss_oauth') . ' ' . 'WHERE ' . $db->nameQuote('type') . '=' . $db->Quote($type) . ' ' . 'AND ' . $db->nameQuote('access_token') . ' IS NOT NULL';
$db->setQuery($query);
$exists = $db->loadResult();
return $exists > 0;
}
示例11: loadByKey
public function loadByKey($key)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT * FROM ' . $db->nameQuote($this->_tbl) . ' WHERE ' . $db->nameQuote('key') . '=' . $db->Quote($key);
$db->setQuery($query);
$data = $db->loadObject();
return parent::bind($data);
}
示例12: getSuffix
public function getSuffix($alias = null)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT `suffix` FROM ' . $db->nameQuote('#__discuss_post_types') . ' WHERE ' . $db->nameQuote('alias') . '=' . $db->quote($alias) . ' AND ' . $db->nameQuote('published') . '=' . $db->quote(1);
$db->setQuery($query);
$result = $db->loadResult();
return $result;
}
示例13: getRuleDescription
public function getRuleDescription($action)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT `description` FROM ' . $db->nameQuote('#__discuss_acl') . ' ' . 'WHERE `action`=' . $db->Quote($action);
$db->setQuery($query);
$description = $db->loadResult();
return $description;
}
示例14: exists
public function exists($postId, $oauthId)
{
$postId = (int) $postId;
$db = DiscussHelper::getDBO();
$query = 'SELECT COUNT(1) FROM ' . $db->nameQuote($this->_tbl) . ' ' . 'WHERE ' . $db->nameQuote('post_id') . '=' . $db->Quote($postId) . ' ' . 'AND ' . $db->nameQuote('oauth_id') . '=' . $db->Quote($oauthId);
$db->setQuery($query);
$result = $db->loadResult();
return $result > 0;
}
示例15: clear
/**
* Delete the outdated entries.
*/
function clear()
{
$db = DiscussHelper::getDBO();
$date = DiscussHelper::getDate();
$query = 'DELETE FROM `#__discuss_captcha` WHERE `created` <= DATE_SUB( ' . $db->Quote($date->toMySQL()) . ', INTERVAL 12 HOUR )';
$db->setQuery($query);
$db->query();
return true;
}