Beispiel #1
0
 /**
  * buildQuery
  *
  * @param   bool  $overrideLimits  Param
  *
  * @return	F0FQuery
  */
 public function buildQuery($overrideLimits = false)
 {
     $db = $this->getDbo();
     $query = F0FQueryAbstract::getNew($db)->select('*')->from($db->quoteName('#__autotweet_channels'));
     $fltName = $this->getState('name', null, 'string');
     if ($fltName) {
         $fltName = "%{$fltName}%";
         $query->where($db->qn('name') . ' LIKE ' . $db->q($fltName));
     }
     $fltChannelId = $this->getState('channel_id', null, 'int');
     if ($fltChannelId) {
         $query->where($db->qn('id') . ' = ' . $db->q($fltChannelId));
     }
     $fltChannelIds = $this->getState('channel_ids', null, 'array');
     if (!empty($fltChannelIds)) {
         $ids = implode(',', $fltChannelIds);
         $query->where($db->qn('id') . ' in (' . $ids . ')');
     }
     $fltCreatedBy = $this->getState('created_by', null, 'int');
     if ($fltCreatedBy) {
         $query->where($db->qn('created_by') . ' = ' . $db->q($fltCreatedBy));
     }
     $fltChanneltype = $this->getState('channeltype', null, 'int');
     if ($fltChanneltype) {
         $query->where($db->qn('channeltype_id') . ' = ' . $db->q($fltChanneltype));
     }
     $exclude_channeltypes = $this->getState('exclude_channeltypes', null, 'array');
     if ($exclude_channeltypes && !empty($exclude_channeltypes)) {
         $exclude_channeltypes = implode(',', $exclude_channeltypes);
         $query->where($db->qn('channeltype_id') . ' not in (' . $exclude_channeltypes . ')');
     }
     $fltPublished = $this->getState('published', 1, 'cmd');
     if ($fltPublished != '' && $fltPublished != 'nofilter') {
         $query->where($db->qn('published') . ' = ' . $db->q($fltPublished));
     }
     $search = $this->getState('search', null);
     if ($search) {
         $search = '%' . $search . '%';
         $query->where('(' . $db->qn('name') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('description') . ' LIKE ' . $db->quote($search) . ')');
     }
     $fltScope = $this->getState('scope', 'S', 'string');
     if ($fltScope && $fltScope != 'N') {
         $query->where($db->qn('scope') . ' = ' . $db->q($fltScope));
     }
     $fltFrontendChannel = $this->getState('frontendchannel', null, 'int');
     if ($fltFrontendChannel) {
         $fltFrontendChannel = '"frontendchannel":"' . $fltFrontendChannel . '"';
         $query->where($db->qn('params') . ' like ' . $db->q('%' . $fltFrontendChannel . '%'));
     } else {
         AclPermsHelper::whereOwnership($query);
     }
     $order = $this->getState('filter_order', 'id', 'cmd');
     if (!in_array($order, array_keys($this->getTable()->getData()))) {
         $order = 'id';
     }
     $dir = $this->getState('filter_order_Dir', 'ASC', 'cmd');
     $query->order($order . ' ' . $dir);
     return $query;
 }
