本文整理汇总了PHP中Komento::getSql方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::getSql方法的具体用法?PHP Komento::getSql怎么用?PHP Komento::getSql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Komento
的用法示例。
在下文中一共展示了Komento::getSql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadByKey
public function loadByKey($key)
{
$sql = Komento::getSql();
$sql->select('#__komento_hashkeys')->where('key', $key);
$data = $sql->loadObject();
return parent::bind($data);
}
示例2: loadComposite
public function loadComposite($component, $ip)
{
$sql = Komento::getSql();
$sql->select('#__komento_ipfilter')->where('component', $component)->where('ip', $ip);
$data = $sql->loadObject();
return parent::bind($data);
}
示例3: send
public function send( $max = 5 )
{
$konfig = Komento::getKonfig();
if( $konfig->get( 'disable_mailq' ) )
{
return false;
}
$db = Komento::getDBO();
$config = Komento::getConfig();
$sql = Komento::getSql();
$sql->select( '#__komento_mailq' )
->column( 'id' )
->where( 'status', 0 )
->order( 'created' )
->limit( $max );
$result = $sql->loadObjectList();
if(! empty($result))
{
foreach($result as $mail)
{
$mailq = Komento::getTable('mailq');
$mailq->load($mail->id);
$sendHTML = $mailq->type == 'html' ? 1 : 0;
$state = 0;
if( empty( $mailq->recipient ) )
{
$state = 1;
}
//send emails.
if( Komento::isJoomla15() )
{
$state = JUtility::sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $sendHTML);
}
else
{
$mail = JFactory::getMailer();
$state = $mail->sendMail($mailq->mailfrom, $mailq->fromname, $mailq->recipient, $mailq->subject, $mailq->body, $sendHTML);
}
if( $state )
{
// update the status to 1 == proccessed
$mailq->status = 1;
$mailq->store();
}
}
}
}
示例4: getTotal
function getTotal()
{
// Lets load the content if it doesn't already exist
if (empty($this->_total)) {
$sql = Komento::getSql();
$sql->select('#__komento_comments', 'a')->column('a.id', 'id', 'count distinct')->rightjoin('#__komento_actions', 'b')->on('a.id', 'b.comment_id')->where('b.type', 'report');
$this->_total = $sql->loadResult();
}
return $this->_total;
}
示例5: exists
public function exists( $id )
{
$sql = Komento::getSql();
$sql->select( '#__users' )
->where( 'id', $id )
->where( 'block', 0 );
$query = $sql->getTotalSql();
$sql->db->setQuery( $query );
return $sql->db->loadResult();
}
示例6: store
public function store($updateNulls = false)
{
$sql = Komento::getSql();
$sql->select('#__komento_configs')->column('1', '', 'count', true)->where('component', $this->component);
$exists = $sql->loadResult() > 0 ? true : false;
$data = new stdClass();
$data->component = $this->component;
$data->params = trim($this->params);
$database = Komento::getDBO();
if ($exists) {
return $database->updateObject('#__komento_configs', $data, 'component');
}
return $database->insertObject('#__komento_configs', $data);
}
示例7: compositeLoad
public function compositeLoad($cid, $type, $component, $reset = true)
{
if ($reset) {
$this->reset();
}
$sql = Komento::getSql();
$sql->select('#__komento_acl')->where('component', $component)->where('type', $type)->where('cid', $cid);
$result = $sql->loadObject();
if (empty($result)) {
$this->cid = $cid;
$this->type = $type;
$this->component = $component;
} else {
$this->bind($result);
}
return $this;
}
示例8: getRule
public function getRule( $component, $ip )
{
$sql = Komento::getSql();
$sql->select( '#__komento_ipfilter' )
->column( 'rules' )
->where( 'component', $component )
->where( 'ip', $ip );
$result = $sql->loadResult();
if( !$result )
{
return false;
}
$result = json_decode( $result );
return $result;
}
示例9: load
public function load($cid)
{
static $instances = array();
if (empty($cid)) {
return NULL;
}
if (!isset($instances[$cid])) {
// Check if this record exist or not
$sql = Komento::getSql();
$sql->select('#__js_res_record')->column('id', 'id', 'count')->where('id', $cid);
$result = $sql->loadResult();
if ($result < 1) {
return $this->onLoadArticleError($cid);
}
$item = ItemsStore::getRecord($cid);
$item->url = $this->prepareLink(Url::record($item));
$instances[$cid] = $item;
}
$this->_item = $instances[$cid];
return $this;
}
示例10: getAttachments
public function getAttachments( $uid )
{
$sql = Komento::getSql();
$sql->select( '#__komento_uploads' )
->where( 'uid', $uid )
->order( 'created' );
$result = $sql->loadObjectList();
$attachments = array();
foreach( $result as $row )
{
$table = Komento::getTable( 'uploads' );
$table->bind( $row );
$attachments[] = $table;
}
return $attachments;
}
示例11: getData
public function getData($component = 'com_component', $type = 'usergroup', $cid = 0)
{
$sql = Komento::getSql();
$sql->select('#__komento_acl')->column('rules')->where('component', $component)->where('type', $type)->where('cid', $cid)->order('type');
$rulesets = $sql->loadResult();
if (empty($rulesets)) {
$rulesets = new stdClass();
} else {
$json = Komento::getJSON();
$rulesets = $json->decode($rulesets);
}
Komento::import('helper', 'acl');
$defaultset = KomentoACLHelper::getEmptySet();
foreach ($defaultset as $section => &$rules) {
foreach ($rules as $key => &$value) {
if (isset($rulesets->{$key})) {
$value = $rulesets->{$key};
}
}
}
return $defaultset;
}
示例12: getAclObject
public function getAclObject( $cid = 0, $type = 'usergroup', $component = 'com_content' )
{
$sql = Komento::getSql();
$sql->select( '#__komento_acl' )
->column( 'rules' )
->where( 'cid', $cid )
->where( 'type', $type )
->where( 'component', $component )
->order( 'id' );
$result = $sql->loadResult();
if( empty( $result ) )
{
return false;
}
$json = Komento::getJSON();
$result = $json->decode( $result );
return $result;
}
示例13: buildQuery
private function buildQuery( $id, $options )
{
$sql = Komento::getSql();
$sql->select( '#__komento_activities', 'a' )
->column( 'a.*' )
->column( 'b.component' )
->column( 'b.cid' )
->column( 'b.comment' )
->column( 'b.name' )
->column( 'b.created_by' )
->column( 'b.parent_id' )
->leftjoin( '#__komento_comments', 'b' )
->on( 'a.comment_id', 'b.id' );
if( $id !== 'all' )
{
$sql->where( 'a.uid', $id );
}
$sql->where( 'a.published', $options['published'] );
$sql->where( 'b.published', 1 );
if( $options['component'] !== 'all' )
{
$sql->where( 'b.component', $options['component'] );
}
if( $options['cid'] !== 'all' )
{
if( !is_array( $options['cid'] ) )
{
$options['cid'] = explode( ',', $options['cid'] );
}
if( count( $options['cid'] ) > 1 )
{
$sql->where( 'b.cid', $options['cid'], 'in' );
}
else
{
$sql->where( 'b.cid', $options['cid'][0] );
}
}
if( $options['type'] !== 'all' )
{
if( !is_array( $options['type'] ) )
{
$options['type'] = explode( ',', $options['type'] );
}
if( count( $options['type'] ) > 1 )
{
$sql->where( 'a.type', $options['type'], 'in' );
}
else
{
$sql->where( 'a.type', $options['type'][0] );
}
}
if( isset( $options['sort'] ) )
{
switch( $options['sort'] )
{
case 'oldest':
$sql->order( 'a.created' );
break;
case 'latest':
default:
$sql->order( 'a.created', 'desc' );
break;
}
}
if( isset( $options['start'] ) && isset( $options['limit'] ) )
{
$sql->limit( $options['start'], $options['limit'] );
}
return $sql;
}
示例14: buildQuery
public function buildQuery()
{
$mainframe = JFactory::getApplication();
$filter_component = $mainframe->getUserStateFromRequest( 'com_komento.subscribers.filter_component', 'filter_component', '*', 'string' );
$filter_type = $mainframe->getUserStateFromRequest( 'com_komento.subscribers.filter_type', 'filter_type', '*', 'string' );
$filter_order = $mainframe->getUserStateFromRequest( 'com_komento.subscribers.filter_order', 'filter_order', 'created', 'cmd' );
$filter_order_Dir = $mainframe->getUserStateFromRequest( 'com_komento.subscribers.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word' );
$sql = Komento::getSql();
$sql->select( '#__komento_subscription' );
if( $filter_component != '*' )
{
$sql->where( 'component', $filter_component );
}
if( $filter_type != '*' )
{
$sql->where( 'type', $filter_type );
}
$sql->order( $filter_order, $filter_order_Dir );
return $sql;
}
示例15: getItemId
public function getItemId($categoryId = null)
{
static $itemids = array();
if (is_null($categoryId)) {
$categoryId = $this->getCategoryId();
}
if (empty($itemids[$categoryId])) {
$sql = Komento::getSql();
$sql->select('#__menu')->column('id')->column('link')->where('link', 'index.php?option=com_jdownloads&view=category&catid%', 'LIKE')->where('published', 1);
$itemid = 0;
$result = $sql->loadObjectList();
if (!empty($result)) {
foreach ($result as $row) {
$catid = substr(strrchr($row->link, '='), 1);
if ($catid == $categoryId) {
$itemid = $row->id;
break;
}
}
}
if (empty($itemid)) {
$sql->clear();
$sql->select('#__menu')->column('id')->where('link', 'index.php?option=com_jdownloads')->where('published', 1);
$itemid = $sql->loadResult();
}
if (empty($itemid)) {
$sql->clear();
$sql->select('#__menu')->column('id')->where('link', 'index.php?option=com_jdownloads&view=category')->where('published', 1);
$itemid = $sql->loadResult();
}
$itemids[$categoryId] = $itemid;
}
return $itemids[$categoryId];
}