Beispiel #1
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     
     $state = $this->_state;
     
     if (is_numeric($state->enabled)) {
         $query->where('tbl.showbanner', '=', $state->enabled);
     }
     
     if ($state->category) {
         $query->where('tbl.catid', '=', $state->category);
     }
     
     if (is_numeric($state->sticky)) {
         $query->where('tbl.sticky', '=', $state->sticky);
     }
     
     if (!empty($state->search)) {
         $query->where('LOWER(tbl.name)', 'LIKE', '%'.strtolower($state->search).'%');
     }
     
     if (!empty($state->tags)) {
         $where = array();
         foreach ($state->tags as $tag) {
             $where[] = 'UPPER(tags) REGEXP \'[[:<:]]'.strtoupper(trim($tag)).'[[:>:]]\'';
         }
         $query->where('( '.implode(' OR ', $where).' )');
     }
 }
Beispiel #2
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->id) {
         $query->where('tbl.joomla_user_id', 'in', $this->_state->id);
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if (is_numeric($this->_state->enabled)) {
         $query->where('tbl.enabled', '=', $this->_state->enabled);
     }
 }
Beispiel #4
0
 /**
  * Build where query
  *
  * @param KDatabaseQuery $query
  */
 public function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->search) {
         $query->where('name', 'LIKE', '%' . $this->_state->search . '%');
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->_state;
     if (is_numeric($state->state)) {
         $query->where('tbl.state', '=', $state->state);
     } else {
         $query->where('tbl.state', '<>', -2);
     }
     if ($state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $state->search . '%');
     }
     if (is_numeric($state->section)) {
         $query->where('tbl.sectionid', '=', $state->section);
     }
     if (is_numeric($state->category)) {
         $query->where('tbl.catid', '=', $state->category);
     }
     if ($state->created_by) {
         $query->where('tbl.created_by', '=', $state->created_by);
     }
     if (is_numeric($state->access)) {
         $query->where('tbl.access', '=', $state->access);
     }
     if ($this->getTable()->isRevisable() && $state->deleted) {
         $query->where('tbl.deleted', '=', 1);
     }
 }
Beispiel #6
0
	protected function _buildQueryWhere(KDatabaseQuery $query)
    {
		if ($this->_state->source instanceof KDatabaseRowInterface) {
			$source = $this->_state->source;

			$query->where('tbl.files_container_id', '=', $source->container->id)
				->where('tbl.folder', '=', '/'.$source->relative_folder)
				->where('tbl.filename', '=', $source->name)
				;

			/*
			 * This is here so that parent method won't try to use the source row object when creating the query
			 */
			$this->_source = $source;
			$this->_state->source = null;
		}
		else if ($this->_state->folder) {
			$query->where('tbl.folder', '=', $this->_state->folder);
		}
		else if ($this->_state->files) {
			$query->where('tbl.filename', 'IN', $this->_state->files);
		}

		parent::_buildQueryWhere($query);

	}
