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; }
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); exit; break; case 'getInstalledApps': $result = ['result' => -1]; $apps = Apps::getAll();
public function getDefinitions($group, $language_code, $pathname) { $defs = []; $group_key = str_replace(['/', '\\'], '-', $group); if ($this->use_cache === false) { return $this->getDefinitionsFromFile($pathname); } $DefCache = new Cache('languages-defs-' . $group_key . '-lang' . $this->getId($language_code)); if ($DefCache->exists()) { $defs = $DefCache->get(); } else { $Qdefs = $this->db->get('languages_definitions', ['definition_key', 'definition_value'], ['languages_id' => $this->getId($language_code), 'content_group' => $group_key]); while ($Qdefs->fetch()) { $defs[$Qdefs->value('definition_key')] = $Qdefs->value('definition_value'); } if (empty($defs)) { $defs = $this->getDefinitionsFromFile($pathname); foreach ($defs as $key => $value) { $this->db->save('languages_definitions', ['languages_id' => $this->getId($language_code), 'content_group' => $group_key, 'definition_key' => $key, 'definition_value' => $value]); } } $DefCache->save($defs); } return $defs; }
} } if ($check !== true) { trigger_error('Online Update: Retrievel of Release Notes for requested v' . $_POST['version'] . ' is not valid.'); http_response_code(404); exit; } $version = str_replace('.', '_', $_POST['version']); $ReleaseNotesCache = new Cache('online_update-rel_notes-' . $version); if ($ReleaseNotesCache->exists()) { $notes = $ReleaseNotesCache->get(); } else { $notes = HTTP::getResponse(['url' => 'https://www.oscommerce.com/version/online_merchant/notes/' . $_POST['version'] . '.txt']); $notes = trim($notes); if (!empty($notes)) { $ReleaseNotesCache->save($notes); } } echo $notes; exit; break; case 'downloadRelease': $check = false; if (isset($_POST['version']) && preg_match('/^(\\d+\\.)?(\\d+\\.)?(\\d+)$/', $_POST['version'])) { foreach ($versions as $v) { if ($v['version'] == $_POST['version']) { $check = true; break; } } }