/** * Implements the init method of JoomlapackFilter * */ function init() { $jreg =& JFactory::getConfig(); $configuration =& JoomlapackModelRegistry::getInstance(); $this->_skipContainedDirectoriesFilter = array(); $temp = $this->_loadFilters(); if (DS == '\\') { if (is_array($temp)) { foreach ($temp as $filter) { $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . $filter); } } } else { if (is_array($temp)) { foreach ($temp as $filter) { $this->_skipContainedDirectoriesFilter[] = JPATH_SITE . DS . $filter; } } } // Add temporary and output directories $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($configuration->get('OutputDirectory'))); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($configuration->getTemporaryDirectory())); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($jreg->getValue('config.tmp_path'))); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_CACHE)); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_ADMINISTRATOR . DS . 'cache')); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_ROOT . DS . 'cache')); // Hack: add the same paths untranslated $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($configuration->get('OutputDirectory')); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($configuration->getTemporaryDirectory()); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($jreg->getValue('config.tmp_path')); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_CACHE); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_ADMINISTRATOR . DS . 'cache'); $this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_ROOT . DS . 'cache'); }
function display() { // Decide what to do; delegate data loading to private methods $task = JRequest::getCmd('task', 'display'); $layout = JRequest::getCmd('layout', 'default'); switch ($layout) { case 'default_edit': switch ($task) { case 'add': $helpfile = 'eff'; JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('EFF_PAGETITLE_NEW') . '</small></small>'); $this->_add(); break; case 'edit': $helpfile = 'eff'; JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('EFF_PAGETITLE_EDIT') . '</small></small>'); $this->_edit(); break; } break; default: $helpfile = 'eff'; JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('EXTRADIRS') . '</small></small>'); $this->_default(); break; } // Load the util helper $this->loadHelper('utils'); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); // Add a spacer, a help button and show the template JToolBarHelper::spacer(); JoomlapackHelperUtils::addLiveHelp('$helpfile'); parent::display(); }
function display() { $tpl = JRequest::getVar('tpl'); // Add toolbar buttons JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('DBEF') . '</small></small>'); JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); JToolBarHelper::spacer(); $bar =& JToolBar::getInstance('toolbar'); switch ($tpl) { case 'tab': JToolBarHelper::deleteList(); $bar->appendButton('Link', 'preview', JText::_('NORMALVIEW'), 'index.php?option=com_joomlapack&view=' . JRequest::getCmd('view')); break; case '': default: $bar->appendButton('Link', 'preview', JText::_('TABULARVIEW'), 'index.php?option=com_joomlapack&view=' . JRequest::getCmd('view') . '&tpl=tab'); break; } JToolBarHelper::spacer(); JoomlapackHelperUtils::addLiveHelp('dbef'); if ($tpl == 'tab') { $model =& $this->getModel('Dbef'); $task = JRequest::getCmd('task', 'default'); $list =& $model->getRecordsList(); $this->assignRef('list', $list); $this->assignRef('pagination', $model->getPagination()); $this->assignRef('class', $model->_filterclass); } $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); parent::display($tpl); }
function display() { $task = JRequest::getCmd('task', 'default'); switch ($task) { case 'showcomment': JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>'); JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option') . '&view=buadmin'); JoomlapackHelperUtils::addLiveHelp('buadmin'); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); jpimport('models.statistics', true); $model =& JoomlapackModelStatistics::getInstance('Statistics', 'JoomlapackModel'); $model->setId(JRequest::getInt('id')); $record =& $model->getStatistic(); $this->assignRef('record', $record); JRequest::setVar('tpl', 'comment'); break; case 'restore': JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>'); JRequest::setVar('tpl', 'restore'); $this->assign('password', JRequest::getVar('password')); $this->assign('link', JRequest::getVar('linktarget')); break; default: $registry =& JoomlapackModelRegistry::getInstance(); $easy = $registry->get('easymode', false); if (!$easy) { JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>'); } else { JToolBarHelper::title(JText::_('JOOMLAPACKEASY') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>'); } JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); JToolBarHelper::spacer(); JToolBarHelper::deleteList(); JToolBarHelper::custom('deletefiles', 'delete.png', 'delete_f2.png', JText::_('STATS_LABEL_DELETEFILES'), true); JToolBarHelper::save('download', JText::_('STATS_LOG_DOWNLOAD')); if (!$easy) { JToolBarHelper::editList('showcomment', JText::_('STATS_LOG_VIEWCOMMENT')); if (JPSPECIALEDITION) { JToolBarHelper::publish('restore', JText::_('STATS_LOG_RESTORE')); } } JToolBarHelper::spacer(); if (!$easy) { JoomlapackHelperUtils::addLiveHelp('buadmin'); } else { JoomlapackHelperUtils::addLiveHelp('buadmineasy'); } $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); jpimport('models.statistics', true); $model =& JoomlapackModelStatistics::getInstance('Statistics', 'JoomlapackModel'); $list =& $model->getStatisticsListWithMeta(); $this->assignRef('list', $list); $this->assignRef('pagination', $model->getPagination()); $this->assign('easy', $easy); break; } parent::display(JRequest::getVar('tpl')); }
function display() { // Set the toolbar title; add a help button JToolBarHelper::title(JText::_('JOOMLAPACKEASY') . ':: <small><small>' . JText::_('CONFIGURATION') . '</small></small>'); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); JoomlapackHelperUtils::addLiveHelp('configeasy'); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); // Load the util helper $this->loadHelper('utils'); // Load the model $model =& $this->getModel(); // Pass on the lists $this->assign('actionlogginglist', $model->getActionLoggingList()); $this->assign('settingsmodelist', $model->getSettingsModeList()); // Let's pass the data $this->assign('OutputDirectory', $model->getVar('OutputDirectoryConfig')); $this->assign('TarNameTemplate', $model->getVar('TarNameTemplate')); $this->assign('settingsmode', $model->getVar('settingsmode')); $this->assign('logLevel', $model->getVar('logLevel')); // Also load the Configuration HTML helper $this->loadHelper('config'); parent::display(); }
function display() { // Decide what to do; delegate data loading to private methods $task = JRequest::getCmd('task', 'display'); $layout = JRequest::getCmd('layout', 'default'); JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('CRONMAN') . '</small></small>'); switch ($layout) { case 'default_edit': // Get the CRON configuration definition if ($task == 'add') { $definition = null; $registry =& JoomlapackModelRegistry::getInstance(); $secret = $registry->get('secret_key'); $this->assign('secret', $secret); } else { $id = JRequest::getInt('id', 0); $model =& $this->getModel('cronman'); $definition = $model->getConfiguration($id); } $this->assign('definition', $definition); // Get some lists and pass them on $model =& $this->getModel('cronman'); $postops = $model->getPostOpList(); $this->assign('postops', $postops); // Add the buttons JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel(); break; case 'default': default: $this->_default(); break; } // Load the util helper $this->loadHelper('utils'); // Add a spacer, a help button and show the template JToolBarHelper::spacer(); JoomlapackHelperUtils::addLiveHelp('profiles'); // Load a list of profiles $model =& $this->getModel('cronman'); jpimport('models.profiles', true); $profilesmodel = new JoomlapackModelProfiles(); $profiles_objects = $profilesmodel->getProfilesList(true); $profiles = array(); foreach ($profiles_objects as $profile) { $id = $profile->id; $profiles[(string) $id] = $profile->description; } unset($profiles_objects); unset($profilesmodel); $this->assign('profiles', $profiles); // Add JoomlaPack CSS $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . '/components/com_joomlapack/assets/css/joomlapack.css'); // Show the view parent::display(); }
/** * Writes a line to the log, if the log level is high enough * * @param int|bool $level The log level (_JP_LOG_XX constants). Use FALSE to pause logging, TRUE to resume logging * @param string $message The message to write to the log */ function WriteLog($level, $message) { static $configuredLoglevel; static $site_root; if (empty($site_root)) { if (!class_exists('JoomlapackHelperUtils')) { jpimport('helpers.utils', true); } $site_root = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE); } if (empty($configuredLoglevel) or $level === true) { // Load the registry if (!class_exists('JoomlapackModelRegistry')) { jpimport('models.registry', true); } $registry =& JoomlapackModelRegistry::getInstance(); // Fetch log level $configuredLoglevel = $registry->get('logLevel'); } if ($level === false) { // Pause logging $configuredLogLevel = false; return; } // Catch paused logging if ($configuredLoglevel === false) { return; } if ($configuredLoglevel >= $level && $configuredLoglevel != 0) { $logName = JoomlapackLogger::logName(); $message = str_replace(JPATH_SITE, "<root>", $message); $message = str_replace($site_root, "<root>", $message); // Fix 2.4 - Also replace the translated path on Windows machines $message = str_replace("\n", ' \\n ', $message); // Fix 1.1.1 - Handle (error) messages containing newlines (by nicholas) switch ($level) { case _JP_LOG_ERROR: $string = "ERROR |"; break; case _JP_LOG_WARNING: $string = "WARNING |"; break; case _JP_LOG_INFO: $string = "INFO |"; break; default: $string = "DEBUG |"; break; } $string .= @strftime("%y%m%d %T") . "|{$message}\r\n"; $fp = @fopen($logName, "at"); if (!($fp === FALSE)) { @fwrite($fp, $string); @fclose($fp); } } }
function display() { // Add toolbar buttons JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('DEF') . '</small></small>'); JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); JToolBarHelper::spacer(); JoomlapackHelperUtils::addLiveHelp('def'); parent::display(); }
/** * Get an array of icon definitions for the Control Panel * * @return array */ function getIconDefinitions() { jpimport('helpers.utils', true); JoomlapackHelperUtils::getJoomlaPackVersion(); $ret = array(); $registry =& JoomlapackModelRegistry::getInstance(); if ($registry->get('easymode', false)) { $ret[] = $this->_makeIconDefinition('reset.png', JText::_('SWITCHTOPRO'), 'switch'); $ret[] = $this->_makeIconDefinition('config.png', JText::_('CONFIGURATION'), 'configeasy'); $ret[] = $this->_makeIconDefinition('backup.png', JText::_('BACKUP'), 'backup'); $ret[] = $this->_makeIconDefinition('bufa.png', JText::_('BUADMIN'), 'buadmin'); $ret[] = $this->_makeIconDefinition('log.png', JText::_('VIEWLOG'), 'log'); } else { $ret[] = $this->_makeIconDefinition('reset.png', JText::_('SWITCHTOEASY'), 'switch'); if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('profiles.png', JText::_('PROFILES'), 'profiles'); } $ret[] = $this->_makeIconDefinition('config.png', JText::_('CONFIGURATION'), 'config'); $ret[] = $this->_makeIconDefinition('backup.png', JText::_('BACKUP'), 'backup'); $ret[] = $this->_makeIconDefinition('bufa.png', JText::_('BUADMIN'), 'buadmin'); $ret[] = $this->_makeIconDefinition('log.png', JText::_('VIEWLOG'), 'log'); if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('multidb.png', $this->_labelInclusion(JText::_('MULTIDB'), 'multidb'), 'multidb'); } if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('dif.png', $this->_labelInclusion(JText::_('EXTRADIRS'), 'eff'), 'eff'); } $ret[] = $this->_makeIconDefinition('sff.png', $this->_labelExclusion(JText::_('SFF'), 'sff'), 'sff'); $ret[] = $this->_makeIconDefinition('def.png', $this->_labelExclusion(JText::_('DEF'), 'def'), 'def'); if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('full.png', $this->_labelExclusion(JText::_('DCS'), array('Skipfiles', 'Skipdirs')), 'skip'); } if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('dbef.png', $this->_labelExclusion(JText::_('DBEF'), 'dbef'), 'dbef'); } if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('extfilter.png', $this->_labelExclusion(JText::_('EXTFILTER'), array('components', 'modules', 'plugins', 'languages', 'templates')), 'extfilter'); } if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('cronman.png', JText::_('CRONMAN'), 'cronman'); } //$ret[] = $this->_makeIconDefinition( 'ftp.png', JText::_('FTPXFERWIZARD'), 'ftpx' ); } // Add Live Update button if it is supported on this server jpimport('models.update', true); $updatemodel =& JoomlapackModelUpdate::getInstance('update', 'JoomlapackModel'); if ($updatemodel->isLiveUpdateSupported()) { $updates =& $updatemodel->getUpdates(); if ($updates->update_available) { $ret[] = $this->_makeIconDefinition('error_big.png', JText::_('CPANEL_UPGRADE_NOW'), 'update'); } else { $ret[] = $this->_makeIconDefinition('ok_big.png', JText::_('CPANEL_UPGRADE_UPTODATE'), 'update'); } } return $ret; }
function display() { // Add toolbar buttons JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('VIEWLOG') . '</small></small>'); JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); JToolBarHelper::spacer(); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); JoomlapackHelperUtils::addLiveHelp('log'); parent::display(); }
function &getFolders($folder) { //JoomlapackLogger::WriteLog(_JP_LOG_DEBUG,'Getting folder list for '.($folder)); jimport('joomla.filesystem.folder'); $temp = JFolder::folders($folder, '.', false, true, array('.', '..')); $ret = array(); if (!empty($temp)) { foreach ($temp as $file) { $ret[] = JPISWINDOWS ? JoomlapackHelperUtils::TranslateWinPath($file) : $file; } } return $ret; }
function display() { $task = JRequest::getCmd('task', 'default'); $act = JRequest::getCmd('act', 'start'); // Set the toolbar title JToolBarHelper::title(JText::_('JOOMLAPACK') . ':: <small><small>' . JText::_('BACKUP') . '</small></small>'); // Load the util helper $this->loadHelper('utils'); switch ($task) { case 'backup': if (!class_exists('JoomlapackModelRegistry')) { jpimport('models.registry', true); } $registry =& JoomlapackModelRegistry::getInstance(); $this->assign('backupMethod', $registry->get('backupMethod')); break; case 'error': $this->assign('errormessage', JRequest::getString('message')); JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); break; case 'finised': JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); JToolBarHelper::spacer(); JoomlapackHelperUtils::addLiveHelp('backup'); break; default: // Add some buttons JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); JToolBarHelper::spacer(); JoomlapackHelperUtils::addLiveHelp('backup'); // Load model $model =& $this->getModel('backup'); // Load the Status Helper jpimport('helpers.status', true); $helper =& JoomlapackHelperStatus::getInstance(); // Pass on data $this->assign('haserrors', !$helper->status); $this->assign('hasquirks', $helper->hasQuirks()); $this->assign('quirks', $helper->getQuirksCell(!$helper->status)); $this->assign('description', $model->getDescription()); $this->assign('comment', $model->getComment()); $this->assign('profile', $model->getProfileID()); $this->assign('profilelist', $model->getProfilesList()); break; } $css = JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'; $document =& JFactory::getDocument(); $document->addStyleSheet($css); parent::display(JRequest::getCmd('tpl', null)); }
function display() { $task = JRequest::getCmd('task'); $force = $task == 'force'; // Set the toolbar title; add a help button JToolBarHelper::title(JText::_('JOOMLAPACK') . ':: <small><small>' . JText::_('LIVEUPDATE')) . '</small></small>'; JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); JoomlapackHelperUtils::addLiveHelp('liveupdate'); // Load the model $model =& $this->getModel(); $updates =& $model->getUpdates($force); $this->assignRef('updates', $updates); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); parent::display(); }
/** * Returns the HTML for the backup status cell * * @return string HTML */ function getStatusCell() { if ($this->status && empty($this->quirks)) { $imageURL = JURI::base() . 'components/com_joomlapack/assets/images/ok_small.png'; $html = '<p class="ok"><img src="' . $imageURL . '" border="0" width="16" height="16" />' . JText::_('JPSTATUSOK') . '</p>'; } elseif ($this->status && !empty($this->quirks)) { $imageURL = JURI::base() . 'components/com_joomlapack/assets/images/ok_small.png'; $html = '<p class="statuswarning"><img src="' . $imageURL . '" border="0" width="16" height="16" />' . JText::_('JPSTATUSWARN') . '</p>'; } else { $imageURL = JURI::base() . 'components/com_joomlapack/assets/images/error_small.png'; $html = '<p class="notok"><img src="' . $imageURL . '" border="0" width="16" height="16" />' . JText::_('JPSTATUSNOTOK') . '</p>'; } jpimport('helpers.utils', true); JoomlapackHelperUtils::getJoomlaPackVersion(); $html .= '<p><span style="font-size: small; color: #666666">' . JText::_('JOOMLAPACK') . ' ' . _JP_VERSION . ' (' . _JP_DATE . ')</span></p>'; return $html; }
function display($tpl = null) { // Decide what to do; delegate data loading to private methods $task = JRequest::getCmd('task', 'display'); $layout = JRequest::getCmd('layout', 'default'); switch ($layout) { case 'default_edit': switch ($task) { case 'add': JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('PROFILE_PAGETITLE_NEW') . '</small></small>'); $this->_add(); break; case 'edit': JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('PROFILE_PAGETITLE_EDIT') . '</small></small>'); $this->_edit(); break; } break; default: switch ($task) { case "import": JToolBarHelper::back('Back', 'index.php?option=com_joomlapack&view=profiles'); JToolBarHelper::spacer(); JRequest::setVar('tpl', 'import'); $tpl = 'import'; $this->assign('description', JRequest::getString('description', '')); break; default: $this->_default(); JToolBarHelper::custom('export', 'export', 'export', JText::_('PROFILE_ICON_EXPORT'), true, false); JToolBarHelper::custom('import', 'import', 'import', JText::_('PROFILE_ICON_IMPORT'), false, false); break; } JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('PROFILES') . '</small></small>'); break; } // Load the util helper $this->loadHelper('utils'); // Add a spacer, a help button and show the template JToolBarHelper::spacer(); JoomlapackHelperUtils::addLiveHelp('profiles'); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . '/components/com_joomlapack/assets/css/joomlapack.css'); parent::display($tpl); }
/** * Loads the file filters off the database and stores them in the _singleFileFilters array * */ function init() { $configuration =& JoomlapackModelRegistry::getInstance(); $temp = $this->_loadFilters(); $this->_singleFileFilters = array(); if (DS == '\\') { if (is_array($temp)) { foreach ($temp as $filter) { $this->_singleFileFilters[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . $filter); } } } else { if (is_array($temp)) { foreach ($temp as $filter) { $this->_singleFileFilters[] = JPATH_SITE . DS . $filter; } } } }
/** * Get an array of icon definitions for the Control Panel * * @return array */ function getIconDefinitions() { jpimport('helpers.utils', true); JoomlapackHelperUtils::getJoomlaPackVersion(); $ret = array(); $registry =& JoomlapackModelRegistry::getInstance(); if ($registry->get('easymode', false)) { $ret[] = $this->_makeIconDefinition('reset.png', JText::_('SWITCHTOPRO'), 'switch'); $ret[] = $this->_makeIconDefinition('config.png', JText::_('CONFIGURATION'), 'configeasy'); $ret[] = $this->_makeIconDefinition('backup.png', JText::_('BACKUP'), 'backup'); $ret[] = $this->_makeIconDefinition('bufa.png', JText::_('BUADMIN'), 'buadmin'); $ret[] = $this->_makeIconDefinition('log.png', JText::_('VIEWLOG'), 'log'); } else { $ret[] = $this->_makeIconDefinition('reset.png', JText::_('SWITCHTOEASY'), 'switch'); if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('profiles.png', JText::_('PROFILES'), 'profiles'); } $ret[] = $this->_makeIconDefinition('config.png', JText::_('CONFIGURATION'), 'config'); $ret[] = $this->_makeIconDefinition('backup.png', JText::_('BACKUP'), 'backup'); $ret[] = $this->_makeIconDefinition('bufa.png', JText::_('BUADMIN'), 'buadmin'); $ret[] = $this->_makeIconDefinition('log.png', JText::_('VIEWLOG'), 'log'); if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('multidb.png', $this->_labelInclusion(JText::_('MULTIDB'), 'multidb'), 'multidb'); } if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('dif.png', $this->_labelInclusion(JText::_('EXTRADIRS'), 'eff'), 'eff'); } $ret[] = $this->_makeIconDefinition('sff.png', $this->_labelExclusion(JText::_('SFF'), 'sff'), 'sff'); $ret[] = $this->_makeIconDefinition('def.png', $this->_labelExclusion(JText::_('DEF'), 'def'), 'def'); if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('full.png', $this->_labelExclusion(JText::_('DCS'), array('Skipfiles', 'Skipdirs')), 'skip'); } if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('dbef.png', $this->_labelExclusion(JText::_('DBEF'), 'dbef'), 'dbef'); } if (JPSPECIALEDITION) { $ret[] = $this->_makeIconDefinition('extfilter.png', $this->_labelExclusion(JText::_('EXTFILTER'), array('components', 'modules', 'plugins', 'languages', 'templates')), 'extfilter'); } //$ret[] = $this->_makeIconDefinition( 'ftp.png', JText::_('FTPXFERWIZARD'), 'ftpx' ); } return $ret; }
/** * Implements the init method of JoomlapackFilter * */ function init() { $configuration =& JoomlapackModelRegistry::getInstance(); $temp = $this->_loadFilters(); $this->_folderFilters = array(); if (DS == '\\') { if (is_array($temp)) { foreach ($temp as $filter) { $this->_folderFilters[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . $filter); } } } else { if (is_array($temp)) { foreach ($temp as $filter) { $this->_folderFilters[] = JPATH_SITE . DS . $filter; } } } // Add any leftover installation directory to exclusion filters. THIS SHOULD NEVER BE NECESSARY ON A REAL SITE! $this->_folderFilters[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . 'installation'); }
function &getFolders($folder) { // Initialize variables $arr = array(); $false = false; if (!is_dir($folder)) { return $false; } $counter = 0; $registry =& JoomlapackModelRegistry::getInstance(); $maxCounter = $registry->get('mnMaxFragmentFiles', 50) * 2; $cube =& JoomlapackCUBE::getInstance(); $allowBreakflag = $cube->operationCounter != 0; $handle = @opendir($folder); // If directory is not accessible, just return FALSE if ($handle === FALSE) { JoomlapackLogger::WriteLog(_JP_LOG_WARNING, 'Unreadable directory ' . $dirName); return $false; } while (($file = @readdir($handle)) !== false && !$this->BREAKFLAG) { $dir = $folder . DS . $file; $isDir = is_dir($dir); if ($isDir && $file != '.' && $file != '..') { $data = JPISWINDOWS ? JoomlapackHelperUtils::TranslateWinPath($dir) : $dir; if ($data) { $arr[] = $data; } } $counter++; if ($counter >= $maxCounter) { $this->BREAKFLAG = true && $allowBreakflag; } } @closedir($handle); return $arr; }
/** * Converts a potential Windows-style path to UNIX-style * * @param string $filePath The filepath * @return string The sanitized filepath */ function sanitizeFilePath($filePath) { if (!class_exists('JoomlapackHelperUtils')) { jpimport('helpers.utils', true); } return JoomlapackHelperUtils::TranslateWinPath($filePath); }
/** * Retrieves an object for the specified engine. It reads the engine.ini in order to do that. * It will also call the _addEngineInclude to make sure the included file persists during * the backup session. * * @param string $engine The engine type (lister, dumper, packer) * @param string $item The engine class file name (e.g. deafault, jpa, etc) */ function &_getAnEngine($engine, $item) { // Load engine definitions JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Creating {$engine} engine of type {$item}"); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Trying to read engine setup data for {$engine}"); // Find and parse all ini files in the given directory $ini_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'engine' . DS . $engine; jimport('joomla.filesystem.folder'); $ini_files = JFolder::files($ini_path, '\\.ini$'); $engineArray = array(); if (count($ini_files)) { foreach ($ini_files as $sourceINI) { $myData = JoomlapackHelperUtils::parse_ini_file($ini_path . DS . $sourceINI, true); foreach ($myData as $key => $value) { $engineArray[$key] = $value; } } } if (isset($engineArray[$item])) { $engineDescriptor = $engineArray[$item]; $dotted = 'engine.' . $engine . '.' . $engineDescriptor['include']; JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Trying to include engine file {$dotted}"); $this->_addEngineInclude($dotted); jpimport($dotted); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Instanciating " . $engineDescriptor['class']); $instance = new $engineDescriptor['class'](); // If we are getting an archiver class, also populate the _archiveExtension field if ($engine == 'packer') { $this->archiveExtension = $engineDescriptor['extension']; } return $instance; } else { $this->setError(JText::sprintf('CUBE_PROVISIONING_ENGINENOTFOUND', $engine . '.' . $item)); return false; } }
/** * Searches for updates and returns an object containing update information * @return JObject An object with members: supported, update_available, * current_version, current_date, latest_version, latest_date, * package_url */ function &getUpdates($force = false) { jimport('joomla.utilities.date'); $ret = new JObject(); if (!$this->isLiveUpdateSupported()) { $ret->supported = false; $ret->update_available = false; return $ret; } else { $ret->supported = true; $update = $this->_getLatestVersion($force); // Check if we need to upgrade, by release date jimport('joomla.utilities.date'); jpimport('helpers.utils', true); JoomlapackHelperUtils::getJoomlaPackVersion(); $curdate = new JDate(_JP_DATE); $curdate = $curdate->toUnix(false); if (is_object($update->reldate)) { $reldate = $update->reldate->toUnix(false); $ret->latest_date = $update->reldate->toFormat('%Y-%m-%d'); } else { $ret->latest_date = @date('Y-m-d', $update->reldate); } $ret->update_available = $reldate > $curdate; $ret->current_version = _JP_VERSION; $ret->current_date = _JP_DATE; $ret->latest_version = $update->version; $ret->status = $update->status; $ret->package_url = JPSPECIALEDITION ? $update->special : $update->free; return $ret; } }
/** * Saves or updates an EFF entry * * @param object $fromObject If set, use data from this object, instead of the request * @access public * @return bool True on success */ function save($fromObject = null) { jpimport('helpers.utils', true); // Get active profile $session =& JFactory::getSession(); $profile = $session->get('profile', null, 'joomlapack'); if (!is_object($fromObject)) { // Map from $_REQUEST $id = JRequest::getVar('id', null); // Create a table $fromObject = array('id' => $id, 'profile' => $profile, 'class' => 'eff', 'value' => JoomlapackHelperUtils::TranslateWinPath(JRequest::getVar('fsdir'))); } // Load table class $table =& $this->getTable('Inclusion'); // Assign from data and save the inclusion filter record if (!$table->save($fromObject)) { $this->setError($table->getError()); return false; } return true; }
/** * Implements the _prepare() abstract method * */ function _prepare() { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackCUBEDomainPack :: Starting _prepare()"); $cube =& JoomlapackCUBE::getInstance(); // Grab the EFF filters JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackCUBEDomainPack :: Getting off-site directory inclusion filters (EFF)"); jpimport('models.eff', true); $effModel = new JoomlapackModelEff(); $this->_extraDirs =& $effModel->getMapping(); // Add the mapping text file if there are EFFs defined! if (count($this->_extraDirs) > 0) { // We add a README.txt file in our virtual directory... JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Creating README.txt in the EFF virtual folder"); $virtualContents = JText::_('EFF_MAPTEXT_INTRO') . "\n\n"; foreach ($this->_extraDirs as $dir) { $virtualContents .= JText::sprintf('EFF_MAPTEXT_LINE', $dir['vdir'], $dir['fsdir']) . "\n"; } // Add the file to our archive $registry =& JoomlapackModelRegistry::getInstance(); $provisioning =& $cube->getProvisioning(); $archiver =& $provisioning->getArchiverEngine(); $archiver->addVirtualFile('README.txt', $registry->get('effvfolder'), $virtualContents); } // Get the directory exclusion filters - this only needs to be done once JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackCUBEDomainPack :: Getting exclusion filters"); $this->_loadAndCacheFilters(); if ($this->getError()) { return false; } // FIX 1.1.0 $mosConfig_absolute_path may contain trailing slashes or backslashes incompatible with exclusion filters // FIX 1.2.2 Some hosts yield an empty string on realpath(JPATH_SITE) // FIX 2.2 On Windows, realpath might fail jpimport('helpers.utils', true); // FIX 2.4: Make an assumption (wild guess...) if (JPATH_BASE == '/administrator') { $cube->addWarning("Your site's root is an empty string. I am trying a workaround."); $jpath_site_real = '/'; } else { // Fix 2.4: Make sure that $jpath_site_real contains something even if realpath fails $jpath_site_real = @realpath(trim(JPATH_SITE)); $jpath_site_real = $jpath_site_real === false ? trim(JPATH_SITE) : $jpath_site_real; $jpath_site_real = JoomlapackHelperUtils::TranslateWinPath($jpath_site_real); } if ($jpath_site_real == '') { // The JPATH_SITE is resolved to an empty string; attempt a workaround // Windows hosts if (DIRECTORY_SEPARATOR == '\\') { if (trim(JPATH_SITE) != '' && trim(JPATH_SITE) != '\\' && trim(JPATH_SITE) != '/') { $cube->addWarning("The site's root couldn't be normalized on a Windows host. Attempting workaround (filters might not work)"); $jpath_site_real = JPATH_SITE; // Forcibly use the configured JPATH_SITE } else { $cube->addWarning("The normalized path to your site's root seems to be an empty string; I will attempt a workaround (Windows host)"); $jpath_site_real = '/'; // Start scanning from filesystem root (workaround mode) } } else { $cube->addWarning("The normalized path to your site's root seems to be an empty string; I will attempt a workaround (*NIX host)"); # Fix 2.1 Since JPATH_SITE is an empty string, shouldn't I begin scanning from the FS root, for crying out loud? What was I thinking putting JPATH_SITE there? $jpath_site_real = '/'; // Start scanning from filesystem root (workaround mode) } } // Fix 2.4.b1 : Add the trailing slash if (substr($jpath_site_real, -1) != '/' && !empty($jpath_site_real)) { $jpath_site_real .= '/'; } $this->_directoryList[] = $jpath_site_real; // Start scanning from Joomla! root, as decided above $this->_doneScanning = false; // Instruct the class to scan for files and directories $this->_doneSubdirectoryScanning = true; $this->_doneFileScanning = true; $this->_addPath = ''; // No added path for main site // Fix 2.4.b1 -- Since JPATH_SITE might have been post-processed, used the post-processed variable instead $this->_removePath = $jpath_site_real; // Remove absolute path to site's root for main site $this->setState('prepared'); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackCUBEDomainPack :: prepared"); }
<br/> <?php echo JText::_('UPDATE_LABEL_PACKAGELOCATION'); ?> <a href="<?php echo $this->updates->package_url; ?> "> <?php echo htmlentities($this->updates->package_url); ?> </a> </p> <?php jpimport('helpers.utils', true); JoomlapackHelperUtils::getJoomlaPackVersion(); if (substr(_JP_VERSION, 0, 3) == 'svn') { ?> <p><?php echo JText::_('UPDATE_LABEL_NOUPGRADESFOUND_INFO_SVN'); ?> </p> <?php } else { ?> <p><?php echo JText::_('UPDATE_LABEL_NOUPGRADESFOUND_INFO'); ?> </p> <?php }
/** * Initializes the array of filters. Reads the data of the filter.ini in the * classes/filter directory. */ function init() { // Load the filter.ini jpimport('helpers.utils', true); // Find and parse all ini files in the given directory $ini_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'filter'; jimport('joomla.filesystem.folder'); $ini_files = JFolder::files($ini_path, '\\.ini$'); $filterArray = array(); if (count($ini_files)) { foreach ($ini_files as $sourceINI) { $myData = JoomlapackHelperUtils::parse_ini_file($ini_path . DS . $sourceINI, true); foreach ($myData as $key => $value) { $filterArray[$key] = $value; } } } // Walk through INI file entries and add them to the filter list foreach ($filterArray as $filter) { $this->addFilter('filter.' . $filter['include'], $filter['class']); } }
function display() { $layout = JRequest::getCmd('layout', 'default'); $task = JRequest::getCmd('task', 'components'); // Add submenus (those nifty text links below the toolbar!) $link = JURI::base() . '?option=com_joomlapack&view=extfilter&task=components'; JSubMenuHelper::addEntry(JText::_('EXTFILTER_COMPONENTS'), $link, $task == 'components'); $link = JURI::base() . '?option=com_joomlapack&view=extfilter&task=modules'; JSubMenuHelper::addEntry(JText::_('EXTFILTER_MODULES'), $link, $task == 'modules'); $link = JURI::base() . '?option=com_joomlapack&view=extfilter&task=plugins'; JSubMenuHelper::addEntry(JText::_('EXTFILTER_PLUGINS'), $link, $task == 'plugins'); $link = JURI::base() . '?option=com_joomlapack&view=extfilter&task=languages'; JSubMenuHelper::addEntry(JText::_('EXTFILTER_LANGUAGES'), $link, $task == 'languages'); $link = JURI::base() . '?option=com_joomlapack&view=extfilter&task=templates'; JSubMenuHelper::addEntry(JText::_('EXTFILTER_TEMPLATES'), $link, $task == 'templates'); // Add toolbar buttons JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('EXTFILTER') . '</small></small>'); JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option')); JToolBarHelper::spacer(); $model =& $this->getModel(); switch ($task) { case 'components': // Add "re-apply" button $bar =& JToolBar::getInstance('toolbar'); $href = 'index.php?option=com_joomlapack&view=extfilter&task=reapplyComponents'; $bar->appendButton('Link', 'apply', JText::_('EXTFILTER_LABEL_REAPPLY'), $href); JToolBarHelper::spacer(); // Pass along the list of components $this->assignRef('components', $model->getComponents()); break; case 'modules': // Add "re-apply" button $bar =& JToolBar::getInstance('toolbar'); $href = 'index.php?option=com_joomlapack&view=extfilter&task=reapplyModules'; $bar->appendButton('Link', 'apply', JText::_('EXTFILTER_LABEL_REAPPLY'), $href); JToolBarHelper::spacer(); // Pass along the list of components $this->assignRef('modules', $model->getModules()); break; case 'plugins': // Add "re-apply" button $bar =& JToolBar::getInstance('toolbar'); $href = 'index.php?option=com_joomlapack&view=extfilter&task=reapplyPlugins'; $bar->appendButton('Link', 'apply', JText::_('EXTFILTER_LABEL_REAPPLY'), $href); JToolBarHelper::spacer(); // Pass along the list of components $this->assignRef('plugins', $model->getPlugins()); break; case 'templates': // Add "re-apply" button $bar =& JToolBar::getInstance('toolbar'); $href = 'index.php?option=com_joomlapack&view=extfilter&task=reapplyTemplates'; $bar->appendButton('Link', 'apply', JText::_('EXTFILTER_LABEL_REAPPLY'), $href); JToolBarHelper::spacer(); // Pass along the list of components $this->assignRef('templates', $model->getTemplates()); break; case 'languages': // Add "re-apply" button $bar =& JToolBar::getInstance('toolbar'); $href = 'index.php?option=com_joomlapack&view=extfilter&task=reapplyLanguages'; $bar->appendButton('Link', 'apply', JText::_('EXTFILTER_LABEL_REAPPLY'), $href); JToolBarHelper::spacer(); // Pass along the list of components $this->assignRef('languages', $model->getLanguages()); break; } $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); JoomlapackHelperUtils::addLiveHelp('extfilter'); parent::display(); }
function display() { // Set the toolbar title; add a help button JToolBarHelper::title(JText::_('JOOMLAPACK') . ':: <small><small>' . JText::_('CONFIGURATION')) . '</small></small>'; JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); JoomlapackHelperUtils::addLiveHelp('config'); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css'); // Load the util helper $this->loadHelper('utils'); // Load the model $model =& $this->getModel(); // Pass on the lists $this->assign('backuptypelist', $model->getBackupTypeList()); $this->assign('loglevellist', $model->getLogLevelList()); $this->assign('sqlcompatlist', $model->getSqlCompatList()); $this->assign('algolist', $model->getAlgoList()); $this->assign('listerlist', $model->getFilelistEngineList()); $this->assign('dumperlist', $model->getDatabaseEngineList()); $this->assign('archiverlist', $model->getArchiverEngineList()); $this->assign('installerlist', $model->getInstallerList()); $this->assign('backupmethodlist', $model->getBackupMethodList()); $this->assign('authlist', $model->getAuthLevelList()); // Let's pass the data // -- Common Basic $this->assign('OutputDirectory', $model->getVar('OutputDirectory')); // -- Common Frontend $this->assign('enableFrontend', $model->getVar('enableFrontend')); $this->assign('secretWord', $model->getVar('secretWord')); $this->assign('frontendemail', $model->getVar('frontendemail')); $this->assign('arbitraryfeemail', $model->getVar('arbitraryfeemail')); // -- Basic $this->assign('BackupType', $model->getVar('BackupType')); $this->assign('TarNameTemplate', $model->getVar('TarNameTemplate')); $this->assign('logLevel', $model->getVar('logLevel')); $this->assign('authlevel', $model->getVar('authlevel')); $this->assign('cubeinfile', $model->getVar('cubeinfile')); // -- Advanced $this->assign('MySQLCompat', $model->getVar('MySQLCompat')); $this->assign('dbAlgorithm', $model->getVar('dbAlgorithm')); $this->assign('packAlgorithm', $model->getVar('packAlgorithm')); $this->assign('listerengine', $model->getVar('listerengine')); $this->assign('dbdumpengine', $model->getVar('dbdumpengine')); $this->assign('packerengine', $model->getVar('packerengine')); $this->assign('InstallerPackage', $model->getVar('InstallerPackage')); $this->assign('backupMethod', $model->getVar('backupMethod')); $this->assign('throttling', $model->getVar('throttling')); $this->assign('enableSizeQuotas', $model->getVar('enableSizeQuotas')); $this->assign('enableCountQuotas', $model->getVar('enableCountQuotas')); $this->assign('sizeQuota', $model->getVar('sizeQuota')); $this->assign('countQuota', $model->getVar('countQuota')); $this->assign('enableMySQLKeepalive', $model->getVar('enableMySQLKeepalive')); $this->assign('gzipbinary', $model->getVar('gzipbinary')); $this->assign('effvfolder', $model->getVar('effvfolder')); // -- Magic numbers $this->assign('mnRowsPerStep', $model->getVar('mnRowsPerStep')); $this->assign('mnMaxFragmentSize', $model->getVar('mnMaxFragmentSize')); $this->assign('mnMaxFragmentFiles', $model->getVar('mnMaxFragmentFiles')); $this->assign('mnZIPForceOpen', $model->getVar('mnZIPForceOpen')); $this->assign('mnZIPCompressionThreshold', $model->getVar('mnZIPCompressionThreshold')); $this->assign('mnZIPDirReadChunk', $model->getVar('mnZIPDirReadChunk')); $this->assign('mnMaxExecTimeAllowed', $model->getVar('mnMaxExecTimeAllowed')); $this->assign('mnMinimumExectime', $model->getVar('mnMinimumExectime')); $this->assign('mnExectimeBiasPercent', $model->getVar('mnExectimeBiasPercent')); $this->assign('mnMaxOpsPerStep', $model->getVar('mnMaxOpsPerStep')); $this->assign('mnArchiverChunk', $model->getVar('mnArchiverChunk')); // -- MySQLDump $this->assign('mysqldumpPath', $model->getVar('mysqldumpPath')); $this->assign('mnMSDDataChunk', $model->getVar('mnMSDDataChunk')); $this->assign('mnMSDMaxQueryLines', $model->getVar('mnMSDMaxQueryLines')); $this->assign('mnMSDLinesPerSession', $model->getVar('mnMSDLinesPerSession')); // Also load the Configuration HTML helper $this->loadHelper('config'); parent::display(); }
?> index.php" method="post" name="adminForm" id="adminForm"><input type="hidden" name="option" value="com_joomlapack" /> <input type="hidden" name="view" value="profiles" /> <input type="hidden" name="boxchecked" id="boxchecked" value="0" /> <input type="hidden" name="task" id="task" value="" /> <input type="hidden" name="id" id="id" value="<?php echo $id; ?> " /> <table> <tr> <td><?php echo JHTML::_('tooltip', JText::_('PROFILE_LABEL_DESCRIPTION_TOOLTIP'), '', '', JText::_('PROFILE_LABEL_DESCRIPTION')); ?> </td> <td><input type="text" name="description" id="description" value="<?php echo $description; ?> " /></td> </tr> </table> </form> <?php echo JoomlapackHelperUtils::getFooter(); ?> </div>
function _getEngineList($engine) { jpimport('helpers.utils', true); // Load engine definitions $ini_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'engine' . DS . $engine; jimport('joomla.filesystem.folder'); $ini_files = JFolder::files($ini_path, '\\.ini$'); $engineArray = array(); if (count($ini_files)) { foreach ($ini_files as $sourceINI) { $myData = JoomlapackHelperUtils::parse_ini_file($ini_path . DS . $sourceINI, true); foreach ($myData as $key => $value) { $engineArray[$key] = $value; } } } // Create selection list array $options = array(); foreach ($engineArray as $sectionKey => $engineItem) { // Use translation keys for engine names $description = JText::_($engineItem['translationkey']); $options[] = JHTML::_('select.option', $sectionKey, $description); } return $options; }