/** * Displays the HTML for this page, directly outputting it to the browser (due to the use of tabs) */ function echoHTML() { // Load the translations // Make the Control Panel HTML $cpanel = new JoomlapackCPanelHTML(); $cpanel->addItem(JoomlapackAbstraction::JPLink('config'), 'config', JoomlapackLangManager::_('CPANEL_CONFIG')); $cpanel->addItem(JoomlapackAbstraction::JPLink('configmigrate'), 'configmigrate', JoomlapackLangManager::_('CPANEL_CONFIGMIGRATE')); $cpanel->addItem(JoomlapackAbstraction::JPLink('def'), 'def', JoomlapackLangManager::_('CPANEL_DEF')); $cpanel->addItem(JoomlapackAbstraction::JPLink('sff'), 'sff', JoomlapackLangManager::_('CPANEL_SFF')); $cpanel->addItem(JoomlapackAbstraction::JPLink('dbef'), 'dbef', JoomlapackLangManager::_('CPANEL_DBEF')); $cpanel->addItem(JoomlapackAbstraction::JPLink('multidb'), 'multidb', JoomlapackLangManager::_('CPANEL_MULTIDB')); $cpanel->addItem(JoomlapackAbstraction::JPLink('pack'), 'backup', JoomlapackLangManager::_('CPANEL_PACK')); $cpanel->addItem(JoomlapackAbstraction::JPLink('backupadmin'), 'bufa', JoomlapackLangManager::_('CPANEL_BUADMIN')); $cpanel->addItem(JoomlapackAbstraction::JPLink('log'), 'log', JoomlapackLangManager::_('CPANEL_LOG')); $cpanel->addItem(JoomlapackAbstraction::JPLink('unlock'), 'reset', JoomlapackLangManager::_('CPANEL_UNLOCK')); $cpanelHTML = $cpanel->getHTML(); // Create the admin form echo JoomlapackCommonHTML::getAdminHeadingHTML(JoomlapackLangManager::_('CPANEL_HOME')); echo <<<ENDSNIPPET \t\t<table class="adminform"> \t\t\t<tr> \t\t\t\t<td width="55%" valign="top"> \t\t\t\t\t{$cpanelHTML} \t\t\t\t</td> \t\t\t\t<td width="45%" valign="top"> ENDSNIPPET; $this->_getTabsHTML(); echo <<<ENDSNIPPET \t\t\t\t</td> \t\t\t</tr> \t\t</table>\t\t ENDSNIPPET; }
/** * Modifies a filter * * @param string $root Folder where the file exists * @param string $file The file for which the filter is about * @param mixed $checked If set to on, yes or checked then the filter is activated, otherwise deactivated */ function modifyFilter($root, $file, $checked) { $value = JoomlapackAbstraction::TranslateWinPath($root . "/" . $file); if ($checked == "on" || $checked == "yes" || $checked == "checked") { // Enable the filter JoomlapackHelperFiltertable::addExclusionFilter($this->_filterClass, $value); } else { // Disable the filter JoomlapackHelperFiltertable::deleteExclusionFilter($this->_filterClass, $value); } }
/** * Displays the HTML for this page * */ function echoHTML() { $nohtml = JoomlapackAbstraction::getParam('no_html', 0); if ($nohtml == 1) { JoomlapackLogger::VisualizeLogDirect(); } else { $configuration =& JoomlapackConfiguration::getInstance(); $option = JoomlapackAbstraction::getParam('option', 'com_joomlapack'); // Show top header echo JoomlapackCommonHTML::getAdminHeadingHTML(JoomlapackLangManager::_('LOG_LOGBANNER')); echo "<p><a href=\"index2.php?option={$option}&act=dllog&no_html=1\">" . JoomlapackLangManager::_('LOG_DOWNLOADTEXT') . "</a></p>"; echo '<iframe src="index2.php?option=' . $option . '&act=log&no_html=1" width="90%" height="400px">'; echo '</iframe>'; } }
/** * Adds all non-Joomla tables to the exclusion filters */ function ExcludeNonJoomla() { // Get all tables $db = JoomlapackAbstraction::getDatabase(); $sql = "SHOW TABLES"; $db->setQuery($sql); $tables = $db->loadRowList(); // Get prefix $prefix = JoomlapackAbstraction::getDBPrefix(); // Loop tables foreach ($tables as $row) { $table = $row[0]; $abstractTable = str_replace($prefix, '#__', $table); if ($table == $abstractTable) { // Filter only non-Joomla tables $this->modifyFilter($abstractTable, true); } } }
/** * Translation function, based on a translation key * * @param string $key The key to translate * @return string The translation, or the key of the translation wasn't found */ function _($key) { static $translations; // Load translations on first call if (!$translations) { // Get local language if (!defined('_JEXEC')) { global $mosConfig_lang; $lang = $mosConfig_lang; } else { $language =& JFactory::getLanguage(); $lang = $language->getBackwardLang(); } // Load default language (English) $langEnglish = JoomlapackAbstraction::parse_ini_file(JPATH_COMPONENT_ADMINISTRATOR . DS . 'lang' . DS . 'english.ini', false); // Load user's language file, if exists if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . "/lang/{$lang}.ini")) { $langLocal = JoomlapackAbstraction::parse_ini_file(JPATH_COMPONENT_ADMINISTRATOR . DS . 'lang' . DS . "{$lang}.ini", false); if (is_array($langLocal)) { $translations = array_merge($langEnglish, $langLocal); } else { $translations = $langEnglish; } // # END FIX 1.2.b2 } else { $translations = $langEnglish; } unset($langEnglish); unset($langLocal); } if (key_exists($key, $translations)) { return $translations[$key]; } else { return $key; } }
function outputEngineSelector($formField, $engine, $selectedValue) { // Load engine definitions $sourceINI = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'engine' . DS . $engine . DS . 'engine.ini'; $engineArray = JoomlapackAbstraction::parse_ini_file($sourceINI, true); // Create selection list array $options = array(); foreach ($engineArray as $sectionKey => $engineItem) { if (!defined('_JEXEC')) { $options[] = mosHTML::makeOption($sectionKey, $engineItem['description']); } else { $options[] = JHTML::_('select.option', $sectionKey, $engineItem['description']); } } // Output the selection list if (!defined('_JEXEC')) { echo mosHTML::selectList($options, $formField, '', 'value', 'text', $selectedValue); } else { echo JHTML::_('select.genericlist', $options, $formField, '', 'value', 'text', $selectedValue); } }
/** * Parse an INI file and return an associative array. Since PHP versions before 5.1 are * bitches with regards to INI parsing, I use a PHP-only solution to overcome this * obstacle. * * @param string $file The file to process * @param bool $process_sections True to also process INI sections * @return array An associative array of sections, keys and values */ function parse_ini_file($file, $process_sections) { if (version_compare(PHP_VERSION, '5.1.0', '>=')) { return parse_ini_file($file, $process_sections); } else { return JoomlapackAbstraction::_parse_ini_file($file, $process_sections); } }
/** * Loads a page's HTML or instructs the class to process an AJAX request, based on the contents of * the page request. * * @param object $page A JoomlaPack's page class object */ function _loadPage(&$page) { if (JoomlapackAbstraction::isSAJAX()) { $page->processAJAX(); } else { $page->echoHTML(); } }
function isInclusionFilterSet($filterClass, $value) { if (isset($value['id'])) { $newval = array(); foreach ($value as $key => $data) { if ($key != 'id') { $newval[$key] = $data; } } $value = $newval; unset($newval); } $value = serialize($value); $db = JoomlapackAbstraction::getDatabase(); $sql = 'SELECT COUNT(' . $db->nameQuote('id') . ') FROM #__jp_inclusion WHERE ' . $db->nameQuote('class') . ' = ' . $db->Quote($filterClass) . ' AND ' . $db->nameQuote('value') . ' = ' . $db->Quote($value); $db->setQuery($sql); $count = $db->loadResult(); return $count > 0; }
/** * Returns a table's abstract name (replacing the prefix with the magic #__ string) * * @param string $tableName The canonical name, e.g. 'jos_content' * @return string The abstract name, e.g. '#__content' */ function _getAbstract($tableName) { // FIX 1.2 Stable - Handle (very rare) cases with an empty db prefix $prefix = JoomlapackAbstraction::getDBPrefix(); switch ($prefix) { case '': // This is more of a hack; it assumes all tables are Joomla! tables if the prefix is empty. return '#__' . $tableName; break; default: // Normal behaviour for 99% of sites return str_replace($prefix, "#__", $tableName); break; } }
function getDirSelectionHTML($root) { jpimport('classes.filter.def'); jpimport('helpers.lang'); $root = realpath($root); $out = <<<END \t\t\t<h4>{$root}</h4> \t\t\t<table class="adminlist"> \t\t\t\t<tr> \t\t\t\t\t<th align="left" width="50"> END; $out .= JoomlapackLangManager::_('DEF_EXCLUDE') . "\n" . "</th><th class=\"title\">" . JoomlapackLangManager::_('DEF_DIRECTORY') . "</th></tr>"; $def = new JoomlapackFilterDEF(); $def->init(); $dirs = $def->getDirectory($root); $id = 0; foreach ($dirs as $dir => $excluded) { $id++; $checked = $excluded ? " checked = \"true\" " : ""; $nocheck = $dir == "." || $dir == ".."; $out .= "\n<tr><td align=\"center\">"; if (!$nocheck) { $out .= "<input type=\"checkbox\" {$checked} onclick=\"ToggleFilter('" . JoomlapackAbstraction::TranslateWinPath($root) . "', '{$dir}','def-{$id}');\" id=\"def-{$id}\">"; } else { $out .= " "; } $out .= "</td><td align=\"left\">"; if ($excluded) { $out .= htmlentities($dir); } else { $out .= "<a href=\"javascript:dirSelectionHTML('" . JoomlapackAbstraction::TranslateWinPath($root . DIRECTORY_SEPARATOR . $dir) . "');\">" . htmlentities($dir) . "</a>"; } $out .= "</td></tr>"; } $out .= "\n</table>"; return $out; }
function _getNewURI($finished = false, $error = false) { $option = JoomlapackAbstraction::getParam('option'); $key = JoomlapackAbstraction::getParam('key'); $dummy = JoomlapackAbstraction::getParam('dummy', 0); $tweak = JoomlapackAbstraction::getParam('tweak', 'http'); $dummy++; if ($finished) { if ($error) { return JoomlapackAbstraction::SiteURI() . "/index2.php?option={$option}&act=fullbackup&task=finished&error=1&key={$key}&no_html=1"; } else { return JoomlapackAbstraction::SiteURI() . "/index2.php?option={$option}&act=fullbackup&task=finished&key={$key}&no_html=1"; } } else { return JoomlapackAbstraction::SiteURI() . "/index2.php?option={$option}&act=fullbackup&task=continue&key={$key}&no_html=1&dummy={$dummy}&tweak={$tweak}"; } }
function getTables() { $db = JoomlapackAbstraction::getDatabase(); $sql = "SHOW TABLES"; $db->setQuery($sql); $results = $db->loadRowList(); $ret = array(); foreach ($results as $row) { $ret[] = $row[0]; } return $ret; }
function getImageURI($imageName) { return JoomlapackAbstraction::SiteURI() . '/administrator/components/' . JoomlapackAbstraction::getParam('option', 'com_joomlapack') . '/assets/images/' . $imageName . '.png'; }
/** * Outputs an error condition. Used by the JavaScript Redirects backup method. * It displays all errors found in the class' _errorStack array. * * @access private * @since 1.2.b1 */ function _echoHTML_Redirects_Error() { ?> <div id="Main"> <div id="Timeout" style="display:none; margin-top: 10px;" class="sitePack"> <table border="0" width="100%"> <tr> <td valign="top"> <img src="<?php echo JoomlapackCommonHTML::getImageURI('error_big'); ?> " border="0" /> </td> </tr> <?php foreach ($this->_errorStack as $errorString) { ?> <tr> <td> <p><?php echo $errorString; ?> </p> </td> </tr> <?php } ?> <tr> <td> </td> <td> <a href="<?php echo JoomlapackAbstraction::JPLink('log'); ?> "> <div class="jpbutton"> <img src="<?php echo JoomlapackCommonHTML::getImageURI('log'); ?> " border="0" /> <p><?php echo JoomlapackLangManager::_('CPANEL_LOG'); ?> </p> </div> </a> </td> </tr> </table> </div> </div> <?php }
/** * Return an instance of JDatabase * * @return JDatabase */ function _getDB() { if ($this->_isJoomla) { // Core Joomla! database, get the existing instance $db = JoomlapackAbstraction::getDatabase(); return $db; } else { // We have to connect ourselves if (defined('_JEXEC')) { // Joomla! 1.5.x jimport('joomla.database.database'); jimport('joomla.database.table'); $conf =& JFactory::getConfig(); $host = $this->_host . ($this->_port != '' ? ':' . $this->_port : ''); $user = $this->_username; $password = $this->_password; $database = $this->_database; $prefix = ''; $driver = $conf->getValue('config.dbtype'); $debug = $conf->getValue('config.debug'); $options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix); $db =& JDatabase::getInstance($options); if (JError::isError($db)) { $this->_errorMessage = "JoomlapackDumperDefault :: Database Error:" . $db->toString(); $this->_isError = true; $this->setError($this->_errorMessage); return false; } if ($db->getErrorNum() > 0) { $this->_errorMessage = 'JDatabase::getInstance: Could not connect to database <br/>' . 'joomla.library:' . $db->getErrorNum() . ' - ' . $db->getErrorMsg(); $this->_isError = true; $this->setError($this->_errorMessage); return false; } $db->debug($debug); return $db; } else { // Joomla! 1.0.x $host = $this->_host . ($this->_port != '' ? ':' . $this->_port : ''); $user = $this->_username; $password = $this->_password; $database = $this->_database; $prefix = ''; $db = new database($host, $user, $password, $database, $prefix, false); // A dummy SQL statement which shouldn't fail $sql = 'SHOW TABLES'; $db->setQuery($sql); $db->query(); // If the query failed, I guess we're not connected to the database if ($db->getErrorNum() > 0) { $this->_errorMessage = 'database(): Could not connect to database <br/>' . 'joomla.library:' . $db->getErrorNum() . ' - ' . $db->getErrorMsg(); $this->_isError = true; $this->setError($this->_errorMessage); return false; } return $db; } } }
function _echoFix() { $jpconfiguration =& JoomlapackConfiguration::getInstance(); $db = JoomlapackAbstraction::getDatabase(); echo JoomlapackCommonHTML::getAdminHeadingHTML(JoomlapackLangManager::_('CPANEL_CONFIGMIGRATE')); // Catch the "nothing to do" case if ($jpconfiguration->get('siteRoot') == JPATH_SITE) { echo JoomlapackLangManager::_('CONFIGMIGRATE_NOFIXREQUIRED'); return; } // Sometimes, it is possible that the siteRoot configuration value is not set // (e.g. manually upgrading from an older version, keeping the config xml file). // This will fix it if (is_null($jpconfiguration->get('siteRoot'))) { echo JoomlapackLangManager::_('CONFIGMIGRATE_NOROOTSTORED'); $jpconfiguration->set('siteRoot', JPATH_SITE); $jpconfiguration->SaveConfiguration(); return; } // A genuine case of site location mismatch. Let's take a look at it. $oldPath = JoomlapackAbstraction::TranslateWinPath($jpconfiguration->get('siteRoot')); $newPath = JoomlapackAbstraction::TranslateWinPath(JPATH_SITE); $sql = 'SELECT * FROM ' . $db->nameQuote('#__jp_exclusion'); $db->setQuery($sql); $temparray = $db->loadAssocList(); foreach ($temparray as $row) { $value = $row['value']; if (strstr($value, $oldPath)) { $value = str_replace($oldPath, $newPath, $value); $sql = 'UPDATE ' . $db->nameQuote('#__jp_exclusion') . ' SET ' . $db->nameQuote('value') . ' = ' . $db->Quote($value) . ' WHERE ' . $db->nameQuote('id') . ' = ' . $db->Quote($row['id']); $db->setQuery($sql); $db->query(); } } echo JoomlapackLangManager::_('CONFIGMIGRATE_FIXED'); }
/** * Returns the contents of the files in the 'filename' parameter of * the request. It returns a 404 if the file is not found. */ function downloadFile() { $configuration =& JoomlapackConfiguration::getInstance(); $filename = JoomlapackAbstraction::getParam('filename', null); // Check for blank filename if (is_null($filename)) { header("HTTP/1.0 404 Not Found"); return; } // Make sure the filename is OK and get absolute path to file $filename = stripslashes($filename); $filename = realpath($configuration->OutputDirectory . DIRECTORY_SEPARATOR . $filename); // Test for nonexistent file if ($filename === FALSE) { header("HTTP/1.0 404 Not Found"); return; } // OK, all check pass. Now, get me the file! ob_end_clean(); // In case some braindead mambot spits its own HTML despite no_html=1 // Since we're not outputting text/html, we need to send the correct headers! // Tell the browser we'll be outputting a gzip file header('Content-type: application/zip'); // TODO Find the correct MIME type for binary archives! // It will be called... whatever the filename is header('Content-Disposition: attachment; filename="' . basename($filename) . '"'); readfile($filename); }
if ($task == 'export') { $skipFooter = true; } jpackScreens::fConfigMigrate(); break; case "cpanel": default: if (!JoomlapackAbstraction::isSAJAX()) { echo '<link rel="stylesheet" href="components/' . $option . '/assets/css/jpcss.css" type="text/css" />'; } // Application status check jpackScreens::fMain(); break; } // Post-AJAX cleanup if (JoomlapackAbstraction::isSAJAX()) { // Restore error handler if (isset($old_error_handler)) { restore_error_handler(); } } else { // Common footer if (!isset($skipFooter)) { jpackScreens::CommonFooter(); } // PayPal donate on Control Panel if ($act == 'cpanel') { ?> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <p> <input type="hidden" name="cmd" value="_s-xclick">
/** * 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}"); $sourceINI = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'engine' . DS . $engine . DS . 'engine.ini'; $engineArray = JoomlapackAbstraction::parse_ini_file($sourceINI, true); if (isset($engineArray[$item])) { $engineDescriptor = $engineArray[$item]; $dotted = 'classes.engine.' . $engine . '.' . $engineDescriptor['include']; $this->_addEngineInclude($dotted); jpimport($dotted); $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->_Error = 'Engine ' . $engine . '.' . $item . ' not found.'; return false; } }
/** * Forces SAJAX to user per-page AJAX proxy URLs. Call it to make AJAX calls be processed by the * page class processAJAX() method. * */ function sajax_force_page_ajax() { global $sajax_remote_uri_params; $option = JoomlapackAbstraction::getParam('option', 'com_joomlapack'); $act = JoomlapackAbstraction::getParam('act', 'ajax'); $sajax_remote_uri_params = "option={$option}&act={$act}&no_html=1"; }
function getFileSelectionHTML($root) { // Import usefull JoomlaPack classes jpimport('classes.filter.sff'); jpimport('helpers.lang'); jpimport('classes.core.utility.filtermanager'); // Cleanup the root folder we were passed $root = realpath($root); // Get some translation strings $lang_dir = JoomlapackLangManager::_('SFF_DIR'); $lang_excluded = JoomlapackLangManager::_('SFF_EXCLUDE'); $lang_file = JoomlapackLangManager::_('SFF_FILE'); // Scan folder for files $sff = new JoomlapackFilterSFF(); $scanResult = $sff->getDirectory($root); // Get the directories filters; we're not going to allow the user to enter excluded folders :) $filterManager = new JoomlapackFilterManager(); $filterManager->init(); // Produce the output $out = <<<END \t\t\t<h4>{$root}</h4> \t\t\t<table border="0" cellspacing="10"> \t\t\t\t<tr> \t\t\t\t\t<td valign="top"> \t\t\t\t\t\t<!-- Directory Selection --> \t\t\t\t\t\t<table class="adminlist"> \t\t\t\t\t\t\t<thead> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<th>{$lang_dir}</th> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t</thead> \t\t\t\t\t\t\t<tbody> END; $dirFilters = $filterManager->getFilters('folder'); foreach ($scanResult['folders'] as $folder) { if (is_array($dirFilters)) { $wholefolder = JoomlapackAbstraction::TranslateWinPath($root . DIRECTORY_SEPARATOR . $folder); $showLink = !in_array($wholefolder, $dirFilters); } else { $showLink = true; } $out .= "\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>\n"; if ($showLink) { $out .= "<a href=\"javascript:dirSelectionHTML('" . JoomlapackAbstraction::TranslateWinPath($root . DIRECTORY_SEPARATOR . $folder) . "');\">" . htmlentities($folder) . "</a>"; } else { $out .= htmlentities($folder); } $out .= "\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n"; } $out .= <<<END \t\t\t\t\t\t\t</tbody> \t\t\t\t\t\t</table> \t\t\t\t\t</td> \t\t\t\t\t<td valign="top"> \t\t\t\t\t\t<!-- File Selection --> \t\t\t\t\t\t<table class="adminlist"> \t\t\t\t\t\t\t<thead> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<th>{$lang_excluded}</th> \t\t\t\t\t\t\t\t\t<th>{$lang_file}</th> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t</thead> \t\t\t\t\t\t\t<tbody> END; $id = 0; foreach ($scanResult['files'] as $file => $excluded) { $id++; $checked = $excluded ? " checked = \"true\" " : ""; $out .= "\n<tr><td align=\"center\">"; $out .= "<input type=\"checkbox\" {$checked} onclick=\"ToggleFilter('" . JoomlapackAbstraction::TranslateWinPath($root) . "', '{$file}','sff-{$id}');\" id=\"sff-{$id}\">"; $out .= "</td><td align=\"left\">"; $out .= htmlentities($file); $out .= "</td></tr>"; } $out .= <<<END \t\t\t\t\t\t\t</tbody> \t\t\t\t\t\t</table> \t\t\t\t\t</td> \t\t\t\t</tr> \t\t\t</table> END; return $out; }
/** * Calculates the absolute path to the log file */ function logName() { $configuration =& JoomlapackConfiguration::getInstance(); return JoomlapackAbstraction::TranslateWinPath($configuration->get('OutputDirectory') . DS . "joomlapack.log"); }
function _getDirContents_opendir($dirName, $shellFilter = null) { $handle = @opendir($dirName); // If directory is not accessible, just return FALSE if ($handle === FALSE) { $this->setWarning('Unreadable directory ' . $dirName); $false = false; return $false; } // Initialize return array $retArray = array(); // FIX 1.2.1 -- Remove trailing slash if (substr($dirName, -1, 1) == '/' || substr($dirName, -1, 1) == '\\') { $dirName = substr($dirName, 0, strlen($dirName) - 1); } while (!(($filename = readdir($handle)) === false)) { $match = is_null($shellFilter); $match = !$match ? fnmatch($shellFilter, $filename) : true; if ($match) { $filename = JoomlapackAbstraction::TranslateWinPath($dirName . DIRECTORY_SEPARATOR . $filename); $retArray[] = $filename; } } @closedir($handle); return $retArray; }
$myBase = realpath($myBase) == '' ? $myBase : realpath($myBase); // 1.2a3 -- Rare case when $myBase == '/' define('DS', DIRECTORY_SEPARATOR); define('JPATH_SITE', realpath($myBase)); define('JPATH_COMPONENT_ADMINISTRATOR', $myBase . DS . 'administrator' . DS . 'components' . DS . $option); define('JPATH_COMPONENT', $myBase . DS . 'components' . DS . $option); } // Include Joomla! Version Abstraction Layer require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'frameworkabstraction.php'; // Include abstract classes definitions jpimport('classes.abstract.object'); jpimport('classes.abstract.filter'); jpimport('classes.abstract.enginearchiver'); jpimport('classes.abstract.engineparts'); // Always populate basic Joomla! page parameters and make them global global $act, $task; // Get the parameters from the request $act = JoomlapackAbstraction::getParam('act', 'default'); $task = JoomlapackAbstraction::getParam('task', ''); // Load language definitions require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'lang.php'; switch ($act) { case "fullbackup": require_once JPATH_COMPONENT . '/includes/CFullBackup.php'; $tickableObject =& CFullBackup::getInstance(); $tickableObject->tick(); break; default: echo JoomlapackLangManager::_('FRONTEND_ACCESSDENIED'); break; }
/** * 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.frameworkabstraction'); $sourceINI = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'filter' . DS . 'filter.ini'; $filterArray = JoomlapackAbstraction::parse_ini_file($sourceINI, true); // Walk through INI file entries and add them to the filter list foreach ($filterArray as $filter) { $this->addFilter('classes.filter.' . $filter['include'], $filter['class']); } }
/** * Deletes a selected row * */ function _deleteFromPOST() { $id = JoomlapackAbstraction::getParam('id', ''); JoomlapackHelperFiltertable::deleteInclusionFilter($this->_filterClass, $id); }
/** * Removes the $p_remove_dir from $p_filename, while prepending it with $p_add_dir. * Largely based on code from the pclZip library. * @access private */ function _addRemovePaths($p_filename, $p_remove_dir, $p_add_dir) { $p_filename = JoomlapackAbstraction::TranslateWinPath($p_filename); $p_remove_dir = $p_remove_dir == '' ? '' : JoomlapackAbstraction::TranslateWinPath($p_remove_dir); //should fix corrupt backups, fix by nicholas if (!($p_remove_dir == "")) { if (substr($p_remove_dir, -1) != '/') { $p_remove_dir .= "/"; } if (substr($p_filename, 0, 2) == "./" || substr($p_remove_dir, 0, 2) == "./") { if (substr($p_filename, 0, 2) == "./" && substr($p_remove_dir, 0, 2) != "./") { $p_remove_dir = "./" . $p_remove_dir; } if (substr($p_filename, 0, 2) != "./" && substr($p_remove_dir, 0, 2) == "./") { $p_remove_dir = substr($p_remove_dir, 2); } } $v_compare = $this->_PathInclusion($p_remove_dir, $p_filename); if ($v_compare > 0) { if ($v_compare == 2) { $v_stored_filename = ""; } else { $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); } } } else { $v_stored_filename = $p_filename; } if (!($p_add_dir == "")) { if (substr($p_add_dir, -1) == "/") { $v_stored_filename = $p_add_dir . $v_stored_filename; } else { $v_stored_filename = $p_add_dir . "/" . $v_stored_filename; } } return $v_stored_filename; }
/** * Counts the number of instances for a specific variable * * @param string $key The varaible's name * @return string */ function CountVar($key) { $database = JoomlapackAbstraction::getDatabase(); $sql = "SELECT `key` FROM #__jp_packvars WHERE `key` = \"" . $database->getEscaped($key) . "\""; $database->setQuery($sql); $database->query(); return $database->getNumRows(); }