protected function getInput() { // Construct the various argument calls that are supported $attribs = 'class="inputbox" multiple="multiple" size="15"'; $filter = Mijosef::get('utility')->getSkippedComponents(); $rows = MijoDatabase::loadResultArray("SELECT `element` FROM `#__extensions` WHERE `type` = 'component' AND `element` NOT IN ({$filter}) ORDER BY `element`"); $lang = JFactory::getLanguage(); $options = array(); $options[] = array('option' => 'all', 'name' => JText::_('- All Components -')); foreach ($rows as $row) { $lang->load($row . '.sys', JPATH_ADMINISTRATOR); $options[] = array('option' => $row, 'name' => JText::_($row)); } return JHTML::_('select.genericlist', $options, $this->name, $attribs, 'option', 'name', $this->value, $this->name); }
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; }
function _getURLs() { $where = MijosefController::_getWhere($this); if (!($urls = MijoDatabase::loadResultArray("SELECT url_sef FROM #__mijosef_urls {$where}"))) { return false; } return $urls; }
function getComponents() { static $components; if (!isset($components)) { $components = array(); $filter = self::getSkippedComponents(); $rows = MijoDatabase::loadResultArray("SELECT `element` FROM `#__extensions` WHERE `type` = 'component' AND `element` NOT IN ({$filter}) ORDER BY `element`"); $lang = JFactory::getLanguage(); foreach ($rows as $row) { $lang->load($row . '.sys', JPATH_ADMINISTRATOR); $components[] = JHTML::_('select.option', $row, JText::_($row)); } } return $components; }
function checkComponents() { $filter = Mijosef::get('utility')->getSkippedComponents(); $components = MijoDatabase::loadResultArray("SELECT `element` FROM `#__extensions` WHERE `type` = 'component' AND `element` NOT IN ({$filter}) ORDER BY `element`"); foreach ($components as $component) { // Check if there is already a record available $total = MijoDatabase::loadResult("SELECT COUNT(*) FROM #__mijosef_extensions WHERE extension = '{$component}'"); if ($total < 1) { $name = ""; $routed = false; if (!$routed) { $ext = JPATH_MIJOSEF_ADMIN . '/extensions/' . $component . '.php'; if (file_exists($ext)) { $name = Mijosef::get('utility')->getXmlText(JPATH_MIJOSEF_ADMIN . '/extensions/' . $component . '.xml', 'name'); $router = 3; $routed = true; } } if (!$routed) { $router = JPATH_SITE . '/components/' . $component . '/router.php'; if (file_exists($router)) { $router = 2; $routed = true; } } if (!$routed) { $router = 1; $routed = true; } if ($routed) { $prms = array(); $prms['router'] = "{$router}"; $prms['prefix'] = ""; $prms['skip_menu'] = "0"; $reg = new JRegistry($prms); $params = $reg->toString(); MijoDatabase::query("INSERT INTO #__mijosef_extensions (name, extension, params) VALUES ('{$name}', '{$component}', '{$params}')"); } } } }