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; }
function getOutput() { $current_version = OSCOM::getVersion(); $new_version = false; $VersionCache = new Cache('core_version_check'); if ($VersionCache->exists()) { $date_last_checked = DateTime::toShort(date('Y-m-d H:i:s', $VersionCache->getTime()), true); $releases = $VersionCache->get(); foreach ($releases as $version) { $version_array = explode('|', $version); if (version_compare($current_version, $version_array[0], '<')) { $new_version = true; break; } } } else { $date_last_checked = OSCOM::getDef('module_admin_dashboard_version_check_never'); } $output = '<table class="table table-hover"> <thead> <tr class="info"> <th>' . OSCOM::getDef('module_admin_dashboard_version_check_title') . '</th> <th class="text-right">' . OSCOM::getDef('module_admin_dashboard_version_check_date') . '</th> </tr> </thead> <tbody>'; if ($new_version == true) { $output .= ' <tr class="success"> <td colspan="2">' . HTML::image(OSCOM::linkImage('icons/warning.gif'), OSCOM::getDef('icon_warning')) . ' <strong>' . OSCOM::getDef('module_admin_dashboard_version_check_update_available') . '</strong></td> </tr>'; } $output .= ' <tr> <td><a href="' . OSCOM::link('online_update.php') . '">' . OSCOM::getDef('module_admin_dashboard_version_check_check_now') . '</a></td> <td class="text-right">' . $date_last_checked . '</td> </tr> </tbody> </table>'; return $output; }
* @copyright (c) 2016 osCommerce; https://www.oscommerce.com * @license MIT; https://www.oscommerce.com/license/mit.txt */ use OSC\OM\Apps; use OSC\OM\Cache; use OSC\OM\HTML; 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;
$Qcheck->execute(); if ($Qcheck->fetch() !== false) { $OSCOM_Db->save('administrators', ['user_password' => Hash::encrypt(trim($_POST['CFG_ADMINISTRATOR_PASSWORD']))], ['user_name' => $_POST['CFG_ADMINISTRATOR_USERNAME']]); } else { $OSCOM_Db->save('administrators', ['user_name' => $_POST['CFG_ADMINISTRATOR_USERNAME'], 'user_password' => Hash::encrypt(trim($_POST['CFG_ADMINISTRATOR_PASSWORD']))]); } } if (FileSystem::isWritable(OSCOM::BASE_DIR . 'Work')) { if (!is_dir(Cache::getPath())) { mkdir(Cache::getPath(), 0777); } if (!is_dir(OSCOM::BASE_DIR . 'Work/Session')) { mkdir(OSCOM::BASE_DIR . 'Work/Session', 0777); } } foreach (glob(Cache::getPath() . '*.cache') as $c) { unlink($c); } $dir_fs_document_root = $_POST['DIR_FS_DOCUMENT_ROOT']; if (substr($dir_fs_document_root, -1) != '\\' && substr($dir_fs_document_root, -1) != '/') { if (strrpos($dir_fs_document_root, '\\') !== false) { $dir_fs_document_root .= '\\'; } else { $dir_fs_document_root .= '/'; } } $http_url = parse_url($_POST['HTTP_WWW_ADDRESS']); $http_server = $http_url['scheme'] . '://' . $http_url['host']; $http_catalog = $http_url['path']; if (isset($http_url['port']) && !empty($http_url['port'])) { $http_server .= ':' . $http_url['port'];
?> </td> <td class="text-right"><?php echo count($cache_files[$key]); ?> </td> <td class="action"><a href="<?php echo OSCOM::link(FILENAME_CACHE, 'action=reset&block=' . $key); ?> "><i class="fa fa-recycle" title="<?php echo OSCOM::getDef('image_delete'); ?> "></i></a></td> </tr> <?php } ?> </tbody> </table> <p> <?php echo '<strong>' . OSCOM::getDef('text_cache_directory') . '</strong> ' . FileSystem::displayPath(Cache::getPath()); ?> </p> <?php require $oscTemplate->getFile('template_bottom.php'); require 'includes/application_bottom.php';
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; }
$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; } } } 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'])) {
function pass() { $VersionCache = new Cache('core_version_check'); return $VersionCache->exists() && $VersionCache->getTime() > strtotime('-30 days'); }
function tep_remove_product($product_id) { $OSCOM_Db = Registry::get('Db'); $Qimage = $OSCOM_Db->get('products', 'products_image', ['products_id' => (int) $product_id]); $Qduplicate = $OSCOM_Db->get('products', 'products_id', ['products_image' => $Qimage->value('products_image'), 'products_id' => ['op' => '!=', 'val' => (int) $product_id]], null, 1); if ($Qduplicate->fetch() === false) { if (!empty($Qimage->value('products_image')) && is_file(OSCOM::getConfig('dir_root', 'Shop') . 'images/' . $Qimage->value('products_image'))) { unlink(OSCOM::getConfig('dir_root', 'Shop') . 'images/' . $Qimage->value('products_image')); } } $Qimages = $OSCOM_Db->get('products_images', 'image', ['products_id' => (int) $product_id]); if ($Qimages->fetch() !== false) { do { $Qduplicate = $OSCOM_Db->get('products_images', 'id', ['image' => $Qimages->value('image'), 'products_id' => ['op' => '!=', 'val' => (int) $product_id]], null, 1); if ($Qduplicate->fetch() === false) { if (is_file(OSCOM::getConfig('dir_root', 'Shop') . 'images/' . $Qimages->value('image'))) { unlink(OSCOM::getConfig('dir_root', 'Shop') . 'images/' . $Qimages->value('image')); } } } while ($Qimages->fetch()); $OSCOM_Db->delete('products_images', ['products_id' => (int) $product_id]); } $OSCOM_Db->delete('specials', ['products_id' => (int) $product_id]); $OSCOM_Db->delete('products', ['products_id' => (int) $product_id]); $OSCOM_Db->delete('products_to_categories', ['products_id' => (int) $product_id]); $OSCOM_Db->delete('products_description', ['products_id' => (int) $product_id]); $OSCOM_Db->delete('products_attributes', ['products_id' => (int) $product_id]); $Qdel = $OSCOM_Db->prepare('delete from :table_customers_basket where products_id = :products_id or products_id like :products_id_att'); $Qdel->bindInt(':products_id', (int) $product_id); $Qdel->bindInt(':products_id_att', (int) $product_id . '{%'); $Qdel->execute(); $Qdel = $OSCOM_Db->prepare('delete from :table_customers_basket_attributes where products_id = :products_id or products_id like :products_id_att'); $Qdel->bindInt(':products_id', (int) $product_id); $Qdel->bindInt(':products_id_att', (int) $product_id . '{%'); $Qdel->execute(); $Qreviews = $OSCOM_Db->get('reviews', 'reviews_id', ['products_id' => (int) $product_id]); while ($Qreviews->fetch()) { $OSCOM_Db->delete('reviews_description', ['reviews_id' => $Qreviews->valueInt('reviews_id')]); } $OSCOM_Db->delete('reviews', ['products_id' => (int) $product_id]); Cache::clear('categories'); Cache::clear('products-also_purchased'); }
if (is_file($image_location)) { unlink($image_location); } } } $OSCOM_Db->delete('manufacturers', ['manufacturers_id' => (int) $manufacturers_id]); $OSCOM_Db->delete('manufacturers_info', ['manufacturers_id' => (int) $manufacturers_id]); if (isset($_POST['delete_products']) && $_POST['delete_products'] == 'on') { $Qproducts = $OSCOM_Db->get('products', 'products_id', ['manufacturers_id' => (int) $manufacturers_id]); while ($Qproducts->fetch()) { tep_remove_product($Qproducts->value('products_id')); } } else { $OSCOM_Db->save('products', ['manufacturers_id' => ''], ['manufacturers_id' => (int) $manufacturers_id]); } Cache::clear('manufacturers'); OSCOM::redirect(FILENAME_MANUFACTURERS, 'page=' . $_GET['page']); break; } } require $oscTemplate->getFile('template_top.php'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo OSCOM::getDef('heading_title'); ?> </td>
$Qproduct = $OSCOM_Db->get('products', '*', ['products_id' => (int) $products_id]); $OSCOM_Db->save('products', ['products_quantity' => $Qproduct->valueInt('products_quantity'), 'products_model' => $Qproduct->value('products_model'), 'products_image' => $Qproduct->value('products_image'), 'products_price' => $Qproduct->value('products_price'), 'products_date_added' => 'now()', 'products_date_available' => $Qproduct->hasValue('products_date_available') ? $Qproduct->value('products_date_available') : null, 'products_weight' => $Qproduct->value('products_weight'), 'products_status' => 0, 'products_tax_class_id' => $Qproduct->valueInt('products_tax_class_id'), 'manufacturers_id' => $Qproduct->valueInt('manufacturers_id'), 'products_gtin' => $Qproduct->value('products_gtin')]); $dup_products_id = $OSCOM_Db->lastInsertId(); $Qdesc = $OSCOM_Db->get('products_description', '*', ['products_id' => (int) $products_id]); while ($Qdesc->fetch()) { $OSCOM_Db->save('products_description', ['products_id' => (int) $dup_products_id, 'language_id' => $Qdesc->valueInt('language_id'), 'products_name' => $Qdesc->value('products_name'), 'products_description' => $Qdesc->value('products_description'), 'products_url' => $Qdesc->value('products_url'), 'products_viewed' => 0]); } $Qimages = $OSCOM_Db->get('products_images', '*', ['products_id' => (int) $products_id]); while ($Qimages->fetch()) { $OSCOM_Db->save('products_images', ['products_id' => (int) $dup_products_id, 'image' => $Qimages->value('image'), 'htmlcontent' => $Qimages->value('htmlcontent'), 'sort_order' => $Qimages->valueInt('sort_order')]); } $OSCOM_Db->save('products_to_categories', ['products_id' => (int) $dup_products_id, 'categories_id' => (int) $categories_id]); $products_id = $dup_products_id; } Cache::clear('categories'); Cache::clear('products-also_purchased'); } $OSCOM_Hooks->call('Products', 'ActionCopy'); OSCOM::redirect(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id); break; } } // check if the catalog image directory exists if (is_dir(OSCOM::getConfig('dir_root', 'Shop') . 'images/')) { if (!FileSystem::isWritable(OSCOM::getConfig('dir_root', 'Shop') . 'images/')) { $OSCOM_MessageStack->add(OSCOM::getDef('error_catalog_image_directory_not_writeable', ['images_path' => OSCOM::getConfig('dir_root', 'Shop') . 'images/']), 'error'); } } else { $OSCOM_MessageStack->add(OSCOM::getDef('error_catalog_image_directory_does_not_exist', ['images_path' => OSCOM::getConfig('dir_root', 'Shop') . 'images/']), 'error'); } $cPath_back = '';