Ejemplo n.º 1
0
 function m_eventHandler()
 {
     if (!isset($this->request['action'])) {
         $this->request['action'] = "";
     }
     $action = explode(".", $this->request['action']);
     $member = explode("=", $this->request['action']);
     if (!isset($this->request['mode'])) {
         $this->request['mode'] = "";
     }
     if (!isset($action[1])) {
         $action[1] = "";
     }
     switch ($action[0]) {
         #HANDLING VIEW(FRONTEND-SHOP BUILDER)
         case "ecom":
             $obShopInterface = new c_shopInterface();
             $obShopInterface->obTpl = $this->obTpl;
             $obShopInterface->obDb = $this->obDb;
             $obShopInterface->request = $this->request;
             $obShopInterface->imageUrl = SITE_URL . "images/";
             $obShopInterface->imagePath = SITE_PATH . "images/";
             $obShopDb = new c_shopDb();
             $obShopDb->obTpl = $this->obTpl;
             $obShopDb->obDb = $this->obDb;
             $obShopDb->request = $this->request;
             $obBill = new c_billShipInfo();
             $obBill->obTpl = $this->obTpl;
             $obBill->obDb = $this->obDb;
             $obBill->request = $this->request;
             $obSearch = new c_search();
             $obSearch->obTpl = $this->obTpl;
             $obSearch->obDb = $this->obDb;
             $obSearch->request = $this->request;
             $obBrand = new c_brand();
             $obBrand->obTpl = $this->obTpl;
             $obBrand->obDb = $this->obDb;
             $obBrand->request = $this->request;
             switch ($action[1]) {
                 case "search":
                     $obSearch->searchTemplate = $this->templatePath . "searchPage.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo; <a href='#'>Search Results</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obSearch->m_searchResults());
                     break;
                 case "brand":
                     $obBrand->brandTemplate = $this->templatePath . "brandPage.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo; <a href='#'>Brand Results</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBrand->m_brandResults());
                     break;
                 case "details":
                     if ($obShopInterface->m_checkMemberPage()) {
                         $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.details&mode=" . $this->request['mode']);
                         $_SESSION['referer'] = $retUrl;
                         $this->libFunc->authenticate();
                         unset($_SESSION['referer']);
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('department'));
                         $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDeptDetails());
                     } else {
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('department'));
                         $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDeptDetails());
                     }
                     break;
                 case "deptattribute":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('department'));
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDeptAttributeSort());
                     break;
                 case "pdetails":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('product'));
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showProductDetails());
                     break;
                 case "pfinder":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo; <a href='#'>Product Finder</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_ProductFinder());
                     break;
                 case "cdetails":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('content'));
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showContentDetails());
                     break;
                 case "deletereview":
                     $obShopDb->m_deleteReview();
                     break;
                 case "reviewForm":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.reviewForm&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->m_topNavigation('product'));
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showProductDetails());
                     break;
                 case "largeImg":
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspLargeImg());
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", $obShopInterface->breadcrumb);
                     break;
                 case "reviewAdd":
                     $this->libFunc->authenticate();
                     $obShopDb->m_reviewAdd();
                     break;
                 case "help":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.help");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $obShopDb->m_reviewHelp();
                     break;
                 case "noHelp":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.noHelp");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $obShopDb->m_reviewNoHelp();
                     break;
                 case "addtocart":
                     if (!$obShopDb->m_addTocart()) {
                         $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                         $obShopInterface->m_viewCart();
                         $obShopDb->stockTemplate = $this->templatePath . "stockControl.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Stock control</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obShopDb->m_dspStockMessage());
                     }
                     break;
                 case "addmulticart":
                     if (!$obShopDb->m_addToMulticart()) {
                         $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                         $obShopInterface->m_viewCart();
                         $obShopDb->stockTemplate = $this->templatePath . "stockControl.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Stock control</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obShopDb->m_dspStockMessage());
                     }
                     break;
                 case "remove":
                     $obShopDb->m_deleteCart();
                     break;
                 case "updateCart":
                     if ($this->request['mode'] == LANG_EMPTYBASKET) {
                         $obShopDb->m_emptyCart();
                     } elseif ($this->request['mode'] == LANG_UPDATEBASKET) {
                         if (!$obShopDb->m_updateCart()) {
                             $obShopDb->stockTemplate = $this->templatePath . "stockControl.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Stock control</a>");
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopDb->m_dspStockMessage());
                         }
                     } else {
                         $obShopDb->templatePath = $this->templatePath;
                         $obShopDb->Interface = $obShopInterface;
                         if (!$obShopDb->m_updateCart('1')) {
                             $obShopDb->stockTemplate = $this->templatePath . "stockControl.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Stock control</a>");
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopDb->m_dspStockMessage());
                         }
                     }
                     break;
                 case "calcShip":
                     if ($this->request['mode'] == "Get Quote") {
                         $_SESSION['calcShip'] = $this->request['mode'];
                     }
                     $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " &nbsp;&raquo;&nbsp;<a href='#'>Shopping basket</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_viewCart());
                     break;
                 case "viewcart":
                     $_SESSION['referer'] = SITE_SAFEURL . "ecom/index.php?action=ecom.viewcart";
                     $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " &nbsp;&raquo;&nbsp;<a href='#'>Shopping basket</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_viewCart());
                     break;
                 case "changepostage":
                     if (DEFAULT_POSTAGE_METHOD == 'zones') {
                         $this->comFunc->m_postageZonePrice($_SESSION['cartweight'], $this->request['countryid'], $_SESSION['grandTotal'], 1, $_SESSION['subtotal'], $_SESSION['grandsubTotal'], $_SESSION['VAT']);
                     } elseif (DEFAULT_POSTAGE_METHOD == 'cities') {
                         $this->comFunc->m_postageCityPrice($_SESSION['cartweight'], $this->request['countryid'], $_SESSION['grandTotal'], 1, $_SESSION['subtotal'], $_SESSION['grandsubTotal'], $_SESSION['VAT'], $this->request['stateid']);
                     }
                     break;
                 case "updateviewcart":
                     $this->comFunc->m_UpdateViewCart();
                     break;
                 case "changecountry":
                     $this->comFunc->m_postageCityCountry($this->request['countryid']);
                     break;
                 case "giftwrap":
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Gift wrap</a>");
                     $obShopInterface->giftTemplate = $this->templatePath . "giftwrap.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspGiftWrap());
                     break;
                 case "giftAdd":
                     $obShopDb->m_addGiftWrap();
                     break;
                 case "removeGift":
                     $obShopDb->m_removeGift();
                     break;
                 case "backitem":
                     $obShopDb->m_backOrderSeperate();
                     break;
                 case "backremove":
                     $obShopDb->m_deleteCart();
                     break;
                 case "instructions":
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Backorder instructions</a>");
                     $obShopInterface->giftTemplate = $this->templatePath . "backorder.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspBackOrderInstructions());
                     break;
                 default:
                     $obShopInterface->template = $this->templatePath . "viewcart.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Shopping basket</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_viewCart());
                     break;
             }
             break;
         case "checkout":
             $obBill = new c_billShipInfo();
             $obBill->obTpl = $this->obTpl;
             $obBill->obDb = $this->obDb;
             $obBill->request = $this->request;
             $obPayment = new c_payment();
             $obPayment->obTpl = $this->obTpl;
             $obPayment->obDb = $this->obDb;
             $obPayment->request = $this->request;
             $user = new c_userInterface();
             $user->obTpl = $this->obTpl;
             $user->obDb = $this->obDb;
             $user->request = $this->request;
             $obReview = new c_review();
             $obReview->obTpl = $this->obTpl;
             $obReview->obDb = $this->obDb;
             $obReview->request = $this->request;
             $obSaveOrder = new c_saveOrder();
             $obSaveOrder->obTpl = $this->obTpl;
             $obSaveOrder->obDb = $this->obDb;
             $obSaveOrder->request = $this->request;
             $obreceipt = new c_receipt();
             $obreceipt->obTpl = $this->obTpl;
             $obreceipt->obDb = $this->obDb;
             $obreceipt->request = $this->request;
             $this->libFunc = new c_libFunctions();
             $cardSave = new c_cardSave();
             $cardSave->obDb = $this->obDb;
             $cardSave->obTpl = $this->obTpl;
             $cardSave->request = $this->request;
             $cardSave->libFunc = $this->libFunc;
             switch ($action[1]) {
                 case "login":
                     $obBill->m_checkLogin();
                     $obBill->loginTemplate = $this->templatePath . "checkoutLogin.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Login</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_checkoutLoginForm());
                     break;
                 case "lost":
                     $user->cart = 1;
                     $user->m_sendPassword();
                     $obBill->loginTemplate = $this->templatePath . "checkoutLogin.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Login</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_checkoutLoginForm());
                     break;
                 case "loginForm":
                     $obBill->loginTemplate = $this->templatePath . "checkoutLogin.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Login</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_checkoutLoginForm());
                     break;
                 case "logout":
                     session_destroy();
                     $retUrl1 = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl1;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.login");
                     header("Location:" . $retUrl);
                     break;
                 case "billing":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     //$_SESSION['referer']=$retUrl;
                     #IF WITHOUT LOGIN CHECKUT SELECTED
                     //if(!isset($this->request['email']) && empty($this->request['email'])){
                     #IF EMAIL NOT SPECIFIED THEN CHECK LOGIN DETAILS
                     //$this->libFunc->m_cartAuthenticate();
                     //session_unregister('referer');
                     //}
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Billing &amp; delivery address</a>");
                     unset($_SESSION['referer']);
                     $obBill->billShipTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_billShipInfoForm());
                     break;
                 case "billingerr":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     //$_SESSION['referer']=$retUrl;
                     #IF WITHOUT LOGIN CHECKUT SELECTED
                     //if(!isset($this->request['email']) && empty($this->request['email'])){
                     #IF EMAIL NOT SPECIFIED THEN CHECK LOGIN DETAILS
                     //$this->libFunc->m_cartAuthenticate();
                     //session_unregister('referer');
                     //}
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Billing &amp; delivery address</a>");
                     unset($_SESSION['referer']);
                     $obBill->billShipTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $obBill->err = 1;
                     $obBill->errMsg = 'There was a problem with your payment details.';
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_billShipInfoForm());
                     break;
                 case "addBillShipInfo":
                     $this->comFunc->m_checkShoppingCart();
                     $result = $obBill->m_verifyBillShipAdd();
                     if ($result) {
                         echo "||ERROR||1||" . $result . "||";
                     } else {
                         $obBill->m_saveBillShipInfo();
                     }
                     break;
                 case "shipping":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     $obBill->postageTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Postage information</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_postageSelect());
                     break;
                 case "updatePostage":
                     $this->comFunc->m_checkShoppingCart();
                     $obBill->m_updatePostage();
                     break;
                 case "payment":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     $obPayment->paymentTemplate = $this->templatePath . "payment.tpl.htm";
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Choose a payment method</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obPayment->m_paymentMethods());
                     break;
                 case "review":
                     $siteUrl = SITE_URL . "ecom/index.php?action=checkout.billing";
                     $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($siteUrl));
                     break;
                 case "reviewit":
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     if ($obPayment->m_verifyPaymentGateway()) {
                         $obPayment->paymentTemplate = $this->templatePath . "payment.tpl.htm";
                         //$paymentUrl=$this->libFunc->m_safeUrl(SITE_URL."ecom/index.php?action=checkout.payment");
                         $paymentUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.billing");
                         $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href=\"" . $paymentUrl . "\">Billing & delivery address</a>&nbsp;&raquo;&nbsp;<a href='#'>Review your order</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obPayment->m_paymentMethods());
                     } else {
                         $obReview->libFunc = $this->libFunc;
                         $obReview->reviewTemplate = $this->templatePath . "review.tpl.htm";
                         //$paymentUrl=$this->libFunc->m_safeUrl(SITE_URL."ecom/index.php?action=checkout.payment");
                         $paymentUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.billing");
                         $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href=\"" . $paymentUrl . "\">Billing & delivery address</a>&nbsp;&raquo;&nbsp;<a href='#'>Review your order</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obReview->m_reviewCheckout());
                     }
                     break;
                 case "saveorder":
                     $obSaveOrder->cardsaveTemplate = $this->templatePath . "cardsave.tpl.htm";
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     $obSaveOrder->worldpayTemplate = $this->templatePath . "worldpay.tpl.htm";
                     $obSaveOrder->secpayTemplate = $this->templatePath . "secpay.tpl.htm";
                     $obSaveOrder->hsbcTemplate = $this->templatePath . "hsbc.tpl.htm";
                     $obSaveOrder->barclayTemplate = $this->templatePath . "barclay.tpl.htm";
                     $obSaveOrder->paypalTemplate = $this->templatePath . "paypal.tpl.htm";
                     $obSaveOrder->offSTTemplate = $this->templatePath . "offst.tpl.htm";
                     #(BEGIN) SAGEPAY INTEGRATION
                     $obSaveOrder->sagepayTemplate = $this->templatePath . "sageform.tpl.htm";
                     #(END) SAGEPAY INTEGRATION
                     $this->comFunc->m_checkShoppingCart();
                     $obBill->errMsg = $obSaveOrder->m_saveOrderData();
                     //$obSaveOrder->m_saveOrderData();
                     $obBill->billShipTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"" . $cartUrl . "\">Shopping basket</a>&nbsp;&raquo;&nbsp;<a href='#'>Choose a payment method</a>");
                     unset($_SESSION['userid']);
                     unset($_SESSION['username']);
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_billShipInfoForm());
                     break;
                 case "return":
                     //PAYPAL AND OTHER RETURN PAGE DISPLAY
                     $obreceipt->template = $this->templatePath . "return.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href=\"#\">Order Confirmation</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obreceipt->m_return());
                     break;
                 case "IPN":
                     //PAYPAL INSTANT PAYMENT NOTIFICATION
                     $result = $obreceipt->m_Paypal_IPN_Notification();
                     if ($result[0] == "1") {
                         $obreceipt->m_sendOrderDetails($result[1]);
                     }
                     break;
                 case "sage3d":
                     $obreceipt->m_Sagepay_3D1();
                     break;
                 case "sage3d2":
                     $obreceipt->m_Sagepay_3D2();
                     break;
                 case "sage3dr":
                     $obreceipt->m_Sagepay_3DR();
                     break;
                 case "cs3d":
                     $cardSave->m_cardSave_3D1();
                     break;
                 case "cs3d2":
                     $cardSave->m_cardSave_3D2();
                     break;
                 case "cs3dr":
                     $cardSave->m_cardSave_3DR();
                     break;
                 case "cshcb":
                     $cardSave->m_cardSave_Hosted_Callback("0");
                     break;
                 case "cshcb2":
                     $cardSave->m_cardSave_Hosted_Callback("1");
                     break;
                 case "process":
                     $obreceipt->processTemplate = $this->templatePath . "orderProcessed.tpl.htm";
                     $obPayment->errMsg = $obreceipt->m_sendOrderDetails();
                     break;
                 case "status":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.status&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     if ((!isset($_SESSION['userid']) || !isset($_SESSION['username']) || $_SESSION['userid'] == "") && !isset($_SESSION['customer']) && !isset($_SESSION['email'])) {
                         $siteUrl = SITE_URL . "ecom/index.php?action=checkout.loginForm";
                         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($siteUrl));
                     }
                     unset($_SESSION['referer']);
                     $obreceipt->template = $this->templatePath . "orderProcessed.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Order Processed</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obreceipt->m_orderProcessed());
                     break;
                 case "receipt":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.receipt&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     if ((!isset($_SESSION['userid']) || !isset($_SESSION['username']) || $_SESSION['userid'] == "") && !isset($_SESSION['customer']) && !isset($_SESSION['email'])) {
                         $siteUrl = SITE_URL . "ecom/index.php?action=checkout.loginForm";
                         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($siteUrl));
                     }
                     //$this->libFunc->m_cartAuthenticate();
                     unset($_SESSION['referer']);
                     $obreceipt->receiptTemplate = $this->templatePath . "receipt.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>View Receipt</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obreceipt->m_dspreceipt());
                     break;
                 case "editOrder":
                     if ((!isset($_SESSION['userid']) || !isset($_SESSION['username']) || $_SESSION['userid'] == "") && !isset($_SESSION['customer']) && !isset($_SESSION['email'])) {
                         $siteUrl = SITE_URL . "ecom/index.php?action=checkout.loginForm";
                         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($siteUrl));
                     }
                     $obShopDb = new c_shopDb();
                     $obShopDb->obTpl = $this->obTpl;
                     $obShopDb->obDb = $this->obDb;
                     $obShopDb->request = $this->request;
                     $obShopDb->m_addInvoiceToCart();
                     $cartUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart");
                     $this->libFunc->m_mosRedirect($cartUrl);
                     break;
                 case "cardsave_success":
                     if ($_REQUEST['StatusCode'] != '0') {
                         $_SESSION['Message'] = $_REQUEST['Message'];
                         $retUrl = SITE_URL . "ecom/index.php?action=checkout.billing";
                         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($retUrl));
                         exit;
                     }
                     $vAuthCode = $_SESSION['vAuthCode'] = str_replace("AuthCode: ", "", $_REQUEST['Message']);
                     if ($vAuthCode) {
                         $this->obDb->query = "update " . ORDERS . " set vAuthCode='{$vAuthCode}' where iOrderid_PK=" . $_REQUEST['OrderID'];
                         $this->obDb->updateQuery();
                     }
                     $obCSR->receiptTemplate = $this->templatePath . "cardsave_success.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Cardsave Success</a>");
                     $retUrl = SITE_URL . "ecom/index.php?action=checkout.process&mode=" . $_REQUEST['OrderID'];
                     $this->obDb->query = "update " . ORDERS . " set iOrderStatus=1 where iOrderid_PK=" . $_REQUEST['OrderID'];
                     $this->obDb->updateQuery();
                     $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($retUrl));
                     break;
                 case "backorder":
                     $obreceipt->m_processBackorder();
                     break;
                 case "supplierConf":
                     $obreceipt->receiptTemplate = $this->templatePath . "supplier_conf.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Confirmation</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obreceipt->m_supplierOrderConf());
                     break;
                 default:
                     $this->comFunc->m_checkShoppingCart();
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                     $_SESSION['referer'] = $retUrl;
                     if (!isset($this->request['email']) && empty($this->request['email'])) {
                         $this->libFunc->m_cartAuthenticate();
                         unset($_SESSION['referer']);
                     } elseif ($obBill->m_valiadateEmail() == 1) {
                         $obBill->loginTemplate = $this->templatePath . "checkoutLogin.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Login</a>");
                         $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_checkoutLoginForm());
                         break;
                     }
                     $obBill->billShipTemplate = $this->templatePath . "ConfirmOrderAndBillShip.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Shopping basket</a>");
                     $this->obTpl->set_var("TPL_VAR_BODY", $obBill->m_billShipInfoForm());
                     break;
             }
             break;
         case "wishlist":
             if (USEWISHLIST != 1) {
                 $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php?action=error&mode=content");
                 header("Location:" . $retUrl);
                 exit;
             }
             $obWishInterface = new c_wishInterface();
             $obWishInterface->obTpl = $this->obTpl;
             $obWishInterface->obDb = $this->obDb;
             $obWishInterface->request = $this->request;
             $obWishlistDb = new c_wishlistDb();
             $obWishlistDb->obTpl = $this->obTpl;
             $obWishlistDb->obDb = $this->obDb;
             $obWishlistDb->request = $this->request;
             $this->libFunc = new c_libFunctions();
             switch ($action[1]) {
                 case "display":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=wishlist.display");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>My Wish List</a>");
                     $obWishInterface->template = $this->templatePath . "wishlist.tpl.htm";
                     $obWishInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obWishInterface->m_showWishlist());
                     break;
                 case "add":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=wishlist.add&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->libFunc->authenticate();
                     $obWishlistDb->m_insertWishlist();
                     break;
                 case "emailadd":
                     $this->libFunc->authenticate();
                     $obWishlistDb->m_addWishEmail();
                     break;
                 case "emailsend":
                     $this->libFunc->authenticate();
                     $obWishInterface->m_sendEmail();
                     break;
                 case "emailremove":
                     $this->libFunc->authenticate();
                     $obWishlistDb->m_removeWishEmail();
                     break;
                 case "modify":
                     $this->libFunc->authenticate();
                     $obWishlistDb->m_modifyWishlist();
                     break;
                 default:
                     $this->libFunc->authenticate();
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>My wishlist</a>");
                     $obWishInterface->template = $this->templatePath . "wishlist.tpl.htm";
                     $obWishInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obWishInterface->m_showWishlist());
                     break;
             }
             break;
         case "compare":
             if (USECOMPARE != 1) {
                 $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php");
                 header("Location:" . $retUrl);
                 exit;
             }
             $obCompareInterface = new c_compareInterface();
             $obCompareInterface->obTpl = $this->obTpl;
             $obCompareInterface->obDb = $this->obDb;
             $obCompareInterface->request = $this->request;
             $obCompareDb = new c_comparelistDb();
             $obCompareDb->obTpl = $this->obTpl;
             $obCompareDb->obDb = $this->obDb;
             $obCompareDb->request = $this->request;
             $this->libFunc = new c_libFunctions();
             switch ($action[1]) {
                 case "display":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=compare.display");
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>My Comparison List</a>");
                     $obCompareInterface->template = $this->templatePath . "comparelist.tpl.htm";
                     $obCompareInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obCompareInterface->m_showComparelist());
                     break;
                 case "add":
                     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=compare.add&mode=" . $this->request['mode']);
                     $_SESSION['referer'] = $retUrl;
                     $this->libFunc->authenticate();
                     unset($_SESSION['referer']);
                     $this->libFunc->authenticate();
                     $obCompareDb->m_insertComparelist();
                     break;
                 case "modify":
                     $this->libFunc->authenticate();
                     $obCompareDb->m_modifyComparelist();
                     break;
                 default:
                     $this->libFunc->authenticate();
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>My Comaparison list</a>");
                     $obCompareInterface->template = $this->templatePath . "comparelist.tpl.htm";
                     $obCompareInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obCompareInterface->m_showComparelist());
                     break;
             }
             break;
         case "enquiry":
         case "wishlist":
             $obEnquiryInterface = new c_enquiryInterface();
             $obEnquiryInterface->obTpl = $this->obTpl;
             $obEnquiryInterface->obDb = $this->obDb;
             $obEnquiryInterface->request = $this->request;
             $obEnquiryDb = new c_enquiryDb();
             $obEnquiryDb->obTpl = $this->obTpl;
             $obEnquiryDb->obDb = $this->obDb;
             $obEnquiryDb->request = $this->request;
             $this->libFunc = new c_libFunctions();
             switch ($action[1]) {
                 case "dspForm":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Product Enquiry</a>");
                     $obEnquiryInterface->enquiryTemplate = $this->templatePath . "enquiry.tpl.htm";
                     $obEnquiryInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obEnquiryInterface->m_showEnquiryForm());
                     break;
                 case "post":
                     $obEnquiryInterface->m_sendEmail();
                     break;
                 case "status":
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Product Enquiry</a>");
                     $obEnquiryInterface->enquiryTemplate = $this->templatePath . "enquirySubmit.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obEnquiryInterface->m_showStatus());
                     break;
                 default:
                     $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", "&nbsp;&raquo;&nbsp;<a href='#'>Product Enquiry</a>");
                     $obEnquiryInterface->enquiryTemplate = $this->templatePath . "enquiry.tpl.htm";
                     $obEnquiryInterface->libFunc = $this->libFunc;
                     $this->obTpl->set_var("TPL_VAR_BODY", $obEnquiryInterface->m_showEnquiryForm());
                     break;
             }
             break;
         default:
             $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php");
             header("Location:" . $retUrl);
             exit;
             break;
     }
 }
