function getOutput()
 {
     $entries = [];
     $newsCache = new Cache('oscommerce_website-news-latest5');
     if ($newsCache->exists(360)) {
         $entries = $newsCache->get();
     } else {
         $response = HTTP::getResponse(['url' => 'https://www.oscommerce.com/index.php?RPC&GetLatestNews']);
         if (!empty($response)) {
             $response = json_decode($response, true);
             if (is_array($response) && count($response) === 5) {
                 $entries = $response;
             }
         }
         $newsCache->save($entries);
     }
     $output = '<table class="table table-hover">
                <thead>
                  <tr class="info">
                    <th>' . OSCOM::getDef('module_admin_dashboard_latest_news_title') . '</th>
                    <th class="text-right">' . OSCOM::getDef('module_admin_dashboard_latest_news_date') . '</th>
                  </tr>
                </thead>
                <tbody>';
     if (is_array($entries) && count($entries) === 5) {
         foreach ($entries as $item) {
             $output .= '    <tr>
                         <td><a href="' . HTML::outputProtected($item['link']) . '" target="_blank">' . HTML::outputProtected($item['title']) . '</a></td>
                         <td class="text-right" style="white-space: nowrap;">' . HTML::outputProtected(DateTime::toShort($item['date'])) . '</td>
                       </tr>';
         }
     } else {
         $output .= '    <tr>
                       <td colspan="2">' . OSCOM::getDef('module_admin_dashboard_latest_news_feed_error') . '</td>
                     </tr>';
     }
     $output .= '    <tr>
                     <td class="text-right" colspan="2">
                       <a href="https://www.oscommerce.com/Us&News" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_news')) . '"><span class="fa fa-fw fa-home"></span></a>
                       <a href="https://www.oscommerce.com/newsletter/subscribe" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_newsletter')) . '"><span class="fa fa-fw fa-newspaper-o"></span></a>
                       <a href="https://plus.google.com/+osCommerce" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_google_plus')) . '"><span class="fa fa-fw fa-google-plus"></span></a>
                       <a href="https://www.facebook.com/pages/osCommerce/33387373079" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_facebook')) . '"><span class="fa fa-fw fa-facebook"></span></a>
                       <a href="https://twitter.com/osCommerce" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_twitter')) . '"><span class="fa fa-fw fa-twitter"></span></a>
                     </td>
                   </tr>
                 </tbody>
               </table>';
     return $output;
 }
 function _getContent()
 {
     $result = null;
     $NewsCache = new Cache('oscommerce_website-partner_news');
     if ($NewsCache->exists(60)) {
         $result = $NewsCache->get();
     } else {
         $response = HTTP::getResponse(['url' => 'https://www.oscommerce.com/index.php?RPC&Website&Index&GetPartnerStatusUpdates']);
         if (!empty($response)) {
             $response = json_decode($response, true);
             if (is_array($response) && !empty($response)) {
                 $result = $response;
                 $NewsCache->save($result);
             }
         }
     }
     return $result;
 }
 function getOutput()
 {
     $entries = [];
     $addonsCache = new Cache('oscommerce_website-addons-latest5');
     if ($addonsCache->exists(360)) {
         $entries = $addonsCache->get();
     } else {
         $response = HTTP::getResponse(['url' => 'https://www.oscommerce.com/index.php?RPC&GetLatestAddons']);
         if (!empty($response)) {
             $response = json_decode($response, true);
             if (is_array($response) && count($response) === 5) {
                 $entries = $response;
             }
         }
         $addonsCache->save($entries);
     }
     $output = '<table class="table table-hover">
                <thead>
                  <tr class="info">
                    <th>' . OSCOM::getDef('module_admin_dashboard_latest_addons_title') . '</th>
                    <th class="text-right">' . OSCOM::getDef('module_admin_dashboard_latest_addons_date') . '</th>
                  </tr>
                </thead>
                <tbody>';
     if (is_array($entries) && count($entries) === 5) {
         foreach ($entries as $item) {
             $output .= '    <tr>
                         <td><a href="' . HTML::outputProtected($item['link']) . '" target="_blank">' . HTML::outputProtected($item['title']) . '</a></td>
                         <td class="text-right" style="white-space: nowrap;">' . HTML::outputProtected(DateTime::toShort($item['date'])) . '</td>
                       </tr>';
         }
     } else {
         $output .= '    <tr>
                       <td colspan="2">' . OSCOM::getDef('module_admin_dashboard_latest_addons_feed_error') . '</td>
                     </tr>';
     }
     $output .= '    <tr>
                     <td class="text-right" colspan="2"><a href="http://addons.oscommerce.com" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_addons_icon_site')) . '"><span class="fa fa-fw fa-home"></span></a></td>
                   </tr>
                 </tbody>
               </table>';
     return $output;
 }
