function com_install() { include JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomap' . DS . 'classes' . DS . 'JoomapConfig.php'; echo '<table class="adminlist" style="width:auto"><tr class="row0"><td>→</td><td>' . "\n"; JoomapConfig::create(); echo '</td></tr>' . "\n"; if (JoomapConfig::restore()) { echo '<tr class="row1"><td>→</td><td>' . _JOOMAP_MSG_SET_RESTORED . '</td></tr>' . "\n"; } echo "</table>\n"; }
/** * Uninstall routine for Joomap. * Drops the settings table from the Joomla! database * @author Daniel Grothe * @see JoomapConfig.php * @version $Id: uninstall.joomap.php 12 2008-08-17 20:51:27Z koders.de $ */ function com_uninstall() { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomap' . DS . 'classes' . DS . 'JoomapConfig.php'; JoomapConfig::backup(); JoomapConfig::remove(); }
$user =& JFactory::getUser(); if (!$user->authorize('com_users', 'manage')) { $app =& JFactory::getApplication(); $app->redirect('index2.php', JText::_('ALERTNOTAUTH')); } // load language file $lang =& JFactory::getLanguage(); if (file_exists(JPATH_COMPONENT . DS . 'language' . DS . $lang->getBackwardLang() . '.php')) { require_once JPATH_COMPONENT . DS . 'language' . DS . $lang->getBackwardLang() . '.php'; } else { //echo 'Language file [ '. $lang->getBackwardLang().' ] not found, using default language: english<br />'; require_once JPATH_COMPONENT . DS . 'language' . DS . '/english.php'; } // load settings from database require_once JPATH_COMPONENT . DS . 'classes' . DS . 'JoomapConfig.php'; $config = new JoomapConfig(); if (!$config->load()) { $text = _JOOMAP_ERR_NO_SETTINGS . "<br />\n"; $link = 'index2.php?option=com_joomap&task=create'; echo sprintf($text, $link); } $cid = JRequest::getVar('cid', array(), '', 'array'); JArrayHelper::toInteger($cid, array()); $task = JRequest::getVar('task', '', '', 'string'); $admin = new JoomapAdmin(); $admin->show($config, $task, $cid); class JoomapAdmin { var $config = null; /** Parses input parameters and calls appropriate function */ function show(&$config, &$task, &$cid)
/** Restore backup settings */ function restore() { $database =& JFactory::getDBO(); $query = "SELECT * FROM #__joomap_backup"; // restore backup settings $database->setQuery($query); $backup = $database->loadObject(); if (!$backup) { return false; } if (isset($this) && is_object($this)) { $config =& $this; } else { $config = new JoomapConfig(); } $vars = get_class_vars('JoomapConfig'); // assign current settings foreach ($vars as $var => $value) { if (isset($backup->{$var})) { $config->{$var} = $backup->{$var}; } } return $config->save(); // save current settings }
/** * The Joomap component frontend * @author Daniel Grothe * @see joomla.html.php * @see joomla.google.php * @package Joomap */ // load Joomap language file $LangPath = $GLOBALS['mosConfig_absolute_path'] . '/administrator/components/com_joomap/language/'; if (file_exists($LangPath . $GLOBALS['mosConfig_lang'] . '.php')) { require_once $LangPath . $GLOBALS['mosConfig_lang'] . '.php'; } else { require_once $LangPath . 'english.php'; } require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/components/com_joomap/classes/JoomapConfig.php'; $config = new JoomapConfig(); $config->load(); require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/components/com_joomap/classes/JoomapPlugins.php'; JoomapPlugins::loadPlugins(); $joomap = new Joomap($config); $tree = $joomap->generateTree(); //$joomap->printDebugTree( $tree ); // DEBUG output $view = mosGetParam($_REQUEST, 'view', 'html'); switch ($view) { case 'google': // Google Sitemaps output require_once $GLOBALS['mosConfig_absolute_path'] . '/components/com_joomap/joomap.google.php'; JoomapGoogle::printTree($joomap, $tree); break; default: // Html output