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($datetime) { $errors = ErrorHandler::getAll(100); $from_timestamp = DateTime::getTimestamp($datetime, 'Y-m-d H:i:s'); $result = 0; foreach ($errors as $error) { if ($error['timestamp'] > $from_timestamp) { $result++; } } 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 initialize() { static::loadConfig(); DateTime::setTimeZone(); ErrorHandler::initialize(); static::setSite(); if (!static::siteExists(static::getSite())) { trigger_error('Site \'' . static::getSite() . '\' does not exist', E_USER_ERROR); exit; } static::setSiteApplication(); call_user_func(array('osCommerce\\OM\\Core\\Site\\' . static::getSite() . '\\Controller', 'initialize')); }
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 start() { $OSCOM_PDO = Registry::get('PDO'); $Qcounter = $OSCOM_PDO->query('select startdate, counter from :table_counter'); $Qcounter->execute(); $result = $Qcounter->fetchAll(); if (count($result) > 0) { $OSCOM_PDO->exec('update :table_counter set counter = counter+1'); } else { $Qcounterupdate = $OSCOM_PDO->prepare('insert into :table_counter (startdate, counter) values (:start_date, 1)'); $Qcounterupdate->bindValue(':start_date', DateTime::getNow()); $Qcounterupdate->execute(); } return true; }
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 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); }
public static function start() { $OSCOM_Database = Registry::get('Database'); $Qcounter = $OSCOM_Database->query('select startdate, counter from :table_counter'); $Qcounter->execute(); if ($Qcounter->numberOfRows()) { $counter_startdate = $Qcounter->value('startdate'); $counter_now = $Qcounter->valueInt('counter') + 1; $Qcounterupdate = $OSCOM_Database->query('update :table_counter set counter = counter+1'); $Qcounterupdate->execute(); } else { $counter_startdate = DateTime::getNow(); $counter_now = 1; $Qcounterupdate = $OSCOM_Database->query('insert into :table_counter (startdate, counter) values (:start_date, 1)'); $Qcounterupdate->bindValue(':start_date', $counter_startdate); $Qcounterupdate->execute(); } return true; }
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 function initialize() { $OSCOM_Database = Registry::get('Database'); $OSCOM_Language = Registry::get('Language'); $OSCOM_Currencies = Registry::get('Currencies'); $Qupcoming = $OSCOM_Database->query('select p.products_id, pa.value as date_expected from :table_products p, :table_templates_boxes tb, :table_product_attributes pa where tb.code = :code and tb.id = pa.id and to_days(str_to_date(pa.value, "%Y-%m-%d")) >= to_days(now()) and pa.products_id = p.products_id and p.products_status = :products_status order by pa.value limit :max_display_upcoming_products'); $Qupcoming->bindValue(':code', 'DateAvailable'); $Qupcoming->bindInt(':products_status', 1); $Qupcoming->bindInt(':max_display_upcoming_products', MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY); if (MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE > 0) { $Qupcoming->setCache('upcoming_products-' . $OSCOM_Language->getCode() . '-' . $OSCOM_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE); } $Qupcoming->execute(); if ($Qupcoming->numberOfRows() > 0) { $this->_content = '<ol style="list-style: none;">'; while ($Qupcoming->next()) { $OSCOM_Product = new Product($Qupcoming->valueInt('products_id')); $this->_content .= '<li>' . DateTime::getLong($Qupcoming->value('date_expected')) . ': ' . osc_link_object(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword()), $OSCOM_Product->getTitle()) . ' ' . $OSCOM_Product->getPriceFormated(true) . '</li>'; } $this->_content .= '</ol>'; } $Qupcoming->freeResult(); }
public function initialize() { $OSCOM_PDO = Registry::get('PDO'); $OSCOM_Language = Registry::get('Language'); $OSCOM_Currencies = Registry::get('Currencies'); $Qupcoming = $OSCOM_PDO->prepare('select p.products_id, pa.value as date_expected from :table_products p, :table_templates_boxes tb, :table_product_attributes pa where tb.code = :code and tb.id = pa.id and to_days(str_to_date(pa.value, "%Y-%m-%d")) >= to_days(now()) and pa.products_id = p.products_id and p.products_status = :products_status order by pa.value limit :max_display_upcoming_products'); $Qupcoming->bindValue(':code', 'DateAvailable'); $Qupcoming->bindInt(':products_status', 1); $Qupcoming->bindInt(':max_display_upcoming_products', MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY); if (MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE > 0) { $Qupcoming->setCache('upcoming_products-' . $OSCOM_Language->getCode() . '-' . $OSCOM_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE); } $Qupcoming->execute(); $result = $Qupcoming->fetchAll(); if (!empty($result)) { $this->_content = '<ol style="list-style: none;">'; foreach ($result as $r) { $OSCOM_Product = new Product($r['products_id']); $this->_content .= '<li>' . DateTime::getLong($r['date_expected']) . ': ' . HTML::link(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword()), $OSCOM_Product->getTitle()) . ' ' . $OSCOM_Product->getPriceFormated(true) . '</li>'; } $this->_content .= '</ol>'; } }
<div class="moduleBox"> <span style="float: right;"><h6><?php echo OSCOM::getDef('order_status') . ' ' . $o['orders_status_name']; ?> </h6></span> <h6><?php echo OSCOM::getDef('order_number') . ' ' . $o['orders_id']; ?> </h6> <div class="content"> <table border="0" width="100%" cellspacing="2" cellpadding="4"> <tr> <td width="50%" valign="top"><?php echo '<b>' . OSCOM::getDef('order_date') . '</b> ' . DateTime::getLong($o['date_purchased']) . '<br /><b>' . $order_type . '</b> ' . HTML::outputProtected($order_name); ?> </td> <td width="30%" valign="top"><?php echo '<b>' . OSCOM::getDef('order_products') . '</b> ' . Order::numberOfProducts($o['orders_id']) . '<br /><b>' . OSCOM::getDef('order_cost') . '</b> ' . strip_tags($o['order_total']); ?> </td> <td width="20%"><?php echo HTML::button(array('href' => OSCOM::getLink(null, null, 'Orders=' . $o['orders_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'SSL'), 'icon' => 'document', 'title' => OSCOM::getDef('button_view'))); ?> </td> </tr> </table> </div> </div>
/** * Deactivate all banners that have passed their schedule * * @access public */ public function expireAll() { $OSCOM_Database = Registry::get('Database'); $Qbanner = $OSCOM_Database->query('select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from :table_banners b, :table_banners_history bh where b.status = 1 and b.banners_id = bh.banners_id group by b.banners_id'); $Qbanner->execute(); while ($Qbanner->next()) { if (!osc_empty($Qbanner->value('expires_date'))) { if (DateTime::getNow() >= $Qbanner->value('expires_date')) { $this->expire($Qbanner->valueInt('banners_id')); } } elseif (!osc_empty($Qbanner->valueInt('expires_impressions'))) { if ($Qbanner->valueInt('expires_impressions') > 0 && $Qbanner->valueInt('banners_shown') >= $Qbanner->valueInt('expires_impressions')) { $this->expire($Qbanner->valueInt('banners_id')); } } } }
<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">
$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'); // } ?>
protected static function log($message) { if (is_writable(OSCOM::BASE_DIRECTORY . 'Work/Logs')) { file_put_contents(OSCOM::BASE_DIRECTORY . 'Work/Logs/update-' . self::$_to_version . '.txt', '[' . DateTime::getNow('d-M-Y H:i:s') . '] ' . $message . "\n", FILE_APPEND); } }
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(); } }
<div style="float: right; text-align: center;"> <?php echo osc_link_object(OSCOM::getLink(null, null, 'Images&' . $OSCOM_Product->getKeyword()), $OSCOM_Image->show($OSCOM_Product->getImage(), $OSCOM_Product->getTitle(), 'hspace="5" vspace="5"', 'thumbnail'), 'target="_blank" onclick="window.open(\'' . OSCOM::getLink(null, null, 'Images&' . $OSCOM_Product->getKeyword()) . '\', \'popUp\', \'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=' . ($OSCOM_Product->numberOfImages() > 1 ? $OSCOM_Image->getWidth('large') + $OSCOM_Image->getWidth('thumbnails') * 2 + 70 : $OSCOM_Image->getWidth('large') + 20) . ',height=' . ($OSCOM_Image->getHeight('large') + 20) . '\'); return false;"'); ?> <?php echo '<p>' . osc_link_object(OSCOM::getLink(null, 'Cart', 'Add&' . $OSCOM_Product->getKeyword()), osc_draw_image_button('button_in_cart.gif', OSCOM::getDef('button_add_to_cart'))) . '</p>'; ?> </div> <?php } ?> <p><?php echo osc_image(DIR_WS_IMAGES . 'stars_' . $Qreviews->valueInt('reviews_rating') . '.png', sprintf(OSCOM::getDef('rating_of_5_stars'), $Qreviews->valueInt('reviews_rating'))) . ' ' . sprintf(OSCOM::getDef('reviewed_by'), $Qreviews->valueProtected('customers_name')) . '; ' . DateTime::getLong($Qreviews->value('date_added')); ?> </p> <p><?php echo nl2br(wordwrap($Qreviews->valueProtected('reviews_text'), 60, '­')); ?> </p> <div class="submitFormButtons"> <span style="float: right;"><?php echo osc_link_object(OSCOM::getLink(null, null, 'Reviews&Write&' . $OSCOM_Product->getKeyword()), osc_draw_image_button('button_write_review.gif', OSCOM::getDef('button_write_review'))); ?> </span> <?php
<?php echo osc_image(DIR_WS_IMAGES . $OSCOM_Template->getPageImage(), $OSCOM_Template->getPageTitle(), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'id="pageIcon"'); ?> <h1><?php echo $OSCOM_Template->getPageTitle(); ?> </h1> <?php while ($Qreviews->next()) { ?> <div class="moduleBox"> <div style="float: right; margin-top: 5px;"><?php echo sprintf(OSCOM::getDef('review_date_added'), DateTime::getLong($Qreviews->value('date_added'))); ?> </div> <h6><?php echo osc_link_object(OSCOM::getLink(null, 'Products', 'Reviews&View=' . $Qreviews->valueInt('reviews_id') . '&' . $Qreviews->value('products_keyword')), $Qreviews->value('products_name')); ?> (<?php echo sprintf(OSCOM::getDef('reviewed_by'), $Qreviews->valueProtected('customers_name')); ?> )</h6> <div class="content"> <?php if (!osc_empty($Qreviews->value('image'))) {
<tr> <td width="<?php echo $OSCOM_Image->getWidth('thumbnails') + 10; ?> " valign="top" align="center"> <?php if ($OSCOM_Product->hasImage()) { echo osc_link_object(OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()), $OSCOM_Image->show($OSCOM_Product->getImage(), $OSCOM_Product->getTitle())); } ?> </td> <td valign="top"><?php echo osc_link_object(OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()), '<b><u>' . $OSCOM_Product->getTitle() . '</u></b>') . '<br />' . OSCOM::getDef('date_added') . ' ' . DateTime::getLong($OSCOM_Product->getDateAdded()) . '<br />' . OSCOM::getDef('manufacturer') . ' ' . $OSCOM_Product->getManufacturer() . '<br /><br />' . OSCOM::getDef('price') . ' ' . $OSCOM_Product->getPriceFormated(); ?> </td> <td align="right" valign="middle"><?php echo osc_link_object(OSCOM::getLink(null, 'Cart', 'Add&' . $OSCOM_Product->getKeyword()), osc_draw_image_button('button_in_cart.gif', OSCOM::getDef('button_add_to_cart'))); ?> </td> </tr> <tr> <td colspan="3"> </td> </tr> <?php } } else { ?>
public static function sendEmail($id) { $OSCOM_PDO = Registry::get('PDO'); $OSCOM_Currencies = Registry::get('Currencies'); $OSCOM_Language = Registry::get('Language'); $Qorder = $OSCOM_PDO->prepare('select * from :table_orders where orders_id = :orders_id limit 1'); $Qorder->bindInt(':orders_id', $id); $Qorder->execute(); if ($Qorder->fetch() !== false) { $email_order = STORE_NAME . "\n" . OSCOM::getDef('email_order_separator') . "\n" . sprintf(OSCOM::getDef('email_order_order_number'), $id) . "\n" . sprintf(OSCOM::getDef('email_order_invoice_url'), OSCOM::getLink('Shop', 'Account', 'Orders=' . $id, 'SSL', false, true, true)) . "\n" . sprintf(OSCOM::getDef('email_order_date_ordered'), DateTime::getLong()) . "\n\n" . OSCOM::getDef('email_order_products') . "\n" . OSCOM::getDef('email_order_separator') . "\n"; $Qproducts = $OSCOM_PDO->prepare('select orders_products_id, products_model, products_name, products_price, products_tax, products_quantity from :table_orders_products where orders_id = :orders_id order by orders_products_id'); $Qproducts->bindInt(':orders_id', $id); $Qproducts->execute(); while ($Qproducts->fetch()) { $email_order .= $Qproducts->valueInt('products_quantity') . ' x ' . $Qproducts->value('products_name') . ' (' . $Qproducts->value('products_model') . ') = ' . $OSCOM_Currencies->displayPriceWithTaxRate($Qproducts->value('products_price'), $Qproducts->value('products_tax'), $Qproducts->valueInt('products_quantity'), false, $Qorder->value('currency'), $Qorder->value('currency_value')) . "\n"; $Qvariants = $OSCOM_PDO->prepare('select group_title, value_title from :table_orders_products_variants where orders_id = :orders_id and orders_products_id = :orders_products_id order by id'); $Qvariants->bindInt(':orders_id', $id); $Qvariants->bindInt(':orders_products_id', $Qproducts->valueInt('orders_products_id')); $Qvariants->execute(); while ($Qvariants->fetch()) { $email_order .= "\t" . $Qvariants->value('group_title') . ': ' . $Qvariants->value('value_title') . "\n"; } } $email_order .= OSCOM::getDef('email_order_separator') . "\n"; $Qtotals = $OSCOM_PDO->prepare('select title, text from :table_orders_total where orders_id = :orders_id order by sort_order'); $Qtotals->bindInt(':orders_id', $id); $Qtotals->execute(); while ($Qtotals->fetch()) { $email_order .= strip_tags($Qtotals->value('title') . ' ' . $Qtotals->value('text')) . "\n"; } if (strlen($Qorder->value('delivery_name')) > 0 && strlen($Qorder->value('delivery_street_address')) > 0) { $address = array('name' => $Qorder->value('delivery_name'), 'company' => $Qorder->value('delivery_company'), 'street_address' => $Qorder->value('delivery_street_address'), 'suburb' => $Qorder->value('delivery_suburb'), 'city' => $Qorder->value('delivery_city'), 'state' => $Qorder->value('delivery_state'), 'zone_code' => $Qorder->value('delivery_state_code'), 'country_title' => $Qorder->value('delivery_country'), 'country_iso2' => $Qorder->value('delivery_country_iso2'), 'country_iso3' => $Qorder->value('delivery_country_iso3'), 'postcode' => $Qorder->value('delivery_postcode'), 'format' => $Qorder->value('delivery_address_format')); $email_order .= "\n" . OSCOM::getDef('email_order_delivery_address') . "\n" . OSCOM::getDef('email_order_separator') . "\n" . Address::format($address) . "\n"; } $address = array('name' => $Qorder->value('billing_name'), 'company' => $Qorder->value('billing_company'), 'street_address' => $Qorder->value('billing_street_address'), 'suburb' => $Qorder->value('billing_suburb'), 'city' => $Qorder->value('billing_city'), 'state' => $Qorder->value('billing_state'), 'zone_code' => $Qorder->value('billing_state_code'), 'country_title' => $Qorder->value('billing_country'), 'country_iso2' => $Qorder->value('billing_country_iso2'), 'country_iso3' => $Qorder->value('billing_country_iso3'), 'postcode' => $Qorder->value('billing_postcode'), 'format' => $Qorder->value('billing_address_format')); $email_order .= "\n" . OSCOM::getDef('email_order_billing_address') . "\n" . OSCOM::getDef('email_order_separator') . "\n" . Address::format($address) . "\n\n"; $Qstatus = $OSCOM_PDO->prepare('select orders_status_name from :table_orders_status where orders_status_id = :orders_status_id and language_id = :language_id'); $Qstatus->bindInt(':orders_status_id', $Qorder->valueInt('orders_status')); $Qstatus->bindInt(':language_id', $OSCOM_Language->getID()); $Qstatus->execute(); $email_order .= sprintf(OSCOM::getDef('email_order_status'), $Qstatus->value('orders_status_name')) . "\n" . OSCOM::getDef('email_order_separator') . "\n"; $Qstatuses = $OSCOM_PDO->prepare('select date_added, comments from :table_orders_status_history where orders_id = :orders_id and comments != "" order by orders_status_history_id'); $Qstatuses->bindInt(':orders_id', $id); $Qstatuses->execute(); while ($Qstatuses->fetch()) { $email_order .= DateTime::getLong($Qstatuses->value('date_added')) . "\n\t" . wordwrap(str_replace("\n", "\n\t", $Qstatuses->value('comments')), 60, "\n\t", 1) . "\n\n"; } // HPDL // if (is_object($GLOBALS[$payment])) { // $email_order .= OSCOM::getDef('email_order_payment_method') . "\n" . // OSCOM::getDef('email_order_separator') . "\n"; // $email_order .= $OSCOM_ShoppingCart->getBillingMethod('title') . "\n\n"; // if (isset($GLOBALS[$payment]->email_footer)) { // $email_order .= $GLOBALS[$payment]->email_footer . "\n\n"; // } // } $oEmail = new Mail($Qorder->value('customers_name'), $Qorder->value('customers_email_address'), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, OSCOM::getDef('email_order_subject')); $oEmail->setBodyPlain($email_order); $oEmail->send(); // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { $oEmail = new Mail('', SEND_EXTRA_ORDER_EMAILS_TO, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, OSCOM::getDef('email_order_subject')); $oEmail->setBodyPlain($email_order); $oEmail->send(); } } }
/** * Generate a time zone selection menu * * @param $name string The name of the selection field * @param $default The default value * @return string * @since v3.0.1 */ public static function timeZoneSelectMenu($name, $default = null) { if (!isset($default)) { $default = date_default_timezone_get(); } $result = array(); foreach (DateTime::getTimeZones() as $zone => $zones_array) { foreach ($zones_array as $key => $value) { $result[] = array('id' => $key, 'text' => $value, 'group' => $zone); } } return HTML::selectMenu($name, $result, $default); }
<div style="float: right; text-align: center;"> <?php echo HTML::link(OSCOM::getLink(null, null, 'Images&' . $OSCOM_Product->getKeyword()), $OSCOM_Image->show($OSCOM_Product->getImage(), $OSCOM_Product->getTitle(), 'hspace="5" vspace="5"', 'thumbnail'), 'target="_blank" onclick="window.open(\'' . OSCOM::getLink(null, null, 'Images&' . $OSCOM_Product->getKeyword()) . '\', \'popUp\', \'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=' . ($OSCOM_Product->numberOfImages() > 1 ? $OSCOM_Image->getWidth('large') + $OSCOM_Image->getWidth('thumbnails') * 2 + 70 : $OSCOM_Image->getWidth('large') + 20) . ',height=' . ($OSCOM_Image->getHeight('large') + 20) . '\'); return false;"'); ?> <?php echo '<p>' . HTML::button(array('href' => OSCOM::getLink(null, 'Cart', 'Add&' . $OSCOM_Product->getKeyword()), 'icon' => 'cart', 'title' => OSCOM::getDef('button_add_to_cart'))) . '</p>'; ?> </div> <?php } ?> <p><?php echo HTML::image(OSCOM::getPublicSiteLink('images/stars_' . $Qreviews->valueInt('reviews_rating') . '.png'), sprintf(OSCOM::getDef('rating_of_5_stars'), $Qreviews->valueInt('reviews_rating'))) . ' ' . sprintf(OSCOM::getDef('reviewed_by'), $Qreviews->valueProtected('customers_name')) . '; ' . DateTime::getLong($Qreviews->value('date_added')); ?> </p> <p><?php echo nl2br(wordwrap($Qreviews->valueProtected('reviews_text'), 60, '­')); ?> </p> <div class="submitFormButtons"> <span style="float: right;"><?php echo HTML::button(array('href' => OSCOM::getLink(null, null, 'Reviews&Write&' . $OSCOM_Product->getKeyword()), 'icon' => 'pencil', 'title' => OSCOM::getDef('button_write_review'))); ?> </span> <?php
public static function import($filename) { $error_log = file($filename); unlink($filename); if (!is_resource(self::$_dbh)) { self::connect(); } foreach ($error_log as $error) { if (preg_match('/^\\[([0-9]{2})-([A-Za-z]{3})-([0-9]{4}) ([0-9]{2}):([0-5][0-9]):([0-5][0-9])\\] (.*)$/', $error)) { $timestamp = DateTime::getTimestamp(substr($error, 1, 20), 'd-M-Y H:i:s'); $message = substr($error, 23); $Qinsert = self::$_dbh->prepare('insert into error_log (timestamp, message) values (:timestamp, :message)'); $Qinsert->bindInt(':timestamp', $timestamp); $Qinsert->bindValue(':message', $message); $Qinsert->execute(); } } }
echo OSCOM::getDef('field_last_name'); ?> </label><?php echo HTML::inputField('lastname', $new_customer ? null : $OSCOM_ObjectInfo->get('customers_lastname')); ?> </p> <?php if (ACCOUNT_DATE_OF_BIRTH == '1') { ?> <p><label for="dob"><?php echo OSCOM::getDef('field_date_of_birth'); ?> </label><?php echo HTML::inputField('dob', $new_customer ? null : DateTime::fromUnixTimestamp(DateTime::getTimestamp($OSCOM_ObjectInfo->get('customers_dob')), 'Y-m-d')); ?> </p> <script>$('#dob').datepicker({dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, yearRange: '-100:+0'});</script> <?php } ?> <p><label for="email_address"><?php echo OSCOM::getDef('field_email_address'); ?> </label><?php echo HTML::inputField('email_address', $new_customer ? null : $OSCOM_ObjectInfo->get('customers_email_address')); ?>
} $counter = 0; $reviews_listing = Reviews::getListing($OSCOM_Product->getID()); foreach ($reviews_listing['entries'] as $r) { $counter++; if ($counter > 1) { ?> <hr style="height: 1px; width: 150px; text-align: left; margin-left: 0px" /> <?php } ?> <p><?php echo HTML::image(OSCOM::getPublicSiteLink('images/stars_' . (int) $r['reviews_rating'] . '.png'), sprintf(OSCOM::getDef('rating_of_5_stars'), (int) $r['reviews_rating'])) . ' ' . sprintf(OSCOM::getDef('reviewed_by'), HTML::outputProtected($r['customers_name'])) . '; ' . DateTime::getLong($r['date_added']); ?> </p> <p><?php echo nl2br(wordwrap(HTML::outputProtected($r['reviews_text']), 60, '­')); ?> </p> <?php } ?> <div class="listingPageLinks"> <span style="float: right;"><?php echo PDO::getBatchPageLinks('page', $reviews_listing['total'], OSCOM::getAllGET('page'));
use osCommerce\OM\Core\Site\Shop\Reviews; $reviews_listing = Reviews::getListing(); ?> <h1><?php echo $OSCOM_Template->getPageTitle(); ?> </h1> <?php foreach ($reviews_listing['entries'] as $r) { ?> <div class="moduleBox"> <div style="float: right; margin-top: 5px;"><?php echo sprintf(OSCOM::getDef('review_date_added'), DateTime::getLong($r['date_added'])); ?> </div> <h6><?php echo HTML::link(OSCOM::getLink(null, 'Products', 'Reviews&View=' . $r['reviews_id'] . '&' . $r['products_keyword']), $r['products_name']); ?> (<?php echo sprintf(OSCOM::getDef('reviewed_by'), HTML::outputProtected($r['customers_name'])); ?> )</h6> <div class="content"> <?php if (!empty($r['image'])) {