/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; } }
<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 }
/** * Initialises CUBE to start a new backup * */ function start($description, $comment) { global $mainframe; // Load registry $configuration =& JoomlapackModelRegistry::getInstance(); $configuration->reload(); // Load engine provisioning object $this->provisioning =& JoomlapackCUBEProvisioning::getInstance(); // Initialize statistics model $this->statmodel =& JoomlapackModelStatistics::getInstance(); // Initialize private fields $this->_activeDomain = 'init'; $this->_object = null; $this->_isFinished = false; // Load JP version JoomlapackHelperUtils::getJoomlaPackVersion(); // Initialise log file JoomlapackLogger::ResetLog(); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "--------------------------------------------------------------------------------"); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JoomlaPack " . _JP_VERSION . ' (' . _JP_DATE . ')'); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Got backup?"); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "--------------------------------------------------------------------------------"); // PHP configuration variables are tried to be logged only for debug and info log levels if ($configuration->get('logLevel') >= 2) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "--- System Information ---"); if (function_exists('phpversion')) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "PHP Version :" . phpversion()); } if (function_exists('php_uname')) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "OS Version :" . php_uname('s')); } $db =& JFactory::getDBO(); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "DB Version :" . $db->getVersion()); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "DB Collation :" . $db->getCollation()); if (isset($_SERVER['SERVER_SOFTWARE'])) { $server = $_SERVER['SERVER_SOFTWARE']; } else { if ($sf = getenv('SERVER_SOFTWARE')) { $server = $sf; } else { $server = JText::_('n/a'); } } JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Web Server :" . $server); if (function_exists('php_sapi_name')) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "PHP Interface :" . php_sapi_name()); } $version = new JVersion(); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Joomla! version :" . $version->getLongVersion()); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "User agent :" . phpversion() <= "4.2.1" ? getenv("HTTP_USER_AGENT") : $_SERVER['HTTP_USER_AGENT']); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Safe mode :" . ini_get("safe_mode")); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Display errors :" . ini_get("display_errors")); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Error reporting :" . error2string()); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Disabled functions :" . ini_get("disable_functions")); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "open_basedir restr.:" . ini_get('open_basedir')); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Max. exec. time :" . ini_get("max_execution_time")); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Memory limit :" . ini_get("memory_limit")); if (function_exists("memory_get_usage")) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Current mem. usage :" . memory_get_usage()); } if (function_exists("gzcompress")) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "GZIP Compression : available (good)"); } else { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "GZIP Compression : n/a (no compression)"); } JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JPATH_BASE :" . JPATH_BASE); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JPATH_ROOT :" . JPATH_ROOT); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JPATH_CACHE :" . JPATH_CACHE); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Output directory :" . $configuration->get('OutputDirectory')); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Temporary directory:" . $configuration->getTemporaryDirectory()); $temp = JoomlapackCUBETables::_getBase64() ? 'Available; will be used for temp vars' : 'Not available'; JoomlapackLogger::WriteLog(_JP_LOG_INFO, "BASE64 Encoding :" . $temp); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "--------------------------------------------------------------------------------"); } jpimport('helpers.status', true); $statushelper =& JoomlapackHelperStatus::getInstance(); if ($statushelper->hasQuirks()) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JoomlaPack has detected the following potential problems:"); foreach ($statushelper->quirks as $q) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, '- ' . $q['code'] . ' ' . $q['description'] . ' (' . $q['severity'] . ')'); } JoomlapackLogger::WriteLog(_JP_LOG_INFO, "You probably do not have to worry about them, but you should be aware of them."); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "--------------------------------------------------------------------------------"); } // Get current profile ID $session =& JFactory::getSession(); $profile_id = $session->get('profile', null, 'joomlapack'); JoomlapackLogger::WriteLog(_JP_LOG_INFO, "Loading profile #{$profile_id}"); // Get archive name switch ($configuration->get('BackupType')) { case 'dbonly': JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JoomlaPack is starting a new database backup"); $extension = '.sql'; break; case 'full': JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JoomlaPack is starting a new full site backup"); // Instanciate archiver, only if not in DB only mode $archiver =& $this->provisioning->getArchiverEngine(true); if ($this->provisioning->getError()) { $this->setError($this->provisioning->getError()); return; } $extension = $this->provisioning->archiveExtension; break; case 'extradbonly': JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JoomlaPack is starting a new extra databases only backup"); // Instanciate archiver, only if not in DB only mode $archiver =& $this->provisioning->getArchiverEngine(true); if ($this->provisioning->getError()) { $this->setError($this->provisioning->getError()); return; } $extension = $this->provisioning->archiveExtension; break; } $relativeArchiveName = JoomlapackHelperUtils::getExpandedTarName($extension, false); $absoluteArchiveName = JoomlapackHelperUtils::getExpandedTarName($extension, true); // ==== Stats initialisation === $this->statmodel->setId(0); // Detect backup origin if ($mainframe->isAdmin()) { $origin = 'backend'; } else { $origin = 'frontend'; } // Get profile $session =& JFactory::getSession(); $profile_id = $session->get('profile', null, 'joomlapack'); unset($session); // Create an initial stats entry jimport('joomla.utilities.date'); $jdate = new JDate(); switch ($configuration->get('BackupType')) { case 'full': $backupType = 'full'; break; case 'dbonly': $backupType = 'dbonly'; break; case 'extradbonly': $backupType = 'extradbonly'; break; } JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Backup type is now set to '" . $backupType . "'"); $temp = array('description' => $description, 'comment' => $comment, 'backupstart' => $jdate->toMySQL(), 'status' => 'run', 'origin' => $origin, 'type' => $backupType, 'profile_id' => $profile_id, 'archivename' => $relativeArchiveName, 'absolute_path' => $absoluteArchiveName); // Save the entry $this->statmodel->save($temp); if ($this->statmodel->getError()) { $this->setError($this->statmodel->getError()); return; } unset($temp); // Get the ID! $temp = $this->statmodel->getSavedTable(); $this->_statID = $temp->id; // Initialize the archive. if ($configuration->get('BackupType') != 'dbonly') { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Expanded archive file name: " . $absoluteArchiveName); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Seeding archive with installer"); $installerPackage = JPATH_COMPONENT_ADMINISTRATOR . DS . 'assets' . DS . "installers" . DS . $configuration->get('InstallerPackage'); $archiver->initialize($installerPackage, $absoluteArchiveName); $archiver->setComment($comment); // Add the comment to the archive itself. if ($archiver->getError()) { $this->setError($archiver->getError()); return; } } $this->_initialised = true; }