public function getPaths() { $ret = (object) array('cli' => (object) array('supported' => false, 'path' => false), 'altcli' => (object) array('supported' => false, 'path' => false), 'frontend' => (object) array('supported' => false, 'path' => false), 'info' => (object) array('windows' => false, 'php_path' => false, 'root_url' => false, 'secret' => '', 'feenabled' => false)); // Get the profile ID $profileid = AEPlatform::getInstance()->get_active_profile(); // Get the absolute path to the site's root $absolute_root = rtrim(realpath(JPATH_ROOT), DIRECTORY_SEPARATOR); // Is this Windows? $ret->info->windows = DIRECTORY_SEPARATOR == '\\' || substr(strtoupper(PHP_OS), 0, 3) == 'WIN'; // Get the pseudo-path to PHP CLI if ($ret->info->windows) { $ret->info->php_path = 'c:\\path\\to\\php.exe'; } else { $ret->info->php_path = '/path/to/php'; } // Get front-end backup secret key $ret->info->secret = AEUtilComconfig::getValue('frontend_secret_word', ''); $ret->info->feenabled = AEUtilComconfig::getValue('frontend_enable', false); // Get root URL $ret->info->root_url = rtrim(AEUtilComconfig::getValue('siteurl', ''), '/'); // Get information for CLI CRON script if (AKEEBA_PRO) { $ret->cli->supported = true; $ret->cli->path = $absolute_root . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'akeeba-backup.php'; if ($profileid != 1) { $ret->cli->path .= ' --profile=' . $profileid; } } // Get information for alternative CLI CRON script if (AKEEBA_PRO) { $ret->altcli->supported = true; if (trim($ret->info->secret) && $ret->info->feenabled) { $ret->altcli->path = $absolute_root . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'akeeba-altbackup.php'; if ($profileid != 1) { $ret->altcli->path .= ' --profile=' . $profileid; } } } // Get information for front-end backup $ret->frontend->supported = true; if (trim($ret->info->secret) && $ret->info->feenabled) { $ret->frontend->path = 'index.php?option=com_akeeba&view=backup&key=' . urlencode($ret->info->secret); if ($profileid != 1) { $ret->frontend->path .= '&profile=' . $profileid; } } return $ret; }
/** * Public constructor. Initialises the protected members as well. * * @param array $config */ public function __construct($config = array()) { parent::__construct($config); $isPro = defined('AKEEBA_PRO') ? AKEEBA_PRO : 0; JLoader::import('joomla.application.component.helper'); $dlid = AEUtilComconfig::getValue('update_dlid', ''); $this->extraQuery = null; // If I have a valid Download ID I will need to use a non-blank extra_query in Joomla! 3.2+ if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) { // Even if the user entered a Download ID in the Core version. Let's switch his update channel to Professional $isPro = true; $this->extraQuery = 'dlid=' . $dlid; } $this->updateSiteName = 'Akeeba Backup ' . ($isPro ? 'Professional' : 'Core'); $this->updateSite = 'http://cdn.akeebabackup.com/updates/ab' . ($isPro ? 'pro' : 'core') . '.xml'; }
?> </p> </div> <script type="text/javascript" language="javascript"> if(typeof akeeba.jQuery == 'function') { if(typeof akeeba.jQuery.ui == 'object') { akeeba.jQuery('#nojquerywarning').css('display','none'); akeeba.jQuery('#notfixedperms').css('display','none'); } } </script> <?php if (!version_compare(PHP_VERSION, '5.3.0', 'ge') && AEUtilComconfig::getValue('displayphpwarning', 1)) { ?> <div class="alert"> <a class="close" data-dismiss="alert" href="#">×</a> <p><strong><?php echo JText::_('COM_AKEEBA_CONFIG_LBL_OUTDATEDPHP_HEADER'); ?> </strong><br/> <?php echo JText::_('COM_AKEEBA_CONFIG_LBL_OUTDATEDPHP_BODY'); ?> </p> <p> <a class="btn btn-small btn-primary" href="index.php?option=com_akeeba&view=cpanel&task=disablephpwarning&<?php echo JFactory::getSession()->getFormToken();
/** * Loads a platform-specific software configuration option * @param string $key * @param mixed $default * @return mixed */ public function get_platform_configuration_option($key, $default) { // Get the component configuration option WITHOUT using the bloody ever-changing Joomla! API... return AEUtilComconfig::getValue($key, $default); }
<?php /** * @package AkeebaBackup * @copyright Copyright (c)2009-2014 Nicholas K. Dionysopoulos * @license GNU General Public License version 3, or later * * @since 1.3 */ // Protect from unauthorized access defined('_JEXEC') or die; JHtml::_('behavior.framework'); JHtml::_('behavior.calendar'); JHtml::_('behavior.modal'); $dateFormat = AEUtilComconfig::getValue('dateformat', ''); $dateFormat = trim($dateFormat); $dateFormat = !empty($dateFormat) ? $dateFormat : JText::_('DATE_FORMAT_LC4'); // Filesize formatting function by eregon at msn dot com // Published at: http://www.php.net/manual/en/function.number-format.php function format_filesize($number, $decimals = 2, $force_unit = false, $dec_char = '.', $thousands_char = '') { if ($number <= 0) { return '-'; } $units = array('b', 'Kb', 'Mb', 'Gb', 'Tb'); if ($force_unit === false) { $unit = floor(log($number, 2) / 10); } else { $unit = $force_unit; } if ($unit == 0) {
public function needsDownloadID() { // Do I need a Download ID? $ret = true; $isPro = AKEEBA_PRO; if (!$isPro) { $ret = false; } else { JLoader::import('joomla.application.component.helper'); $dlid = AEUtilComconfig::getValue('update_dlid', ''); if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) { $ret = false; } } // Deactivate update site for Akeeba Backup JLoader::import('joomla.application.component.helper'); $component = JComponentHelper::getComponent('com_akeeba'); $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('update_site_id')->from($db->qn('#__update_sites_extensions'))->where($db->qn('extension_id') . ' = ' . $db->q($component->id)); $db->setQuery($query); $updateSite = $db->loadResult(); if ($updateSite) { $query = $db->getQuery(true)->delete($db->qn('#__update_sites'))->where($db->qn('update_site_id') . ' = ' . $db->q($updateSite)); $db->setQuery($query); $db->execute(); $query = $db->getQuery(true)->delete($db->qn('#__update_sites_extensions'))->where($db->qn('update_site_id') . ' = ' . $db->q($updateSite)); $db->setQuery($query); $db->execute(); } // Deactivate the update site for FOF $query = $db->getQuery(true)->select('update_site_id')->from($db->qn('#__update_sites'))->where($db->qn('location') . ' = ' . $db->q('http://cdn.akeebabackup.com/updates/libraries/fof')); $db->setQuery($query); $updateSite = $db->loadResult(); if ($updateSite) { $query = $db->getQuery(true)->delete($db->qn('#__update_sites'))->where($db->qn('update_site_id') . ' = ' . $db->q($updateSite)); $db->setQuery($query); $db->execute(); $query = $db->getQuery(true)->delete($db->qn('#__update_sites_extensions'))->where($db->qn('update_site_id') . ' = ' . $db->q($updateSite)); $db->setQuery($query); $db->execute(); } return $ret; }
/** * Does the user need to enter a Download ID in the component's Options page? * * @return bool */ public function needsDownloadID() { // Do I need a Download ID? $ret = true; $isPro = AKEEBA_PRO; if (!$isPro) { $ret = false; } else { JLoader::import('joomla.application.component.helper'); $dlid = AEUtilComconfig::getValue('update_dlid', ''); if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) { $ret = false; } } return $ret; }
/** * Refreshes the Joomla! update sites for this extension as needed * * @return void */ public function refreshUpdateSite() { $isPro = defined('AKEEBA_PRO') ? AKEEBA_PRO : 0; JLoader::import('joomla.application.component.helper'); $dlid = AEUtilComconfig::getValue('update_dlid', ''); $extra_query = null; // If I have a valid Download ID I will need to use a non-blank extra_query in Joomla! 3.2+ if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) { // Even if the user entered a Download ID in the Core version. Let's switch his update channel to Professional $isPro = true; $extra_query = 'dlid=' . $dlid; } // Create the update site definition we want to store to the database $update_site = array('name' => 'Akeeba Backup ' . ($isPro ? 'Professional' : 'Core'), 'type' => 'extension', 'location' => 'http://cdn.akeebabackup.com/updates/ab' . ($isPro ? 'pro' : 'core') . '.xml', 'enabled' => 1, 'last_check_timestamp' => 0, 'extra_query' => $extra_query); if (version_compare(JVERSION, '3.0.0', 'lt')) { unset($update_site['extra_query']); } $db = $this->getDbo(); // Get the extension ID to ourselves $query = $db->getQuery(true)->select($db->qn('extension_id'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeeba')); $db->setQuery($query); $extension_id = $db->loadResult(); if (empty($extension_id)) { return; } // Get the update sites for our extension $query = $db->getQuery(true)->select($db->qn('update_site_id'))->from($db->qn('#__update_sites_extensions'))->where($db->qn('extension_id') . ' = ' . $db->q($extension_id)); $db->setQuery($query); $updateSiteIDs = $db->loadColumn(0); if (!count($updateSiteIDs)) { // No update sites defined. Create a new one. $newSite = (object) $update_site; $db->insertObject('#__update_sites', $newSite); $id = $db->insertid(); $updateSiteExtension = (object) array('update_site_id' => $id, 'extension_id' => $extension_id); $db->insertObject('#__update_sites_extensions', $updateSiteExtension); } else { // Loop through all update sites foreach ($updateSiteIDs as $id) { $query = $db->getQuery(true)->select('*')->from($db->qn('#__update_sites'))->where($db->qn('update_site_id') . ' = ' . $db->q($id)); $db->setQuery($query); $aSite = $db->loadObject(); // Does the name and location match? if ($aSite->name == $update_site['name'] && $aSite->location == $update_site['location']) { // Do we have the extra_query property (J 3.2+) and does it match? if (property_exists($aSite, 'extra_query')) { if ($aSite->extra_query == $update_site['extra_query']) { continue; } } else { // Joomla! 3.1 or earlier. Updates may or may not work. continue; } } $update_site['update_site_id'] = $id; $newSite = (object) $update_site; $db->updateObject('#__update_sites', $newSite, 'update_site_id', true); } } }