Exemple #1
0
 function _buildViewWhere($prefix = "")
 {
     $where = array();
     // Search URL
     if ($this->search_url != '') {
         $src = parent::secureQuery($this->search_url, true);
         $where[] = "LOWER({$prefix}url_sef) LIKE {$src}";
     }
     // Search Title
     if ($this->search_title != '') {
         $src = parent::secureQuery($this->search_title, true);
         $where[] = "{$prefix}title LIKE {$src}";
     }
     // Title Filter
     if ($this->filter_title != -1) {
         if ($this->filter_title == 1) {
             $where[] = "{$prefix}title = ''";
         } elseif ($this->filter_title == 2) {
             $where[] = "{$prefix}title != ''";
         }
     }
     // Search Description
     if ($this->search_desc != '') {
         $src = parent::secureQuery($this->search_desc, true);
         $where[] = "{$prefix}description LIKE {$src}";
     }
     // Description Filter
     if ($this->filter_desc != -1) {
         if ($this->filter_desc == 1) {
             $where[] = "{$prefix}description = ''";
         } elseif ($this->filter_desc == 2) {
             $where[] = "{$prefix}description != ''";
         }
     }
     // Search Keywords
     if ($this->search_key != '') {
         $src = parent::secureQuery($this->search_key, true);
         $where[] = "{$prefix}keywords LIKE {$src}";
     }
     // Keywords Filter
     if ($this->filter_key != -1) {
         if ($this->filter_key == 1) {
             $where[] = "{$prefix}keywords = ''";
         } elseif ($this->filter_key == 2) {
             $where[] = "{$prefix}keywords != ''";
         }
     }
     // Published Filter
     if ($this->filter_published != -1) {
         $src = parent::secureQuery($this->filter_published);
         $where[] = "{$prefix}published = {$src}";
     }
     // Search id
     if ($this->search_id != '') {
         $src = parent::secureQuery($this->search_id);
         $where[] = "{$prefix}id = {$src}";
     }
     // Execute
     $where = count($where) ? " WHERE " . implode(" AND ", $where) : "";
     // Component Filter
     if ($this->filter_component != '-1') {
         $src = $this->_db->getEscaped($this->filter_component);
         $where = str_replace(' WHERE ', ' AND ', $where);
         $where = str_replace('AND LOWER(url_sef) LIKE', "AND LOWER(m.url_sef) LIKE", $where);
         // Get ids
         $ids = MijoDatabase::loadResultArray("SELECT m.id FROM #__mijosef_metadata AS m, #__mijosef_urls AS u WHERE m.url_sef = u.url_sef AND u.url_real LIKE '%option={$src}%' {$where}");
         $where = ' WHERE id = 0';
         if (count($ids) > 0) {
             $where = " WHERE {$prefix}id IN (" . implode(", ", $ids) . ")";
         }
     }
     // Duplicated title
     if ($this->type == 'dtitle') {
         // Get ids
         $this->_db->setQuery("SELECT id FROM #__mijosef_metadata AS t1 INNER JOIN (SELECT title FROM #__mijosef_metadata GROUP BY title HAVING COUNT(title) > 1) AS t2 ON t1.title = t2.title {$where}");
         $ids = $this->_db->loadResultArray();
         $where = " WHERE id = '-1'";
         if (count($ids) > 0) {
             $where = " WHERE {$prefix}id IN (" . implode(", ", $ids) . ")";
         }
     }
     // Duplicated description
     if ($this->type == 'ddesc') {
         // Get ids
         $this->_db->setQuery("SELECT id FROM #__mijosef_metadata AS t1 INNER JOIN (SELECT description FROM #__mijosef_metadata GROUP BY description HAVING COUNT(description) > 1) AS t2 ON t1.description = t2.description {$where}");
         $ids = $this->_db->loadResultArray();
         $where = " WHERE id = '-1'";
         if (count($ids) > 0) {
             ${$where} = " WHERE {$prefix}id IN (" . implode(", ", $ids) . ")";
         }
     }
     return $where;
 }
Exemple #2
0
 function __construct()
 {
     parent::__construct('ilinks');
 }
