本文整理汇总了PHP中ISC_SetCookie函数的典型用法代码示例。如果您正苦于以下问题:PHP ISC_SetCookie函数的具体用法?PHP ISC_SetCookie怎么用?PHP ISC_SetCookie使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ISC_SetCookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TrackVisitor
/**
* Actually track a visitor.
*/
function TrackVisitor()
{
$today_stamp = mktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
if (!isset($_COOKIE['STORE_VISITOR'])) {
// We have a new visitor, let's track that.
$query = sprintf("SELECT COUNT(uniqueid) AS num FROM [|PREFIX|]unique_visitors WHERE datestamp='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($today_stamp));
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
if ($row['num'] == 0) {
// This person is the first to visit the site today, so track it
$new_visitor = array("datestamp" => $today_stamp, "numuniques" => 1);
$GLOBALS['ISC_CLASS_DB']->InsertQuery("unique_visitors", $new_visitor);
} else {
// At least one person has visited the site today, just update the record
$query = sprintf("UPDATE [|PREFIX|]unique_visitors SET numuniques=numuniques+1 WHERE datestamp='%d'", $today_stamp);
// Run the query to update the number of unique visitors
$GLOBALS['ISC_CLASS_DB']->Query($query);
}
// Set the tracking cookie for another 24 hours
ISC_SetCookie("STORE_VISITOR", true, time() + 86400);
}
header("Content-type: image/gif");
echo base64_decode('R0lGODlhAQABALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//wBiZCH5BAEAAA8ALAAAAAABAAEAAAQC8EUAOw==');
exit;
}
示例2: CreateSession
public function CreateSession()
{
$this->_token = session_id();
$newSession = array("sessionhash" => $this->_token, "sessdata" => "", "sesslastupdated" => time());
$this->_id = $GLOBALS['ISC_CLASS_DB']->InsertQuery("sessions", $newSession);
$this->_new_session = true;
$this->_data = array();
ISC_SetCookie("SHOP_SESSION_TOKEN", $this->_token, time() + (int) @ini_get('session.gc_maxlifetime'));
}
示例3: editOrderSaveAction
//.........这里部分代码省略.........
// Process a payment
$paymentMethod = Interspire_Request::post('paymentMethod');
$providerSuccess = false;
// Retrieve the payment method details
$paymentFields = Interspire_Request::post('paymentField');
if (!empty($paymentFields[$paymentMethod])) {
$paymentFields = $paymentFields[$paymentMethod];
}
else {
$paymentFields = array();
}
if ($quote->getGrandTotalWithStoreCredit() > 0 && ($adding || empty($order['ordpaymentstatus']) || empty($order['orderpaymentmodule'])) && !empty($paymentMethod)) {
$gatewayAmount = $quote->getGrandTotalWithStoreCredit();
$provider = null;
// was a custom payment specified?
if ($paymentMethod == 'custom') {
$paymentMethodName = $paymentFields['custom_name'];
$providerSuccess = true;
}
// actual payment module
else {
GetModuleById('checkout', $provider, $paymentMethod);
if(is_object($provider)) {
$paymentMethodName = $provider->GetDisplayName();
if (method_exists($provider, 'ProcessManualPayment')) {
// set the order token as required by various payment methods
ISC_SetCookie('SHOP_ORDER_TOKEN', $order['ordtoken'], time() + (3600*24), true);
// make the token immediately available
$_COOKIE['SHOP_ORDER_TOKEN'] = $order['ordtoken'];
// process the payment
$result = $provider->ProcessManualPayment($order, $paymentFields);
if ($result['result']) {
$providerSuccess = true;
$gatewayAmount = $result['amount'];
FlashMessage(GetLang('OrderPaymentSuccess', array('amount' => FormatPrice($gatewayAmount), 'orderId' => $orderId, 'provider' => $paymentMethodName)), MSG_SUCCESS);
}
else {
$errors[] = GetLang('OrderPaymentFail', array('orderId' => $orderId, 'provider' => $paymentMethodName, 'reason' => $result['message']));
}
}
else {
// all manual/offline methods will always be successfull
$providerSuccess = true;
}
}
else {
// failed to get a payment module
}
}
// if the grand total after minus the coupon,etc is 0 and it's adding order also the payment method is custom.
} else if ($quote->getGrandTotalWithStoreCredit() == 0 && ($adding || empty($order['ordpaymentstatus']) || empty($order['orderpaymentmodule'])) && $paymentMethod == 'custom') {
$paymentMethodName = $paymentFields['custom_name'];
$providerSuccess = true;
}
// was payment successfull?
if ($providerSuccess) {
示例4: SetPanelSettings
//.........这里部分代码省略.........
if (!empty($searchedProductIds) && $this->is_subarray($pIdArr, $searchedProductIds)) {
$hasProds = true;
$GLOBALS['CustomPage'] .= $subArr['description'];
}
}
if ($hasProds) {
$GLOBALS['YMMTableDisplay'] = 'block';
} else {
//if there is no static items, show the dynamic page
if (!empty($searchedProductIds)) {
$GLOBALS['DynamicDisplay'] = 'block';
}
$GLOBALS['YMMTableDisplay'] = 'block';
}
}
//lguan_20100612: Show overal product rating at category landing page
if ($category_rating != 0) {
//$GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='".$GLOBALS['TPL_PATH']."/images/IcoRating$category_rating.gif' alt='' /></h2>";
}
// $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>";
//wirror_20110324: replace the empyt ymm selector with the given picture
if (!isset($GLOBALS['YMMTable']) || !$GLOBALS['YMMTable']) {
$GLOBALS['YMMTable'] = "<img src='/images/mmy-middle-6.jpg'/>";
}
$GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListingMain");
/*
//alandy_2012-1-19 modify.
if(isset($GLOBALS['showDialog']) && !empty($GLOBALS['showDialog'])){
$showDialog = true;
}
*/
if ($GLOBALS['results_page_flag'] == 0 && !isset($params['srch_category'])) {
$GLOBALS['SearchLink'] = "";
if (isset($params['searchtext'])) {
$GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['searchtext']));
}
if (isset($params['search'])) {
$GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['search']));
}
if (isset($params['model']) && !isset($params['make'])) {
$GLOBALS['SearchLink'] .= "/model/" . MakeURLSafe(strtolower($params['model']));
}
if (isset($params['model_flag']) && $params['model_flag'] == 0 && !isset($params['make'])) {
$GLOBALS['SearchLink'] .= "/model_flag/" . MakeURLSafe(strtolower($params['model_flag']));
}
$GLOBALS['SearchResults'] = "";
if (isset($GLOBALS['YMMTable']) && $GLOBALS['YMMTable'] !== "<img src='/images/mmy-middle-6.jpg'/>") {
$GLOBALS['SearchResults'] .= "<div>" . $GLOBALS['YMMTable'] . "</div>";
}
if ($_REQUEST['is_smart_search']) {
$GLOBALS['SearchResults'] .= '<p class="ErrorMessage">' . GetLang('SearchYourSearch') . ' <strong>"' . htmlspecialchars($GLOBALS['OriginalSearchQuery']) . '"</strong> ' . GetLang('SearchDidNotMatch') . '</p>';
if ($GLOBALS['OriginalSearchQuery'] == '') {
$GLOBALS['SearchTitle'] = '';
} else {
$GLOBALS['SearchTitle'] = " " . sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']);
//$GLOBALS['SearchTitle'] = GetLang('SearchResultsFor');
}
}
//$GLOBALS['SearchResults'] .= "<div style='width:100%'><p class='InfoMessage'>Please choose a category or brand</p></div>";
$GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t\t\t\t%%Panel.StaticFeaturedBrands%%";
$GLOBALS['HidePanels'][] = 'SearchPagingTop';
}
}
$GLOBALS['SearchResults'] .= "<script type=\"text/javascript\"> \$('.focushiddendiv').css({'position':'absolute', 'margin-top':'-200px', 'display':'block'}); </script>";
if ($GLOBALS['EnableSEOUrls'] == 1) {
$back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']);
} else {
$back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING'];
}
ISC_SetCookie("back2search", $back2url, 0, "/");
// Showing the syndication option?
if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) {
$GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_NEWSEARCH']->GetQuery(), 0, false);
$GLOBALS['SNIPPETS']['SearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultsFeed");
}
/*
//alandy_2012-1-16 add logic.
if(isset($showDialog) && $showDialog){
$GLOBALS['Displaydialog'] = 5;
}
*/
} else {
if (isset($GLOBALS['showDialog']) && !empty($GLOBALS['showDialog'])) {
$GLOBALS['Displaydialog'] = 5;
unset($GLOBALS['showDialog']);
}
$this->YMMSelectors($params);
//alandy_2012-2-6 hidde middle ymm selector.
//$GLOBALS['SearchResults'] = "<div>".$GLOBALS['YMMTable']."</div>";
$GLOBALS['SearchResults'] = '';
$GLOBALS['CategoryBrandList'] = "\n\t\t\t\n\t\t\t %%Panel.StaticFeaturedCategories%%\n\t\t\t\t %%Panel.StaticFeaturedBrands%%\n\t\t\t\t ";
// No search results were found
// commented below code as need to show the favorite categories and brands as in homepage
// $GLOBALS['HideSearchResults'] = "none";
//$GLOBALS['HidePanels'][] = 'SearchPageProducts';
}
//var_dump($GLOBALS['SearchResults']);exit;
}
示例5: SetPanelSettings
//.........这里部分代码省略.........
unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']);
$i = 0;
foreach ($get_variables as $key => $value) {
$sort_qry .= "&{$key}={$value}";
}
if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') {
$sort = "asc ";
$img = " <img src='{$path}/templates/default/images/ArrowDown.gif' border=0>";
} else {
$sort = "desc ";
$img = " <img src='{$path}/templates/default/images/ArrowUp.gif' border=0>";
}
//wirror_code_mark_begin
//$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas
if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
$path = $path . "/a-b-testing";
if ($GLOBALS['EnableSEOUrls'] == 1) {
$GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand / Series</a>";
$GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Image / Part#</a>";
$GLOBALS['ProductDetails'] = "<a href='{$path}{$mmy_links}/orderby/prodfinalprice/sortby/{$sort}'>Price</a>";
} else {
$GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand / Series</a>";
$GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Image / Part#</a>";
$GLOBALS['ProductDetails'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodfinalprice&sortby={$sort}'>Price</a>";
}
if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') {
$GLOBALS['ProductBrand'] .= $img;
}
$GLOBALS['ProductVQ'] = $vq_column_title;
/*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname')
$GLOBALS['Product_VQ'] .= $img;*/
if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') {
$GLOBALS['ProductPartNumber'] .= $img;
}
$GLOBALS['ProductPQ'] = "Product Options";
/*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption')
$GLOBALS['SearchResults'] .= $img;*/
if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') {
$GLOBALS['ProductPrice'] .= $img;
}
if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodfinalprice') {
$GLOBALS['ProductDetails'] .= $img;
}
$GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryProductsItemHeader");
} else {
//lguan_20100612: Show overal product rating at category landing page
/*if($category_rating != 0)
{
$GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='".$GLOBALS['TPL_PATH']."/images/IcoRating$category_rating.gif' alt='' /></h2>";
}*/
// $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>";
$GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryListingMain");
if ($GLOBALS['results_page_flag'] == 0 && !isset($params['srch_category'])) {
$GLOBALS['SearchLink'] = "";
if (isset($params['searchtext'])) {
$GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['searchtext']));
}
if (isset($params['search'])) {
$GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['search']));
}
if (isset($params['model']) && !isset($params['make'])) {
$GLOBALS['SearchLink'] .= "/model/" . MakeURLSafe(strtolower($params['model']));
}
if (isset($params['model_flag']) && $params['model_flag'] == 0 && !isset($params['make'])) {
$GLOBALS['SearchLink'] .= "/model_flag/" . MakeURLSafe(strtolower($params['model_flag']));
}
$GLOBALS['SearchResults'] = "";
if (isset($GLOBALS['YMMTable'])) {
$GLOBALS['SearchResults'] .= "<div>" . $GLOBALS['YMMTable'] . "</div>";
}
if ($_REQUEST['is_smart_search']) {
$GLOBALS['SearchResults'] .= '<p class="ErrorMessage">' . GetLang('SearchYourSearch') . ' <strong>"' . htmlspecialchars($GLOBALS['OriginalSearchQuery']) . '"</strong> ' . GetLang('SearchDidNotMatch') . '</p>';
if ($GLOBALS['OriginalSearchQuery'] == '') {
$GLOBALS['SearchTitle'] = '';
} else {
$GLOBALS['SearchTitle'] = " " . sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']);
}
}
//$GLOBALS['SearchResults'] .= "<div style='width:100%'><p class='InfoMessage'>Please choose a category or brand</p></div>";
$GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t\t\t\t%%Panel.StaticFeaturedBrands%%";
$GLOBALS['HidePanels'][] = 'SearchPagingTop';
}
}
$GLOBALS['SearchResults'] .= "<script type=\"text/javascript\"> \$('.focushiddendiv').css({'position':'absolute', 'margin-top':'-200px', 'display':'block'}); </script>";
if ($GLOBALS['EnableSEOUrls'] == 1) {
$back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']);
} else {
$back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING'];
}
ISC_SetCookie("back2search", $back2url, 0, "/");
} else {
$this->YMMSelectors($params);
$GLOBALS['SearchResults'] = "<div>" . $GLOBALS['YMMTable'] . "</div>";
$GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t%%Panel.StaticFeaturedBrands%%";
// No search results were found
// commented below code as need to show the favorite categories and brands as in homepage
/*$GLOBALS['HideSearchResults'] = "none";
$GLOBALS['HidePanels'][] = 'SearchPageProducts';*/
}
}
示例6: _AddToRecentlyViewedProducts
public function _AddToRecentlyViewedProducts()
{
/*
Store this product's ID in a persistent cookie
that will be used to remember the last 5 products
that this person has viewed
*/
$viewed_products = array();
if (isset($_COOKIE['RECENTLY_VIEWED_PRODUCTS'])) {
$viewed_products = explode(",", $_COOKIE['RECENTLY_VIEWED_PRODUCTS']);
}
if (in_array($this->GetProductId(), $viewed_products)) {
// Remove it from the array
foreach ($viewed_products as $k => $v) {
if ($v == $this->GetProductId()) {
unset($viewed_products[$k]);
}
}
}
// Add it to the list
$viewed_products[] = $this->GetProductId();
// Only store the 5 most recent product Id's
if (count($viewed_products) > 5) {
$reverse_viewed_products = array_reverse($viewed_products);
$viewed_products = array();
for ($i = 0; $i < 5; $i++) {
$viewed_products[] = $reverse_viewed_products[$i];
}
// Reverse the array so the oldest products show first
$viewed_products = array_reverse($viewed_products);
}
$new_viewed_products = implode(",", $viewed_products);
// Persist the cookie for 30 days
ISC_SetCookie("RECENTLY_VIEWED_PRODUCTS", $new_viewed_products, time() + 3600 * 24 * 30);
// Persist the cookie session-wide for use on the cart page
$_SESSION['RECENTLY_VIEWED_PRODUCTS'] = $new_viewed_products;
}
示例7: ProcessLogin
public function ProcessLogin()
{
//zcs=>authenticate captcha when it is not a QA user
if (GetConfig('UserQA') != $_POST['username']) {
$GLOBALS['ISC_CLASS_CAPTCHA'] = GetClass('ISC_CAPTCHA');
$captcha = trim($_REQUEST['captcha']);
if (isc_strtolower($captcha) != isc_strtolower($GLOBALS['ISC_CLASS_CAPTCHA']->LoadSecret())) {
// Captcha validation failed
$GLOBALS['ISC_CLASS_ADMIN_AUTH']->DoLogin(false, false, GetLang('InvalidCaptcha'));
die;
}
}
//<=zcs
$loginName = '';
$loginPass = '';
if ((!isset($_POST['username']) || !isset($_POST['password'])) && !isset($_COOKIE['RememberToken'])) {
$GLOBALS['ISC_CLASS_ADMIN_AUTH']->DoLogin(true);
return;
}
// Is this an automatic login from "Remember Me" being ticked?
if (isset($_POST['username'])) {
$loginName = @$_POST['username'];
$loginPass = @$_POST['password'];
//zcs= add "fails" "userstatus" & remove " and userstatus='1'"
$query = sprintf("SELECT pk_userid, username, userpass, token, userimportpass, fails, userstatus FROM [|PREFIX|]users WHERE username='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($loginName));
} else {
if (isset($_COOKIE['RememberToken']) && trim($_COOKIE['RememberToken']) != '') {
$md5 = $_COOKIE['RememberToken'];
//zcs= add "fails" "userstatus" & remove " userstatus='1' AND"
$query = sprintf("SELECT pk_userid, username, userpass, token, userimportpass, fails, userstatus FROM [|PREFIX|]users WHERE md5(concat(username, token))='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($md5));
} else {
// Otherwise, we have a bad username/password
$GLOBALS['ISC_CLASS_LOG']->LogAdminAction("invalid", $loginName);
$GLOBALS['ISC_CLASS_ADMIN_AUTH']->DoLogin(true);
die;
}
}
if (isset($_POST['remember']) || isset($_COOKIE['RememberToken'])) {
$remember = true;
} else {
$remember = false;
}
ob_start();
// Try and find a user with the same credentials
$userResult = $GLOBALS["ISC_CLASS_DB"]->Query($query);
if ($userRow = $GLOBALS["ISC_CLASS_DB"]->Fetch($userResult)) {
//zcs=>if already locked user, change message & get out
if ($userRow['userstatus'] == 0) {
$GLOBALS['ISC_CLASS_LOG']->LogAdminAction("has been locked", $loginName);
$GLOBALS['ISC_CLASS_ADMIN_AUTH']->DoLogin(false, false, GetLang('LockedUser'));
die;
}
//<=zcs
if (!$remember) {
ISC_SetCookie("RememberToken", "", time() - 3600 * 24 * 365, true);
}
// Was this an improted password?
if ($userRow['userimportpass'] != '' && $userRow['userpass'] != md5($loginPass)) {
if (ValidateImportPassword($loginPass, $userRow['userimportpass'])) {
// Valid login from an import password. We now store the Interspire Shopping Cart version of the password
$updatedUser = array("userpass" => md5($loginPass), "userimportpass" => "", 'fails' => 0);
$GLOBALS['ISC_CLASS_DB']->UpdateQuery("users", $updatedUser, "pk_userid='" . $GLOBALS['ISC_CLASS_DB']->Quote($userRow['pk_userid']) . "'");
} else {
$this->doLoginFailed($userRow['pk_userid'], $userRow['fails']);
//zcs=if failed
unset($userRow['pk_userid']);
}
} else {
// Is this a "Remember Me" auto login or a form login?
if (isset($_POST['username'])) {
if ($userRow['userpass'] != md5($loginPass)) {
$this->doLoginFailed($userRow['pk_userid'], $userRow['fails']);
//zcs=if failed
unset($userRow['pk_userid']);
} else {
//zcs=>clear last fails
if ($userRow['fails'] > 0) {
$this->clearFails($userRow['pk_userid']);
}
//<=zcs
}
} else {
// If they get here then "Remember Me" was set and valid so we don't have to do anything
}
}
if (isset($userRow['pk_userid'])) {
// Set the auth session variable to true
$_COOKIE['STORESUITE_CP_TOKEN'] = $userRow['token'];
ISC_SetCookie("STORESUITE_CP_TOKEN", $userRow['token'], 0, true);
if ($remember) {
ISC_SetCookie("RememberToken", md5($userRow['username'] . $userRow['token']), time() + 3600 * 24 * 365, true);
}
// Log the successful login to the administrators log
$GLOBALS['ISC_CLASS_LOG']->LogAdminAction("valid");
// Everything was OK and the user has been logged in successfully
?>
<script type="text/javascript">
document.location.href='index.php?ToDo=';
</script>
<?php
//.........这里部分代码省略.........
示例8: SaveDefaultSortField
/**
* Saves a users sort order in a cookie for when they return to the page later (preserve their sort order)
*
* @param string Unique identifier for the page we're saving this preference for.
* @param string The field we're sorting by.
* @param string The order we're sorting in.
*/
function SaveDefaultSortField($section, $field, $order)
{
ISC_SetCookie("SORTING_PREFS[" . $section . "]", serialize(array($field, $order)));
}
示例9: SavePendingOrder
/**
* Create the pending order in the database with the customers selected payment details, etc.
*
* @return array An array containing information about what needs to be done next.
*/
public function SavePendingOrder()
{
$provider = null;
$verifyPaymentProvider = true;
$redirectToFinishOrder = false;
$providerId = '';
$pendingOrderResult = array();
if (!isset($_SESSION['CHECKOUT']['PENDING_DATA'])) {
return false;
}
// Did they agree to signup to any mailing lists?
if (isset($_POST['join_mailing_list'])) {
ISC_SetCookie("JOIN_MAILING_LIST", 1, time() + 3600 * 24 * 7);
}
if (isset($_POST['join_order_list'])) {
ISC_SetCookie("JOIN_ORDER_LIST", 1, time() + 3600 * 24 * 7);
}
$orderTotal = $_SESSION['CHECKOUT']['PENDING_DATA']['ORDER_TOTAL'];
$giftCertificateAmount = $_SESSION['CHECKOUT']['PENDING_DATA']['GIFTCERTIFICATE_AMOUNT'];
$gatewayAmount = $_SESSION['CHECKOUT']['PENDING_DATA']['GATEWAY_AMOUNT'];
$creditUsed = 0;
$giftCertificates = array();
// Find out what currency we are using. We'll need this later to display their previous orders in the currency that they have selected
$selectedCurrency = GetCurrencyById($GLOBALS['CurrentCurrency']);
if (isset($_SESSION['OFFERCART']['GIFTCERTIFICATES']) && is_array($_SESSION['OFFERCART']['GIFTCERTIFICATES'])) {
$giftCertificates = $_SESSION['OFFERCART']['GIFTCERTIFICATES'];
// Now we check that the gift certificates can actually be applied to the order
$GLOBALS['ISC_CLASS_GIFT_CERTIFICATES'] = GetClass('ISC_GIFTCERTIFICATES');
$badCertificates = array();
$remainingBalance = 0;
$GLOBALS['ISC_CLASS_GIFT_CERTIFICATES']->GiftCertificatesApplicableToOrder($orderTotal, $giftCertificates, $remainingBalance, $badCertificates);
// One or more gift certificates were invalid so this order is now invalid
if (count($badCertificates) > 0) {
$badCertificatesList = '<strong>' . GetLang('BadGiftCertificates') . '</strong><ul>';
foreach ($badCertificates as $code => $reason) {
if (is_array($reason) && $reason[0] == "expired") {
$reason = sprintf(GetLang('BadGiftCertificateExpired'), CDate($reason[1]));
} else {
$reason = GetLang('BadGiftCertificate' . ucfirst($reason));
}
$badCertificatesList .= sprintf("<li>%s - %s", isc_html_escape($code), $reason);
}
$badCertificatesList .= "</ul>";
$pendingOrderResult = array('error' => GetLang('OrderContainedInvalidGiftCertificates'), 'errorDetails' => $badCertificatesList);
return $pendingOrderResult;
} else {
if ($orderTotal == $giftCertificateAmount && $remainingBalance > 0) {
$pendingOrderResult = array('error' => GetLang('OrderTotalStillRemainingCertificates'));
return $pendingOrderResult;
} else {
if ($orderTotal == $giftCertificateAmount) {
$providerId = 'giftcertificate';
$verifyPaymentProvider = false;
$redirectToFinishOrder = true;
}
}
}
}
// If the order total is 0, then we just forward the user on to the "Thank You" page and set the payment provider to ''
if ($orderTotal == 0) {
$providerId = '';
$verifyPaymentProvider = false;
$redirectToFinishOrder = true;
}
if ($verifyPaymentProvider) {
if (isset($_POST['credit_checkout_provider']) && $_POST['credit_checkout_provider'] != "") {
$_POST['checkout_provider'] = $_POST['credit_checkout_provider'];
}
$selected_provider = "";
$providers = GetCheckoutModulesThatCustomerHasAccessTo(true);
// If there's more than one, use the value they've chosen
if (count($providers) > 1 && isset($_POST['checkout_provider']) || isset($_SESSION['CHECKOUT']['ProviderListHTML'])) {
$selected_provider = $_POST['checkout_provider'];
} else {
if (count($providers) == 1) {
$selected_provider = $providers[0]['object']->GetId();
$_POST['checkout_provider'] = $selected_provider;
} else {
$selected_provider = '';
}
}
if (!isset($_POST['checkout_provider'])) {
$_POST['checkout_provider'] = '';
}
// Are we using our store credit?
$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
$customer = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerDataByToken();
if (isset($_POST['store_credit']) && $_POST['store_credit'] == 1 && $customer['custstorecredit'] > 0) {
// User has not chosen a payment provider and can't afford this order using only store credit, throw back as error
if (!$_POST['checkout_provider'] && $customer['custstorecredit'] < $orderTotal) {
return false;
} else {
$onlyCredit = false;
$updateExtra = '';
// If we're only using store credit
//.........这里部分代码省略.........
示例10: SaveDefaultPerPage
/**
* Saves a users per page setting in a cookie for when they return to the page later
*
* @param string Unique identifier for the page we're saving this preference for.
* @param int The per page setting to save
*/
function SaveDefaultPerPage($section, $perPage = 20)
{
ISC_SetCookie("PERPAGE_PREFS[".$section."]", (int)$perPage);
}
示例11: ProcessLogin
public function ProcessLogin($todo='')
{
$loginName='';
$loginPass='';
if((!isset($_POST['username']) || !isset($_POST['password'])) && !isset($_COOKIE['RememberToken'])) {
$GLOBALS['ISC_CLASS_ADMIN_AUTH']->displayLoginForm(true);
return;
}
// Is this an automatic login from "Remember Me" being ticked?
$userManager = getClass('ISC_ADMIN_USER');
$userRow = null;
$autoLogin = false;
if(isset($_POST['username'])) {
$loginName = @$_POST['username'];
$loginPass = @$_POST['password'];
$userRow = $userManager->getUserByField('username', $loginName, '*');
}
else if(isset($_COOKIE['RememberToken']) && trim($_COOKIE['RememberToken']) != '') {
$userRow = $userManager->getUserByField('md5(concat(username, token))', $_COOKIE['RememberToken'], '*');
$autoLogin = true;
}
$remember = false;
if(isset($_POST['remember']) || isset($_COOKIE['RememberToken'])) {
$remember = true;
}
ob_start();
// Try and find a user with the same credentials
if($userRow != null && $userRow['userstatus'] == 1) {
$uid = $userRow['pk_userid'];
// check 1: lockout
$lockout = (int) $userRow['attempt_lockout'];
if ($lockout != 0 && $lockout > time()) {
// user is currently being locked out due to too
// many failed login attempts in a row
$msg = GetLang('LockedOutError', array(
'lockoutTime' => GetConfig('PCILoginLockoutTimeMin'),
'unblockLink' => 'index.php?ToDo=unblock&step=sendEmail&t='.$uid,
));
$this->template->assign('AdminLogo', GetConfig('AdminLogo'));
$this->template->assign('Message', $msg);
$this->template->display('plain.tpl');
die;
}
// check 2: expired password
$expiry = $userManager->getPasswordExpiry($uid);
if ($expiry != 0 && $expiry != 1 && time() > $expiry) {
// if expiry is zero, user password is pre 6.0
// if expiry is one, password expiry feature is disabled
// otherwise, password has expired
// send email and force user to change password
$userManager->sendResetPasswordEmail($userRow['username'], true);
$expireDays = (int) GetConfig('PCIPasswordExpiryTimeDay');
FlashMessage(GetLang('PasswordExpired', array(
'expireDays' => $expireDays,
)), MSG_INFO);
$GLOBALS['ISC_CLASS_ADMIN_AUTH']->displayLoginForm();
return;
}
if (!$remember) {
ISC_SetCookie("RememberToken", "", time() - 3600*24*365, true);
}
if ($autoLogin || $userManager->verifyPassword($uid, $loginPass) == true) {
// Set the auth session variable to true
$_COOKIE['STORESUITE_CP_TOKEN'] = $userRow['token'];
ISC_SetCookie("STORESUITE_CP_TOKEN", $userRow['token'], 0, true);
if($remember) {
ISC_SetCookie("RememberToken", md5($userRow['username'] . $userRow['token']), time() + 3600*24*365, true);
}
// Log the successful login to the administrators log
$GLOBALS['ISC_CLASS_LOG']->LogAdminAction("valid");
$userManager->resetFailedLoginAttempt($uid);
$userManager->updateLoginTimestamp($uid);
// Everything was OK and the user has been logged in successfully
header('Location: index.php?ToDo=' . $todo);
die();
} else {
// record this failed attempt
$userManager->addFailedLoginAttempt($uid);
}
}
// Otherwise, we have a bad username/password
$GLOBALS['ISC_CLASS_LOG']->LogAdminAction("invalid", $loginName);
$GLOBALS['ISC_CLASS_ADMIN_AUTH']->displayLoginForm(true);
die();
}
示例12: LoginCustomer
/**
* Private function used for loggin in a customer
*
* @param mixed Either the customer's ID or record array.
* @param boolean Set to true to not show any error messages but return true or false depending on if the login was successful or not.
* @return boolean True if the login was successful.
*/
private function LoginCustomer($ClientRecord, $silent=false)
{
if (isId($ClientRecord)) {
$ClientRecord = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]customers WHERE customerid=" . (int)$ClientRecord));
}
if (!is_array($ClientRecord)) {
return false;
}
@ob_end_clean();
if(!trim($ClientRecord['customertoken'])) {
$custToken = GenerateCustomerToken();
$updated_customer_token = array(
"customertoken" => $custToken
);
$GLOBALS['ISC_CLASS_DB']->UpdateQuery("customers", $updated_customer_token, "customerid='".$GLOBALS['ISC_CLASS_DB']->Quote($ClientRecord['customerid'])."'");
$ClientRecord['customertoken'] = $custToken;
}
ISC_SetCookie("SHOP_TOKEN", $ClientRecord['customertoken'], time()+(3600*24*7), true);
// Make the cookie accessible via PHP as well
$_COOKIE['SHOP_TOKEN'] = $ClientRecord['customertoken'];
// Also store it in the session as well when we're transferring the session between domains
$_SESSION['SHOP_TOKEN'] = $ClientRecord['customertoken'];
if($silent == true) {
return true;
}
if (isset($_SESSION['LOGIN_REDIR']) && $_SESSION['LOGIN_REDIR'] != '') {
// Take them to the page they wanted
$page = $_SESSION['LOGIN_REDIR'];
unset($_SESSION['LOGIN_REDIR']);
header(sprintf("Location: %s", $page));
}
else {
// Take them to the "My Account" page
header(sprintf("Location: %s/account.php", $GLOBALS['ShopPathNormal']));
}
die();
}
示例13: GetClass
// Disable product comparisons if the template does not support them
if($GLOBALS['TPL_CFG']['MaxComparisonProducts'] == 0) {
$GLOBALS['ISC_CFG']['EnableProductComparisons'] = false;
}
// check if the store is down for maintenance
if(GetConfig('DownForMaintenance')) {
// we have token coming through
if (!empty($_GET['ctk'])) {
$token = $_GET['ctk'];
// check if the token is valid for a user
$query = "SELECT pk_userid FROM [|PREFIX|]users where token = '" . $GLOBALS['ISC_CLASS_DB']->Quote($token) . "'";
$res = $GLOBALS['ISC_CLASS_DB']->Query($query);
if ($GLOBALS['ISC_CLASS_DB']->CountResult($res)) {
// set the cookie so the admin auth class will function
ISC_SetCookie('STORESUITE_CP_TOKEN', $token, 0, true);
$_COOKIE['STORESUITE_CP_TOKEN'] = $token;
}
}
$GLOBALS['ISC_CLASS_ADMIN_AUTH'] = GetClass('ISC_ADMIN_AUTH');
if(!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->IsLoggedIn() || !$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_See_Store_During_Maintenance)) {
define('MAINTENANCE_IS_ADMIN', false);
Store_DownForMaintenance::showDownForMaintenance();
die();
}
define('MAINTENANCE_IS_ADMIN', true);
if(isset($_GET['showStore']) && $_GET['showStore'] == 'yes') {
$_SESSION['AdminShowStore'] = true;
} elseif (isset($_GET['showStore']) && $_GET['showStore'] == 'no') {
示例14: SetPanelSettings
//.........这里部分代码省略.........
if ($row['subcatgids'] != "") {
$subcatgids = str_ireplace("~", ",", $row['subcatgids']);
$subcatgids_qry = "select catname from [|PREFIX|]categories where categoryid in (" . $subcatgids . ")";
$subcatgids_res = $GLOBALS['ISC_CLASS_DB']->Query($subcatgids_qry);
if ($GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res) > 0) {
while ($subcatgids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($subcatgids_res)) {
if ($GLOBALS['EnableSEOUrls'] == 1) {
$GLOBALS['ProductsCount'] .= "<br><a href='" . $series_link . "/subcategory/" . MakeURLSafe(Strtolower($subcatgids_arr['catname'])) . "'>" . $subcatgids_arr['catname'] . "</a>";
} else {
$GLOBALS['ProductsCount'] .= "<br><a href='" . $series_link . "&subcategory=" . MakeURLSafe(Strtolower($subcatgids_arr['catname'])) . "'>" . $subcatgids_arr['catname'] . "</a>";
}
}
}
}
$content = $row['brandname'] . "<br>";
$content .= $row['catname'] . "<br>";
$content .= "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', '');
$GLOBALS['leftsidecontent'] = $content;
$GLOBALS['PriceRange'] = "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', '');
$content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty'];
$GLOBALS['rightsidecontent'] = $content;
$GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>";
$GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>";
$content = "{$link}<img src='{$path}/templates/default/images/view.gif'></a>";
$GLOBALS['ViewDetailsImage'] = $content;
if (IsDiscountAvailable('series', $row['brandseriesid'])) {
$GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
}
if ($this->IsMakeAnOffer('series', $row['brandseriesid']) == 'yes') {
$GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>";
}
$GLOBALS['lowersidecontent'] = $content;
$GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing");
$GLOBALS['HideCompareItems'] = "none";
}
}
}
$get_variables = $_GET;
$sort_qry = "{$path}/search.php?search_query=" . urlencode($params['search_query']);
unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']);
$i = 0;
foreach ($get_variables as $key => $value) {
$sort_qry .= "&{$key}={$value}";
}
if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') {
$sort = "asc ";
$img = " <img src='{$path}/templates/default/images/ArrowDown.gif' border=0>";
} else {
$sort = "desc ";
$img = " <img src='{$path}/templates/default/images/ArrowUp.gif' border=0>";
}
//$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas
if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
if ($GLOBALS['EnableSEOUrls'] == 1) {
$GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand</a>";
$GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Part Number</a>";
$GLOBALS['ProductPrice'] = "<a href='{$path}{$mmy_links}/orderby/prodcalculatedprice/sortby/{$sort}'>Price</a>";
} else {
$GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand</a>";
$GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Part Number</a>";
$GLOBALS['ProductPrice'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcalculatedprice&sortby={$sort}'>Price</a>";
}
if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') {
$GLOBALS['ProductBrand'] .= $img;
}
$GLOBALS['ProductVQ'] = $vq_column_title;
/*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname')
$GLOBALS['Product_VQ'] .= $img;*/
if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') {
$GLOBALS['ProductPartNumber'] .= $img;
}
$GLOBALS['ProductPQ'] = "Product Options";
/*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption')
$GLOBALS['SearchResults'] .= $img;*/
if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') {
$GLOBALS['ProductPrice'] .= $img;
}
$GLOBALS['ProductDetails'] = "Details";
$GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItemHeader");
} else {
// $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>";
$GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListingMain");
}
if ($GLOBALS['EnableSEOUrls'] == 1) {
$back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']);
} else {
$back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING'];
}
ISC_SetCookie("back2search", $back2url, 0, "/");
// Showing the syndication option?
if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) {
$GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);
$GLOBALS['SNIPPETS']['SearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultsFeed");
}
} else {
// No search results were found
$GLOBALS['HideSearchResults'] = "none";
$GLOBALS['HidePanels'][] = 'SearchPageProducts';
}
}
示例15: getPortableDeviceType
parseLangFile(ISC_BASE_PATH.'/language/'.getConfig('Language').'/module_language.ini');
$templatePath = ISC_BASE_PATH.'/admin/templates';
// Control panel mobile interface is supported on the following devices:
// iPhone, iPod Touch, Palm Pre and Android based devices
$mobileDevice = getPortableDeviceType();
$supportedDevices = array(
'iphone',
'ipod',
'pre',
'android'
);
if(is_array($mobileDevice) && in_array($mobileDevice['device'], $supportedDevices) && empty($_COOKIE['fullControlPanel'])) {
if(!empty($_REQUEST['fullControlPanel'])) {
ISC_SetCookie('fullControlPanel', 1);
}
define('IS_PHONE', true);
$templatePath .= '/iphone/';
}
initBuildTemplateInstance($templatePath);
if(GetConfig('isSetup')) {
// Ensure database tables exist
$GLOBALS['ProductEdition'] = GetLang('Edition') . mysql_dump();
if(!gzte11(ISC_LARGEPRINT)) {
$GLOBALS['ProductEditionUpgrade'] = 1;
}
$GLOBALS['ISC_CLASS_ADMIN_ENGINE'] = GetClass('ISC_ADMIN_ENGINE');