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; }
public static function execute($search, $pageset = 1) { if (!is_numeric($pageset) || floor($pageset) != $pageset) { $pageset = 1; } $result = array('entries' => array(), 'total' => ErrorHandler::getTotalFindEntries($search)); foreach (ErrorHandler::find($search, MAX_DISPLAY_SEARCH_RESULTS, $pageset) as $row) { $result['entries'][] = array('date' => DateTime::getShort(DateTime::fromUnixTimestamp($row['timestamp']), true), 'message' => $row['message']); } return $result; }
public static function execute() { $result = array(); $db_time = OSCOM::callDB('Admin\\ServerInfo\\GetTime'); $db_uptime = OSCOM::callDB('Admin\\ServerInfo\\GetUptime'); $db_version = OSCOM::callDB('Admin\\ServerInfo\\GetVersion'); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5)); $data = array(array('key' => 'date', 'title' => OSCOM::getDef('field_server_date'), 'value' => DateTime::getShort(null, true)), array('key' => 'system', 'title' => OSCOM::getDef('field_server_operating_system'), 'value' => $system . ' ' . $kernel), array('key' => 'host', 'title' => OSCOM::getDef('field_server_host'), 'value' => $host . ' (' . gethostbyname($host) . ')'), array('key' => 'uptime', 'title' => OSCOM::getDef('field_server_up_time'), 'value' => @exec('uptime')), array('key' => 'http_server', 'title' => OSCOM::getDef('field_http_server'), 'value' => $_SERVER['SERVER_SOFTWARE']), array('key' => 'php', 'title' => OSCOM::getDef('field_php_version'), 'value' => 'PHP v' . PHP_VERSION . ' / Zend v' . zend_version()), array('key' => 'db_server', 'title' => OSCOM::getDef('field_database_host'), 'value' => DB_SERVER . ' (' . gethostbyname(DB_SERVER) . ')'), array('key' => 'db_version', 'title' => OSCOM::getDef('field_database_version'), 'value' => $db_version), array('key' => 'db_date', 'title' => OSCOM::getDef('field_database_date'), 'value' => DateTime::getShort($db_time, true)), array('key' => 'db_uptime', 'title' => OSCOM::getDef('field_database_up_time'), 'value' => $db_uptime)); $result['entries'] = $data; $result['total'] = count($data); return $result; }
/** * Retrieve web server and database server information * * @access public */ public static function getAll() { $OSCOM_Database = Registry::get('Database'); $result = array(); $Qdate = $OSCOM_Database->query('select now() as datetime'); $Quptime = $OSCOM_Database->query('show status like "Uptime"'); @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', @exec('uname -a'), 5)); $db_uptime = intval($Quptime->valueInt('Value') / 3600) . ':' . str_pad(intval($Quptime->valueInt('Value') / 60 % 60), 2, '0', STR_PAD_LEFT); $data = array(array('key' => 'date', 'title' => OSCOM::getDef('field_server_date'), 'value' => DateTime::getShort(null, true)), array('key' => 'system', 'title' => OSCOM::getDef('field_server_operating_system'), 'value' => $system . ' ' . $kernel), array('key' => 'host', 'title' => OSCOM::getDef('field_server_host'), 'value' => $host . ' (' . gethostbyname($host) . ')'), array('key' => 'uptime', 'title' => OSCOM::getDef('field_server_up_time'), 'value' => @exec('uptime')), array('key' => 'http_server', 'title' => OSCOM::getDef('field_http_server'), 'value' => $_SERVER['SERVER_SOFTWARE']), array('key' => 'php', 'title' => OSCOM::getDef('field_php_version'), 'value' => 'PHP v' . PHP_VERSION . ' / Zend v' . zend_version()), array('key' => 'db_server', 'title' => OSCOM::getDef('field_database_host'), 'value' => DB_SERVER . ' (' . gethostbyname(DB_SERVER) . ')'), array('key' => 'db_version', 'title' => OSCOM::getDef('field_database_version'), 'value' => 'MySQL v' . $OSCOM_Database->getServerVersion()), array('key' => 'db_date', 'title' => OSCOM::getDef('field_database_date'), 'value' => DateTime::getShort($Qdate->value('datetime'), true)), array('key' => 'db_uptime', 'title' => OSCOM::getDef('field_database_up_time'), 'value' => $db_uptime)); $result['entries'] = $data; $result['total'] = count($data); return $result; }
public static function execute() { $result = array(); $db_time = OSCOM::callDB('Admin\\ServerInfo\\GetTime'); $db_uptime = OSCOM::callDB('Admin\\ServerInfo\\GetUptime'); $db_version = OSCOM::callDB('Admin\\ServerInfo\\GetVersion'); $uptime = '---'; if (!in_array('exec', explode(',', str_replace(' ', '', ini_get('disable_functions'))))) { $uptime = @exec('uptime'); } $data = array(array('key' => 'date', 'title' => OSCOM::getDef('field_server_date'), 'value' => DateTime::getShort(null, true)), array('key' => 'system', 'title' => OSCOM::getDef('field_server_operating_system'), 'value' => php_uname('s') . ' ' . php_uname('r')), array('key' => 'host', 'title' => OSCOM::getDef('field_server_host'), 'value' => php_uname('n') . ' (' . gethostbyname(php_uname('n')) . ')'), array('key' => 'uptime', 'title' => OSCOM::getDef('field_server_up_time'), 'value' => $uptime), array('key' => 'http_server', 'title' => OSCOM::getDef('field_http_server'), 'value' => $_SERVER['SERVER_SOFTWARE']), array('key' => 'php', 'title' => OSCOM::getDef('field_php_version'), 'value' => 'PHP v' . PHP_VERSION . ' / Zend v' . zend_version()), array('key' => 'db_server', 'title' => OSCOM::getDef('field_database_host'), 'value' => OSCOM::getConfig('db_server') . ' (' . gethostbyname(OSCOM::getConfig('db_server')) . ')'), array('key' => 'db_version', 'title' => OSCOM::getDef('field_database_version'), 'value' => $db_version), array('key' => 'db_date', 'title' => OSCOM::getDef('field_database_date'), 'value' => DateTime::getShort($db_time, true)), array('key' => 'db_uptime', 'title' => OSCOM::getDef('field_database_up_time'), 'value' => $db_uptime)); $result['entries'] = $data; $result['total'] = count($data); return $result; }
public static function execute($log) { $log = basename($log); if (substr($log, 0, -4) != '.txt') { $log .= '.txt'; } $result = array('entries' => array()); foreach (file(OSCOM::BASE_DIRECTORY . 'Work/Logs/' . $log) as $l) { if (preg_match('/^\\[([0-9]{2})-([A-Za-z]{3})-([0-9]{4}) ([0-9]{2}):([0-5][0-9]):([0-5][0-9])\\] (.*)$/', $l)) { $result['entries'][] = array('date' => DateTime::getShort(DateTime::fromUnixTimestamp(DateTime::getTimestamp(substr($l, 1, 20), 'd-M-Y H:i:s')), true), 'message' => substr($l, 23)); } } $result['total'] = count($result['entries']); return $result; }
public function __construct() { Registry::get('Language')->loadIniFile('modules/IndexModules/ErrorLog.php'); $this->_title = OSCOM::getDef('admin_indexmodules_errorlog_title'); $this->_title_link = OSCOM::getLink(null, 'ErrorLog'); if (Access::hasAccess(OSCOM::getSite(), 'ErrorLog')) { $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . OSCOM::getDef('admin_indexmodules_errorlog_table_heading_date') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_errorlog_table_heading_message') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; if (ErrorHandler::getTotalEntries() > 0) { $counter = 0; foreach (ErrorHandler::getAll(6) as $row) { $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . ' <td style="white-space: nowrap;">' . Registry::get('Template')->getIcon(16, 'errorlog.png') . ' ' . DateTime::getShort(DateTime::fromUnixTimestamp($row['timestamp']), true) . '</td>' . ' <td>' . osc_output_string_protected(substr($row['message'], 0, 60)) . '..</td>' . ' </tr>'; $counter++; } } else { $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');">' . ' <td colspan="2">' . osc_icon('tick.png') . ' ' . OSCOM::getDef('admin_indexmodules_errorlog_no_errors_found') . '</td>' . ' </tr>'; } $this->_data .= ' </tbody>' . '</table>'; } }
public static function execute() { if (!isset($_GET['search'])) { $_GET['search'] = ''; } if (!isset($_GET['page']) || !is_numeric($_GET['page'])) { $_GET['page'] = 1; } if (!empty($_GET['search'])) { $result = Customers::find($_GET['search'], $_GET['page']); } else { $result = Customers::getAll($_GET['page']); } foreach ($result['entries'] as &$c) { $c['date_account_created'] = DateTime::getShort($c['date_account_created'], true); } $result['rpcStatus'] = RPC::STATUS_SUCCESS; echo json_encode($result); }
$status = $Qstatus->fetchAll(); if (count($status) > 0) { ?> <div class="moduleBox"> <h6><?php echo OSCOM::getDef('order_history_heading'); ?> </h6> <div class="content"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php foreach ($status as $s) { echo ' <tr>' . "\n" . ' <td valign="top" width="70">' . DateTime::getShort($s['date_added']) . '</td>' . "\n" . ' <td valign="top" width="70">' . $s['orders_status_name'] . '</td>' . "\n" . ' <td valign="top">' . (strlen(HTML::outputProtected($s['comments'])) > 0 ? nl2br(HTML::outputProtected($s['comments'])) : ' ') . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table> </div> </div> <?php } // HPDL // if ( DOWNLOAD_ENABLED == '1' ) { // include('includes/modules/downloads.php'); // } ?>
public function add($product_id, $quantity = null) { $OSCOM_Customer = Registry::get('Customer'); $OSCOM_PDO = Registry::get('PDO'); $OSCOM_Language = Registry::get('Language'); if (!is_numeric($product_id)) { return false; } $OSCOM_Product = new Product($product_id); if ($OSCOM_Product->isValid()) { if ($this->exists($product_id)) { $item_id = $this->getBasketID($product_id); if (!is_numeric($quantity)) { $quantity = $this->getQuantity($item_id) + 1; } $this->_contents[$item_id]['quantity'] = $quantity; if ($OSCOM_Customer->isLoggedOn()) { $Qupdate = $OSCOM_PDO->prepare('update :table_shopping_carts set quantity = :quantity where customers_id = :customers_id and item_id = :item_id'); $Qupdate->bindInt(':quantity', $quantity); $Qupdate->bindInt(':customers_id', $OSCOM_Customer->getID()); $Qupdate->bindInt(':item_id', $item_id); $Qupdate->execute(); } } else { if (!is_numeric($quantity)) { $quantity = 1; } if ($OSCOM_Customer->isLoggedOn()) { $Qid = $OSCOM_PDO->prepare('select max(item_id) as item_id from :table_shopping_carts where customers_id = :customers_id'); $Qid->bindInt(':customers_id', $OSCOM_Customer->getID()); $Qid->execute(); $item_id = $Qid->valueInt('item_id') + 1; } else { if (empty($this->_contents)) { $item_id = 1; } else { $item_id = max(array_keys($this->_contents)) + 1; } } $this->_contents[$item_id] = array('item_id' => $item_id, 'id' => $product_id, 'parent_id' => (int) $OSCOM_Product->getData('parent_id'), 'name' => $OSCOM_Product->getTitle(), 'model' => $OSCOM_Product->getModel(), 'keyword' => $OSCOM_Product->getKeyword(), 'image' => $OSCOM_Product->getImage(), 'price' => $OSCOM_Product->getPrice(true), 'quantity' => $quantity, 'weight' => $OSCOM_Product->getData('weight'), 'tax_class_id' => $OSCOM_Product->getData('tax_class_id'), 'date_added' => DateTime::getShort(DateTime::getNow()), 'weight_class_id' => $OSCOM_Product->getData('weight_class_id')); if ($OSCOM_Customer->isLoggedOn()) { $Qnew = $OSCOM_PDO->prepare('insert into :table_shopping_carts (customers_id, item_id, products_id, quantity, date_added) values (:customers_id, :item_id, :products_id, :quantity, now())'); $Qnew->bindInt(':customers_id', $OSCOM_Customer->getID()); $Qnew->bindInt(':item_id', $item_id); $Qnew->bindInt(':products_id', $product_id); $Qnew->bindInt(':quantity', $quantity); $Qnew->execute(); } if ($OSCOM_Product->getData('parent_id') > 0) { $Qvariant = $OSCOM_PDO->prepare('select pvg.id as group_id, pvg.title as group_title, pvg.module, pvv.id as value_id, pvv.title as value_title from :table_products_variants pv, :table_products_variants_values pvv, :table_products_variants_groups pvg where pv.products_id = :products_id and pv.products_variants_values_id = pvv.id and pvv.languages_id = :languages_id_pvv and pvv.products_variants_groups_id = pvg.id and pvg.languages_id = :languages_id_pvg'); $Qvariant->bindInt(':products_id', $product_id); $Qvariant->bindInt(':languages_id_pvv', $OSCOM_Language->getID()); $Qvariant->bindInt(':languages_id_pvg', $OSCOM_Language->getID()); $Qvariant->execute(); while ($Qvariant->fetch()) { $group_title = ProductVariants::getGroupTitle($Qvariant->value('module'), $Qvariant->toArray()); $value_title = ProductVariants::getValueTitle($Qvariant->value('module'), $Qvariant->toArray()); $has_custom_value = ProductVariants::hasCustomValue($Qvariant->value('module')); $this->_contents[$item_id]['variants'][] = array('group_id' => $Qvariant->valueInt('group_id'), 'value_id' => $Qvariant->valueInt('value_id'), 'group_title' => $group_title, 'value_title' => $value_title, 'has_custom_value' => $has_custom_value); if ($OSCOM_Customer->isLoggedOn() && $has_custom_value === true) { $Qnew = $OSCOM_PDO->prepare('insert into :table_shopping_carts_custom_variants_values (shopping_carts_item_id, customers_id, products_id, products_variants_values_id, products_variants_values_text) values (:shopping_carts_item_id, :customers_id, :products_id, :products_variants_values_id, :products_variants_values_text)'); $Qnew->bindInt(':shopping_carts_item_id', $item_id); $Qnew->bindInt(':customers_id', $OSCOM_Customer->getID()); $Qnew->bindInt(':products_id', $product_id); $Qnew->bindInt(':products_variants_values_id', $Qvariant->valueInt('value_id')); $Qnew->bindValue(':products_variants_values_text', $value_title); $Qnew->execute(); } } } } $this->_cleanUp(); $this->_calculate(); } }
<td class="productInfoKey">Model:</td> <td class="productInfoValue"><span id="productInfoModel"><?php echo $OSCOM_Product->getModel(); ?> </span></td> </tr> <?php if ($OSCOM_Product->hasAttribute('date_available')) { // HPDL check case ?> <tr> <td class="productInfoKey">Date Available:</td> <td class="productInfoValue"><?php echo DateTime::getShort($OSCOM_Product->getAttribute('date_available')); ?> </td> </tr> <?php } ?> </table> <?php if ($OSCOM_Product->hasVariants()) { ?> <script language="javascript" type="text/javascript">