Exemple #3
0
 function _buildViewWhere()
 {
     $where = array();
     // Search SEF URL
     if ($this->search_sef != '') {
         $src = parent::secureQuery($this->search_sef, true);
         $where[] = "LOWER(url_sef) LIKE {$src}";
     }
     // Type Filter
     $type = $this->_db->getEscaped($this->type, true);
     if (isset($type)) {
         if ($type != 'trashed') {
             $where[] = "params LIKE '%\"trashed\":0%'";
         }
         if ($type != 'notfound') {
             $where[] = "params LIKE '%\"notfound\":0%'";
         }
         switch ($type) {
             case 'sef':
                 $where[] = "params LIKE '%\"custom\":0%'";
                 // SEF URLs
                 break;
             case 'custom':
                 $where[] = "params LIKE '%\"custom\":1%'";
                 // Custom URLs
                 break;
             case 'notfound':
                 $where[] = "params LIKE '%\"notfound\":1%'";
                 // 404 URLs
                 break;
             case 'locked':
                 $where[] = "params LIKE '%\"locked\":1%'";
                 // Locked URLs
                 break;
             case 'blocked':
                 $where[] = "params LIKE '%\"blocked\":1%'";
                 // Blocked URLs
                 break;
             case 'red':
                 $where[] = "used = '0'";
                 // Red URLs
                 break;
             case 'trashed':
                 $where[] = "params LIKE '%\"trashed\":1%'";
                 // Trashed URLs
                 break;
             case 'moved':
                 $this->_mainframe->redirect('index.php?option=com_mijosef&controller=movedurls&task=view');
                 break;
             default:
                 $where[] = "params LIKE '%\"custom\":0%'";
                 // SEF URLs
                 break;
         }
     }
     // Search Real URL
     if ($this->search_real != '' && $type != 'notfound') {
         $src = parent::secureQuery($this->search_real, true);
         $where[] = "LOWER(url_real) LIKE {$src}";
     }
     // Component Filter
     if ($this->filter_component != '-1' && $type != 'notfound') {
         $src = $this->_db->getEscaped($this->filter_component, true);
         $where[] = "(LOWER(url_real) LIKE '%option={$src}&%' OR url_real LIKE '%option={$src}')";
     }
     // Language Filter
     if ($this->filter_lang != '-1') {
         $src = $this->_db->getEscaped($this->filter_lang, true);
         $where[] = "(LOWER(url_real) LIKE '%lang={$src}&%' OR url_real LIKE '%lang={$src}')";
     }
     // Published Filter
     if ($this->filter_published != '-1') {
         $src = $this->_db->getEscaped($this->filter_published, true);
         $where[] = "params LIKE '%\"published\":{$src}%'";
     }
     // Used Filter
     if ($this->filter_used != '-1') {
         $src = parent::secureQuery($this->filter_used);
         $where[] = "used = {$src}";
     }
     // Locked Filter
     if ($this->filter_locked != '-1') {
         $src = $this->_db->getEscaped($this->filter_locked, true);
         $where[] = "params LIKE '%\"locked\":{$src}%'";
     }
     // Blocked Filter
     if ($this->filter_blocked != '-1') {
         $src = $this->_db->getEscaped($this->filter_blocked, true);
         $where[] = "params LIKE '%\"blocked\":{$src}%'";
     }
     // Date filtering
     $null_date = $this->_db->getNullDate();
     $null_date = parent::secureQuery($null_date);
     $from_date = $to_date = false;
     $fromdate = $this->_db->getEscaped($this->fromdate, true);
     if ($fromdate) {
         $dt = explode('.', $fromdate);
         $from_date = '20' . $dt[2] . '-' . $dt[1] . '-' . $dt[0];
         $from_date = parent::secureQuery($from_date);
     }
     $todate = $this->_db->getEscaped($this->todate, true);
     if ($todate) {
         $dt = explode('.', $todate);
         $to_date = '20' . $dt[2] . '-' . $dt[1] . '-' . $dt[0];
         $to_date = parent::secureQuery($to_date);
     }
     $filter_date = $this->_db->getEscaped($this->filter_date, true);
     if ($filter_date == 'c') {
         // From only
         if ($from_date && !$to_date) {
             $where[] = "cdate >= {$from_date}";
         }
         // To only
         if (!$from_date && $to_date) {
             $where[] = "cdate <= {$to_date}";
         }
         // Date range
         if ($from_date && $to_date) {
             $where[] = "(cdate >= {$from_date} AND cdate <= {$to_date})";
         }
     }
     if ($filter_date == 'm') {
         // From only
         if ($from_date && !$to_date) {
             $where[] = "(mdate >= {$from_date} OR (mdate = {$null_date} AND cdate >= {$from_date}))";
         }
         // To only
         if (!$from_date && $to_date) {
             $where[] = "(mdate <= {$to_date} OR (mdate = {$null_date} AND cdate <= {$to_date}))";
         }
         // Date range
         if ($from_date && $to_date) {
             $where[] = "((mdate >= {$from_date} OR (mdate = {$null_date} AND cdate >= {$from_date})) AND (mdate <= {$to_date} OR (mdate = {$null_date} AND cdate <= {$to_date})))";
         }
     }
     // Search hits
     if ($this->search_hits != '') {
         $src = parent::secureQuery($this->search_hits);
         $where[] = "hits = {$src}";
     }
     // Search id
     if ($this->search_id != '') {
         $src = parent::secureQuery($this->search_id);
         $where[] = "id = {$src}";
     }
     // Execute
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     // Duplicated URLs
     if ($type == 'duplicated' || $type == 'red') {
         // Get ids
         $this->_db->setQuery("SELECT id FROM #__mijosef_urls AS t1 INNER JOIN (SELECT url_sef FROM #__mijosef_urls WHERE params LIKE '%\"trashed\":0%' GROUP BY url_sef HAVING COUNT(url_sef) > 1) AS t2 ON t1.url_sef = t2.url_sef{$where}");
         $ids = $this->_db->loadResultArray();
         $where = " WHERE id = '-1'";
         if (count($ids) > 0) {
             $where = " WHERE id IN (" . implode(", ", $ids) . ")";
         }
     }
     return $where;
 }