Beispiel #2
0
 /**
  * buildQuery
  *
  * @param   bool  $overrideLimits  Param
  *
  * @return	F0FQuery
  */
 public function buildQuery($overrideLimits = false)
 {
     $db = $this->getDbo();
     $query = F0FQueryAbstract::getNew($db)->select('*')->from($db->quoteName('#__autotweet_posts'));
     $fltPostdate = $this->getState('postdate', null, 'date');
     if ($fltPostdate) {
         $fltPostdate = $fltPostdate . '%';
         $query->where($db->qn('postdate') . ' LIKE ' . $db->q($fltPostdate));
     }
     $fltAfterDate = $this->getState('after_date', null, 'date');
     if ($fltAfterDate) {
         $query->where($db->qn('postdate') . ' >= ' . $db->q($fltAfterDate));
     }
     $fltChannel = $this->getState('channel', null, 'int');
     if ($fltChannel) {
         $query->where($db->qn('channel_id') . ' = ' . $db->q($fltChannel));
     }
     $fltPlugin = $this->getState('plugin', null, 'string');
     if ($fltPlugin) {
         $query->where($db->qn('plugin') . ' = ' . $db->q($fltPlugin));
     }
     $fltRefId = $this->getState('ref_id', null, 'string');
     if ($fltRefId) {
         $query->where($db->qn('ref_id') . ' = ' . $db->q($fltRefId));
     }
     $fltNotId = $this->getState('not_id', null, 'string');
     if ($fltNotId) {
         $query->where($db->qn('id') . ' <> ' . $db->q($fltNotId));
     }
     $fltMessage = $this->getState('message', null, 'string');
     if ($fltMessage) {
         $query->where($db->qn('message') . ' = ' . $db->q($fltMessage));
     }
     $fltPubstate = $this->getState('pubstate', null);
     if (is_array($fltPubstate)) {
         if (count($fltPubstate) > 0) {
             $list = array();
             foreach ($fltPubstate as $pubstate) {
                 $list[] = $db->q($pubstate);
             }
             $fltPubstate = implode(',', $list);
             $query->where($db->qn('pubstate') . ' IN (' . $fltPubstate . ')');
         }
     } else {
         if ($fltPubstate != '') {
             $query->where($db->qn('pubstate') . ' = ' . $db->q($fltPubstate));
         }
     }
     $fltPubstates = $this->getState('pubstates', null, 'string');
     if ($fltPubstates != '') {
         $fltPubstates = TextUtil::listToArray($fltPubstates);
         $list = array();
         foreach ($fltPubstates as $p) {
             $list[] = $db->q($p);
         }
         $fltPubstates = implode(',', $list);
         $query->where($db->qn('pubstate') . ' IN (' . $fltPubstates . ')');
     }
     $search = $this->getState('search', null);
     if ($search) {
         $search = '%' . $search . '%';
         $query->where('(' . $db->qn('id') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('ref_id') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('resultmsg') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('message') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('title') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('url') . ' LIKE ' . $db->quote($search) . ')');
     }
     AclPermsHelper::whereOwnership($query);
     $order = $this->getState('filter_order', 'postdate', 'cmd');
     if (!in_array($order, array_keys($this->getTable()->getData()))) {
         $order = 'postdate';
     }
     $dir = $this->getState('filter_order_Dir', 'DESC', 'cmd');
     $query->order($order . ' ' . $dir);
     return $query;
 }
Beispiel #3
0
 /**
  * buildQuery
  *
  * @param   bool  $overrideLimits  Param
  *
  * @return	F0FQuery
  */
 public function buildQuery($overrideLimits = false)
 {
     $db = $this->getDbo();
     $query = F0FQueryAbstract::getNew($db)->select('*')->from($db->quoteName('#__autotweet_requests'));
     $fltPublishup = $this->getState('publish_up', null, 'date');
     if ($fltPublishup) {
         $fltPublishup = $fltPublishup . '%';
         $query->where($db->qn('publish_up') . ' LIKE ' . $db->q($fltPublishup));
     }
     $fltUntilDate = $this->getState('until_date', null, 'date');
     if ($fltUntilDate) {
         $query->where($db->qn('publish_up') . ' <= ' . $db->q($fltUntilDate));
     }
     $input = new F0FInput();
     $start = $input->get('xtstart');
     if ($start) {
         $date = new JDate($start);
         $query->where($db->qn('publish_up') . ' >= ' . $db->q($date->toSql()));
     }
     $end = $input->get('xtend');
     if ($end) {
         $date = new JDate($end);
         $query->where($db->qn('publish_up') . ' <= ' . $db->q($date->toSql()));
     }
     $fltPlugin = $this->getState('plugin', null, 'string');
     if ($fltPlugin) {
         $query->where($db->qn('plugin') . ' = ' . $db->q($fltPlugin));
     }
     $fltRefId = $this->getState('ref_id', null, 'string');
     if ($fltRefId) {
         $query->where($db->qn('ref_id') . ' = ' . $db->q($fltRefId));
     }
     $fltRids = $this->getState('rids', null);
     if ($fltRids != '') {
         if (is_string($fltRids)) {
             $fltRids = TextUtil::listToArray($fltRids);
         }
         $list = array();
         foreach ($fltRids as $p) {
             $list[] = $db->q($p);
         }
         $fltRids = implode(',', $list);
         $query->where($db->qn('id') . ' IN (' . $fltRids . ')');
     }
     $fltTypeinfo = $this->getState('typeinfo', null, 'string');
     if ($fltTypeinfo) {
         $query->where($db->qn('typeinfo') . ' = ' . $db->q($fltTypeinfo));
     }
     $fltPublished = $this->getState('published', 0, 'int');
     $query->where($db->qn('published') . ' = ' . $db->q($fltPublished));
     $search = $this->getState('search', null);
     if ($search) {
         $search = '%' . $search . '%';
         $query->where('(' . $db->qn('id') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('ref_id') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('description') . ' LIKE ' . $db->quote($search) . ' OR ' . $db->qn('url') . ' LIKE ' . $db->quote($search) . ')');
     }
     AclPermsHelper::whereOwnership($query);
     $order = $this->getState('filter_order', 'publish_up', 'cmd');
     if (!in_array($order, array_keys($this->getTable()->getData()))) {
         $order = 'publish_up';
     }
     $dir = $this->getState('filter_order_Dir', 'ASC', 'cmd');
     $query->order($order . ' ' . $dir);
     return $query;
 }