protected function onBrowse($tpl = null) { $task = $this->input->getCmd('task', 'browse'); switch ($task) { case 'preview': $model = $this->getModel(); $htaccess = $model->makeHtaccess(); $this->htaccess = $htaccess; $this->setLayout('plain'); break; default: /** @var AdmintoolsModelHtmaker $model */ $model = $this->getModel(); $config = $model->loadConfiguration(); $this->htconfig = $config; $this->loadHelper('servertech'); $this->isSupported = AdmintoolsHelperServertech::isHtaccessSupported(); break; } }
protected function onBrowse($tpl = null) { $task = $this->input->getCmd('task', 'browse'); switch ($task) { case 'preview': /** @var AdmintoolsModelNginxmaker $model */ $model = $this->getModel(); $nginxconf = $model->makeNginXConf(); $this->nginxconf = $nginxconf; $this->setLayout('plain'); break; default: /** @var AdmintoolsModelNginxmaker $model */ $model = $this->getModel(); $config = $model->loadConfiguration(); $this->nginxconf = $config; $this->loadHelper('servertech'); $this->isSupported = AdmintoolsHelperServertech::isNginxSupported(); break; } }
public function writeHtaccess() { // Make sure we are called by an expected caller if (!class_exists('AdmintoolsHelperServertech')) { require_once JPATH_ADMINISTRATOR . '/components/com_admintools/helpers/servertech.php'; } AdmintoolsHelperServertech::checkCaller(array('AdmintoolsControllerHtmaker::apply')); // Make and save the .htaccess file $htaccess = $this->makeHtaccess(); JLoader::import('joomla.filesystem.file'); if (@file_exists(JPATH_ROOT . '/.htaccess')) { JFile::copy('.htaccess', '.htaccess.admintools', JPATH_ROOT); } return JFile::write(JPATH_ROOT . DIRECTORY_SEPARATOR . '.htaccess', $htaccess); }
protected function onBrowse($tpl = null) { // Is this the Professional release? JLoader::import('joomla.filesystem.file'); $isPro = ADMINTOOLS_PRO == 1; $this->isPro = $isPro; // Should we show the stats and graphs? JLoader::import('joomla.html.parameter'); JLoader::import('joomla.application.component.helper'); $db = JFactory::getDbo(); $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_admintools')); $db->setQuery($sql); $rawparams = $db->loadResult(); $params = new JRegistry(); $params->loadString($rawparams, 'JSON'); $this->showstats = $params->get('showstats', 1); $reorderPlugin = $params->get('reorderplugin', 1); // Load the models /** @var AdmintoolsModelCpanels $model */ $model = $this->getModel(); /** @var AdmintoolsModelAdminpw $adminpwmodel */ $adminpwmodel = F0FModel::getAnInstance('Adminpw', 'AdmintoolsModel'); /** @var AdmintoolsModelMasterpw $mpModel */ $mpModel = F0FModel::getAnInstance('Masterpw', 'AdmintoolsModel'); /** @var AdmintoolsModelGeoblock $geoModel */ $geoModel = F0FModel::getAnInstance('Geoblock', 'AdmintoolsModel'); /** @var AdmintoolsModelStats $statsModel */ $statsModel = F0FModel::getAnInstance('Stats', 'AdmintoolsModel'); /** Reorder the Admin Tools plugin */ if ($reorderPlugin) { $model->reorderPlugin(); } // Decide on the administrator password padlock icon $adminlocked = $adminpwmodel->isLocked(); $this->adminLocked = $adminlocked; // Do we have to show a master password box? $this->hasValidPassword = $mpModel->hasValidPassword(); // Is this MySQL? $dbType = JFactory::getDbo()->name; $isMySQL = strpos($dbType, 'mysql') !== false; // If the user doesn't have a valid master pw for some views, don't show // the buttons. $this->enable_cleantmp = $mpModel->accessAllowed('cleantmp'); $this->enable_fixperms = $mpModel->accessAllowed('fixperms'); $this->enable_purgesessions = $mpModel->accessAllowed('purgesessions'); $this->enable_dbtools = $mpModel->accessAllowed('dbtools'); $this->enable_dbchcol = $mpModel->accessAllowed('dbchcol'); $this->isMySQL = $isMySQL; $this->pluginid = $model->getPluginID(); $this->hasplugin = $geoModel->hasGeoIPPlugin(); $this->pluginNeedsUpdate = $geoModel->dbNeedsUpdate(); // Is this a very old version? If it's older than 90 days let's warn the user $this->oldVersion = false; $relDate = new JDate(ADMINTOOLS_DATE); $interval = time() - $relDate->toUnix(); if ($interval > 60 * 60 * 24 * 90) { $this->oldVersion = true; } $this->loadHelper('servertech'); // Is .htaccess Maker supported? $this->htMakerSupported = AdmintoolsHelperServertech::isHtaccessSupported(); // Is NginX Configuration Maker supported? $this->nginxMakerSupported = AdmintoolsHelperServertech::isNginxSupported(); // Collect information about the site $this->statsIframe = F0FModel::getTmpInstance('Stats', 'AdmintoolsModel')->collectStatistics(true); // Post-installation messages information $this->hasPostInstallationMessages = $model->hasPostInstallMessages(); $this->extension_id = $model->getState('extension_id', 0, 'int'); $this->needsdlid = $model->needsDownloadID(); return true; }
public function writeNginXConf() { // Make sure we are called by an expected caller if (!class_exists('AdmintoolsHelperServertech')) { require_once JPATH_ADMINISTRATOR . '/components/com_admintools/helpers/servertech.php'; } AdmintoolsHelperServertech::checkCaller(array('AdmintoolsControllerNginxmaker::apply')); $nginxConf = $this->makeNginXConf(); JLoader::import('joomla.filesystem.file'); if (@file_exists(JPATH_ROOT . '/nginx.conf')) { JFile::copy('nginx.conf', 'nginx.conf.admintools', JPATH_ROOT); } return JFile::write(JPATH_ROOT . DIRECTORY_SEPARATOR . 'nginx.conf', $nginxConf); }