Beispiel #4
0
use OSC\OM\HTTP;
use OSC\OM\OSCOM;
use OSC\OM\Registry;
require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (tep_not_null($action)) {
    switch ($action) {
        case 'getShowcase':
            $result = ['result' => -1];
            $AppsShowcaseCache = new Cache('apps-showcase');
            if ($AppsShowcaseCache->exists(360)) {
                $showcase = $AppsShowcaseCache->get();
            } else {
                $showcase = [];
                $version_url = str_replace('.', '_', OSCOM::getVersion());
                $response = HTTP::getResponse(['url' => 'https://apps.oscommerce.com/index.php?RPC&GetShowcase&' . $version_url]);
                if (!empty($response)) {
                    $showcase = json_decode($response, true);
                }
                if (is_array($showcase) && !empty($showcase) && isset($showcase['rpcStatus']) && $showcase['rpcStatus'] === 1) {
                    $AppsShowcaseCache->save($showcase);
                }
            }
            if (is_array($showcase) && !empty($showcase) && isset($showcase['rpcStatus']) && $showcase['rpcStatus'] === 1 && isset($showcase['showcase'])) {
                $result['result'] = 1;
                $result['showcase'] = [];
                foreach ($showcase['showcase'] as $app) {
                    $result['showcase'][] = ['vendor' => $app['vendor'], 'app' => $app['app'], 'title' => $app['title'], 'description' => $app['description'], 'is_installed' => Apps::exists($app['vendor'] . '\\' . $app['app'])];
                }
            }
            echo json_encode($result);
Beispiel #5
0
 case 'httpsCheck':
     if (isset($_GET['subaction']) && $_GET['subaction'] == 'do') {
         if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
             $result['status'] = '1';
             $result['message'] = 'success';
         }
     } else {
         $url = 'https://' . $_SERVER['HTTP_HOST'];
         if (isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['REQUEST_URI'])) {
             $url .= $_SERVER['REQUEST_URI'];
         } else {
             $url .= $_SERVER['SCRIPT_FILENAME'];
         }
         $url .= '&subaction=do';
         // errors are silenced to not log failed connection checks
         $response = @HTTP::getResponse(['url' => $url, 'verify_ssl' => false]);
         if (!empty($response)) {
             $response = json_decode($response, true);
             if (is_array($response) && isset($response['status']) && $response['status'] == '1') {
                 $result['status'] = '1';
                 $result['message'] = 'success';
             }
         }
     }
     break;
 case 'dbCheck':
     try {
         $OSCOM_Db = Db::initialize(isset($_POST['server']) ? $_POST['server'] : '', isset($_POST['username']) ? $_POST['username'] : '', isset($_POST['password']) ? $_POST['password'] : '', isset($_POST['name']) ? $_POST['name'] : '', null, null, ['log_errors' => false]);
         $result['status'] = '1';
         $result['message'] = 'success';
     } catch (\Exception $e) {
     }
     if ($check !== true) {
         trigger_error('Online Update: Download for requested v' . $_POST['version'] . ' update package is not valid.');
         http_response_code(404);
         exit;
     }
     $result = ['result' => -1];
     if (FileSystem::isWritable(OSCOM::BASE_DIR . 'Work/OnlineUpdates', true)) {
         if (!is_dir(OSCOM::BASE_DIR . 'Work/OnlineUpdates')) {
             mkdir(OSCOM::BASE_DIR . 'Work/OnlineUpdates', 0777, true);
         }
         $filepath = OSCOM::BASE_DIR . 'Work/OnlineUpdates/' . $_POST['version'] . '-update.zip';
         if (FileSystem::isWritable($filepath)) {
             unlink($filepath);
         }
         $downloadFile = HTTP::getResponse(['url' => 'https://www.oscommerce.com/?Products&Download=oscom-' . $_POST['version'] . '-ou', 'method' => 'post']);
         $save_result = file_put_contents($filepath, $downloadFile);
         if ($save_result !== false && $save_result > 0) {
             $result['result'] = 1;
         } else {
             $result['result'] = -3;
             $result['path'] = FileSystem::displayPath($filepath);
         }
     } else {
         $result['result'] = -2;
         $result['path'] = FileSystem::displayPath(OSCOM::BASE_DIR . 'Work/OnlineUpdates');
     }
     echo json_encode($result);
     exit;
     break;
 case 'applyRelease':
Beispiel #7
0
 */
use OSC\OM\HTML;
use OSC\OM\HTTP;
use OSC\OM\OSCOM;
require 'includes/application_top.php';
$OSCOM_Language->loadDefinitions('server_info');
$info = tep_get_system_information();
$server = parse_url(OSCOM::getConfig('http_server'));
$action = isset($_GET['action']) ? $_GET['action'] : '';
switch ($action) {
    case 'getPhpInfo':
        phpinfo();
        exit;
        break;
    case 'submit':
        $response = HTTP::getResponse(['url' => 'https://www.oscommerce.com/index.php?RPC&Website&Index&SaveUserServerInfo&v=2', 'parameters' => ['info' => json_encode($info)]]);
        if ($response != 'OK') {
            $OSCOM_MessageStack->add(OSCOM::getDef('error_info_submit'), 'error');
        } else {
            $OSCOM_MessageStack->add(OSCOM::getDef('success_info_submit'), 'success');
        }
        OSCOM::redirect('server_info.php');
        break;
    case 'save':
        $info_file = 'server_info-' . date('YmdHis') . '.txt';
        header('Content-type: text/plain');
        header('Content-disposition: attachment; filename=' . $info_file);
        echo tep_format_system_info_array($info);
        exit;
        break;
}