public static function execute()
 {
     $OSCOM_Cache = Registry::get('Cache');
     $result = array('entries' => array());
     if ($OSCOM_Cache->read('coreupdate-availablepackages', 360)) {
         $versions = $OSCOM_Cache->getCache();
     } else {
         $versions = HttpRequest::getResponse(array('url' => 'http://www.oscommerce.com/version/online_merchant/3', 'method' => 'get'));
         $OSCOM_Cache->write($versions);
     }
     $versions_array = explode("\n", $versions);
     $counter = 0;
     foreach ($versions_array as $v) {
         $v_info = explode('|', $v);
         if (version_compare(OSCOM::getVersion(), $v_info[0], '<')) {
             $result['entries'][] = array('key' => $counter, 'version' => $v_info[0], 'date' => DateTime::getShort(DateTime::fromUnixTimestamp(DateTime::getTimestamp($v_info[1], 'Ymd'))), 'announcement' => $v_info[2], 'update_package' => isset($v_info[3]) ? $v_info[3] : null);
             $counter++;
         }
     }
     usort($result['entries'], function ($a, $b) {
         return version_compare($a['version'], $b['version'], '>');
     });
     $result['total'] = count($result['entries']);
     return $result;
 }
Exemplo n.º 2
0
 public static function execute(ApplicationAbstract $application)
 {
     if (!CoreUpdate::localPackageExists() || CoreUpdate::getPackageInfo('version_from') != OSCOM::getVersion()) {
         Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_wrong_version_to_update_from'), 'error');
         OSCOM::redirect(OSCOM::getLink());
     }
     if (CoreUpdate::canApplyPackage()) {
         if (CoreUpdate::applyPackage()) {
             CoreUpdate::deletePackage();
             // Refresh access list for new/deleted Applications
             $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_SESSION[OSCOM::getSite()]['id']);
             Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
         } else {
             Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
         }
     } else {
         Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_check_target_permissions'), 'error');
         OSCOM::redirect(OSCOM::getLink(null, null, 'Apply&v=' . $_GET['v']));
     }
     OSCOM::redirect(OSCOM::getLink());
 }
Exemplo n.º 3
0
<?php

/**
 * osCommerce Online Merchant
 * 
 * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
 * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
 */
use osCommerce\OM\Core\OSCOM;
?>

<p align="center">osCommerce Online Merchant Copyright &copy; 2000-2011 <a href="http://www.oscommerce.com" target="_blank">osCommerce</a> (<a href="http://www.oscommerce.com/about/copyright" target="_blank">Copyright Policy</a>, <a href="http://www.oscommerce.com/about/trademark" target="_blank">Trademark Policy</a>)<br />osCommerce is a registered trademark of Harald Ponce de Leon</p>

<div style="text-align: center; padding: 5px;"><span class="poweredByButton"><a href="http://www.oscommerce.com" target="_blank"><span class="poweredBy">Powered By</span><span class="osCommerce"><?php 
echo 'osCommerce Online Merchant v' . OSCOM::getVersion();
?>
</span></a></span></div>
?>
</h1>

<?php 
if ($OSCOM_MessageStack->exists()) {
    echo $OSCOM_MessageStack->get();
}
?>

<form id="liveSearchForm">
  <?php 
echo HTML::inputField('search', null, 'id="liveSearchField" class="searchField" placeholder="' . OSCOM::getDef('placeholder_search') . '"') . HTML::button(array('type' => 'button', 'params' => 'onclick="osC_DataTable.reset();"', 'title' => OSCOM::getDef('button_reset')));
?>

  <span style="float: right;"><?php 
echo HTML::button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'triangle-1-w', 'title' => OSCOM::getDef('button_back'))) . (CoreUpdate::getPackageInfo('version_from') == OSCOM::getVersion() ? ' ' . HTML::button(array('href' => OSCOM::getLink(null, null, 'Apply&Process&v=' . $_GET['v']), 'icon' => 'disk', 'title' => OSCOM::getDef('button_apply_update'))) : '');
?>
</span>
</form>

<div style="padding: 20px 5px 5px 5px; height: 16px;">
  <span id="batchTotalPages"></span>
  <span id="batchPageLinks"></span>
</div>

<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable" id="coreUpdateDataTable">
  <thead>
    <tr>
      <th><?php 
echo OSCOM::getDef('table_heading_files');
?>