Ejemplo n.º 2
0
 function m_updateArticleFeed()
 {
     $libFunc = new c_libFunctions();
     #INTIALIZING VALUES
     if (isset($this->request['rssarticles'])) {
         $this->obDb->query = "UPDATE " . SITESETTINGS . " SET nNumberdata ='" . $this->request['rssarticles'] . "' WHERE vDatatype='rssarticles'";
         $this->obDb->updateQuery();
     }
     $obUpdateDb = new c_shopDb();
     $obUpdateDb->obDb = $this->obDb;
     $obUpdateDb->m_RSSArticleFeed();
     $this->libFunc->m_mosRedirect(SITE_URL . "sales/adminindex.php?action=feeds.home");
 }
 function m_eventHandler()
 {
     if (!isset($this->request['action'])) {
         $this->request['action'] = "";
     }
     $action = explode(".", $this->request['action']);
     if (isset($this->request['owner']) && !is_Numeric($this->request['owner'])) {
         $this->request['owner'] = 0;
     }
     $obShopInterface = new c_shopInterface();
     $obShopInterface->obTpl = $this->obTpl;
     $obShopInterface->obDb = $this->obDb;
     $obShopInterface->request = $this->request;
     $obShopInterface->imageUrl = SITE_URL . "images/";
     $obShopInterface->imagePath = SITE_PATH . "images/";
     switch ($action[0]) {
         #HANDLING VIEW(FRONTEND-SHOP BUILDER)
         case "ec_show":
             switch ($action[1]) {
                 case "home":
                     $obShopInterface->departmentTemplate = $this->templatePath . "dspShopBuilder.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDepartments());
                     break;
                 case "deptFrm":
                     $obShopInterface->departmentTemplate = $this->templatePath . "dspDeptForm.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspDepartmentForm());
                     break;
                 case "contentFrm":
                     $obShopInterface->contentTemplate = $this->templatePath . "dspContentForm.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspContentForm());
                     break;
                 case "dspMsg":
                     $obShopInterface->msgTemplate = $this->templatePath . "dspMessage.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspMessage());
                     break;
                 case "dspUploadFrm":
                     $obShopInterface->uploadTemplate = $this->templatePath . "uploadImages.tpl.htm";
                     $obShopInterface->m_uploadForm();
                     break;
                 case "dspProFrm":
                     $obShopInterface->productTemplate = $this->templatePath . "dspProdForm.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspProductForm());
                     break;
                 case "reorder":
                     $obShopInterface->reorderTemplate = $this->templatePath . "dspOrderList.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_reorder());
                     break;
                 case "associate":
                     $obShopInterface->associateTemplate = $this->templatePath . "dspAssociateItems.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_associateItems());
                     break;
                 case "vdiscount":
                     $obShopInterface->discountTemplate = $this->templatePath . "volDiscount.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_volDiscount());
                     break;
                 case "attachOpt":
                     $obShopInterface->optionTemplate = $this->templatePath . "attachOption.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_attachOptions());
                     break;
                 case "deleteimage":
                     $this->libfunc->check_token();
                     $obShopInterface->m_deleteImage();
                     break;
                 default:
                     $obShopInterface->departmentTemplate = $this->templatePath . "dspShopBuilder.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDepartments());
                     break;
             }
             break;
             #HANDLING MODEL(DATABASE TRANSANCTION-SHOP BUILDER)
         #HANDLING MODEL(DATABASE TRANSANCTION-SHOP BUILDER)
         case "ec_db":
             $obUpdateDb = new c_shopDb();
             $optionDb = new c_optionDb();
             $obUpdateDb->obDb = $this->obDb;
             $obUpdateDb->request = $this->request;
             $obUpdateDb->imagePath = SITE_PATH . "images/";
             //die($this->request['type']);
             switch ($action[1]) {
                 case "updateHome":
                     $this->libfunc->check_token();
                     if ($this->request['type'] == "product") {
                         $obUpdateDb->m_updateHomeProduct();
                     } elseif ($this->request['type'] == "content") {
                         $obUpdateDb->m_updateHomeContent();
                     } else {
                         $obUpdateDb->m_updateHomeDept();
                     }
                     break;
                 case "Dept":
                     $this->libfunc->check_token();
                     if ($this->request['mode'] == "edit") {
                         if (!$obShopInterface->verifyEditDept()) {
                             $obUpdateDb->m_updateDept();
                         } else {
                             $obShopInterface->request['msg'] = 1;
                             $obShopInterface->request['id'] = $this->request['deptId'];
                             $obShopInterface->request['type'] = $this->request['type'];
                             $obShopInterface->departmentTemplate = $this->templatePath . "dspDeptForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspDepartmentForm());
                         }
                     } else {
                         if (!$obShopInterface->verifyInsertDept()) {
                             $obUpdateDb->m_insertDept();
                         } else {
                             if (empty($this->request['deptId'])) {
                                 $obShopInterface->request['dupeid'] = $this->request['deptId'];
                                 $obShopInterface->request['type'] = $this->request['type'];
                             }
                             $obShopInterface->request['msg'] = 1;
                             $obShopInterface->departmentTemplate = $this->templatePath . "dspDeptForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspDepartmentForm());
                         }
                     }
                     break;
                 case "updateAssociate":
                     $this->libfunc->check_token();
                     $obUpdateDb->m_updateAssociate();
                     break;
                 case "addDiscount":
                     $this->libfunc->check_token();
                     $obUpdateDb->m_addDiscount();
                     break;
                 case "attach":
                     $this->libfunc->check_token();
                     $obUpdateDb->m_attach();
                     break;
                 case "delRelation":
                     $this->libfunc->check_token();
                     $obUpdateDb->m_delRelation();
                     break;
                 case "updateSort":
                     $obUpdateDb->m_updateSort();
                     break;
                 case "uploadDeptImages":
                     $this->libfunc->check_token();
                     if (!$obShopInterface->verifyImageUpload()) {
                         $obUpdateDb->m_uploadImage();
                     } else {
                         $obShopInterface->request['image'] = $this->request['current_image'];
                         $obShopInterface->uploadTemplate = $this->templatePath . "uploadImages.tpl.htm";
                         $obShopInterface->m_uploadForm();
                     }
                     break;
                 case "insertProduct":
                     $this->libfunc->check_token();
                     if ($this->request['mode'] == "edit") {
                         if (!$obShopInterface->verifyEditProduct()) {
                             $obUpdateDb->m_updateProduct();
                         } else {
                             $obShopInterface->request['msg'] = 1;
                             $obShopInterface->request['id'] = $this->request['prodId'];
                             $obShopInterface->productTemplate = $this->templatePath . "dspProdForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspProductForm());
                         }
                     } else {
                         if (!$obShopInterface->verifyInsertProduct()) {
                             $obUpdateDb->m_insertProduct();
                         } else {
                             if (empty($this->request['prodId'])) {
                                 $obShopInterface->request['dupeid'] = $this->request['prodId'];
                                 $obShopInterface->request['type'] = $this->request['type'];
                             }
                             $obShopInterface->request['msg'] = 1;
                             $obShopInterface->productTemplate = $this->templatePath . "dspProdForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspProductForm());
                         }
                     }
                     break;
                 case "content":
                     $this->libfunc->check_token();
                     if ($this->request['mode'] == "edit") {
                         if (!$obShopInterface->verifyEditContent()) {
                             $obUpdateDb->m_updateContent();
                         } else {
                             $obShopInterface->request['msg'] = 1;
                             $obShopInterface->request['id'] = $this->request['contentId'];
                             $obShopInterface->contentTemplate = $this->templatePath . "dspContentForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspContentForm());
                         }
                     } else {
                         if (!$obShopInterface->verifyInsertContent()) {
                             $obUpdateDb->m_insertContent();
                         } else {
                             if (empty($this->request['contentId'])) {
                                 $obShopInterface->request['dupeid'] = $this->request['contentId'];
                                 $obShopInterface->request['type'] = $this->request['type'];
                             }
                             $obShopInterface->request['msg'] = 1;
                             $obShopInterface->contentTemplate = $this->templatePath . "dspContentForm.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspContentForm());
                         }
                     }
                     break;
                 case "delDept":
                 case "delProduct":
                 case "delContent":
                     $this->libfunc->check_token();
                     $obUpdateDb->m_delete();
                     break;
                     break;
                     break;
                 case "delCInstance":
                 case "delPInstance":
                     $this->libfunc->check_token();
                     $obUpdateDb->m_deleteInstance();
                     break;
                     break;
             }
             break;
             #HANDLING HELP PAGES
         #HANDLING HELP PAGES
         case "help":
             $this->Template = MODULES_PATH . "default/templates/admin/helpOuter.htm";
             $this->obTpl->set_file("mainContent", $this->Template);
             switch ($action[1]) {
                 case "dept":
                     $this->Template = MODULES_PATH . "default/templates/help/department.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_PAGETITLE", "Department Help");
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "product":
                     $this->Template = MODULES_PATH . "default/templates/help/products.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_PAGETITLE", "Department Help");
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "content":
                     $this->Template = MODULES_PATH . "default/templates/help/content.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_PAGETITLE", "Department Help");
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "orderlist":
                     $this->Template = MODULES_PATH . "default/templates/help/order_list.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_PAGETITLE", "Order List Help");
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "associate":
                     $this->Template = MODULES_PATH . "default/templates/help/associate.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "menuhelp":
                     $this->Template = MODULES_PATH . "default/templates/help/menu.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "stdoption":
                     $this->Template = MODULES_PATH . "default/templates/help/options.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "ctmoption":
                     $this->Template = MODULES_PATH . "default/templates/help/choices.tpl.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "package":
                     $this->Template = MODULES_PATH . "default/templates/help/product_packages.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "vdiscount":
                     $this->Template = MODULES_PATH . "default/templates/help/volume_discounts.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
                 case "attach":
                     $this->Template = MODULES_PATH . "default/templates/help/choices.tpl.htm";
                     $this->obTpl->set_file("innerContent", $this->Template);
                     $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent"));
                     break;
             }
             $this->obTpl->pparse("return", "mainContent");
             exit;
             break;
             #HANDLING MENU_FRONT END (VIEW)
         #HANDLING MENU_FRONT END (VIEW)
         case "ec_menu":
             $obMenuInterface = new c_menuInterface();
             $obMenuInterface->obTpl = $this->obTpl;
             $obMenuInterface->obDb = $this->obDb;
             $obMenuInterface->request = $this->request;
             $obMenuInterface->imageUrl = SITE_URL . "images/";
             $obMenuInterface->imagePath = SITE_PATH . "images/";
             $obUpdateMenuDb = new c_menuDb();
             $obUpdateMenuDb->obDb = $this->obDb;
             $obUpdateMenuDb->request = $this->request;
             $obUpdateMenuDb->imagePath = SITE_PATH . "images/";
             switch ($action[1]) {
                 case "dspForm":
                     $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuHeader.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuHeaders());
                     break;
                 case "show":
                     $obMenuInterface->menuHeadTemplate = $this->templatePath . "dspMenuHeader.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_showMenuHeaders());
                     break;
                 case "menuadd":
                     $this->libfunc->check_token();
                     if ($this->request['mode'] == "edit") {
                         if (!$obMenuInterface->m_verifyEditMenuHeader()) {
                             $obUpdateMenuDb->m_updateMenuHeader();
                         } else {
                             $obMenuInterface->request['msg'] = 1;
                             $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuHeader.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuHeaders());
                         }
                     } else {
                         if (!$obMenuInterface->m_verifyInsertMenuHeader()) {
                             $obUpdateMenuDb->m_insertMenuHeader();
                         } else {
                             $obMenuInterface->request['msg'] = 1;
                             $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuHeader.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuHeaders());
                         }
                     }
                     break;
                 case "uploadForm":
                     $obMenuInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_uploadForm());
                     break;
                 case "upload":
                     $this->libfunc->check_token();
                     if (!$obMenuInterface->m_verifyImageUpload()) {
                         $obUpdateMenuDb->m_uploadImage();
                     } else {
                         $obMenuInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_uploadForm());
                     }
                     break;
                 case "updatehome":
                     $this->libfunc->check_token();
                     $obUpdateMenuDb->m_updateHomeMenuHeader();
                     break;
                 case "deleteMenu":
                     $this->libfunc->check_token();
                     $obUpdateMenuDb->m_deleteMenu();
                     break;
                 case "itemForm":
                     $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuItems.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuItem());
                     break;
                 case "viewItems":
                     $obMenuInterface->menuItemTemplate = $this->templatePath . "dspMenuItems.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_showMenuItem());
                     break;
                 case "itemadd":
                     $this->libfunc->check_token();
                     if ($this->request['mode'] == "edit") {
                         if (!$obMenuInterface->m_verifyEditMenuItem()) {
                             $obUpdateMenuDb->m_updateMenuItem();
                         } else {
                             $obMenuInterface->request['msg'] = 1;
                             $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuItems.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuItem());
                         }
                     } else {
                         if (!$obMenuInterface->m_verifyInsertMenuItem()) {
                             $obUpdateMenuDb->m_insertMenuItem();
                         } else {
                             $obMenuInterface->request['msg'] = 1;
                             $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuItems.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuItem());
                         }
                     }
                     break;
                 case "itemhome":
                     $obUpdateMenuDb->m_updateHomeMenuItem();
                     break;
                 case "deleteItem":
                     $this->libfunc->check_token();
                     $obUpdateMenuDb->m_deleteItem();
                     break;
                 default:
                     $obMenuInterface->menuHeadTemplate = $this->templatePath . "dspMenuHeader.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_showMenuHeaders());
                     break;
             }
             break;
         case "ec_option":
             $obOptionInterface = new c_optionInterface();
             $obOptionInterface->obTpl = $this->obTpl;
             $obOptionInterface->obDb = $this->obDb;
             $obOptionInterface->request = $this->request;
             $obOptionInterface->imageUrl = SITE_URL . "images/";
             $obOptionInterface->imagePath = SITE_PATH . "images/";
             $obUpdateOptionDb = new c_optionDb();
             $obUpdateOptionDb->obDb = $this->obDb;
             $obUpdateOptionDb->request = $this->request;
             $obUpdateOptionDb->imagePath = SITE_PATH . "images/";
             #INTIALIZING ACTION
             if (!isset($action[1])) {
                 $action[1] = "";
             }
             switch ($action[1]) {
                 case "home":
                     $obOptionInterface->optionsTemplate = $this->templatePath . "optionHome.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptions());
                     break;
                 case "dspStandardOpt":
                     $obOptionInterface->optionsTemplate = $this->templatePath . "optionStandard.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showStandardOpt());
                     break;
                 case "dspCustomOpt":
                     $obOptionInterface->optionsTemplate = $this->templatePath . "optionCustom.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showCustomOpt());
                     break;
                 case "dspAttributes":
                     $obOptionInterface->attributeTemplate = $this->templatePath . "attributes.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showAttribute());
                     break;
                 case "dspAddattribute":
                     $obOptionInterface->addattributeTemplate = $this->templatePath . "addattributes.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showAddAttribute());
                     break;
                 case "dspNumForm":
                     $obOptionInterface->optionNumTemplate = $this->templatePath . "formNumOption.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_formNumOptions());
                     break;
                 case "stdOptForm":
                     $obOptionInterface->optionTemplate = $this->templatePath . "formOptions.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptionForm());
                     break;
                 case "ajaxAttribute":
                     $obUpdateOptionDb->m_ajaxgetAtrribute();
                     break;
                 case "optionadd":
                     $this->libfunc->check_token();
                     if ($obOptionInterface->m_verifyInsertOption()) {
                         $images = $obUpdateOptionDb->m_uploadImages();
                         $obUpdateOptionDb->m_insertOption($images);
                     } else {
                         $obOptionInterface->request['msg'] = 1;
                         $obOptionInterface->optionTemplate = $this->templatePath . "formOptions.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptionForm());
                     }
                     break;
                 case "optionedit":
                     $this->libfunc->check_token();
                     if ($obOptionInterface->m_verifyEditOption()) {
                         $obUpdateOptionDb->m_updateOption();
                     } else {
                         $obOptionInterface->request['msg'] = 1;
                         $obOptionInterface->optionTemplate = $this->templatePath . "formOptions.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptionForm());
                     }
                     break;
                 case "editForm":
                     $obOptionInterface->optionTemplate = $this->templatePath . "formEditOptions.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_formEditOption());
                     break;
                 case "uploadForm":
                     $this->libfunc->check_token();
                     $obOptionInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_uploadForm());
                     break;
                 case "upload":
                     $this->libfunc->check_token();
                     if (!$obOptionInterface->m_verifyImageUpload()) {
                         $obUpdateOptionDb->m_uploadImage();
                     } else {
                         $obOptionInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm";
                         $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_uploadForm());
                     }
                     break;
                 case "addattribute":
                     $this->libfunc->check_token();
                     $obUpdateOptionDb->m_insertAttribute();
                     break;
                 case "editattribute":
                     $this->libfunc->check_token();
                     $obUpdateOptionDb->m_editAttribute();
                     break;
                 case "deleteattribute":
                     $this->libfunc->check_token();
                     $obUpdateOptionDb->m_delAttribute();
                     break;
                 case "delete":
                     $this->libfunc->check_token();
                     $obUpdateOptionDb->m_deleteOption();
                     break;
                 case "deleteChoice":
                     $this->libfunc->check_token();
                     $obUpdateOptionDb->m_deleteChoice();
                     break;
                 case "editChoice":
                 case "ctmOptForm":
                     $obOptionInterface->optionTemplate = $this->templatePath . "formCustomOption.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_customOptionForm());
                     break;
                     break;
                 case "choiceadd":
                     $this->libfunc->check_token();
                     if ($this->request['mode'] == "edit") {
                         if (!$obOptionInterface->m_verifyEditChoice()) {
                             $obUpdateOptionDb->m_updateChoice();
                         } else {
                             $obOptionInterface->request['msg'] = 1;
                             $obOptionInterface->optionTemplate = $this->templatePath . "formCustomOption.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_customOptionForm());
                         }
                     } else {
                         if (!$obOptionInterface->m_verifyInsertChoice()) {
                             $obUpdateOptionDb->m_insertChoice();
                         } else {
                             $obOptionInterface->request['msg'] = 1;
                             $obOptionInterface->optionTemplate = $this->templatePath . "formCustomOption.tpl.htm";
                             $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_customOptionForm());
                         }
                     }
                     break;
                 default:
                     $obOptionInterface->optionsTemplate = $this->templatePath . "optionHome.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptions());
                     break;
             }
             break;
         case "ec_package":
             $obPackInterface = new c_packageInterface();
             $obPackInterface->obTpl = $this->obTpl;
             $obPackInterface->obDb = $this->obDb;
             $obPackInterface->request = $this->request;
             $obPackInterface->imageUrl = SITE_URL . "images/";
             $obPackInterface->imagePath = SITE_PATH . "images/";
             $obUpdatePackDb = new c_packageDb();
             $obUpdatePackDb->obDb = $this->obDb;
             $obUpdatePackDb->request = $this->request;
             $obUpdatePackDb->imagePath = SITE_PATH . "images/";
             #INTIALIZING ACTION
             if (!isset($action[1])) {
                 $action[1] = "";
             }
             switch ($action[1]) {
                 case "home":
                     $obPackInterface->packageTemplate = $this->templatePath . "packageHome.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obPackInterface->m_packageHome());
                     break;
                 case "build":
                     $obPackInterface->packageTemplate = $this->templatePath . "buildPackage.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obPackInterface->m_packageBuild());
                     break;
                 case "disamble":
                     $obPackInterface->packageTemplate = $this->templatePath . "disamblePackage.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obPackInterface->m_packageDisamble());
                     break;
                 case "disambleit":
                     $this->libfunc->check_token();
                     $obUpdatePackDb->m_disamblePack();
                     break;
                 case "delete":
                     $this->libfunc->check_token();
                     $obUpdatePackDb->m_deletePackItem();
                     break;
                 case "update":
                     $this->libfunc->check_token();
                     $obUpdatePackDb->m_updatePackage();
                     break;
                 case "updateHome":
                     $obUpdatePackDb->m_updateHome();
                     break;
                 case "updatePackHome":
                     $obUpdatePackDb->m_updatePackHome();
                     break;
                 default:
                     $obPackInterface->packageTemplate = $this->templatePath . "packageHome.tpl.htm";
                     $this->obTpl->set_var("TPL_VAR_BODY", $obPackInterface->m_packageHome());
                     break;
             }
             break;
         default:
             header("Location:" . SITE_URL . "ecom/adminindex.php?action=ec_show.home");
             exit;
             break;
     }
 }