function getInput() { $attribs = 'class="inputbox"'; $extension = Mijosef::get('utility')->getExtensionFromRequest(); $options = Mijosef::get('utility')->getRouterList($extension); return JHTML::_('select.genericlist', $options, $this->name, $attribs, 'value', 'text', $this->value, $this->name); }
function getLists() { global $mainframe, $option; $lists = array(); // Table ordering $lists['order_dir'] = $this->filter_order_Dir; $lists['order'] = $this->filter_order; // Reset filters $lists['reset_filters'] = '<button onclick="resetFilters();">' . JText::_('Reset') . '</button>'; // Filter's action $javascript = 'onchange="document.adminForm.submit();"'; // Components List $com_list = array(); $com_list[] = JHTML::_('select.option', '', JText::_('COM_MIJOSEF_COMMON_COM_FILTER')); $com_list = array_merge($com_list, Mijosef::get('utility')->getComponents()); $lists['component_list'] = JHTML::_('select.genericlist', $com_list, 'filter_component', 'class="inputbox" size="1"' . $javascript, 'value', 'text', $this->filter_component); // Languages list $lang_list = array(); $lang_list[] = JHTML::_('select.option', '', JText::_('COM_MIJOSEF_COMMON_LANGUAGE_FILTER')); $lang_list = array_merge($lang_list, Mijosef::get('utility')->getLanguages()); $lists['lang_list'] = JHTML::_('select.genericlist', $lang_list, 'filter_lang', 'class="inputbox" size="1"' . $javascript, 'value', 'text', $this->filter_lang); // Search Real URL $lists['search_real'] = "<input type=\"text\" name=\"search_real\" value=\"{$this->search_real}\" size=\"45\" maxlength=\"255\" onchange=\"document.adminForm.submit();\" />"; // Used Filter $used_list[] = JHTML::_('select.option', '-1', JText::_('COM_MIJOSEF_COMMON_SELECT')); $used_list[] = JHTML::_('select.option', '2', JText::_('Yes')); $used_list[] = JHTML::_('select.option', '1', JText::_('No')); $lists['used_list'] = JHTML::_('select.genericlist', $used_list, 'filter_used', 'class="inputbox" size="1"' . $javascript, 'value', 'text', $this->filter_used); // Search hits $lists['search_hits'] = "<input type=\"text\" name=\"search_hits\" value=\"{$this->search_hits}\" size=\"3\" maxlength=\"10\" onchange=\"document.adminForm.submit();\" />"; return $lists; }
function edit($tpl = NULL) { $row = $this->getModel()->getEditData('MijosefExtensions'); $ext_form = JForm::getInstance('extensionForm', JPATH_MIJOSEF_ADMIN . '/extensions/' . $row->extension . '.xml', array(), true, 'config'); $ext_values = array('params' => json_decode($row->params)); $ext_form->bind($ext_values); $default_form = JForm::getInstance('commonForm', JPATH_MIJOSEF_ADMIN . '/extensions/default_params.xml', array(), true, 'config'); $default_values = array('params' => json_decode($row->params)); $default_form->bind($default_values); $row->description = ''; $row->hasCats = 0; $xml_file = JPATH_MIJOSEF_ADMIN . '/extensions/' . $row->extension . '.xml'; if (file_exists($xml_file)) { $row->description = Mijosef::get('utility')->getXmlText($xml_file, 'description'); $row->hasCats = (int) Mijosef::get('utility')->getXmlText($xml_file, 'hasCats'); } // Get behaviors JHTML::_('behavior.combobox'); JHTML::_('behavior.tooltip'); // Assign data $this->assignRef('row', $row); $this->assignRef('ext_params', $ext_form); $this->assignRef('default_params', $default_form); parent::display($tpl); }
public function _getTag($tag) { static $cache = array(); if (!isset($cache[$tag])) { $joomfish = $this->MijosefConfig->joomfish_trans_url ? ', id' : ''; $clean_tag = Mijosef::get('utility')->cleanText($tag); $row = MijoDatabase::loadRow("SELECT id, title, alias, description{$joomfish} FROM #__mijosef_tags WHERE title = '{$clean_tag}'"); $name = $this->params->get('tagid_inc', '1') != '1' ? $row[0] . ' ' : ''; if (parent::urlPart($this->params->get('tag_part', 'global')) == 'title') { $name .= $row[1]; } else { $name .= $row[2]; } $cache[$tag]['name'] = $name; $cache[$tag]['meta_title'] = $row[1]; if ($this->params->get('meta_desc_mijosef', '2') == '2') { $cache[$tag]['meta_desc'] = $row[3]; } } $this->meta_title[] = $cache[$tag]['meta_title']; if (!empty($cache[$tag]['meta_desc'])) { $this->meta_desc = $cache[$tag]['meta_desc']; } return $cache[$tag]['name']; }
function onContentAfterSave($context, &$article, $isNew) { if ($isNew) { return true; } // Check we are manipulating a valid form. if (!in_array($context, array('com_content.article'))) { return true; } if (!self::_systemCheckup()) { return true; } $id = JRequest::getInt('mijosef_id'); $url_sef = JRequest::getString('mijosef_url_sef'); $title = Mijosef::get('utility')->replaceSpecialChars(JRequest::getString('mijosef_title')); $description = Mijosef::get('utility')->replaceSpecialChars(JRequest::getString('mijosef_desc')); $keywords = Mijosef::get('utility')->replaceSpecialChars(JRequest::getString('mijosef_key')); $lang = JRequest::getString('mijosef_lang'); $robots = JRequest::getString('mijosef_robots'); $googlebot = JRequest::getString('mijosef_googlebot'); if ($id == 0) { MijoDatabase::query("INSERT IGNORE INTO #__mijosef_metadata (url_sef, title, description, keywords, lang, robots, googlebot) VALUES('{$url_sef}', '{$title}', '{$description}', '{$keywords}', '{$lang}', '{$robots}', '{$googlebot}')"); } else { MijoDatabase::query("UPDATE #__mijosef_metadata SET title = '{$title}', description = '{$description}', keywords = '{$keywords}', lang = '{$lang}', robots = '{$robots}', googlebot = '{$googlebot}' WHERE id = {$id}"); } }
function view($tpl = null) { // Toolbar JToolBarHelper::title(JText::_('COM_MIJOSEF_COMMON_UPGRADE'), 'mijosef'); $this->toolbar->appendButton('Popup', 'help1', JText::_('Help'), 'http://www.mijosoft.com/support/docs/mijosef/installation-upgrading/upgrade?tmpl=component', 650, 500); $versions = array(2); $version_info = Mijosef::get('utility')->getRemoteInfo(); $versions['latest'] = $version_info['mijosef']; $versions['installed'] = Mijosef::get('utility')->getXmlText(JPATH_MIJOSEF_ADMIN . '/a_mijosef.xml', 'version'); $this->assignRef('versions', $versions); parent::display($tpl); }
function getMijosefVersion() { $mijosef = JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; if (!file_exists($mijosef)) { return 0; } require_once $mijosef; $utility = Mijosef::get('utility'); $installed = $utility->getXmlText(JPATH_ADMINISTRATOR . '/components/com_mijosef/a_mijosef.xml', 'version'); $version_info = $utility->getRemoteInfo(); $latest = $version_info['mijosef']; $version = version_compare($installed, $latest); return $version; }
function used() { // Check token JRequest::checkToken() or jexit('Invalid Token'); $ids = parent::_getIDs($this->_table, $this->_model); Mijosef::get('utility')->import('models.sefurls'); $model = new MijosefModelSefUrls(); foreach ($ids as $index => $id) { $model->used($id); } // Redirect $id = JRequest::getInt('id'); $this->setRedirect('index.php?option=' . $this->_option . '&controller=' . $this->_context . '&task=view&id=' . $id . '&tmpl=component'); }
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); }
public function getLang(&$uri) { if (Mijosef::getConfig()->multilang == 0) { return ''; } $lang = $uri->getVar('lang'); if (empty($lang)) { $lang = self::$_lang; if (empty($lang)) { $lang = JRequest::getWord('lang', ''); } } if (empty($lang)) { return ''; } $uri->setVar('lang', $lang); return $lang; }
function getInput() { $attribs = 'class="inputbox" size="10" multiple="multiple"'; // Get rows static $tree; if (!isset($tree)) { $extension = Mijosef::get('utility')->getExtensionFromRequest(); $mijosef_ext = Mijosef::getExtension($extension); $db_query = ""; if ($this->element['db_query']) { $db_query = $this->element['db_query']; } $rows = $mijosef_ext->getCategoryList($db_query); // Collect childrens $children = array(); if (!empty($rows)) { foreach ($rows as $row) { // Not subcategories if (empty($row->parent)) { $row->parent = 0; } $pt = $row->parent; $list = @$children[$pt] ? $children[$pt] : array(); array_push($list, $row); $children[$pt] = $list; } } // Not subcategories if (empty($rows[0]->parent)) { $rows[0]->parent = 0; } // Build Tree $tree = self::_buildTree(intval($rows[0]->parent), '', array(), $children); } $options = array(); $options[] = array('id' => 'all', 'name' => JText::_('COM_MIJOSEF_PARAMS_ALL_CATS')); /*foreach ($node->children() as $option) { $options[] = array('id' => $option->attributes('value'), 'name' => $option->data()); }*/ foreach ($tree as $item) { $options[] = array('id' => $item->id, 'name' => $item->name); } return JHTML::_('select.genericlist', $options, $this->name, $attribs, 'id', 'name', $this->value, $this->name); }
public function upgrade() { $installer = Mijosef::get('installer'); // Get package $type = JRequest::getCmd('type'); if ($type == 'upload') { $userfile = JRequest::getVar('install_package', null, 'files', 'array'); $package = $installer->getPackageFromUpload($userfile); } elseif ($type == 'server') { $url = self::_getURL(); $package = $installer->getPackageFromServer($url); } if (!$package || empty($package['dir'])) { $this->setState('message', 'Unable to find install package.'); return false; } $file = ''; if (JFile::exists($package['dir'] . '/com_mijosef_j25_basic.zip')) { $file = $package['dir'] . '/com_mijosef_j25_basic.zip'; } else { if (JFile::exists($package['dir'] . '/com_mijosef_j25_plus.zip')) { $file = $package['dir'] . '/com_mijosef_j25_plus.zip'; } else { if (JFile::exists($package['dir'] . '/com_mijosef_j25_pro.zip')) { $file = $package['dir'] . '/com_mijosef_j25_pro.zip'; } else { if (JFile::exists($package['dir'] . '/com_mijosef_j25_vip.zip')) { $file = $package['dir'] . '/com_mijosef_j25_vip.zip'; } } } } if (!empty($file)) { $p1 = $installer->unpack($file); $install = new JInstaller(); $install->install($p1['dir']); } else { $install = new JInstaller(); $install->install($package['dir']); } JFolder::delete($package['dir']); return true; }
public function getPackageFromServer($url) { // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { JError::raiseWarning('1001', JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_INSTALL_PHP_SETTINGS')); return false; } // Make sure that zlib is loaded so that the package can be unpacked if (!extension_loaded('zlib')) { JError::raiseWarning('1001', JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_INSTALL_PHP_ZLIB')); return false; } // Get temp path $JoomlaConfig =& JFactory::getConfig(); $tmp_dest = $JoomlaConfig->get('tmp_path'); $url = str_replace('http://www.mijosoft.com/', '', $url); $url = str_replace('https://www.mijosoft.com/', '', $url); $url = 'http://mijosoft.com/' . $url; // Grab the package $data = Mijosef::get('utility')->getRemoteData($url); $target = $tmp_dest . '/mijosef_upgrade.zip'; // Write buffer to file $written = JFile::write($target, $data); if (!$written) { JError::raiseWarning('SOME_ERROR_CODE', '<br /><br />' . JText::_('File not uploaded, please, make sure that your "MijoSEF => Configuration => Personal ID" and/or the "Global Configuration=>Server=>Path to Temp-folder" field has a valid value.') . '<br /><br /><br />'); return false; } $p_file = basename($target); // Was the package downloaded? if (!$p_file) { JError::raiseWarning('SOME_ERROR_CODE', JText::_('Invalid Personal ID')); return false; } // Unpack the downloaded package file $package = self::unpack($tmp_dest . '/' . $p_file); if (!$package) { JError::raiseWarning('SOME_ERROR_CODE', JText::_('An error occured, please, make sure that your "MijoSEF => Configuration => Personal ID" and/or the "Global Configuration=>Server=>Path to Temp-folder" field has a valid value.')); return false; } // Delete the package file JFile::delete($tmp_dest . DS . $p_file); return $package; }
echo Mijosef::get('utility')->replaceSpecialChars(htmlspecialchars($row->robots), true); ?> " /> </td> </tr> <tr> <td width="25%" class="key"> <label for="name"> <?php echo JText::_('COM_MIJOSEF_URL_EDIT_METAGOOGLEBOT'); ?> </label> </td> <td width="75%"> <input class="inputbox" type="text" name="mijosef_googlebot" size="20" value="<?php echo Mijosef::get('utility')->replaceSpecialChars(htmlspecialchars($row->googlebot), true); ?> " /> </td> </tr> </table> <input type="hidden" name="mijosef_id" value="<?php echo $row->id; ?> "> <input type="hidden" name="mijosef_url_sef" value="<?php echo $row->url_sef; ?> "> </div> </div>
function setData($table, $id, $db_field, $new_field) { $row = Mijosef::getTable($table); if (!$row->load($id)) { return false; } $row->{$db_field} = $new_field; if (!$row->check()) { return false; } if (!$row->store()) { return false; } }
function editSaveMoved($id = 0) { $row = Mijosef::getTable('MijosefMovedUrls'); $row->url_old = JRequest::getVar('url_old'); $row->url_new = JRequest::getVar('url_sef'); // Make sure the record is valid if (!$row->check()) { return JError::raiseWarning(500, $row->getError()); } // Save the changes if (!$row->store()) { return JError::raiseWarning(500, $row->getError()); } return true; }
function getCache() { $metadata = array(); $cache = Mijosef::getCache(); $metadata = $cache->load('metadata'); return $metadata; }
public static function sefToolEnabled() { //check mijosef $mijoseffilename = JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; if (JFile::exists($mijoseffilename)) { require_once($mijoseffilename); $mijoconfig = Mijosef::getConfig(); if ($mijoconfig->mode == 1){ return true; } } //check sh404 $sh404filename = JPATH_ADMINISTRATOR . '/components/com_sh404sef/sh404sef.class.php'; if (JFile::exists($sh404filename)) { require_once($sh404filename); // get our configuration $sefConfig = &Sh404sefFactory::getConfig(); if ($sefConfig->Enabled) { return true; } } //check acesef //no more necessary with acesef > 4.1.1 // $aceseffilename = JPATH_ADMINISTRATOR . '/components/com_acesef/library/utility.php'; // if (JFile::exists($aceseffilename)) { // require_once($aceseffilename); // $AcesefConfig = AcesefFactory::getConfig(); // if ($AcesefConfig->mode == 1){ // //woraround to set language filter mijosef don't set it in 4.1.1 // $app = JFactory::getApplication(); // if ($app->isSite()){ // $app->setLanguageFilter(true); // } // return true; // } // } return false; }
function getCache() { $urls = array(); $cache = Mijosef::getCache(); $urls = $cache->load('urls_moved'); return $urls; }
public function _systemCheckup($check_raw = true) { static $status; if (!isset($status)) { $status = true; if (version_compare(PHP_VERSION, '5.2.0', '<')) { JError::raiseWarning('100', JText::sprintf('MijoSEF requires PHP 5.2.x to run, please contact your hosting company.')); $status = false; return $status; } $mijosef = JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; if (!file_exists($mijosef)) { $status = false; return $status; } require_once $mijosef; $this->MijosefConfig = Mijosef::getConfig(); // Is backend if (JFactory::getApplication()->isAdmin()) { $status = false; return $status; } // Joomla SEF is disabled if (!JFactory::getConfig()->get('sef')) { $status = false; return $status; } // Check if MijoSEF is enabled if ($this->MijosefConfig->mode == 0) { $status = false; return $status; } // Is plugin enabled if (!JPluginHelper::isEnabled('system', 'mijosef')) { $status = false; return $status; } } if ($check_raw == true) { $raw = JRequest::getCmd('format') == 'raw' || JRequest::getCmd('format') == 'xml' || JRequest::getCmd('tmpl') == 'raw'; if ($raw) { $status = false; } } return $status; }
?> </th> <th nowrap="nowrap"> <?php echo $this->lists['search_sef']; ?> </th> <th nowrap="nowrap"> <?php echo $this->lists['search_real']; ?> <?php echo $this->lists['component_list']; ?> <?php if (Mijosef::get('utility')->JoomFishInstalled() && $this->MijosefConfig->ui_sef_language == 1) { echo $this->lists['lang_list']; } ?> </th> <?php if ($this->MijosefConfig->ui_sef_published == 1) { ?> <th nowrap="nowrap"> <?php echo $this->lists['published_list']; ?> </th> <?php } ?>
function getCountCache() { $cache = Mijosef::getCache(); $count = array(); $items = array('versions', 'extensions', 'urls', 'urls_moved', 'metadata', 'sitemap', 'tags', 'ilinks'); foreach ($items as $item) { $contents = $cache->load($item); if (!empty($contents)) { $count[$item] = count($contents); } else { $count[$item] = 0; } } return $count; }
$url = 'index.php?option=com_mijoextensions&view=download&model=ext_mijosef_' . str_replace('com_', '', $row->extension) . '&free=1'; $func = "upgradeExt('" . $url . "');"; } elseif (!empty($pid)) { $url = 'index.php?option=com_mijoextensions&view=download&model=ext_mijosef_' . str_replace('com_', '', $row->extension) . '&pid=' . $pid; $func = "upgradeExt('" . $url . "');"; } else { $func = "return noPersonalId();"; } $status = '<input type="button" class="button hasTip" value="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_2') . '" onclick="' . $func . '" title="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_UPGRADE') . '"/>'; } } else { $status = '<input type="button" class="button hasTip" value="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_3') . '" onclick="window.open(\'' . $info->link . '\');" title="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_GET') . '" />'; } } // Router $router = JHTML::_('select.genericlist', Mijosef::get('utility')->getRouterList($row->extension), 'router[' . $row->id . ']', 'class="inputbox" size="1"', 'value', 'text', $params->get('router', '1')); // Prefix $prefix = $params->get('prefix'); // Skip menu $skip_menu = JHTML::_('select.booleanlist', 'skip_menu[' . $row->id . ']', null, $params->get('skip_menu')); $checked = JHTML::_('grid.id', $i, $row->id); ?> <tr class="<?php echo "row{$k}"; ?> "> <td> <?php echo $this->pagination->getRowOffset($i); ?> </td>
function _pluginTitle($url_id, $org_title, $db_title) { // Modify original title $modified_title = $org_title; if (!empty($modified_title)) { $JoomlaConfig =& JFactory::getConfig(); $sitename = $JoomlaConfig->getValue('sitename'); $component = JRequest::getVar('option'); if (file_exists(JPATH_MIJOSEF_ADMIN . '/extensions/' . $component . '.xml')) { $ext_params = Mijosef::get('cache')->getExtensionParams($component); $separator = $ext_params->get('separator', '-'); $custom_sitename = $ext_params->get('custom_sitename', ''); $use_sitename = $ext_params->get('use_sitename', '2'); $title_prefix = $ext_params->get('title_prefix', ''); $title_suffix = $ext_params->get('title_suffix', ''); } else { $separator = $this->MijosefConfig->meta_t_seperator; $custom_sitename = $this->MijosefConfig->meta_t_sitename; $use_sitename = $this->MijosefConfig->meta_t_usesitename; $title_prefix = $this->MijosefConfig->meta_t_prefix; $title_suffix = $this->MijosefConfig->meta_t_suffix; } if (!empty($custom_sitename)) { $sitename = $custom_sitename; } if ($use_sitename == 1) { $modified_title = $sitename . " " . $separator . " " . $modified_title; } elseif ($use_sitename == 2) { $modified_title = $modified_title . " " . $separator . " " . $sitename; } if (!empty($title_prefix)) { $modified_title = $title_prefix . " " . $separator . " " . $modified_title; } if (!empty($title_suffix)) { $modified_title = $modified_title . " " . $separator . " " . $title_suffix; } } if (empty($db_title)) { return $modified_title; } else { return $db_title; } }
function showStatus($type) { static $status; if (!isset($status)) { $status = Mijosef::get('utility')->getSefStatus(); } if (isset($status[$type])) { if ($type == "live_site") { echo '<input type="text" name="live_site" id="live_site" class="inputbox" size="35" value="' . $status['live_site'] . '" />'; echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'0\');" value="' . JText::_('Save') . '" />'; } elseif ($type == "php") { if ($status[$type]) { echo '<span style="font-weight: bold; color: green;">' . PHP_VERSION . '</span>'; } else { echo '<span style="font-weight: bold; color: red;">' . PHP_VERSION . '</span>'; } } elseif ($type == "s_mod_rewrite") { if ($status[$type]) { echo '<span style="font-weight: bold; color: green;">' . JText::_('OK') . '</span>'; } else { echo '<span style="font-weight: bold; color: red;">' . JText::_('COM_MIJOSEF_CPANEL_STATUS_SERVER_MOD_NO') . '</span>'; } } elseif ($type == "htaccess") { if ($status[$type]) { echo '<span style="font-weight: bold; color: green;">' . JText::_('OK') . '</span>'; } else { echo '<span style="font-weight: bold; color: red;">' . JText::_('COM_MIJOSEF_CPANEL_STATUS_HTA_NO') . '</span>'; } } elseif ($type == "version_checker") { if ($status[$type]) { echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'0\');" value="' . JText::_('Disable') . '" />'; } else { echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'1\');" value="' . JText::_('Enable') . '" />'; } } elseif ($type == "jfrouter") { if ($status[$type]) { echo '<span style="font-weight: bold; color: red;">' . JText::_('Enabled') . '</span>'; echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'0\');" value="' . JText::_('Disable') . '" />'; } else { echo '<span style="font-weight: bold; color: green;">' . JText::_('Disabled') . '</span>'; echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'1\');" value="' . JText::_('Enable') . '" />'; } } elseif ($type == "languagefilter") { if ($status[$type]) { echo '<span style="font-weight: bold; color: red;">' . JText::_('Enabled') . '</span>'; echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'0\');" value="' . JText::_('Disable') . '" />'; } else { echo '<span style="font-weight: bold; color: green;">' . JText::_('Disabled') . '</span>'; echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'1\');" value="' . JText::_('Enable') . '" />'; } } else { if ($status[$type]) { echo '<span style="font-weight: bold; color: green;">' . JText::_('Enabled') . '</span>'; echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'0\');" value="' . JText::_('Disable') . '" />'; } else { echo '<span style="font-weight: bold; color: red;">' . JText::_('Disabled') . '</span>'; echo ' '; echo '<input type="button" onclick="sefStatus(\'' . $type . '\', \'1\');" value="' . JText::_('Enable') . '" />'; } } } }
protected function showError() { if (Mijosef::getConfig()->show_db_errors == 1 && self::$_dbo->getErrorNum()) { throw new Exception(__METHOD__ . ' failed. (' . self::$_dbo->getErrorMsg() . ')'); } }
</td> </tr> <tr> <td> <?php echo JText::_('COM_MIJOSEF_CPANEL_STATUS_MOD_REWRITE'); ?> </td> <td> <?php $this->showStatus('mod_rewrite'); ?> </td> </tr> <?php if (Mijosef::get('utility')->JoomFishInstalled()) { ?> <tr> <td> <?php echo JText::_('COM_MIJOSEF_CPANEL_STATUS_JOOMFISH'); ?> </td> <td> <?php $this->showStatus('jfrouter'); ?> </td> </tr> <?php }
echo Mijosef::get('utility')->replaceSpecialChars(htmlspecialchars($this->row->googlebot), true); ?> " /> </td> </tr> <tr> <td width="23%" class="key2"> <label for="name"> <?php echo JText::_('COM_MIJOSEF_COMMON_META') . ' ' . JText::_('COM_MIJOSEF_URL_EDIT_METACANONICAL'); ?> </label> </td> <td width="77%"> <input class="inputbox" type="text" name="canonical" size="80" value="<?php echo Mijosef::get('utility')->replaceSpecialChars(htmlspecialchars($this->row->canonical), true); ?> " /> </td> </tr> </table> </fieldset> <input type="hidden" name="option" value="com_mijosef" /> <input type="hidden" name="controller" value="metadata" /> <input type="hidden" name="task" value="edit" /> <input type="hidden" name="modal" value="0" /> <input type="hidden" name="id" value="<?php echo $this->row->id; ?> " /> <?php
function onAfterDispatch() { $document =& JFactory::getDocument(); // Metadata Mijosef::get('metadata')->plugin($document); // Set base href if ($this->MijosefConfig->base_href == 2) { $document->setBase(JURI::current()); } elseif ($this->MijosefConfig->base_href == 3) { $document->setBase(JURI::base()); } elseif ($this->MijosefConfig->base_href == 4) { $document->setBase(''); } }
function install() { // Get the extension manifest object $this->manifest =& $this->parent->getManifest(); // Set the extension's name $name = (string) $this->manifest->name; $this->parent->set('name', $name); // Set the extension's description $description = (string) $this->manifest->description; $this->parent->set('message', $description); // Set the installation path $this->parent->setPath('extension_root', JPATH_ADMINISTRATOR . '/components/com_mijosef/extensions'); /** * --------------------------------------------------------------------------------------------- * Filesystem Processing Section * --------------------------------------------------------------------------------------------- */ // If the extension directory does not exist, lets create it $created = false; if (!file_exists($this->parent->getPath('extension_root'))) { if (!($created = JFolder::create($this->parent->getPath('extension_root')))) { $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Failed to create directory') . ': "' . $this->parent->getPath('extension_root') . '"'); return false; } } if ($created) { $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); } // Copy all necessary files $element =& $this->manifest->files; if ($this->parent->parseFiles($element, -1) === false) { // Install failed, roll back changes $this->parent->abort(); return false; } // If there is an install file, lets copy it. $installScriptElement = (string) $this->manifest->installfile; if ($installScriptElement) { // Make sure it hasn't already been copied (this would be an error in the xml install file) if (!file_exists($this->parent->getPath('extension_root') . DS . $installScriptElement)) { $path['src'] = $this->parent->getPath('source') . DS . $installScriptElement; $path['dest'] = $this->parent->getPath('extension_root') . DS . $installScriptElement; if (!$this->parent->copyFiles(array($path))) { // Install failed, rollback changes $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Could not copy PHP install file.')); return false; } } $this->set('install.script', $installScriptElement); } // If there is an uninstall file, lets copy it. $uninstallScriptElement = (string) $this->manifest->uninstallfile; if ($uninstallScriptElement) { // Make sure it hasn't already been copied (this would be an error in the xml install file) if (!file_exists($this->parent->getPath('extension_root') . DS . $uninstallScriptElement)) { $path['src'] = $this->parent->getPath('source') . DS . $uninstallScriptElement; $path['dest'] = $this->parent->getPath('extension_root') . DS . $uninstallScriptElement; if (!$this->parent->copyFiles(array($path))) { // Install failed, rollback changes $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Could not copy PHP uninstall file.')); return false; } } } /** * --------------------------------------------------------------------------------------------- * Database Processing Section * --------------------------------------------------------------------------------------------- */ $db =& JFactory::getDBO(); /* * Let's run the install queries for the component * If backward compatibility is required - run queries in xml file * If Joomla 1.5 compatible, with discreet sql files - execute appropriate * file for utf-8 support or non-utf-8 support */ $result = $this->parent->parseQueries($this->manifest->install->queries); if ($result === false) { // Install failed, rollback changes $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('SQL Error') . " " . $db->stderr(true)); return false; } elseif ($result === 0) { // no backward compatibility queries found - try for Joomla 1.5 type queries // second argument is the utf compatible version attribute $utfresult = $this->parent->parseSQLFiles($this->manifest->install->sql); if ($utfresult === false) { // Install failed, rollback changes $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('SQLERRORORFILE') . " " . $db->stderr(true)); return false; } } // Get extension $extension = preg_replace('/.xml$/', '', basename($this->parent->getPath('manifest'))); // Check if extension exists and upgrade is performed $db->setQuery("SELECT name, params FROM #__mijosef_extensions WHERE extension = '{$extension}'"); $existing = $db->loadObject(); $installation = false; // Existing Install if (!is_null($existing)) { if ($existing->name == "") { Mijosef::get('utility')->import('library.parameter'); $old_p = new JRegistry($existing->params); $new_p = new JRegistry(self::_getDefaultParams()); $new_p->set('prefix', $old_p->get('prefix', '')); $new_p->set('skip_menu', $old_p->get('skip_menu', '0')); $params = $new_p->toString(); $db->setQuery("UPDATE #__mijosef_extensions SET name = '{$name}', params = '{$params}' WHERE extension = '{$extension}'"); $db->query(); $installation = true; } } else { JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_mijosef/tables'); $row =& JTable::getInstance('MijosefExtensions', 'Table'); $row->name = $name; $row->extension = $extension; $row->params = self::_getDefaultParams(); $row->store(); $installation = true; } // Remove already created URLs for this extension require_once JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; $MijosefConfig =& Mijosef::getConfig(); if ($installation && $MijosefConfig->purge_ext_urls == 1) { $db->setQuery("DELETE FROM #__mijosef_urls WHERE (url_real LIKE '%option={$extension}&%' OR url_real LIKE '%option={$extension}') AND params LIKE '%locked=0\nb%'"); $db->query(); } /** * --------------------------------------------------------------------------------------------- * Custom Installation Script Section * --------------------------------------------------------------------------------------------- */ /* * If we have an install script, lets include it, execute the custom * install method, and append the return value from the custom install * method to the installation message. */ if ($this->get('install.script')) { if (is_file($this->parent->getPath('extension_root') . DS . $this->get('install.script'))) { ob_start(); ob_implicit_flush(false); require_once $this->parent->getPath('extension_root') . DS . $this->get('install.script'); if (function_exists('com_install')) { if (com_install() === false) { $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Custom install routine failure')); return false; } } $msg = ob_get_contents(); ob_end_clean(); if ($msg != '') { $this->parent->set('extension.message', $msg); } } } /** * --------------------------------------------------------------------------------------------- * Finalization and Cleanup Section * --------------------------------------------------------------------------------------------- */ // Lastly, we will copy the manifest file to its appropriate place. if (!$this->parent->copyManifest(-1)) { // Install failed, rollback changes $this->parent->abort(JText::_('Could not copy setup file')); return false; } return true; }