本文整理汇总了PHP中isc_json_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP isc_json_encode函数的具体用法?PHP isc_json_encode怎么用?PHP isc_json_encode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isc_json_encode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($transitions)
{
$current = current(array_keys($transitions));
do
{
$next = $transitions[$current];
if(is_array($next)) {
$found = false;
foreach($next as $transition) {
if(is_array($transition)) {
if($this->actor->{$transition['on']}() === true) {
$next = $transition['next'];
$found = true;
break;
}
}
else
{
$next = $transition;
$found = true;
break;
}
}
if(!$found)
throw new Exception('No valid next state: '.isc_json_encode($current));
}
if($next !== null)
$this->actor->{$next}();
$current = $next;
}
while($next !== null);
}
示例2: removeFromGroup
private function removeFromGroup()
{
$group = $this->getValue('group');
$controllers = (array)json_decode($this->keystore->get('jc_'.$group));
unset($controllers[$this->getId()]);
$this->keystore->set('jc_'.$group,isc_json_encode($controllers));
$this->clearValue('group');
}
示例3: output
public static function output($message, $success=false, $additionalArray=null)
{
// @codeCoverageIgnoreStart
// if this is ever changed so that die() is optiona, remove the ignore tags - otherwise this method should never be called during a unit test since it makes phpunit quit
if (is_array($message)) {
$jsonArray = $message;
} else {
if(is_array($additionalArray) && !empty($additionalArray)) {
$jsonArray = $additionalArray;
}else{
$jsonArray = array();
}
$jsonArray['success'] = (bool)$success;
$jsonArray['message'] = $message;
}
$charset = GetConfig('CharacterSet');
if (!$charset) {
$charset = 'utf-8';
}
if(self::$useTextarea) {
header('Content-type: text/html; charset=' . $charset);
echo '<textarea>';
} else {
header('Content-type: application/json; charset=' . $charset);
}
echo isc_json_encode($jsonArray);
if(self::$useTextarea) {
echo '</textarea>';
}
die();
// @codeCoverageIgnoreEnd
}
示例4: remoteDeleteMultiple
public function remoteDeleteMultiple(ISC_ADMIN_REMOTE $remote)
{
$db = $GLOBALS["ISC_CLASS_DB"];
$productId = false;
$productHash = false;
if (isset($_POST['product'])) {
$productId = (int)@$_POST['product'];
if (!isId($productId) || !ProductExists($productId)) {
$response['error'] = GetLang('ProductDoesntExist');
die(isc_json_encode($response));
}
if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) {
$response['error'] = GetLang('Unauthorized');
die(isc_json_encode($response));
}
} else if (isset($_POST['hash']) && $_POST['hash']) {
$productHash = $_POST['hash'];
if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Create_Product)) {
$response['error'] = GetLang('Unauthorized');
die(isc_json_encode($response));
}
} else {
$response['error'] = GetLang('ProductDoesntExist');
die(isc_json_encode($response));
}
$deletes = array();
$errors = array();
$warnings = array();
$newThumbnailId = null;
if (!isset($_POST['images']) || !is_array($_POST['images'])) {
$response['error'] = GetLang('InvalidProductImageId');
die(isc_json_encode($response));
}
$_POST['images'] = array_unique(@$_POST['images']);
foreach ($_POST['images'] as $imageId) {
if (!(int)$imageId) {
$errors[$imageId] = GetLang('InvalidProductImageId');
continue;
}
$imageId = (int)$imageId;
try {
$image = new ISC_PRODUCT_IMAGE($imageId);
} catch (ISC_PRODUCT_IMAGE_RECORDNOTFOUND_EXCEPTION $exception) {
// record was not found in database, so it's already been deleted, mark it as deleted and skip it
$deletes[] = $imageId;
continue;
} catch (Exception $exception) {
// some other error occurred when trying to load the image, note it in errors list
$errors[$imageId] = GetLang('ProductImageDeleteDatabaseError');
continue;
}
if ($productId) {
if ($image->getProductId() !== $productId) {
// image does not belong to specified product id, note it in errors list
$errors[$imageId] = GetLang('ProductImageDeleteInvalidProductId');
continue;
}
} else if ($productHash) {
if ($image->getProductId() !== 0 || $image->getProductHash() !== $productHash) {
// image does not belong to specified product id, note it in errors list
$errors[$imageId] = GetLang('ProductImageDeleteInvalidProductId');
continue;
}
}
try {
$image->delete(true, true, $newThumbnailId);
$deletes[] = $imageId;
} catch (ISC_PRODUCT_IMAGE_CANNOTDELETEFILE_EXCEPTION $exception) {
// indicates that the record was deleted but files weren't
$deletes[] = $imageId;
$warnings[$imageId] = GetLang('ProductImageDeleteFileDeleteError');
} catch (Exception $exception) {
// any other error indicates a failure to delete the record
$errors[$imageId] = GetLang('ProductImageDeleteUnknownError');
}
}
$tags = array();
foreach ($errors as $imageId => $message) {
$tags[] = $remote->MakeXMLTag('error', $message, true, array('image' => $imageId));
}
foreach ($warnings as $imageId => $message) {
$tags[] = $remote->MakeXMLTag('warning', $message, true, array('image' => $imageId));
}
foreach ($deletes as $imageId) {
$tags[] = $remote->MakeXMLTag('delete', false, false, array('image' => $imageId));
}
//.........这里部分代码省略.........
示例5: ManageCustomers
//.........这里部分代码省略.........
}
}
else {
// No actual custoemrs
$GLOBALS['DisplaySearch'] = "none";
$GLOBALS['Message'] = MessageBox(GetLang('NoCustomers'), MSG_SUCCESS);
}
}
if (!gzte11(ISC_MEDIUMPRINT)) {
$GLOBALS[base64_decode('SGlkZUV4cG9ydA==')] = "none";
}
if ($MsgDesc != "") {
$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
}
$flashMessages = GetFlashMessages();
if(is_array($flashMessages) && !empty($flashMessages)) {
$GLOBALS['Message'] = '';
foreach($flashMessages as $flashMessage) {
$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
}
}
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Export_Customers)) {
$exportAction = "index.php?ToDo=startExport&t=customers";
if (isset($GLOBALS['CustomSearchId']) && $GLOBALS['CustomSearchId'] != '0') {
$exportAction .= "&searchId=" . $GLOBALS['CustomSearchId'];
}
else {
$params = $_GET;
unset($params['ToDo']);
if (!empty($params)) {
$exportAction .= "&" . http_build_query($params);
}
}
$searchQueryForExport = $_POST + $_GET;
foreach ($searchQueryForExport as $index => $value) {
if ($value === '') {
unset($searchQueryForExport[$index]);
}
}
unset($searchQueryForExport['ToDo'], $searchQueryForExport['SubmitButton1'], $searchQueryForExport['sortField'], $searchQueryForExport['sortOrder'], $searchQueryForExport['SearchButton_x'], $searchQueryForExport['SearchButton_y']);
$searchQueryForExport = isc_json_encode($searchQueryForExport);
$customerExportMenu = array();
$customerExportMenu[] = array(
array(
'backgroundImage' => 'images/export.gif',
'label' => GetLang('EmailIntegrationExportToFile'),
'class' => 'exportMenuLink',
'href' => $exportAction,
),
);
$customerExportMenuModules = array();
$emailModules = ISC_EMAILINTEGRATION::getConfiguredModules();
foreach ($emailModules as /** @var ISC_EMAILINTEGRATION */$emailModule) {
if (!$emailModule->supportsBulkExport()) {
// not all modules have to support bulk exports
continue;
}
$customerExportMenuModules[] = array(
'backgroundImage' => '../modules/' . str_replace('_', '/', $emailModule->GetId()) . '/images/16x16.png',
'label' => GetLang('EmailIntegrationExportToModule', array('module' => $emailModule->GetName())),
'href' => 'javascript:Interspire_EmailIntegration_ModuleExportMachine.start({ exportType: "Customer", exportModule: "' . $emailModule->GetId() . '", exportSearch: ' . $searchQueryForExport . ' });',
);
}
if (!empty($customerExportMenuModules)) {
$customerExportMenu[] = $customerExportMenuModules;
$this->engine->bodyScripts[] = '../javascript/fsm.js';
$this->engine->bodyScripts[] = '../javascript/jquery/plugins/disabled/jquery.disabled.js';
$this->engine->bodyScripts[] = '../javascript/ajaxDataProvider.js';
$this->engine->bodyScripts[] = 'script/emailintegration.js';
$this->engine->bodyScripts[] = 'script/emailintegration.export.js';
// disabled for now until batch rule processing is implemented, as the existing, single-subscription rule processing is too slow for bulk export
// $customerExportMenu[] = array(
// array(
// 'backgroundImage' => 'images/export_to_rules.gif',
// 'label' => GetLang('EmailIntegrationExportToNewsletterRules'),
// 'href' => 'javascript:Interspire_EmailIntegration_RuleExportMachine.start({ exportType: "Customer", exportRule: "NewsletterSubscribed", exportSearch: ' . $searchQueryForExport . ' });',
// ),
// );
}
$this->template->assign('customerExportMenu', $customerExportMenu);
}
$this->template->display('customers.manage.tpl');
}
示例6: SetupOrderManagementForm
/**
* Set up all of the template variables and predefined values for showing the form to edit an
* existing order or create a new order. Will also set up the post variables as values if this
* is a post request.
*
* @param array Optionally, if editing an order, the existing order to use for the default values.
*/
private function SetupOrderManagementForm($order = array())
{
$GLOBLS['CurrentTab'] = 0;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$postData = $_POST;
} else {
$postData = $order;
}
$orderFields = array('OrderBillFirstName' => 'ordbillfirstname', 'OrderBillLastName' => 'ordbilllastname', 'OrderBillCompany' => 'ordbillcompany', 'OrderBillPhone' => 'ordbillphone', 'OrderBillStreet1' => 'ordbillstreet1', 'OrderBillStreet2' => 'ordbillstreet2', 'OrderBillSuburb' => 'ordbillsuburb', 'OrderBillZip' => 'ordbillzip', 'OrderShipFirstName' => 'ordshipfirstname', 'OrderShipLastName' => 'ordshiplastname', 'OrderShipCompany' => 'ordshipcompany', 'OrderShipPhone' => 'ordshipphone', 'OrderShipStreet1' => 'ordshipstreet1', 'OrderShipStreet2' => 'ordshipstreet2', 'OrderShipSuburb' => 'ordshipsuburb', 'OrderShipZip' => 'ordshipzip', 'CustomerEmail' => 'custconemail', 'CustomerPassword' => 'custpassword', 'CustomerPassword2' => 'custpassword2', 'CustomerStoreCredit' => 'custstorecredit', 'CustomerGroup' => 'custgroupid', 'CustomerType' => 'customerType', 'OrderComments' => 'ordcustmessage', 'OrderNotes' => 'ordnotes', 'OrderId' => 'orderid', 'OrderTrackingNo' => 'ordtrackingno', 'AnonymousEmail' => 'anonymousemail', 'OrderBillEmail' => 'ordbillemail', 'OrderShipEmail' => 'ordshipemail');
/* Added below condition for applying store credit permission - vikas */
$loggeduser = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser();
if ($loggeduser['userstorecreditperm'] == 0) {
$GLOBALS['StoreCreditDisable'] = " disabled=\"\" ";
}
$GLOBALS['HideSelectedCustomer'] = 'display: none';
$GLOBALS['HideCustomerSearch'] = '';
$GLOBALS['HideAddressSelects'] = 'display: none';
if (isset($postData['ordcustid']) && $postData['ordcustid'] > 0) {
$GLOBALS['CurrentTab'] = 1;
$GLOBALS['CustomerType'] = 'existing';
$query = "\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM [|PREFIX|]customers WHERE customerid='" . (int) $postData['ordcustid'] . "'\n\t\t\t\t";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$existingCustomer = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
if ($existingCustomer['customerid']) {
$GLOBALS['HideSelectedCustomer'] = '';
$GLOBALS['HideCustomerSearch'] = 'display: none';
$GLOBALS['HideHistoryLink'] = 'display: none';
$GLOBALS['CustomerId'] = $existingCustomer['customerid'];
$GLOBALS['CustomerFirstName'] = isc_html_escape($existingCustomer['custconfirstname']);
$GLOBALS['CustomerLastName'] = isc_html_escape($existingCustomer['custconlastname']);
$GLOBALS['CustomerPhone'] = '';
if ($existingCustomer['custconphone']) {
$GLOBALS['CustomerPhone'] = isc_html_escape($existingCustomer['custconphone']) . '<br />';
}
$GLOBALS['CustomerEmail'] = '';
if ($existingCustomer['custconemail']) {
$GLOBALS['CustomerEmail'] = '<a href="mailto:' . isc_html_escape($existingCustomer['custconemail']) . '">' . isc_html_escape($existingCustomer['custconemail']) . '</a><br />';
}
$GLOBALS['CustomerCompany'] = '';
if ($existingCustomer['custconcompany']) {
$GLOBALS['CustomerCompany'] = isc_html_escape($existingCustomer['custconcompany']) . '<br />';
}
// Grab the addresses
$addresses = $this->LoadCustomerAddresses($existingCustomer['customerid']);
$GLOBALS['AddressJson'] = 'OrderManager.LoadInAddresses(' . isc_json_encode($addresses) . ');';
if (!empty($addresses)) {
$GLOBALS['HideAddressSelects'] = '';
$GLOBALS['DisableAddressSelects'] = 'disabled="disabled"';
}
$GLOBALS['SelectedCustomer'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrdersCustomerSearchResult');
}
//alandy_2011-6-23 add.
/*
if($postData['orderid']>0){
$query = "
SELECT ordbillemail,ordshipemail
FROM [|PREFIX|]orders WHERE ordcustid='".(int)$postData['ordcustid']."' and orderid=".$postData['orderid']."
";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while($rs=$GLOBALS['ISC_CLASS_DB']->Fetch($result)){
if(!empty($rs['ordbillemail'])){
$GLOBALS['GuestCustomerEmail']=$rs['ordbillemail'];
}else{
$GLOBALS['GuestCustomerEmail']=$rs['ordshipemail'];
}
}
}
*/
} else {
if (isset($postData['ordcustid']) && $postData['ordcustid'] == 0) {
if (!isset($postData['customerType'])) {
$GLOBALS['CurrentTab'] = 2;
} else {
if ($postData['customerType'] == 'anonymous') {
$GLOBALS['CurrentTab'] = 2;
} else {
$GLOBALS['CurrenTab'] = 1;
}
}
}
}
/**
* Customer and order custom fields
*/
$GLOBALS['OrderCustomFormFieldsAccountFormId'] = FORMFIELDS_FORM_ACCOUNT;
$GLOBALS['OrderCustomFormFieldsBillingFormId'] = FORMFIELDS_FORM_BILLING;
$GLOBALS['OrderCustomFormFieldsShippingFormId'] = FORMFIELDS_FORM_SHIPPING;
$GLOBALS['CustomFieldsAccountLeftColumn'] = '';
$GLOBALS['CustomFieldsAccountRightColumn'] = '';
$GLOBALS['CustomFieldsBillingColumn'] = '';
$GLOBALS['CustomFieldsShippingColumn'] = '';
$formIdx = array(FORMFIELDS_FORM_ACCOUNT, FORMFIELDS_FORM_BILLING, FORMFIELDS_FORM_SHIPPING);
$fieldMap = array('FirstName' => 'firstname', 'LastName' => 'lastname', 'Company' => 'company', 'Phone' => 'phone', 'AddressLine1' => 'street1', 'AddressLine2' => 'street2', 'City' => 'suburb', 'Zip' => 'zip', 'Country' => 'country', 'State' => 'state');
//.........这里部分代码省略.........
示例7: restoreOrderAction
protected function restoreOrderAction ()
{
echo isc_json_encode($this->restoreOrderActionHandler(Interspire_Request::post('orderId', 0)));
exit;
}
示例8: UploadImage
/**
* Upload a new image from the Image Manager or TinyMCE itself. Images are thrown in the uploaded_images
* directory. Invalid images (no dimensions available, mismatched type) are not accepted. Will output
* a JSON encoded array of details about the image just uploaded.
*/
private function UploadImage()
{
if (empty($_FILES['Filedata'])) {
exit;
}
$_FILES['Filedata']['filesize'] = NiceSize($_FILES['Filedata']['size']);
$_FILES['Filedata']['id'] = substr(md5($_FILES['Filedata']['name']), 0, 10);
$_FILES['Filedata']['errorfile'] = false;
$_FILES['Filedata']['imagepath'] = GetConfig('AppPath') . '/' . GetConfig('ImageDirectory') . '/uploaded_images/';
$_FILES['Filedata']['duplicate'] = false;
if ($_FILES['Filedata']['error'] != UPLOAD_ERR_OK) {
$_FILES['Filedata']['erorrfile'] = 'badupload';
die(isc_json_encode($_FILES));
}
$tmpName = $_FILES['Filedata']['tmp_name'];
$name = basename($_FILES['Filedata']['name']);
$name = str_replace(' ', '_', $name);
$destination = ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/uploaded_images/' . $name;
if (!$this->IsValidImageFile($tmpName, $_FILES['Filedata']['type'])) {
$_FILES['FileData']['errorfile'] = 'badtype';
} else {
if (!$this->IsImageFile(isc_strtolower($name))) {
$_FILES['Filedata']['errorfile'] = 'badname';
} else {
if (file_exists($destination)) {
$_FILES['Filedata']['duplicate'] = true;
} else {
if (!@move_uploaded_file($tmpName, $destination)) {
$_FILES['Filedata']['errorfile'] = 'badupload';
}
}
}
}
// Get the image dimensions so we can show a thumbnail
list($imgWidth, $imgHeight) = @getimagesize($destination);
if (!$imgWidth || !$imgHeight) {
$imgWidth = 200;
$imgHeight = 150;
}
$_FILES['Filedata']['origwidth'] = $imgWidth;
$_FILES['Filedata']['origheight'] = $imgHeight;
if ($imgWidth > 200) {
$imgHeight = 200 / $imgWidth * $imgHeight;
$imgWidth = 200;
}
if ($imgHeight > 150) {
$imgWidth = 150 / $imgHeight * $imgWidth;
$imgHeight = 150;
}
$_FILES['Filedata']['width'] = $imgWidth;
$_FILES['Filedata']['height'] = $imgHeight;
unset($_FILES['Filedata']['tmp_name']);
echo isc_json_encode($_FILES);
exit;
}
示例9: AddProductsToCart
/**
* Handles adding products from the list display mode
*
*/
private function AddProductsToCart()
{
$response = array();
if (isset($_REQUEST['products'])) {
$cart = GetClass('ISC_CART');
$products = explode("&", $_REQUEST["products"]);
foreach ($products as $product) {
list($id, $qty) = explode("=", $product);
if (!$cart->AddSimpleProductToCart($id, $qty)) {
$response["error"] = $_SESSION['ProductErrorMessage'];
}
}
}
echo isc_json_encode($response);
exit;
}
示例10: BulkUpdateVariations
//.........这里部分代码省略.........
$updates[] = "vcpricediff = '" . $_GET['updatePriceDiff'] . "'";
$updates[] = "vcprice = " . (float)$_GET['updatePrice'];
break;
}
switch ($_GET['updateWeightDiff']) {
case "reset":
$updates[] = "vcweightdiff = ''";
$updates[] = "vcweight = 0";
break;
case "add":
case "subtract":
case "fixed":
$updates[] = "vcweightdiff = '" . $_GET['updateWeightDiff'] . "'";
$updates[] = "vcweight = " . (float)$_GET['updateWeight'];
break;
}
if ($inv) {
if ($_GET['updateStockLevel'] != '') {
$updates[] = 'vcstock = ' . (int)$_GET['updateStockLevel'];
}
if ($_GET['updateLowStockLevel'] != '') {
$updates[] = 'vclowstock = ' . (int)$_GET['updateLowStockLevel'];
}
}
// delete existing images?
if (isset($_GET['updateDelImages'])) {
// get distinct images not associated with variations that aren't in the current filter
$query = '
SELECT
vcimagezoom,
vcimagestd,
vcimagethumb
FROM
[|PREFIX|]product_variation_combinations pvc
WHERE
' . $whereSQL .
$optionSQL . '
GROUP BY
vcimagezoom
HAVING
COUNT(*) = (
SELECT
COUNT(*)
FROM
[|PREFIX|]product_variation_combinations pvc2
WHERE
pvc2.vcproductid = pvc.vcproductid AND
pvc2.vcimagezoom = pvc.vcimagezoom
)
';
$res = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($res)) {
GetClass('ISC_ADMIN_PRODUCT')->DeleteVariationImagesForRow($row);
}
$updates[] = "vcimage = ''";
$updates[] = "vcimagezoom = ''";
$updates[] = "vcimagestd = ''";
$updates[] = "vcimagethumb = ''";
}
// import image
elseif (isset($_FILES['updateImage'])) {
try {
$image = ISC_PRODUCT_IMAGE::importImage($_FILES['updateImage']['tmp_name'], $_FILES['updateImage']['name'], false, false, true, false);
$zoom = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true, false);
$standard = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_STANDARD, true, false);
$thumb = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, true, false);
$updates[] = "vcimage = '" . $image->getSourceFilePath() . "'";
$updates[] = "vcimagezoom = '" . $zoom . "'";
$updates[] = "vcimagestd = '" . $standard . "'";
$updates[] = "vcimagethumb = '" . $thumb . "'";
}
catch (Exception $ex) {
}
}
if (!empty($updates)) {
$updates[] = "vclastmodified = " . time();
$updateSQL = implode(', ', $updates);
// update the combinations
$query = 'UPDATE [|PREFIX|]product_variation_combinations SET ' . $updateSQL . ' WHERE ' . $whereSQL . $optionSQL;
$GLOBALS['ISC_CLASS_DB']->Query($query);
}
// regenerate the combinations table to get fresh data
$html = $this->GetVariationCombinationsTable($filterOptions, true);
$response['tableData'] = $html;
echo '<textarea>'.isc_json_encode($response).'</textarea>';
exit;
}
示例11: SetProductImages
//.........这里部分代码省略.........
// do nothing, will result in returning blank string, which is fine
}
if($thumbURL == '' && $zoomImageURL == '') {
continue;
}
$resizedZoomDimension = $productImage->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_ZOOM);
$resizedTinyDimension = $productImage->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_TINY);
//calculate the max zoom image width and height
if ($GLOBALS['ZoomImageMaxWidth'] < $resizedZoomDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_WIDTH]) {
$GLOBALS['ZoomImageMaxWidth'] = $resizedZoomDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_WIDTH];
//the height of the image has got the max width needed to calulate the image fancy box size.
$GLOBALS['ZoomImageMaxWidthHeight'] = $resizedZoomDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_HEIGHT];
}
if ($GLOBALS['ZoomImageMaxHeight'] < $resizedZoomDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_HEIGHT]) {
$GLOBALS['ZoomImageMaxHeight'] = $resizedZoomDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_HEIGHT];
//the width of the image has got the max height needed to calulate the image fancy box size.
$GLOBALS['ZoomImageMaxHeightWidth'] = $resizedZoomDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_HEIGHT];
}
$GLOBALS['ImageDescription'] = isc_html_escape($productImage->getDescription());
if($GLOBALS['ImageDescription'] == '') {
$GLOBALS['ImageDescription'] = GetLang("Image") . " " . ($i + 1);
}
//show image carousel
if(GetConfig('ProductImagesTinyThumbnailsEnabled')==1) {
$GLOBALS['ProdImageJavascript'] .= "
ThumbURLs[".$i."] = " . isc_json_encode($thumbURL) . ";
ProductImageDescriptions[".$i."] = " . isc_json_encode($GLOBALS['ImageDescription']) . ";
";
$GLOBALS['TinyImageOverJavascript'] = "showProductThumbImage(".$i.")";
//$GLOBALS['ProductTinyImageURL'] = $productImage->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_TINY, true);
try{
$GLOBALS['ProductTinyImageURL'] = $productImage->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_TINY, true);
//$GLOBALS['ProductThumbURL'] = $thumbURL;
} catch (Exception $exception) {
// do nothing, will result in returning blank string, which is fine
}
$GLOBALS['ProductThumbIndex'] = $i;
if(GetConfig('ProductImageMode') == 'lightbox') {
$GLOBALS['TinyImageClickJavascript'] = "showProductImageLightBox(".$i."); return false;";
} else {
$GLOBALS['TinyImageClickJavascript'] = "showProductImage('".GetConfig('ShopPath')."/productimage.php', ".$GLOBALS['ProductId'].", ".$i.");";
}
$GLOBALS['TinyImageWidth'] = $resizedTinyDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_WIDTH];
$GLOBALS['TinyImageHeight'] = $resizedTinyDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_HEIGHT];
$GLOBALS['TinyImageTopPadding'] = floor(($GLOBALS['ProductMaxTinyHeight'] - $GLOBALS['TinyImageHeight']) / 2);
$GLOBALS['SNIPPETS']['ProductTinyImages'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductTinyImage");
$continue = true;
}
if(GetConfig('ProductImagesImageZoomEnabled') == 1) {
//check if zoom image is large enough for image zoomer
if($resizedZoomDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_WIDTH]<ISC_PRODUCT_IMAGE_MIN_ZOOM_WIDTH && $resizedZoomDimension[ISC_PRODUCT_IMAGE_DIMENSIONS_HEIGHT]<ISC_PRODUCT_IMAGE_MIN_ZOOM_HEIGHT) {
$zoomImageURL = '';
}
示例12: jsonFilter
/**
* Filter which encodes any given object/string as a json packet
*
* @param mixed $obj
* @return string
*/
public function jsonFilter($obj)
{
return isc_json_encode($obj);
}
示例13: GetVariationOptions
/**
*
* @param int The customer group to use to determine the final product price (used when getting variation details from back end quote system)
*/
public function GetVariationOptions($customerGroupId = null)
{
$productId = (int)$_GET['productId'];
$optionIds = $_GET['options'];
$optionIdsArray = array_map('intval', explode(',', $optionIds));
// We need to find the next type of option that's selectable, so what we do
// is because the vcoptionids column is in the order that the customer selects
// the options, we just find a single matching option and then look up values
// according to the voname.
$query = "
SELECT prodvariationid, vnumoptions
FROM [|PREFIX|]products p
JOIN [|PREFIX|]product_variations v ON (v.variationid=p.prodvariationid)
WHERE p.productid='".$productId."'
";
$result =$GLOBALS['ISC_CLASS_DB']->query($query);
$product = $GLOBALS['ISC_CLASS_DB']->fetch($result);
// Invalid product variation, or product doesn't have a variation
if(empty($product)) {
exit;
}
// If we received the number of options the variation has in, then the customer
// has selected an entire row. Find that row.
if(count($optionIdsArray) == $product['vnumoptions']) {
$setMatches = array();
foreach($optionIdsArray as $optionId) {
$setMatches[] = 'FIND_IN_SET('.$optionId.', vcoptionids)';
}
$query = "
SELECT *
FROM [|PREFIX|]product_variation_combinations
WHERE
vcproductid='".$productId."' AND
vcenabled=1 AND
".implode(' AND ', $setMatches)."
LIMIT 1
";
$result = $GLOBALS['ISC_CLASS_DB']->query($query);
$combination = $GLOBALS['ISC_CLASS_DB']->fetch($result);
$productClass = new ISC_PRODUCT($productId);
$combinationDetails = $productClass->getCombinationDetails($combination, $customerGroupId);
$combinationDetails['comboFound'] = true;
if ($combinationDetails['sku'] == null) {
// prevent a blank sku on details page
$combinationDetails['sku'] = '';
}
echo isc_json_encode($combinationDetails);
exit;
}
// Try to find a combination row with the incoming option ID string, to determine
// which set of options is next.
$query = "
SELECT DISTINCT voname
FROM [|PREFIX|]product_variation_options
WHERE
vovariationid='".$product['prodvariationid']."'
ORDER BY vooptionsort ASC
LIMIT ".count($optionIdsArray).", 1
";
$optionName = $GLOBALS['ISC_CLASS_DB']->fetchOne($query);
$hasOptions = false;
$valueHTML = '';
$setMatches = array();
foreach($optionIdsArray as $optionId) {
$setMatches[] = 'FIND_IN_SET('.$optionId.', vcoptionids)';
}
$query = "
SELECT *
FROM [|PREFIX|]product_variation_options
WHERE
vovariationid='".$product['prodvariationid']."' AND
voname='".$GLOBALS['ISC_CLASS_DB']->quote($optionName)."'
ORDER BY vovaluesort ASC
";
$result = $GLOBALS['ISC_CLASS_DB']->query($query);
while($option = $GLOBALS['ISC_CLASS_DB']->fetch($result)) {
$query = "
SELECT combinationid
FROM [|PREFIX|]product_variation_combinations
WHERE
vcproductid='".$productId."' AND
vcenabled=1 AND
FIND_IN_SET(".$option['voptionid'].", vcoptionids) > 0 AND
".implode(' AND ', $setMatches)."
LIMIT 1
//.........这里部分代码省略.........
示例14: GetSeries
/**
* GetAllBrands
* wirror_20110130: ajax call for series
*
*/
private function GetSeries()
{
$series = array();
$squery = "SELECT * FROM [|PREFIX|]brand_series WHERE brandid!='0' ";
if (isset($_REQUEST['bid']) && $_REQUEST['bid'] > 0) {
$squery .= " AND brandid = {$_REQUEST['bid']} ";
}
$squery .= "ORDER BY seriesname ASC";
$sresult = $GLOBALS["ISC_CLASS_DB"]->Query($squery);
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($sresult)) {
$series[] = array('id' => $row['seriesid'], 'name' => isc_html_escape($row['seriesname']));
}
echo isc_json_encode($series);
exit;
}
示例15: pics_save
function pics_save($_FILES, $description, $firstName, $lastName, $address1, $address2)
{
$description = trim($description);
$firstName = trim($firstName);
$lastName = trim($lastName);
$address1 = trim($address1);
$address2 = trim($address2);
$tempFile = $_FILES['tmp_name'];
$rootdir = ISC_BASE_PATH;
//$allowpictypes = array(1, 2, 3, 6, 7, 8);
$allowpictypestr = GetConfig('LimitCustomerUploadImageFileType');
$allowpictypes = explode(',', $allowpictypestr);
// get file ext
$single_type = exif_imagetype($tempFile);
$picExt = '';
switch ($single_type) {
case 1:
$picExt = '.gif';
break;
case 2:
$picExt = '.jpg';
break;
case 3:
$picExt = '.png';
break;
case 4:
$picExt = '.swf';
break;
case 6:
$picExt = '.bmp';
break;
case 7:
$picExt = '.tiff';
break;
case 8:
$picExt = '.tiff';
break;
}
$allowCustomerUploadMaxNum = GetConfig('LimitCustomerUploadImageNum');
$customerId = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();
$imgNumQuery = "\n\t\t\t\tSELECT imagenum\n\t\t\t\tFROM [|PREFIX|]customers\n\t\t\t\tWHERE customerid='" . (int) $customerId . "'";
$imgNumResult = $GLOBALS['ISC_CLASS_DB']->Query($imgNumQuery);
$imagenum = $GLOBALS['ISC_CLASS_DB']->FetchOne($imgNumResult);
if (!in_array($single_type, $allowpictypes)) {
$status = 0;
$message = "Invalid type of file!";
$errorCode = -1;
} elseif (strlen($description) > 1000) {
$status = 0;
$message = "Description should not surpass 1000 characters!";
$errorCode = -2;
} elseif (strlen($description) <= 0) {
$status = 0;
$message = "You must enter a description for each image submitted!";
$errorCode = -3;
} elseif ($imagenum >= $allowCustomerUploadMaxNum) {
$status = 0;
$message = "You cannot upload more than {$allowCustomerUploadMaxNum} images.";
$errorCode = -4;
} else {
$targetPath = $rootdir . '/upload/' . date('ymd', time()) . '/';
$fileName = time() . md5(mt_rand(0, 999999)) . $picExt;
$path = '/upload/' . date('ymd', time()) . '/' . $fileName;
$targetFile = $rootdir . $path;
mkdir(str_replace('//', '/', $targetPath), 0755, true);
if (move_uploaded_file($tempFile, $targetFile)) {
$CustomerId = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();
$NewPicture = array("customerid" => $CustomerId, "path" => $path, "description" => $description, "filename" => $_FILES['name'], "dateline" => time(), "uploaderFirstName" => $firstName, "uploaderLastName" => $lastName, "address1" => $address1, "address2" => $address2);
if ($GLOBALS['ISC_CLASS_DB']->InsertQuery("pic", $NewPicture)) {
$query1 = "UPDATE [|PREFIX|]customers set imagenum = imagenum + 1 where customerid = '{$CustomerId}'";
$result = $GLOBALS["ISC_CLASS_DB"]->Query($query1);
}
$status = 1;
$errorCode = 0;
$message = "Upload successfully";
}
}
//echo serialize(array("status" => $status, "errorCode" => $errorCode, "message" => $message));
echo isc_json_encode(array("status" => $status, "errorCode" => $errorCode, "message" => $message));
exit;
}