Exemple #4
0
 function __construct()
 {
     parent::__construct('tagsmap', 'tags_map');
 }
Exemple #5
0
 function _buildViewWhere()
 {
     $where = array();
     // Type Filter
     $task = JRequest::getString('task');
     $tasks = array('add', 'edit', 'editSave', 'editApply', 'editCancel');
     $type = $this->_db->getEscaped($this->type, true);
     if ($type != 'moved' && !in_array($task, $tasks)) {
         $this->_mainframe->setUserState($this->_option . '.urls.type', $type);
         $this->_mainframe->redirect('index.php?option=com_mijosef&controller=sefurls&task=view');
     }
     // Search New URL
     if ($this->search_new != '') {
         $src = parent::secureQuery($this->search_new, true);
         $where[] = "LOWER(url_new) LIKE {$src}";
     }
     // Search Old URL
     if ($this->search_old != '') {
         $src = parent::secureQuery($this->search_old, true);
         $where[] = "LOWER(url_old) LIKE {$src}";
     }
     // Published Filter
     if ($this->filter_published != '-1') {
         $src = parent::secureQuery($this->filter_published);
         $where[] = "published = {$src}";
     }
     // Search hit
     if ($this->search_hit != '') {
         $val = parent::secureQuery($this->filter_hit_val);
         $val = $val == 0 ? '=' : ($val == 1 ? '>' : '<');
         $hit = parent::secureQuery($this->search_hit);
         $where[] = "hits {$val} {$hit}";
     }
     // Date Filter
     if ($this->filter_date != '') {
         $src = parent::secureQuery($this->filter_date, true);
         $where[] = "LOWER(last_hit) LIKE {$src}";
     }
     // Search ID
     if ($this->search_id != '') {
         $src = parent::secureQuery($this->search_id);
         $where[] = "id = {$src}";
     }
     // Execute
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     return $where;
 }
Exemple #6
0
 function __construct()
 {
     parent::__construct('bookmarks');
 }
Exemple #7
0
 function __construct()
 {
     parent::__construct('purgeupdate');
 }
Exemple #8
0
 public function __construct()
 {
     parent::__construct('upgrade');
 }
Exemple #9
0
 function __construct()
 {
     parent::__construct('sitemap');
 }
Exemple #10
0
 function _buildViewWhere()
 {
     $where = array();
     if ($this->search_name) {
         $src = parent::secureQuery($this->search_name, true);
         $where[] = "LOWER(name) LIKE {$src} OR LOWER(extension) LIKE {$src}";
     }
     if ($this->filter_router != -1) {
         $src = $this->_db->getEscaped($this->filter_router, true);
         $where[] = "params LIKE '%router={$src}%'";
     }
     if ($this->search_prefix) {
         $src = $this->_db->getEscaped($this->search_prefix, true);
         $where[] = "params LIKE '%prefix={$src}%'";
     }
     if ($this->filter_skipmenu != -1) {
         $src = $this->_db->getEscaped($this->filter_skipmenu, true);
         $where[] = "params LIKE '%skip_menu={$src}%'";
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     return $where;
 }
Exemple #11
0
 function __construct()
 {
     parent::__construct('mijosef');
 }
Exemple #12
0
 function __construct()
 {
     parent::__construct('config');
 }
Exemple #13
0
 function __construct()
 {
     parent::__construct('tags');
 }
Exemple #14
0
 function _buildViewWhere()
 {
     $where = array();
     // Search Real URL
     if ($this->search_real != '') {
         $src = parent::secureQuery($this->search_real, true);
         $where[] = "LOWER(url_real) LIKE {$src}";
     }
     // Component Filter
     if ($this->filter_component != '') {
         $src = $this->_db->getEscaped($this->filter_component, true);
         $where[] = "(LOWER(url_real) LIKE '%option={$src}&%' OR url_real LIKE '%option={$src}')";
     }
     // Language Filter
     if ($this->filter_lang != '') {
         $src = $this->_db->getEscaped($this->filter_lang, true);
         $where[] = "(LOWER(url_real) LIKE '%lang={$src}&%' OR url_real LIKE '%lang={$src}')";
     }
     // Search hits
     if ($this->search_hits != '') {
         $src = parent::secureQuery($this->search_hits);
         $where[] = "hits = {$src}";
     }
     // Get SEF URL
     $sef = self::getSefUrl();
     $where[] = "url_sef = '{$sef}'";
     // Execute
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     return $where;
 }