Beispiel #7
0
	protected function _buildQueryWhere(KDatabaseQuery $query)
	{
		$state = $this->_state;

		if($state->search) {
			$query->where('tbl.title', 'LIKE', '%'.$state->search.'%');
		}

		if($state->position) {
			$query->where('tbl.position', '=', $state->position);
		}
		
		if($state->type) {
			$query->where('tbl.module', '=', $state->type);
		}

		if($state->enabled !== '' && $state->enabled !== null) {
			$query->where('tbl.published', '=', $state->enabled);
		}
		
		if($state->application !== false)
		{
		    $client	= JApplicationHelper::getClientInfo($state->application, true);
	    	$query->where('tbl.client_id', '=', $client->id);
	    }

		parent::_buildQueryWhere($query);
	}
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->application) {
         $query->where('tbl.application', '=', $this->_state->application);
     }
     if ($this->_state->type) {
         $query->where('tbl.type', '=', $this->_state->type);
     }
     if ($this->_state->package && !($this->_state->distinct && !empty($this->_state->column))) {
         $query->where('tbl.package', '=', $this->_state->package);
     }
     if ($this->_state->name) {
         $query->where('tbl.name', '=', $this->_state->name);
     }
     if ($this->_state->action) {
         $query->where('tbl.action', 'IN', $this->_state->action);
     }
     if ($this->_state->start_date && $this->_state->start_date != '0000-00-00') {
         $start_date = $this->getService('koowa:date', array('date' => $this->_state->start_date));
         $days_back = clone $start_date;
         $start = $start_date->addDays(1)->addSeconds(-1)->getDate();
         $query->where('tbl.created_on', '<', $start);
         $query->where('tbl.created_on', '>', $days_back->addDays(-(int) $this->_state->days_back)->getDate());
     }
     if ($this->_state->user) {
         $query->where('tbl.created_by', '=', $this->_state->user);
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if (!$state->isUnique()) {
         if ($state->subscribed) {
             $user = JFactory::getUser();
             $query->where('subscription.user_id', '=', $user->id);
         }
         if ($state->enabled) {
             $query->where('tbl.enabled', '=', (int) $state->enabled);
         }
         if ($state->category) {
             $query->where('tbl.news_category_id', '=', $state->category);
         }
         if ($state->search) {
             $query->where('(', null, null, 'AND')->where('tbl.title', 'LIKE', '%' . $state->search . '%', '')->where('tbl.text', 'LIKE', '%' . $state->search . '%', 'OR')->where(')', null, null, '');
         }
         if ($this->_state->start_date && $this->_state->start_date != '0000-00-00') {
             $start_date = $this->getService('koowa:date', array('date' => $this->_state->start_date));
             $end_date = $this->getService('koowa:date', array('date' => $this->_state->end_date));
             $start = $start_date->addDays(1)->addSeconds(-1)->getDate();
             $end = $end_date->addDays(1)->addSeconds(-1)->getDate();
             $query->where('tbl.created_on', '>', $start);
             $query->where('tbl.created_on', '<', $end);
         }
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #10
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $this->_state->search . '%');
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if (is_numeric($this->_state->enabled)) {
         $query->where('tbl.enabled', '=', $this->_state->enabled);
     }
     $query->where('(', null, null, 'AND')->where('tbl.date_start', '>=', date("Y-m-d"), '')->where('tbl.date_end', '>=', date("Y-m-d"), 'OR')->where(')', null, null, '');
 }
Beispiel #12
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryWhere($query);
     if (is_array($state->taxonomy_taxonomy_id)) {
         $query->where('taxonomy_taxonomy_id', 'IN', $state->taxonomy_taxonomy_id);
     }
 }
Beispiel #13
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->_state;
     if ($state->search) {
         $query->where('tbl.name', 'LIKE', '%' . $state->search . '%')->where('tbl.email', 'LIKE', '%' . $state->search . '%', 'OR');
     }
 }
Beispiel #14
0
	protected function _buildQueryWhere(KDatabaseQuery $query)
    {
		parent::_buildQueryWhere($query);
		
		$query->where('tbl.section', '=', 'com_weblinks')
			  ->where('tbl.published', '=', '1')
			  ->where('weblinks.published', '=', '1')
			  ->where('tbl.access', '<=', KFactory::get('joomla:user')->get('aid', '0'));
    }
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryWhere($query);
     if ($state->row && $state->table) {
         $query->where('tbl.row', '=', $state->row);
         $query->where('tbl.table', '=', $state->table);
     }
 }
Beispiel #16
0
 /**
  * Query WHERE clause
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($search = $this->_state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $search . '%');
     }
     if ($this->_state->enabled !== false && $this->_state->enabled !== '') {
         $query->where('tbl.enabled', '=', $this->_state->enabled);
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->top_level) {
         $query->where('tbl.parent_id = 0');
     }
     if ($this->_state->parent_id) {
         $query->where('tbl.parent_id', '=', $this->_state->parent_id);
     }
 }
Beispiel #18
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($file = $this->_state->file) {
         $query->where('tbl.file', '=', $file, 'and');
     }
     if ($post = $this->_state->post) {
         $query->where('tbl.post_id', '=', $post, 'and');
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->business) {
         $query->where('tbl.businesses_business_id', '=', $state->business);
     }
     if ($state->tag) {
         $query->where('tbl.businesses_tag_id', '=', $state->tag);
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #20
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryWhere($query);
     if (is_numeric($state->enabled)) {
         $query->where('tbl.enabled', '=', $state->enabled);
     }
     if ($state->carousel_category_id) {
         $query->where('tbl.carousel_category_id', '=', $state->carousel_category_id);
     }
 }
Beispiel #21
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->_state;
     if ($state->mimetype) {
         $query->where('mimetype', 'IN', $state->mimetype);
     }
     if ($state->extension) {
         $query->where('extension', 'IN', $state->extension);
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if (!$state->isUnique()) {
         if ($state->search) {
             $query->where('title', 'LIKE', '%' . $state->search . '%');
             $query->where('description', 'LIKE', '%' . $state->search . '%', 'OR');
         }
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #23
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryWhere($query);
     if (is_numeric($state->enabled)) {
         $query->where('tbl.enabled', '=', $state->enabled);
     }
     if ($state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $state->search . '%');
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if (!$this->_state->isUnique()) {
         if ($this->_state->table) {
             $query->where('tbl.table', '=', $this->_state->table);
         }
         if ($this->_state->row) {
             $query->where('tbl.row', '=', $this->_state->row);
         }
     }
 }
Beispiel #25
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     //Build query for the screen names
     $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $id = (int) $me->id;
     //Get sent messages by me
     $where[] = '(tbl.created_by = ' . $id . ' AND recipient.user_id != ' . $id . ')';
     //Get sent messages to me
     $where[] = '(tbl.created_by != ' . $id . ' AND recipient.user_id = ' . $id . ')';
     $query->where('(' . implode(' OR ', $where) . ')');
 }
Beispiel #26
0
 /**
  * Builds a WHERE clause for the query
  * Without tbl. alias, as it caused errors frontend when posting
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     if ($search = $this->_state->search) {
         $query->where('user.name', 'LIKE', '%' . $search . '%', 'or')->where('user.username', 'LIKE', '%' . $search . '%', 'or')->where('user.email', 'LIKE', '%' . $search . '%', 'or');
     }
     if ($this->_state->alias) {
         $query->where('tbl.alias', '=', $this->_state->alias);
     }
     if ($this->_state->not) {
         $query->where('tbl.ninjaboard_person_id', 'not in', $this->_state->not);
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #27
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->_state;
     if (is_numeric($state->published)) {
         $query->where('tbl.published', '=', $state->published);
     }
     if ($state->category) {
         $query->where('tbl.catid', '=', $state->category);
     }
     if (!empty($state->search)) {
         $query->where('LOWER(tbl.name)', 'LIKE', '%' . strtolower($state->search) . '%');
     }
 }
Beispiel #28
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->_state;
     if ($state->parent_id) {
         $id_column = $this->getTable()->getIdentityColumn();
         $query->where('r.ancestor_id', 'IN', $state->parent_id);
         if (empty($state->include_self)) {
             $query->where('tbl.' . $id_column, 'NOT IN', $state->parent_id);
         }
         if ($state->level !== null) {
             $query->where('r.level', 'IN', $state->level);
         }
     }
 }
Beispiel #29
0
 /**
  * Builds a WHERE clause for the query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->type) {
         $query->where('tbl.subscription_type', '=', $this->_state->type);
     } elseif ($this->_state->type_name) {
         $table = KFactory::get('admin::com.ninjaboard.database.table.watches');
         $query->where('tbl.subscription_type', '=', $table->getTypeIdFromName($this->_state->type_name));
     }
     if ($this->_state->type_id) {
         $query->where('tbl.subscription_type_id', '=', $this->_state->type_id);
     }
     if ($this->_state->by) {
         $query->where('tbl.created_by', '=', $this->_state->by);
     }
 }
Beispiel #30
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->at) {
         $query->where('(SELECT ninjaboard_topic_id FROM #__ninjaboard_posts WHERE ninjaboard_topic_id = tbl.ninjaboard_topic_id AND created_user_id = ' . $this->_state->at . ' LIMIT 0 , 1) = tbl.ninjaboard_topic_id');
     }
     // @TODO commeted out until we figure out why it breaks the posting
     //$query->where('first_post.subject', '!=', '', 'AND');
     if ($this->_state->forum) {
         $forum = $this->_state->forum;
         $query->where("( `tbl`.`forum_id` = '{$forum}' OR ('{$forum}' = `symlink`.`ninjaboard_forum_id` AND `tbl`.`show_symlinks` = 1 ) )");
     }
     $query->where('forum.enabled', '=', 1)->where('tbl.enabled', '=', 1);
     //Building the permissions query WHERE clause
     KFactory::get('admin::com.ninjaboard.model.people')->buildForumsPermissionsWhere($query, 'forum.ninjaboard_forum_id');
 }