Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: Home.php
<?php defined('BASEPATH') or exit('No direct script access allowed'); class Home extends MY_Home_Controller { private $templatePath = 'template/layouts/default'; public function __construct() { parent::__construct(); if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->templatePath = 'template/' . $this->data['rsStngs']->Dtheme . '/layouts/default'; }else{ $this->templatePath = 'template/layouts/default'; } } public function index() { $rsSrvcs = array(); $ProductsOrCategories = ""; if (isset($this->data['rsStngs']->productOrCategory) && $this->data['rsStngs']->productOrCategory == 1) { $rsSrvcs = $this->db->query("SELECT * FROM tbl_gf_manufacturer WHERE DisableCategory = 0 AND ShowAtHomePageCat = 1 ORDER BY Category")->result(); $ProductsOrCategories = "Categories"; } else { $rsSrvcs = $this->db->query("SELECT * FROM tbl_gf_retail_services A, tbl_gf_manufacturer B WHERE A.CategoryId = B.CategoryId AND ArchivedPack = 0 AND DisablePackage = 0 AND A.ShowAtHomePage = 1 ORDER BY A.CategoryId, PackageTitle")->result(); $ProductsOrCategories = "Products"; } if ($this->db->table_exists('tbl_gf_ecomm_category') ) { $this->data['ecommCats'] = $this->db->where(array('status' => 1, 'set_on_home' => 1)) ->order_by('id', 'DESC') ->order_by('category_name', 'ASC') ->limit(12) ->get('tbl_gf_ecomm_category') ->result(); } if ($this->db->table_exists('tbl_gf_ecomm_product') ) { $this->data['ecommProducts'] = $this->db->where(array('status' => 1, 'is_home' => 1)) ->order_by('id', 'DESC') ->order_by('product_title', 'ASC') ->limit(12) ->get('tbl_gf_ecomm_product') ->result(); } //popup $popup = $this->db->get_where('tbl_gf_home_news_popup', array('status' => false))->result(); if(!empty($popup)){ $this->data['popup'] = $popup; $this->data['home_popup_title'] = $popup[0]->title; $this->data['home_popup_desc'] = $popup[0]->description; } $this->data['rsSrvcs'] = $rsSrvcs; $this->data['ProductsOrCategories'] = $ProductsOrCategories; $this->data['pagePopupStatus'] = $this->data['rsStngs']->PagePopup; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/home'; } else { $this->data['view'] = 'template/home'; } $this->load->view($this->templatePath, $this->data); } public function details($id=null){ $rsSrvcs = array(); $ProductsOrCategories = ""; if (isset($this->data['rsStngs']->productOrCategory) && $this->data['rsStngs']->productOrCategory == 1) { $rsSrvcs = $this->db->query("SELECT * FROM tbl_gf_manufacturer WHERE DisableCategory = 0 AND ShowAtHomePageCat = 1 AND PackageId = $id ORDER BY Category")->get()->row(); $ProductsOrCategories = "Categories"; } else { $rsSrvcs = $this->db->query("SELECT * FROM tbl_gf_retail_services A, tbl_gf_manufacturer B WHERE A.CategoryId = B.CategoryId AND ArchivedPack = 0 AND DisablePackage = 0 AND A.ShowAtHomePage = 1 AND A.PackageId = $id ORDER BY A.CategoryId, PackageTitle")->result(); $ProductsOrCategories = "Products"; } foreach($rsSrvcs as $rsSrvcs){} $this->data['rsSrvcs'] = $rsSrvcs; //d($this->data['rsSrvcs']); $this->data['Id'] = $rsSrvcs->PackageId; $this->data['ProductsOrCategories'] = $ProductsOrCategories; $this->data['view'] = 'template/imei_service_dtl_page'; $this->load->view($this->templatePath, $this->data); } public function news() { $news_id = $this->input->get('id') ? $this->input->get('id') : 0; $cat_id = $this->input->get('catid') ? $this->input->get('catid') : 0; if ($cat_id > 0) { $Newsresult = $this->db->query("SELECT * FROM tbl_gf_news WHERE DisableNews = 0 AND NewsType = 0 AND CategoryId = $cat_id ORDER BY NewsId")->result(); } elseif ($news_id > 0) { $NewsDetail = $this->db->query("SELECT * FROM tbl_gf_news WHERE DisableNews = 0 AND NewsType = 0 AND NewsId = $news_id ORDER BY NewsId")->row(); if ($NewsDetail->CategoryId > 0) { $Newsresult = $this->db->query("SELECT * FROM tbl_gf_news WHERE DisableNews = 0 AND NewsType = 0 AND CategoryId = $NewsDetail->CategoryId ORDER BY NewsId DESC ")->result(); } else { $Newsresult = $this->db->query("SELECT * FROM tbl_gf_news WHERE DisableNews = 0 AND NewsType = 0 AND NewsId = $news_id ORDER BY NewsId")->result(); } } else { $Newsresult = $this->db->query("SELECT * FROM tbl_gf_news WHERE DisableNews = 0 AND NewsType = 0 ORDER BY NewsId")->result(); } $NewsCategory = $this->db->query("SELECT * FROM tbl_gf_news_cat WHERE DisableCategory = 0 ORDER BY OrderBy")->result(); foreach ($Newsresult as $News) { if ($News->NewsId == $news_id) { $this->data['META_KW_CONTENTS'] = stripslashes($News->MetaKW); $this->data['META_DESC_CONTENTS'] = stripslashes($News->MetaTags); $this->data['SITE_TITLE'] = stripslashes($News->HTMLTitle); } } $this->data['NewsCategory'] = $NewsCategory; $this->data['Newsresult'] = $Newsresult; $this->data['id'] = $news_id; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/event'; } else { $this->data['view'] = 'template/event'; } $this->load->view($this->templatePath, $this->data); } public function imei_services($idLog=NULL) { if ($this->data['rsStngs']->IMEIServices == '0') { redirect(base_url('home')); } $currId = $this->input->post("cId") ?: '0'; $categoryId = $this->input->post("categoryId") ?: ''; $catId = $this->input->post("catId") ?: ''; $currId = sanitizeAndEscapingXXS($currId); $categoryId = sanitizeAndEscapingXXS($categoryId); $catId = sanitizeAndEscapingXXS($catId); $strAnd = ''; $strWhere = ''; if ($categoryId != '') { $strWhere = " SEOURLName = '" . urldecode($categoryId) . "'"; $strAnd = " AND Cat.SEOURLName = '" . urldecode($categoryId) . "'"; } if (is_numeric($catId) && $catId != '0') { $strWhere = " CategoryId = '$catId'"; $strAnd = " AND A.CategoryId = '$catId'"; } if ($strWhere != '') { $row = $this->Home_model->fetch_package_category_data($strWhere); $this->data['META_KW_CONTENTS'] = stripslashes($row->MetaKW); $this->data['META_DESC_CONTENTS'] = stripslashes($row->MetaTags); $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); } else { $row = $this->Home_model->fetch_pages_data(); $this->data['META_KW_CONTENTS'] = stripslashes($row->MetaKW); $this->data['META_DESC_CONTENTS'] = stripslashes($row->MetaTags); $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); } $rsCats = $this->Home_model->fetch_package_cat_by_slbf(); if ($catId != '') $strWhere = " AND A.CategoryId = '$catId'"; if (!($this->session->userdata('GSM_FUS_UserId'))) $strWhere .= " AND HideServiceAtWeb = 0"; $this->data['rsPackages'] = $this->Home_model->fetch_package_category_packages($strWhere); $strGWC = " AND IMEIPricesAtWeb = '1'"; $SERVICE_TYPE = '0'; $arrGroups = array(); $strGroups = ''; $rsGroups = $this->Home_model->fetch_price_plans($strGWC); foreach ($rsGroups as $row) { $arrGroups[$row->PricePlanId] = stripslashes($row->PricePlan); $strGroups .= '<th nowrap="nowrap">' . stripslashes($row->PricePlan) . '</th>'; } $arrGPrices = array(); $rsGPrices = $this->Home_model->fetch_plans_packages_prices_currency($SERVICE_TYPE); foreach ($rsGPrices as $row) { $arrGPrices[$row->PlanId][$row->PackageId] = $row->Price; } $this->data['strGroups'] = $strGroups; $this->data['arrGPrices'] = $arrGPrices; $this->data['arrGroups'] = $arrGroups; $this->data['pagePopupStatus'] = $this->data['rsStngs']->PagePopup; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/imei_services'; } else { $this->data['view'] = 'template/imei_services'; } if($this->data['rsStngs']->PagePopup == 1){ if($idLog){ $this->data['LogId'] = $idLog; $this->data['view'] = 'template/imei_service_dtl_page'; } } $this->load->view($this->templatePath, $this->data); } public function category($id) { if ($this->data['rsStngs']->IMEIServices == '0') { redirect(base_url('home')); } $currId = '0'; $categoryId = ''; $catId = $id; $currId = sanitizeAndEscapingXXS($currId); $categoryId = sanitizeAndEscapingXXS($categoryId); $catId = sanitizeAndEscapingXXS($catId); $strAnd = ''; $strWhere = ''; if ($categoryId != '') { $strWhere = " SEOURLName = '" . urldecode($categoryId) . "'"; $strAnd = " AND Cat.SEOURLName = '" . urldecode($categoryId) . "'"; } if (is_numeric($catId) && $catId != '0') { $strWhere = " CategoryId = '$catId'"; $strAnd = " AND A.CategoryId = '$catId'"; } if ($catId != '') $strWhere = " AND A.CategoryId = '$catId'"; if (!($this->session->userdata('GSM_FUS_UserId'))) $strWhere .= " AND HideServiceAtWeb = 0"; $this->data['rsPackages'] = $rsSrvcs = $this->db->query("SELECT * FROM tbl_gf_retail_services A, tbl_gf_manufacturer B WHERE A.CategoryId = B.CategoryId AND B.CategoryId = '$catId' AND ArchivedPack = 0 AND DisablePackage = 0 AND A.ShowAtHomePage = 1 ORDER BY A.CategoryId, PackageTitle")->result(); $this->data['rsCategory'] = $this->db->query("SELECT * FROM tbl_gf_manufacturer WHERE DisableCategory = 0 AND ShowAtHomePageCat = 1 AND CategoryId = '$catId' ORDER BY Category")->row(); $strGWC = " AND IMEIPricesAtWeb = '1'"; $SERVICE_TYPE = '0'; $this->data['view'] = 'category'; $this->load->view($this->templatePath, $this->data); } public function servicedtl() { $id = $this->input->post_get('id') ?: 0; if (!is_numeric($id)) $strAnd = " SEOURLName = '" . urldecode($id) . "'"; if ($id > 0) $strAnd = " PackageId = '$id'"; $title_detail = ''; $img_detail = ''; $desc_detail = ''; $imgURL = ''; $rs_detail = $this->Home_model->fetch_packages_data($strAnd); if (isset($rs_detail->PackageTitle) && $rs_detail->PackageTitle != '') { $this->data['packId'] = $rs_detail->PackageId; $this->data['packTitle'] = stripslashes($rs_detail->PackageTitle); $this->data['packDesc'] = stripslashes($rs_detail->MustRead); $this->data['delTime'] = stripslashes($rs_detail->TimeTaken); if ($rs_detail->MetaKW != '') $this->data['META_KW_CONTENTS'] = stripslashes($rs_detail->MetaKW); if ($rs_detail->MetaTags != '') $this->data['META_DESC_CONTENTS'] = stripslashes($rs_detail->MetaTags); if ($rs_detail->HTMLTitle != '') $this->data['SITE_TITLE'] = stripslashes($rs_detail->HTMLTitle); $this->data['packPrice'] = $rs_detail->PackagePrice; $this->data['packImg'] = $rs_detail->PackageImage; $rwCrncy = $this->Home_model->fetch_currency_data(); if (isset($rwCrncy->CurrencySymbol) && $rwCrncy->CurrencySymbol != '') { $this->data['currSymbol'] = $rwCrncy->CurrencySymbol; } } $this->data['retailService'] = ''; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/service_dtl'; } else { $this->data['view'] = 'template/service_dtl'; } $this->load->view($this->templatePath, $this->data); } public function file_services() { if ($this->data['rsStngs']->FileServices == '0') { redirect(base_url('home')); } $currId = $this->input->post("cId") ?: '0'; $categoryId = $this->input->post("categoryId") ?: ''; $catId = $this->input->post("catId") ?: ''; $strAnd = ''; $strWhere = ''; if ($categoryId != '') { $strWhere = " SEOURLName = '" . urldecode($categoryId) . "'"; $strAnd = " AND Cat.SEOURLName = '" . urldecode($categoryId) . "'"; } if (is_numeric($catId) && $catId != '0') { $strWhere = " CategoryId = '$catId'"; $strAnd = " AND A.CategoryId = '$catId'"; } if ($strWhere != '') { $row = $this->Home_model->fetch_package_category_data($strWhere); $this->data['META_KW_CONTENTS'] = stripslashes($row->MetaKW); $this->data['META_DESC_CONTENTS'] = stripslashes($row->MetaTags); $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); } else { $row = $this->Home_model->fetch_pages_data(); $this->data['META_KW_CONTENTS'] = stripslashes($row->MetaKW); $this->data['META_DESC_CONTENTS'] = stripslashes($row->MetaTags); $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); } $this->data['rsCats'] = $this->Home_model->fetch_package_category_by_disablecategory(); if ($catId != '') $strWhere = " AND A.CategoryId = '$catId'"; if (!($this->session->userdata('GSM_FUS_UserId'))) $strWhere .= " AND HideServiceAtWeb = 0"; $this->data['rsPackages'] = $this->Home_model->package_category_and_packages($strWhere); $strGWC = " AND FilePricesAtWeb = '1'"; $SERVICE_TYPE = '1'; $arrGroups = array(); $strGroups = ''; $rsGroups = $this->Home_model->fetch_price_plans($strGWC); foreach ($rsGroups as $row) { $arrGroups[$row->PricePlanId] = stripslashes($row->PricePlan); $strGroups .= '<th nowrap="nowrap">' . stripslashes($row->PricePlan) . '</th>'; } $arrGPrices = array(); $rsGPrices = $this->Home_model->fetch_plans_packages_prices_currency($SERVICE_TYPE); foreach ($rsGPrices as $row) { $arrGPrices[$row->PlanId][$row->PackageId] = $row->Price; } $this->data['strGroups'] = $strGroups; $this->data['arrGroups'] = $arrGroups; $this->data['arrGPrices'] = $arrGPrices; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/file_services'; } else { $this->data['view'] = 'template/file_services'; } $this->load->view($this->templatePath, $this->data); } public function server_services($idLog = null) { if ($this->data['rsStngs']->ServerServices == '0') { redirect(base_url('home')); } $currId = $this->input->post("cId") ?: '0'; $categoryId = $this->input->post("categoryId") ?: ''; $catId = $this->input->post("catId") ?: ''; $strAnd = ''; $strWhere = ''; if ($categoryId != '') { $strWhere = " SEOURLName = '" . urldecode($categoryId) . "'"; $strAnd = " AND Cat.SEOURLName = '" . urldecode($categoryId) . "'"; } if (is_numeric($catId) && $catId != '0') { $strWhere = " CategoryId = '$catId'"; $strAnd = " AND A.CategoryId = '$catId'"; } if ($strWhere != '') { $row = $this->Home_model->fetch_log_package_cat_data($strWhere); $this->data['META_KW_CONTENTS'] = stripslashes($row->MetaKW); $this->data['META_DESC_CONTENTS'] = stripslashes($row->MetaTags); $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); } else { $row = $this->Home_model->fetch_pages_data(); $this->data['META_KW_CONTENTS'] = stripslashes($row->MetaKW); $this->data['META_DESC_CONTENTS'] = stripslashes($row->MetaTags); $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); } $this->data['rsCats'] = $this->Home_model->fetch_log_pack_cat_by_disable_cat(); if ($catId != '') $strWhere = " AND A.CategoryId = '$catId'"; if (!$this->session->userdata('GSM_FUS_UserId')) $strWhere .= " AND HideServiceAtWeb = 0"; $this->data['rsPackages'] = $this->Home_model->fetch_log_pack_cat_and_packages($strWhere); $strGWC = " AND ServerPricesAtWeb = '1'"; $SERVICE_TYPE = '2'; $arrGroups = array(); $this->data['arrGroups'] = $arrGroups; $this->data['pagePopupStatus'] = $this->data['rsStngs']->PagePopup; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/server_services'; } else { $this->data['view'] = 'template/server_services'; } if($this->data['rsStngs']->PagePopup == 1){ if($idLog){ $this->data['serverLogId'] = $idLog; $this->data['view'] = 'template/imei_service_dtl_page'; } } $this->load->view($this->templatePath, $this->data); } public function server_service_dtl() { $packId = $this->input->post_get('packId') ?: 0; $id = $this->input->post_get('id') ?: 0; $this->data['packDesc'] = ''; $this->data['delTime'] = ''; $this->data['packPrice'] = ''; $this->data['packTitle'] = ''; $this->data['currSymbol'] = ''; if (!is_numeric($id)) $strAnd = " SEOURLName = '" . urldecode($id) . "'"; else $strAnd = " LogPackageId = '$id'"; $rs_detail = $this->Home_model->fetch_log_packages_by_disablepack($strAnd); if (isset($rs_detail->LogPackageTitle) && $rs_detail->LogPackageTitle != '') { $this->data['packTitle'] = stripslashes($rs_detail->LogPackageTitle); if ($rs_detail->MetaKW != '') $this->data['META_KW_CONTENTS'] = stripslashes($rs_detail->MetaKW); if ($rs_detail->MetaTags != '') $this->data['META_DESC_CONTENTS'] = stripslashes($rs_detail->MetaTags); if ($rs_detail->HTMLTitle != '') $this->data['SITE_TITLE'] = stripslashes($rs_detail->HTMLTitle); $this->data['packDesc'] = stripslashes($rs_detail->LogPackageDetail); $this->data['delTime'] = stripslashes($rs_detail->DeliveryTime); $this->data['packPrice'] = $rs_detail->LogPackagePrice; $rwCrncy = $this->Home_model->fetch_currency_data(); if (isset($rwCrncy->CurrencySymbol) && $rwCrncy->CurrencySymbol != '') { $this->data['currSymbol'] = $rwCrncy->CurrencySymbol; } } $this->data['packImg'] = ''; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/server_service_dtl'; } else { $this->data['view'] = 'template/server_service_dtl'; } $this->load->view($this->templatePath, $this->data); } public function page($SEOURLName = '') { $id = $this->input->post_get('id') ?: 0; if ($SEOURLName) { $id = urldecode($SEOURLName); } $this->data['pTitle'] = ''; $this->data['pText'] = ''; $strAnd = ''; $pageImg = ''; if (!is_numeric($id)) { $strAnd = " SEOURLName = '" . urldecode($id) . "'"; } if ($id > 0) { $strAnd = " PageId = '$id'"; } $actRtl = $pageImg = $pTitle = $pText = ''; $row = $this->Home_model->fetch_page_data_by_id($strAnd); $this->data['pageViewType'] = ''; if (isset($row->PageTitle) && $row->PageTitle != '') { $pTitle = $row->PageTitle; $pText = stripslashes($row->PageText); if ($row->MetaKW != '') $this->data['META_KW_CONTENTS'] = stripslashes($row->MetaKW); if ($row->MetaTags != '') $this->data['META_DESC_CONTENTS'] = stripslashes($row->MetaTags); if ($row->HTMLTitle != '') $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); $pageImg = $row->Image; $actRtl = $row->ActivateRetail; $this->data['pageViewType'] = $row->PageViewType; } $this->data['pageVideos'] = $this->data['pageDownloads'] = array(); if ($this->data['pageViewType'] == 'videos') $this->data['pageVideos'] = $this->Home_model->get_videos(); else if ($this->data['pageViewType'] == 'downloads') $this->data['pageDownloads'] = $this->Home_model->get_downloads(); $this->data['pTitle'] = $pTitle; $this->data['pText'] = stripslashes($pText); $this->data['actRtl'] = $actRtl; $this->data['pageImg'] = $pageImg; $this->data['rwPB'] = $this->Home_model->fetch_banner_data(); $rsFaqs = $this->db->query('SELECT * FROM tbl_gf_faqs WHERE DisableFAQ = 0')->result(); $rsKBs = $this->db->query("SELECT B.CategoryId, Category, Title, Contents FROM tbl_gf_knowledgebase_cat A, tbl_gf_knowledgebase B WHERE A.CategoryId = B.CategoryId AND DisableKB = 0 ORDER BY Title")->result(); if (strtolower(trim($pTitle)) == 'testimonials' || $this->data['pageViewType'] == 'testimonials') { $reviews = $this->Home_model->fetch_reviews(); $this->data['reviews'] = $reviews; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/testimonials'; } else { $this->data['view'] = 'template/testimonials'; } $this->load->view($this->templatePath, $this->data); } elseif (strtolower(trim($pTitle)) == 'promotion') { if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/testimonials'; } else { $this->data['view'] = 'template/testimonials'; } $this->load->view($this->templatePath, $this->data); } elseif (strtolower(trim($pTitle)) == 'faqs') { $this->data['rsFaqs'] = $rsFaqs; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/faqs'; } else { $this->data['view'] = 'template/faqs'; } $this->load->view($this->templatePath, $this->data); } elseif (strtolower(trim($pTitle)) == 'knowledge base') { $this->data['rsKBs'] = $rsKBs; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/knowledge_base'; } else { $this->data['view'] = 'template/knowledge_base'; } $this->load->view($this->templatePath, $this->data); } elseif (strtolower(trim($pTitle)) == 'contact us') { $this->data['rsKBs'] = $rsKBs; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/contactus'; } else { $this->data['view'] = 'template/contactus'; } $this->load->view($this->templatePath, $this->data); } else { if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/page'; } else { $this->data['view'] = 'template/page'; } $this->load->view($this->templatePath, $this->data); } } public function faq() { $this->data['rsFaqs'] = $this->Home_model->fetch_faq_data(); if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/faqs'; } else { $this->data['view'] = 'template/faqs'; } $this->load->view($this->templatePath, $this->data); } public function brands($brandName = '') { //$rsBrands = $this->db->query("SELECT * FROM tbl_gf_manufacturer WHERE DisableCategory = 0 AND ArchivedCategory = 0 ORDER BY OrderBy")->result(); $strWhere = ''; $id = $this->input->post('id') ?: 0; if ($id > 0) $strWhere = " AND B.CategoryId = '$id'"; if ($brandName != '') { $strWhere = " AND B.SEOURLName = '" . urldecode($brandName) . "'"; } $rsBrands = $this->db->query("SELECT * FROM tbl_gf_retail_services A, tbl_gf_manufacturer B WHERE A.CategoryId = B.CategoryId AND ArchivedPack = 0 AND DisablePackage = 0 $strWhere ORDER BY A.CategoryId, PackageTitle")->result(); $this->data['rsBrands'] = $rsBrands; $this->data['pagePopupStatus'] = $this->data['rsStngs']->PagePopup; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/brands'; } else { $this->data['view'] = 'template/brands'; } $this->load->view($this->templatePath, $this->data); } public function brand_services($BrandServiceId = null) { $Currency = $CurrencySymbol = ''; $TODAY_DT_TM = setDtTmWRTYourCountry(); $id = $this->input->post_get('id') ? check_input($this->input->post_get('id'), $this->db->conn_id) : 0; if ($id > 0) { $strWhere = " AND B.CategoryId = '$id'"; } else { $strWhere = " AND B.SEOURLName = '" . urldecode($id) . "'"; } $rwCatDtl = $this->db->query("SELECT Category, HTMLTitle, MetaKW, MetaTags FROM tbl_gf_manufacturer B WHERE (1) $strWhere")->row(); if ($rwCatDtl->MetaKW != '') $this->data['META_KW_CONTENTS'] = stripslashes($rwCatDtl->MetaKW); if ($rwCatDtl->MetaTags != '') $this->data['META_DESC_CONTENTS'] = stripslashes($rwCatDtl->MetaTags); if ($rwCatDtl->HTMLTitle != '') $this->data['SITE_TITLE'] = stripslashes($rwCatDtl->HTMLTitle); $BRAND = stripslashes($rwCatDtl->Category); $rsSrvcs = $this->db->query("SELECT * FROM tbl_gf_retail_services A, tbl_gf_manufacturer B WHERE A.CategoryId = B.CategoryId AND ArchivedPack = 0 AND DisablePackage = 0 $strWhere ORDER BY A.CategoryId, PackageTitle")->result(); $totalSrvcs = count($rsSrvcs); $rwCurr = $this->db->query('SELECT CurrencyId, Currency, CurrencyAbb, CurrencySymbol, ConversionRate FROM tbl_gf_currency WHERE DisableCurrency = 0 AND DefaultCurrency = 1')->row(); if (isset($rwCurr->CurrencyId) && $rwCurr->CurrencyId != '') { /*$this->session->set_userdata('CurrencyID',$rwCurr->CurrencyId) ; $this->session->set_userdata('Currency',$rwCurr->Currency) ; $this->session->set_userdata('CurrencySymbol',$rwCurr->CurrencySymbol) ; $this->session->set_userdata('CurrencyRate',$rwCurr->ConversionRate) ; $this->session->set_userdata('CurrencyAbb',$rwCurr->CurrencyAbb);*/ $CurrencySymbol = $rwCurr->CurrencySymbol; $Currency = $rwCurr->Currency; } $this->data['CurrencySymbol'] = $CurrencySymbol; $this->data['Currency'] = $Currency; $this->data['TODAY_DT_TM'] = $TODAY_DT_TM; $this->data['totalSrvcs'] = $totalSrvcs; $this->data['id'] = $id; $this->data['BRAND'] = $BRAND; $this->data['rsSrvcs'] = $rsSrvcs; $this->data['pagePopupStatus'] = $this->data['rsStngs']->PagePopup; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/brand_services_new'; } else { $this->data['view'] = 'template/brand_services_new'; } if($this->data['rsStngs']->PagePopup == 1){ if($BrandServiceId){ $rsSrvcs = $this->db->where('PackageId', $BrandServiceId)->get('tbl_gf_retail_services')->row(); $this->data['rsSrvcsBrandService'] = $rsSrvcs; $this->data['BrandServiceId'] = $BrandServiceId; $this->data['view'] = 'template/imei_service_dtl_page'; } } $this->load->view($this->templatePath, $this->data); } public function order() { //d($_REQUEST); $imei = ''; $email = $phone = $name = $comments = $META_DESC_CONTENTS1 = $META_KW_CONTENTS1 = $brandAPIId = $col_val = ''; //d($email); $TODAY_DT_TM = setDtTmWRTYourCountry(); $IMEI_F_TYPE = 0; $THEME = $this->data['rsStngs']->Theme; $message = $errorMsg = $errorCustomMsg = ''; $id = ($this->input->post_get('serviceId')) ? check_input($this->input->post_get('serviceId'), $this->db->conn_id) : 0; $seoNm = ($this->input->post_get('sId')) ? check_input($this->input->post_get('sId'), $this->db->conn_id) : 0; if ($seoNm != '') { $rsID = $this->db->query("SELECT PackageId, MetaKW, MetaTags, HTMLTitle FROM tbl_gf_retail_services WHERE SEOURLName = '" . urldecode($seoNm) . "'")->row(); if (isset($rsID->PackageId) && $rsID->PackageId != '') { $id = $rsID->PackageId; if ($rsID->MetaKW != '') $META_KW_CONTENTS1 = stripslashes($rsID->MetaKW); if ($rsID->MetaTags != '') $META_DESC_CONTENTS1 = stripslashes($rsID->MetaTags); if ($rsID->HTMLTitle != '') $this->data['SITE_TITLE'] = stripslashes($rsID->HTMLTitle); } } if (($this->input->post('txtName'))) { $name = ($this->input->post('txtName')) ? check_input($this->input->post('txtName'), $this->db->conn_id) : 0; $IMEI_F_TYPE = ($this->input->post('imeiFType')) ? check_input($this->input->post('imeiFType'), $this->db->conn_id) : 0; $custom_imeiFType = ($this->input->post('customimeiFType')) ? check_input($this->input->post('customimeiFType'), $this->db->conn_id) : 0; $bulkimeiFType = ($this->input->post('bulkimeiFType')) ? check_input($this->input->post('bulkimeiFType'), $this->db->conn_id) : 0; $email = ($this->input->post('txtEmail')) ? check_input($this->input->post('txtEmail'), $this->db->conn_id) : 0; $phone = ($this->input->post('txtPhone')) ? check_input($this->input->post('txtPhone'), $this->db->conn_id) : ''; $comments = ($this->input->post('txtComments')) ? check_input($this->input->post('txtComments'), $this->db->conn_id) : ''; $serviceType = ($this->input->post('serviceType')) ? check_input($this->input->post('serviceType'), $this->db->conn_id) : ''; $rtlType = ($this->input->post('rtlType')) ? check_input($this->input->post('rtlType'), $this->db->conn_id) : ''; $paymentMethodDt = ($this->input->post('pMethod')) ? check_input($this->input->post('pMethod'), $this->db->conn_id) : '1|1'; $arrPM = explode('|', $paymentMethodDt); $pMethodType = $arrPM[0]; //dd($pMethodType); $paymentMethod = $arrPM[1]; $PackType = ($rtlType == 1) ? 4 : 3; # 3 = imei, 4 = server // getting package custom fields again for validation $customFields = $this->db->query("SELECT * FROM `tbl_gf_api_custom_fields` WHERE `PackId` = " . $id . " AND `PackType` = " . $PackType)->result(); $isQuantity = false; $PACK_QUANTITY = 1; $col_val = ''; $OrderFields = []; $allOkay = false; $historyData = ''; $txtIMEI = ''; $ttlFields = count($customFields); for ($ApiFieldIndex = 1; $ApiFieldIndex <= $ttlFields; $ApiFieldIndex++) { // getting posted data $ApiFieldLabel = $this->input->post('lbl' . $ApiFieldIndex); if (!empty($ApiFieldLabel)) { $allOkay = true; $ApiFieldValue = trim($this->input->post('fld' . $ApiFieldIndex)); $ApiFieldMandatory = $this->input->post('mndtry' . $ApiFieldIndex); $ApiFieldName = $this->input->post('colNm' . $ApiFieldIndex); $ApiFieldId = $this->input->post('fieldId' . $ApiFieldIndex); $ApiFieldCustomField = $this->input->post('customField' . $ApiFieldIndex); if ($PackType == 3) { $ApiFieldUseAsIMEI = $this->input->post('useAsIMEI' . $ApiFieldIndex); $ApiFieldAllowDigits = $this->input->post('rstrctnAD' . $ApiFieldIndex); $ApiFieldAllowSmallAlphabets = $this->input->post('rstrctnASA' . $ApiFieldIndex); $ApiFieldAllowCapitalAlphabets = $this->input->post('rstrctnACA' . $ApiFieldIndex); $FieldIMEILastDigit = $this->input->post('txtIMEILastDigit'); } else { $ApiFieldAsQty = $this->input->post('useAsQty' . $ApiFieldIndex); $ApiFieldMinQty = $this->input->post('minQnt' . $ApiFieldIndex); $ApiFieldMaxQty = $this->input->post('maxQnt' . $ApiFieldIndex); } if ($PackType == 3) { $reg = $regMsg = ''; if ($ApiFieldAllowDigits == 1) { $reg .= '\\d'; $regMsg .= ' digits, '; } if ($ApiFieldAllowSmallAlphabets == 1) { $reg .= 'a-z'; $regMsg .= ' small alphabets, '; } if ($ApiFieldAllowCapitalAlphabets == 1) { $reg .= 'A-Z'; $regMsg .= ' capital alphabets, '; } $regMsg = preg_replace('/^\s+|,\s+$/', '', $regMsg); if ($reg) { if (!preg_match('/^[' . $reg . ']+$/', trim($ApiFieldValue))) { $errorMsg .= $ApiFieldLabel . " field must contain " . $regMsg . " only.<br />"; } } $OrderFields[] = array( 'IsIMEI' => ($ApiFieldUseAsIMEI ? 1 : 0), 'ApiFieldId' => $ApiFieldId, 'FieldValue' => $ApiFieldValue ); if ($ApiFieldUseAsIMEI) { $txtIMEI = $ApiFieldValue; if (!is_null($FieldIMEILastDigit)) $txtIMEI .= $FieldIMEILastDigit; } } else { if ($ApiFieldAsQty) { if (!is_numeric($ApiFieldValue)) { $errorMsg .= "Invalid value of " . $ApiFieldLabel . ".<br />"; } else { if ($ApiFieldMinQty || $ApiFieldMaxQty) { if ($ApiFieldMinQty && $ApiFieldValue < $ApiFieldMinQty) $errorMsg .= "Minimum " . $ApiFieldLabel . " should be " . $ApiFieldMinQty . "<br />"; elseif ($ApiFieldMaxQty && $ApiFieldValue > $ApiFieldMaxQty) { $errorMsg .= "Maximum " . $ApiFieldLabel . " should be " . $ApiFieldMaxQty . "<br />"; } else { $isQuantity = true; $PACK_QUANTITY = $ApiFieldValue; } } else { $isQuantity = true; $PACK_QUANTITY = $ApiFieldValue; } } } $OrderFields[] = array( 'ApiFieldId' => $ApiFieldId, 'FieldValue' => $ApiFieldValue ); } if ($ApiFieldMandatory && empty($ApiFieldValue)) { $errorMsg .= "Value for " . $ApiFieldLabel . " can not be empty.<br />"; } if ($historyData != '') $historyData .= '<br />'; $historyData .= $ApiFieldLabel . ": " . $ApiFieldValue; } } include(APPPATH . "third_party/validation.class.php"); $objForm = new validation(); $errorMsg .= $objForm->name_validation($name, 'Name', '3', '30'); $errorMsg .= $objForm->email_validation($email, 'Email'); // if ($custom_imeiFType != '1' && $rtlType == 0) // $errorMsg .= $objForm->digits_validation($imei, 'IMEI #'); $arrIMEIS = array(); $invalidIMEIs = array(); $duplicateIMEIs = array(); $totalIMEIs = 0; //changes here $arrIMEIS = array_map('trim', explode("\n", $txtIMEI)); $duplicateIMEIs = array_repeat($arrIMEIS); $totalIMEIs = sizeof($arrIMEIS); $strCustError = ''; $custFldRes = 0; if ($errorMsg == '' && $errorCustomMsg == '') { $allowDuplicateIMEIs = false; $fee = 0; $toolId = ''; $mepId = ''; $mepValue = ''; $modelId = ''; $modelValue = ''; $serialNo = ''; $modelValueToShow = ''; //======================== API FIELDS ==========================// $providerId = ''; $operatorId = ''; $mobileId = ''; $otherId = ''; $prd = ''; $pin = ''; $kbh = ''; $zte = ''; $other = ''; $network = ''; $type = ''; $locks = ''; //======================== API FIELDS ==========================// //$total_Services = isset($this->input->post_get('hdTotalServices')) ? check_input($this->input->post_get('hdTotalServices'), $this->db->conn_id) : 0; //$total_Fields = isset($this->input->post_get('hdTotalTextFields')) ? check_input($this->input->post_get('hdTotalTextFields'), $this->db->conn_id) : 0; if (is_numeric($id) && $id > 0) { if (($this->input->post('brandId')) && $this->input->post('brandId') != '0') { $mobileId = ($this->input->post('brandId')) ? check_input($this->input->post('brandId'), $this->db->conn_id) : '0'; } if (($this->input->post('modelId')) && $this->input->post('modelId') != '0') { $modelId = ($this->input->post('modelId')) ? check_input($this->input->post('modelId'), $this->db->conn_id) : '0'; } $currDtTm = setDtTmWRTYourCountry(); $srvcTitle = ''; $packCostPrice = 0; $rsPackage = $this->db->query("SELECT PackagePrice, APIId, ExternalNetworkId, PackageTitle, RetailType, PromoStartDate, PromoEndDate, PromoDiscount, CostPrice FROM tbl_gf_retail_services WHERE PackageId='$id'")->row(); if (isset($rsPackage->PackagePrice) && $rsPackage->PackagePrice != '') { $apiId = $rsPackage->APIId; $extNwkId = $rsPackage->ExternalNetworkId; $srvcTitle = stripslashes($rsPackage->PackageTitle); $rtlType = $rsPackage->RetailType; $PACK_PRICE = $rsPackage->PackagePrice; $packCostPrice = $rsPackage->CostPrice; $apiType = ''; $apiKey = ''; $serverURL = ''; $apiUserName = ''; $apiName = ''; if ($apiId > 0) { $rsAPI = $this->db->query("SELECT APIKey, APIType, APITitle, ServerURL, AccountId FROM tbl_gf_api WHERE APIId = '$apiId' AND DisableAPI = 0")->row(); if (isset($rsAPI->APIKey) && $rsAPI->APIKey != '') { $apiType = $rsAPI->APIType; $apiKey = $rsAPI->APIKey; $serverURL = $rsAPI->ServerURL; $apiUserName = $rsAPI->AccountId; $apiName = $rsAPI->APITitle; } } $myCurrency = $myCurrencyAbb = 'USD'; $rwCurr = $this->db->query('SELECT CurrencyId, Currency, CurrencyAbb, CurrencySymbol, ConversionRate FROM tbl_gf_currency WHERE DisableCurrency = 0 AND DefaultCurrency = 1')->row(); $conversionRate = ''; //d($myCurrencyAbb); if (isset($rwCurr->CurrencyId) && $rwCurr->CurrencyId != '') { $CurrencySymbol = $rwCurr->CurrencySymbol; $myCurrency = $myCurrencyAbb = $rwCurr->CurrencyAbb; $conversionRate = $rwCurr->ConversionRate; } $fee = ''; $accountId = ''; $apiPwd = ''; $row = $this->db->query("SELECT * FROM tbl_gf_payment_methods WHERE PaymentMethodId = '$paymentMethod'")->row(); $API_UserName = ''; $API_Password = ''; $paymentMethodDescription = ''; if ($row) { $fee = $row->RetailFee; $flatFee = $row->FlatFee; $vatFee = $row->Vat; $API_UserName = $accountId = $row->Username; $API_API_Username = $row->APIUsername; $API_Password = $apiPwd = $row->APIPassword; $ak = $row->SecretAPIKey; $subPayTypeId = $row->PaymentMethodSubTypeId; $paymentURL = $row->PaymentURL; $message = stripslashes($row->Description); $paymentMethodDescription = stripslashes($row->Description); $rstCurrId = $row->RestrictedCurrency; //=========================================== CHECK IF PAYMENT METHOD IS RESTRICTED WITH A CURRENCY =================================================// if ($rstCurrId > 0) { $rwCurr = $this->db->query("SELECT CurrencyId, Currency, CurrencySymbol, ConversionRate, CurrencyAbb FROM tbl_gf_currency WHERE DisableCurrency = 0 AND CurrencyId = '$rstCurrId'")->row(); if (isset($rwCurr->CurrencyId) && $rwCurr->CurrencyId != '') { $this->session->set_userdata('CurrencyID', $rwCurr->CurrencyId); $this->session->set_userdata('webCurrencyId', $rwCurr->CurrencyId); $this->session->set_userdata('Currency', $rwCurr->Currency); $this->session->set_userdata('CurrencySymbol', $rwCurr->CurrencySymbol); $myCurrency = $myCurrencyAbb = $rwCurr->CurrencyAbb; $this->session->set_userdata('ConversionRate', $rwCurr->ConversionRate); $conversionRate = $rwCurr->ConversionRate; } } //=========================================== CHECK IF PAYMENT METHOD IS RESTRICTED WITH A CURRENCY =================================================// } //d($conversionRate) //$price = convertPrice(ifRetailServiceInPromotion($PACK_PRICE, $rsPackage->PromoStartDate, $rsPackage->PromoEndDate, $rsPackage->PromoDiscount, $TODAY_DT_TM)); $price = ifRetailServiceInPromotion($PACK_PRICE, $rsPackage->PromoStartDate, $rsPackage->PromoEndDate, $rsPackage->PromoDiscount, $TODAY_DT_TM); $price = $price * $conversionRate; $packCostPrice = $packCostPrice * $conversionRate; if ($isQuantity && is_numeric($PACK_QUANTITY)) { $price = $price * $PACK_QUANTITY; $packCostPrice = $packCostPrice * $PACK_QUANTITY; $promoDiscount = ($rsPackage->PackagePrice * $PACK_QUANTITY) - $price; } else { $promoDiscount = $rsPackage->PackagePrice - $price; } $baseURL = base_url(); $flatFeeAmnt = 0; $percentAmnt = 0; $vatAmnt = 0; if ($fee > 0) $percentAmnt = ($price * $fee) / 100; if($vatFee > 0) $vatAmnt = ($price * $vatFee) / 100; if($flatFee > 0) $flatFeeAmnt = $flatFee; $amount = $price + $percentAmnt + $vatAmnt + $flatFeeAmnt; // IN CASE OF EASY PAISA, CONVERT CURRENCY TO PKR if PKR is NOT SELECTED /* if ($pMethodType == '10' && $_SESSION['Currency'] != 'PKR') { // redirect it back to order page. }*/ $this->db->query("INSERT INTO tbl_gf_retail_payments (OrderPrice, Amount, Name, Email, PaymentMethod, PaymentDtTm, Currency, PaymentStatus, CustPhone) VALUES ('$price', '$amount', '$name', '$email', '$paymentMethod', '$currDtTm', '" . $myCurrencyAbb . "', '1', '$phone')"); $invId = $this->db->insert_id(); $this->db->query("INSERT INTO tbl_gf_retail_orders SET OrderStatusId = '1', Price = '$price', IMEINo = '$txtIMEI', PackageId = '$id', RequestedAt = '$currDtTm', `Day` = '" . get_dday($currDtTm) . "', `Month` = '" . get_dmonth($currDtTm) . "', `Year` = '" . get_dyear($currDtTm) . "', Name = '$name', Email = '$email', Currency = '" . $myCurrencyAbb . "', PaymentId = '$invId', OrderAPIId = '$apiId', OrderAPIURL = '$serverURL', OrderAPIUserName = '$apiUserName', OrderAPIType = '$apiType', OrderAPIKey = '$apiKey', OrderAPIServiceId = '$extNwkId', OrderIdFromServer = '0', MobileId = '$mobileId', ModelId = '$modelId', OrderType = '$serviceType', CodeSentToOtherServer = 0, RetailOrderType = '$rtlType', OrderAPIName = '$apiName', OrderData = '" . check_input( $historyData, $this->db->conn_id ) . "', PromotionDiscount = '$promoDiscount', CostPrice = '$packCostPrice'"); $order_id = $this->db->insert_id(); //dd($order_id); if (!empty($order_id)) { foreach ($OrderFields as $FieldOpts) { $orderFieldsData = [ 'OrderId' => (int) $order_id, 'OrderType' => $PackType, 'ApiFieldId' => $FieldOpts['ApiFieldId'], 'FieldValue' => $FieldOpts['FieldValue'], ]; $this->db->insert('tbl_gf_order_fields', $orderFieldsData); } } if ($pMethodType == '1') //PAY PAL { //todo:order payment fetch pages realted payment getway remaining $successRetPage = $baseURL . 'home/order_placed'; $cancelRetPage = $baseURL . 'home/order_cancelled'; $itemName = $srvcTitle . '- Order # ' . $order_id; echo " <html><body><form name='frmOrder' id='frmOrder' action='https://www.paypal.com/cgi-bin/webscr' method='post'> <input type='hidden' name='rm' value='2' /> <input type='hidden' name='no_shipping' value='2' /> <input type='hidden' name='cmd' value='_xclick'> <input type='hidden' name='business' value='" . $accountId . "'> <input type='hidden' name='item_name' value='" . $itemName . "'> <input type='hidden' name='item_number' value='" . $invId . "'> <input type='hidden' name='amount' value='" . $amount . "'> <input type='hidden' name='currency_code' value='" . $this->session->userdata('Currency') . "'> <input type='hidden' name='charset' value='utf-8'> <input type='hidden' name='return' value='" . $successRetPage . "'> <input type='hidden' name='cancel_return' value='" . $cancelRetPage . "'>"; $notificationPage = $baseURL . 'home/orderpmntntfctn'; echo "<input type='hidden' name='notify_url' value='" . $notificationPage . "'>"; echo " </form></body></html><script language='javascript' type='text/javascript'>document.getElementById('frmOrder').submit();</script>"; exit; } elseif ($pMethodType == '10') { // EASY PAISA $hashRequest = ''; $hashKey = $apiPwd; // generated from easypay account //echo $amount . "<br/>"; $amount = round($amount, 1); if (strlen($amount) == 1) { $amount = $amount . ".0"; } $str = $amount; //die(); //echo "<br />"; $lengthvar = strlen($str); //$addzero = str_pad($str, $lengthvar+2,".0"); // $amount = $addzero; //$amount = "10.0" ; $postBackURL = $baseURL . "home/geteztoken"; $expiryDate = "20250531 112300"; $autoRedirect = 0; $EZ_PAYMENT_METHOD = 'CC_PAYMENT_METHOD'; ///starting encryption/// $paramMap = array(); $paramMap['amount'] = $amount; $paramMap['autoRedirect'] = $autoRedirect; $paramMap['emailAddr'] = $email; $paramMap['expiryDate'] = $expiryDate; $paramMap['mobileNum'] = $phone; $paramMap['orderRefNum'] = $invId; $paramMap['paymentMethod'] = $EZ_PAYMENT_METHOD; $paramMap['postBackURL'] = $postBackURL; $paramMap['storeId'] = $accountId; $mapString = ''; foreach ($paramMap as $key => $val) { $mapString .= $key . '=' . $val . '&'; } $mapString = substr($mapString, 0, -1); // Encrypting mapString //$alg = MCRYPT_RIJNDAEL_128; // AES $alg = 'rijndael-128'; // AES $mode = 'ecb'; // ECB $iv_size = mcrypt_get_iv_size($alg, $mode); $block_size = mcrypt_get_block_size($alg, $mode); $iv = mcrypt_create_iv($iv_size, MCRYPT_DEV_URANDOM); $mapString = pkcs5_pad($mapString, $block_size); $crypttext = mcrypt_encrypt($alg, $hashKey, $mapString, $mode, $iv); $hashRequest = base64_encode($crypttext); echo " <html><body><form name='frmOrder' id='frmOrder' action='https://easypay.easypaisa.com.pk/easypay/index.jsf' method='post'> <input name='storeId' type='hidden' value='" . $accountId . "'> <input name='amount' type='hidden' value='" . $amount . "'> <input name='postBackURL' type='hidden' value='" . $postBackURL . "'> <input type='hidden' name='mobileNum' value='" . $phone . "'> <input type='hidden' name='orderRefNum' value='" . $invId . "'> <input type='hidden' name='emailAddr' value='" . $email . "'> <input type='hidden' name='paymentMethod' value='" . $EZ_PAYMENT_METHOD . "'> <input name='autoRedirect' type='hidden' value='" . $autoRedirect . "'> <input name='merchantHashedReq' type='hidden' value='" . $hashRequest . "'> <input name='expiryDate' type='hidden' value='" . $expiryDate . "'>"; echo " </form></body></html><script language='javascript' type='text/javascript'>document.getElementById('frmOrder').submit();</script>"; exit; } elseif ($pMethodType == '11') { $itemName = $srvcTitle . '- Order # ' . $order_id; echo " <html><body>" . form_open(base_url('page/stripe_credits'), "name=frmOrder id=frmOrder") . " <input type='hidden' name='amount' value='" . $amount . "'/> <input type='hidden' name='service' value='" . $itemName . "'/> <input type='hidden' name='pMId' value='" . $paymentMethod . "'/> <input type='hidden' name='invId' value='" . $invId . "'> <input type='hidden' name='currency' value='" . $this->session->userdata('Currency') . "'/>"; echo form_close() . "</body></html><script language='javascript' type='text/javascript'>document.getElementById('frmOrder').submit();</script>"; exit; } /*-------------------------- Start FutueLink Payment ---------------------------*/ elseif ($pMethodType == '12') { //============================= ENCRYPT DATA IN FORM ================================// //Generate a random string Token. //usage $token = generateRandomString(20); //d($token); $user_name = "info@futuelink.com"; //$password = "A9Y0-K8E6-A0H5-M3R0-O6M7"; $credits = $amount; $fee = 0; $serverKey = $API_Password; $order_id = $invId; $url = 'https://shop.futuelink.com/shop-product-pv.php'; $cancel_url = base_url('home/order_cancelled'); $success_url = base_url('home/order_placed?id=' . $order_id); //$Currency = "USD"; //echo "cur=" . $myCurrency . "<br>"; //$currency_code = substr($myCurrency, 0, 3); //$country_code = $country_code_row ? $country_code_row->ISO : 'US'; //print_r($success_url .' / '. $amount); //die; $ARR_KEYS = getDataEncKeys(); $en_credits = encryptFormData(roundMe($credits), $ARR_KEYS[0], $ARR_KEYS[1]); $en_fee = encryptFormData(roundMe($fee), $ARR_KEYS[0], $ARR_KEYS[1]); $en_amount = encryptFormData(roundMe($credits), $ARR_KEYS[0], $ARR_KEYS[1]); $en_Currency = encryptFormData(($country_code), $ARR_KEYS[0], $ARR_KEYS[1]); $en_serverKey = encryptFormData(($serverKey), $ARR_KEYS[0], $ARR_KEYS[1]); $en_token = encryptFormData(($token), $ARR_KEYS[0], $ARR_KEYS[1]); $en_user = encryptFormData(('info@futuelink.com'), $ARR_KEYS[0], $ARR_KEYS[1]); $en_invId = encryptFormData(($order_id), $ARR_KEYS[0], $ARR_KEYS[1]); $en_success_url = encryptFormData(($success_url), $ARR_KEYS[0], $ARR_KEYS[1]); //$encUName = encryptFormData($this->session->userdata('UserName'), $ARR_KEYS[0], $ARR_KEYS[1]); //$encUEmail = encryptFormData($this->session->userdata('UserEmail'), $ARR_KEYS[0], $ARR_KEYS[1]); $en_url = 'https://shop.futuelink.com/shop-product-pv.php'; //d($Currency); echo " <html><body><form name='frmMyOrder' id='frmMyOrder' action='" . $en_url . "' method='post'> <input type='hidden' name='business' value='" . $en_user . "'> <input type='hidden' name='ak' value='" . $en_serverKey . "'> <input type='hidden' name='invId' value='" . $en_invId . "'> <input type='hidden' name='credits' value=" . $credits . "> <input type='hidden' name='amount' value=" . $en_amount . "> <input type='hidden' name='fee' value=" . $en_fee . "> <input type='hidden' name='token' value=" . $en_token . "> <input type='hidden' name='uName' value=" . $en_user . "> <input type='hidden' name='uEmail' value=" . $en_user . "> <input type='hidden' name='uNameUser' value=" . $this->session->userdata('UserFullName') . "> <input type='hidden' name='currency' value='" . $myCurrency . "'> <input type='hidden' name='successurl' value='" . $en_success_url . "'>"; echo " </form></body></html><script language='javascript' type='text/javascript'>document.getElementById('frmMyOrder').submit();</script>"; exit; } /*--------------------------- End FutueLink Payment ----------------------------*/ elseif ($pMethodType == '17') { //============================= ENCRYPT DATA IN FORM ================================// $ARR_KEYS = getDataEncKeys(); //$apiKey = encryptFormData($apiKey, $ARR_KEYS[0], $ARR_KEYS[1]); $invId = encryptFormData($invId, $ARR_KEYS[0], $ARR_KEYS[1]); $credits = 0; $fee = 0; //$fee * $cRate; $credits = encryptFormData(roundMe($credits), $ARR_KEYS[0], $ARR_KEYS[1]); $fee = encryptFormData(roundMe($fee), $ARR_KEYS[0], $ARR_KEYS[1]); $amount = encryptFormData(roundMe($amount), $ARR_KEYS[0], $ARR_KEYS[1]); $myCurrency = encryptFormData($myCurrency, $ARR_KEYS[0], $ARR_KEYS[1]); $token = encryptFormData($token, $ARR_KEYS[0], $ARR_KEYS[1]); $encAccountId = encryptFormData($accountId, $ARR_KEYS[0], $ARR_KEYS[1]); $encUName = encryptFormData($this->session->userdata('UserName'), $ARR_KEYS[0], $ARR_KEYS[1]); $encUEmail = encryptFormData($this->session->userdata('UserEmail'), $ARR_KEYS[0], $ARR_KEYS[1]); $paymentURL = rtrim($paymentURL, '/') . '/shop-product-pv.php'; //============================= ENCRYPT DATA IN FORM ================================// echo " <html><body><form name='frmMyOrder' id='frmMyOrder' action='" . $paymentURL . "' method='post'> <input type='hidden' name='business' value='" . $encAccountId . "'> <input type='hidden' name='ak' value='" . $ak . "'> <input type='hidden' name='invId' value='" . $invId . "'> <input type='hidden' name='credits' value=" . $credits . "> <input type='hidden' name='amount' value=" . $amount . "> <input type='hidden' name='fee' value=" . $fee . "> <input type='hidden' name='token' value=" . $token . "> <input type='hidden' name='uName' value=" . $encUName . "> <input type='hidden' name='uEmail' value=" . $encUEmail . "> <input type='hidden' name='uNameUser' value=" . $this->session->userdata('UserFullName') . "> <input type='hidden' name='currency' value='" . $myCurrency . "'>"; echo " </form></body></html><script language='javascript' type='text/javascript'>document.getElementById('frmMyOrder').submit();</script>"; exit; //-------------------Curl--------------------// } else if ($pMethodType == '50') { //print_r($order_id); $original_order_id = $order_id; $order_id = 'A' . $invId; //echo "order id=" . $order_id; $amount = $amount * 100; //echo "cur=" . $myCurrency . "<br>"; $currency_code = substr($myCurrency, 0, 3); $country_code = $country_code_row ? $country_code_row->ISO : 'US'; $callback_url = base_url('ipn/vitepay_ipn_retail'); $api_secret = $API_Password; $upped = strtoupper("$order_id;$amount;$currency_code;$callback_url;$api_secret"); $hash = SHA1($upped); //echo "<br>" . $hash . "<br>"; $postfields = array( "api_key" => ($API_UserName ?: $accountId), "payment[language_code]" => "en", "payment[currency_code]" => $currency_code, "payment[country_code]" => $country_code, "payment[order_id]" => $order_id, "payment[description]" => $_SERVER['HTTP_HOST'] . ' Retail Order', "payment[amount_100]" => $amount, "payment[decline_url]" => base_url('home/order_declined'), "payment[return_url]" => base_url('home/order_placed?id=' . $original_order_id), "payment[cancel_url]" => base_url('home/order_cancelled'), "payment[callback_url]" => $callback_url, "payment[p_type]" => "orange_money", "redirect" => "0", "hash" => $hash, ); try { $url = "https://api.vitepay.com/v1/prod/payments"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); #curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $response = curl_exec($curl); // Check the return value of curl_exec(), too if ($response === false) { throw new Exception(curl_error($curl), curl_errno($curl)); } } catch (Exception $e) { echo $e->getCode() . " , " . $e->getMessage(); } $info = curl_getinfo($curl); //print_r($curl); if ($info['http_code'] == 200) { //echo $response; //die(); redirect($response); } else { //$this->session->set_flashdata('error_message', $response); //var_dump($response); echo "There was an error while processing your order, please try again."; //$response"; die(); //redirect(base_url('page/add_credits')); } exit(); } /* BinancePay */ else if($pMethodType == '51') //FomoPay - Binance Pay { //Fomo order variables $currencyCode = "BUSD"; $notifyUrl = base_url('ipn/retail_notify_web_hook'); $returnUrl = base_url('home/order_placed'); $backUrl = base_url('home/order_cancelled'); $sourceOfFund = "BINANCEPAY"; $order_number = "R" . $invId; $subject = $_SERVER['HTTP_HOST'] . ' Retail Order'; $description = 'Retail Order #'.$invId.')'; $mid = $API_API_Username; $psk = $API_Password; //$mid = $API_UserName; //$psk = $API_Password; // echo "<pre>"; // print ($psk); // echo "</pre>"; // $rstrctdCurrId = ""; // if($rstrctdCurrId > 0) // { //use converted amount // $amount = $convertedAmount; // } $auth_header = base64_encode($mid.":".$psk); $fomo_request_json_string = '{"mode":"DIRECT","orderNo":"'.$order_number.'","subMid":"00000000","subject":"'.$subject.'","description":"'.$description.'","amount":"'.$amount.'","currencyCode":"'.$currencyCode.'","notifyUrl":"'.$notifyUrl.'","returnUrl":"'.$returnUrl.'","backUrl":"'.$backUrl.'","sourceOfFund":"'.$sourceOfFund.'","transactionOptions": {"timeout":7200,"txnType":"WEB"}}'; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://ipg.fomopay.net/api/orders", //Hammad: Payment URL CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "PUT", CURLOPT_POSTFIELDS => $fomo_request_json_string, CURLOPT_HTTPHEADER => array( "authorization: Basic ".$auth_header."", "cache-control: no-cache", "content-type: application/json" ), )); $fomo_response = curl_exec($curl); /* string(567) "{"id":"100500120220111408430983", "subMid":"00000000","orderNo":"108879", "mode":"DIRECT","subject":"Add Store Credits", "description":"+ Add Funds (Invoice #108879)", "returnUrl":"http://localhost/gsm-tools-v2/page/order_placed", "backUrl":"http://localhost/gsm-tools-v2/page/order_cancelled", "notifyUrl":"http://localhost/gsm-tools-v2/ipn/notify_web_hook", "currencyCode":"BUSD","amount":"768.00000000", "createdAt":1641900043,"status":"CREATED", "primaryTransactionId":"100510120220111408437614", "codeUrl":"https://app.binance.com/qr/dplk6d9b6041025345b3a430c0cd6537afeb"}" */ //print_r($fomo_response); $this->data["dateFomoPay"] = strtotime(date("Y-m-d H:i:s")); $err = curl_error($curl); curl_close($curl); //parsing and displaying only primaryTransactionId $parsed = json_decode($fomo_response, true); if ($err) { echo "Error #:" . $err; } elseif(isset($parsed['codeUrl'])) { $this->saveRetailPaymentTransactionId($parsed['primaryTransactionId'], $order_number); //Generating QR Code for codeUrl require_once APPPATH . 'scripts/phpqrcode/qrlib.php'; $tempDir = FCPATH . "assets/images/qrcodes/"; $codeContents = $parsed['codeUrl']; $fileName = $invId . '_file_' . time() . '.png'; $pngAbsoluteFilePath = $tempDir.$fileName; //d($pngAbsoluteFilePath); QRcode::png($codeContents, $pngAbsoluteFilePath); //Hammad: Remove saving file, instead display image using base64 data in variable $codeContents if($parsed['primaryTransactionId']) { // Update Amount Total with VAT and Flat $this->db->query("UPDATE tbl_gf_retail_payments SET QRCode = '$fileName' WHERE RetailPaymentId = '$invId'"); $notOtherSite = 1; $rs = $this->db->query("SELECT PaymentStatus, RetailPaymentId as RetailPaymentId, QRCode FROM tbl_gf_retail_payments WHERE RetailPaymentId = '$invId' AND PaymentStatus = 1")->row(); $this->data['invIdFutue'] = $rs->RetailPaymentId; $this->data['paymentStatus'] = $rs->PaymentStatus; $this->data['createdAt'] = $rs->CreatedAt; $this->data['QRCode'] = $rs->QRCode; $this->data['invId'] = $invId; $this->data['amount'] = $amount; if($rstrctdCurrId > 0) { $this->data['currencyCode'] = $rstrctdCurr; } else { $this->data['currencyCode'] = $myCurrency; } $this->data['rs'] = $rs; $this->data['retail'] = 1; $this->data['view'] = 'binance'; $this->load->view($this->templatePath, $this->data); return; } } else { echo "API Response:" . $parsed['message']; die(); } } /* End Binance Pay */ else if ($pMethodType == '52') { //PayTabs $original_order_id = $order_id; $order_id = $invId; $url = 'https://secure.paytabs.com/payment/request'; $tran_type = 'sale'; $tran_class = 'ecom'; $serverKey = $API_Password; $profile_id = $API_API_Username; $order_number = strval($order_id); //need to convert to string as Pay Tabs require string //$tran_ref = ''; $cart_currency = 'AED'; //$cart_id = '4244b9fd-c7e9-4f16-8d3c-4fe7bf6c48ca'; //$cart_id = date('YmdHis').'-'.getRealUserIp(); $cart_id = date('YmdHis') . '-' . rand(); $cart_description = $_SERVER['HTTP_HOST'] . ' Credits'; //$return = base_url('ipn/paytab_ipn_retail?tranRef='.$tran_ref); $return = base_url('ipn/paytab_ipn_retail?oId=' . $invId); $INV_AMOUNT = roundMe_2Digits($amount); $ch = curl_init(); $fields = array( 'profile_id' => $profile_id, 'tran_type' => $tran_type, 'tran_class' => $tran_class, 'cart_id' => $order_number, 'cart_description' => $cart_description, 'cart_currency' => $cart_currency, 'cart_amount' => $INV_AMOUNT, 'hide_shipping' => true //, 'callback'=>$return, , 'return' => $return, "customer_details" => array( "street1" => "", "city" => "", "country" => "", "email" => $email, "full_name" => "", "name" => $name, "phone" => "", "state" => "", "province" => "", "zip" => "" ), ); $json_encode = json_encode($fields); //console.log($json_encode); //d($json_encode); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); //0 for a get request curl_setopt($ch, CURLOPT_POSTFIELDS, $json_encode); $headers = array(); $headers[] = 'Authorization: ' . $serverKey; $headers[] = 'Content-Type: application/json'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); $resultDecode = json_decode($result); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); curl_close($ch); } else { $this->saveRetailPaymentTransactionId($resultDecode->tran_ref, $order_number); curl_close($ch); header("location:" . $resultDecode->redirect_url . ""); exit(); } } else if($pMethodType == '55') //BinancePay - 040522 { //echo $invId.','.$amount.','.$myCurrency.', '.$API_API_Username.', '.$API_Password; die; $this->load->library('binance_pay/Binance_pay'); $binance_pay = new Binance_pay(); $returnUrl = base_url('home/order_placed'); $backUrl = base_url('home/order_cancelled'); $goodsDetails = [ 'goodsType' => '02', 'goodsCategory' => "Z000", 'referenceGoodsId' => 'R'.$invId, 'goodsName' => $_SERVER['HTTP_HOST'] . ' Credits', 'url' => array( 'returnUrl' => $returnUrl, 'cancelUrl' => $backUrl, ), ]; /*if($rstrctdCurrId > 0) { //use converted amount $amount = $convertedAmount; }*/ $invId = 'R'. $invId; $myCurrency = "USDT"; $response = $binance_pay->create_order($invId, $amount, $myCurrency, $API_API_Username, $API_Password, $goodsDetails); if($response['status'] == 'SUCCESS'){ $paymentURL = $response['data']['checkoutUrl']; redirect($paymentURL); }elseif($response['status'] == 'FAIL'){ $errorMsg = $response['errorMessage']; redirect(base_url('home/order_cancelled?id='.$invId.'&errorMsg='.$errorMsg)); die; } //echo '<pre>';print_r($response); } else if($pMethodType == '57') //PAYTM { $params = array( 'm_id' => $API_API_Username, 'm_key' => $API_Password, 'invId' => 'PYTM_BLINKR_R'.$invId, 'credits' => $amount, 'urlWebhook' => base_url('ipn/payTmOrderPlaced'), ); require APPPATH . '/libraries/paytm/Paytm.php'; $paytmApi = new Paytm($params); $response = $paytmApi->getTransactionToken($myCurrency); if($response['success'] == true){ unset($this->data); $this->data['orderId'] = $response["orderId"]; $this->data['txnToken'] = $response["txnToken"]; $this->data['amount'] = $response["amount"]; $this->data['m_id'] = $API_API_Username; $this->data['PAYTM_ENVIRONMENT'] = "https://securegw.paytm.in"; $this->session->set_flashdata("data", $this->data); redirect(base_url('home/paytm')); }else{ $errorMsg = $response['message']; redirect(base_url('home/order_cancelled?id='.$id.'&errorMsg='.$errorMsg)); die;; } } else // if($pMethodType == '3')// BANK TRANSFER { //echo '1234'; die; updateRetailOrderAndSendEmails($invId, '5', 1, 1, 1); $this->session->set_flashdata("paymentMethodDescription", $paymentMethodDescription); $this->session->set_flashdata("OrderNumber", $order_id); redirect(base_url("home/order_placed?id=").$invId); } } } } else { $this->session->set_flashdata('error_message', $errorMsg . '<br>' . $errorCustomMsg); } redirect(base_url('home/order?serviceId=' . $id)); } $title = ''; $img = ''; $desc = ''; $prices = ''; $SITE_TITLE = ''; $delTime = ''; $apiId = 0; $strOrderAND = ''; $imeiFType = 0; $sc = 0; $allowQty = $minQnty = $maxQnty = 0; $qntyDropDown = ''; if ($id == '0' || trim($id) == '') { $seoURL = explode("/", ($_SERVER["REQUEST_URI"])); $exactURL = end($seoURL); $exactURL = current(array_slice($seoURL, -1)); $urlWithoutExt = explode('.', $exactURL); if (isset($urlWithoutExt[0])) $strOrderAND = "SEOURLName = '" . urldecode($urlWithoutExt[0]) . "'"; } else { $strOrderAND = "PackageId = '$id'"; } $rs_detail = $this->db->query("SELECT * FROM tbl_gf_retail_services WHERE DisablePackage = 0 AND ArchivedPack = '0' AND $strOrderAND")->row(); if (isset($rs_detail->PackageId) && $rs_detail->PackageId != '') { $id = $rs_detail->PackageId; if ($rs_detail->MetaKW != '') $META_KW_CONTENTS1 = stripslashes($rs_detail->MetaKW); if ($rs_detail->MetaTags != '') $META_DESC_CONTENTS1 = stripslashes($rs_detail->MetaTags); if ($rs_detail->HTMLTitle != '') $SITE_TITLE = stripslashes($rs_detail->HTMLTitle); $title = stripslashes($rs_detail->PackageTitle); $desc = stripslashes($rs_detail->MustRead); $delTime = stripslashes($rs_detail->TimeTaken); $price = convertPrice($rs_detail->PackagePrice, true); $imeiFType = $rs_detail->IMEIFieldType; $bulkimeiFType = $rs_detail->bulkIMEIFieldType; $customimeiFType = $rs_detail->customIMEIFieldType; $imei_custom_name = $rs_detail->imei_custom_name; $imei_custom_length = $rs_detail->imei_custom_length; //ahmedTest $imei_custom_max_length = $rs_detail->imei_custom_max_length; $imei_custom_information = $rs_detail->imei_custom_information; $allowQty = $rs_detail->allowQty; $qntyDropDown = $rs_detail->qntyDropDown; $minQnty = $rs_detail->minQnty; $maxQnty = $rs_detail->maxQnty; $imei_allow_alphabit = $rs_detail->imei_allow_alphabit; $imei_allow_digits = $rs_detail->imei_allow_digits; $imei_capital_alphabets = $rs_detail->imei_capital_alphabets; $imei_small_alphabets = $rs_detail->imei_small_alphabets; if (isset($rs_detail->RetailImage) != '') $img = "uplds$THEME/" . $rs_detail->RetailImage; $apiId = $rs_detail->APIId; $serviceId = $rs_detail->ExternalNetworkId; $redirectTo = $rs_detail->RedirectionURL; $customFldId = $rs_detail->CustomFieldId; $serviceType = $rs_detail->ServiceType; $rtlType = $rs_detail->RetailType; $redirectURL = ''; $TODAY_DT_TM = setDtTmWRTYourCountry(); $promoPrice = convertPrice(ifRetailServiceInPromotion($rs_detail->PackagePrice, $rs_detail->PromoStartDate, $rs_detail->PromoEndDate, $rs_detail->PromoDiscount, $TODAY_DT_TM, true), true); if ($redirectTo != '') echo "<script>window.location = '" . $redirectTo . "'</script>"; } $rsBrands = $this->db->query("SELECT DISTINCT A.BrandId AS Id, Brand AS Value, A.APIId FROM tbl_gf_packs_models A, tbl_gf_api_brands B WHERE A.APIId = B.APIId AND A.BrandId = B.BrandId AND ServiceId = '$id' ORDER BY Brand")->result(); $totalBrands = count($rsBrands); $rsPMethods = $this->db->query("SELECT PaymentMethodId, PaymentMethod, RetailFee, PayMethodTypeId, PayImage, Vat, FlatFee FROM tbl_gf_payment_methods WHERE DisablePaymentMethod = 0 AND PayMethodTypeId IN (1, 3, 10, 11, 12, 17, 50, 52, 51, 53, 55, 57) AND ForRetail = '1' ORDER BY OrderBy")->result(); /*echo '<pre>'; print_r($rsPMethods);*/ $this->data['META_KW_CONTENTS'] = $META_KW_CONTENTS1; $this->data['META_DESC_CONTENTS'] = $META_DESC_CONTENTS1; /* $strOtherCurr = ''; $currency_for_web = ''; if ($this->session->userdata('CurrencyID') && $this->session->userdata('CurrencyID') > 0) $currency_for_web =$this->session->userdata('CurrencyID'); elseif ($this->session->userdata('webCurrencyId') && $this->session->userdata('webCurrencyId') > 0) $currency_for_web = $this->session->userdata('webCurrencyId'); $rsOtherCurrencies = $this->db->query("SELECT * FROM tbl_gf_currency WHERE CurrencyId <> '" . $currency_for_web . "' AND RetailCurrency = '1'")->result(); foreach ($rsOtherCurrencies as $rwORC) { $prOC = (float)onlyFloatVal($promoPrice) * (float) $rwORC->ConversionRate; $strOtherCurr .= '<h5 style="font-size:18px; color:#0088CC;">' . $rwORC->CurrencySymbol . ' ' . roundMe($prOC) . '</h5>'; } */ $this->data['imei_custom_max_length'] = $imei_custom_max_length; $this->data['imei_custom_information'] = $imei_custom_information; $this->data['imei_allow_alphabit'] = $imei_allow_alphabit; $this->data['imei_allow_digits'] = $imei_allow_digits; $this->data['imei_custom_length'] = $imei_custom_length; $this->data['imei_capital_alphabets'] = $imei_capital_alphabets; $this->data['imei_small_alphabets'] = $imei_small_alphabets; $this->data['imei_custom_name'] = $imei_custom_name; $this->data['customimeiFType'] = $customimeiFType; $this->data['bulkimeiFType'] = $bulkimeiFType; $this->data['imei'] = $imei; $this->data['brandAPIId'] = $brandAPIId; $this->data['comments'] = $comments; $this->data['pckTitle'] = $title; $this->data['id'] = $id; $this->data['phone'] = $phone; $this->data['email'] = $email; $this->data['allowQty'] = $allowQty; $this->data['qntyDropDown'] = $qntyDropDown; $this->data['minQnty'] = $minQnty; $this->data['maxQnty'] = $maxQnty; $this->data['name'] = $name; $this->data['promoPrice'] = $promoPrice; $this->data['message'] = $this->session->flashdata('message') ?: $message; $this->data['errorMsg'] = $this->session->flashdata('error_message') ?: $errorMsg; $this->data['rwCustFld'] = array(); $this->data['SITE_TITLE'] = $SITE_TITLE; $this->data['rtlType'] = $rtlType; $this->data['serviceType'] = $serviceType; $this->data['customFldId'] = $customFldId; $this->data['serviceId'] = $serviceId; $this->data['apiId'] = $apiId; $this->data['imeiFType'] = $imeiFType; $this->data['price'] = $price; $this->data['delTime'] = $delTime; $this->data['img'] = $img; $this->data['desc'] = $desc; $this->data['redirectTo'] = $redirectTo; $this->data['redirectURL'] = $redirectURL; $this->data['title'] = $title; // $this->data['totalFields'] = $totalFields; // $this->data['rsFields'] = $rsFields; $this->data['rsBrands'] = $rsBrands; $this->data['totalBrands'] = $totalBrands; $this->data['rsPMethods'] = $rsPMethods; // $this->data['strOtherCurr'] = $strOtherCurr; $strFields = $this->make_custom_fields(get_defined_vars()); $this->data['strFields'] = $strFields; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/order_new'; } else { $this->data['view'] = 'template/order_new'; } $this->load->view($this->templatePath, $this->data); } public function selectVatFlatValues() { try{ $posted_data = $this->input->post(); //d('asdasdsad'); //dd($posted_data); $id = $posted_data['id']; unset($posted_data['id']); $rsPMethods = $this->db->query("SELECT PaymentMethodId, PaymentMethod, RetailFee, PayMethodTypeId, PayImage, Vat, FlatFee FROM tbl_gf_payment_methods WHERE DisablePaymentMethod = 0 AND PayMethodTypeId= $id")->result(); $response = [ 'status' => 1, 'code' => '200', 'message' => 'Updated successfully', 'data' => $rsPMethods[0] ]; echo json_encode($response); die; } catch(Exception $e) { echo json_decode(['status' => 0, 'message' => $e->getMessage()]); } } private function make_custom_fields($variables) { extract($variables); //=================================== CUSTOM FIELDS ============================================// $i = 1; $PackType = ($rtlType == 1) ? 4 : 3; // 3 = imei, 4 = server $strFields = ''; $themeStyle = 0; $qtyField = false; $customFields = $this->db->query("SELECT * FROM `tbl_gf_api_custom_fields` WHERE `PackId` = {$id} AND `PackType` = {$PackType}")->result(); foreach ($customFields as $row) { // making label $FieldLabel = ($row->FieldLabel ?: $row->FieldName); if ($themeStyle == '0') $strFields .= '<div class="form-group"><label>' . $FieldLabel . ':'; else if ($themeStyle == '1') $strFields .= '<div class="control-group"><label class="control-label">' . $FieldLabel . ':'; if ($row->Required == '1') $strFields .= '*'; if ($themeStyle == '0') $strFields .= '</label>'; else if ($themeStyle == '1') $strFields .= '</label><div class="controls">'; // making field $UseAsQuantity = ''; if ($PackType == 4 && $row->UseAsQuantity) { $qtyField = true; if ($row->FieldType == 'dropdown') $UseAsQuantity = 'onchange="calculateAmountAsPerQty(this.value);"'; else $UseAsQuantity = 'oninput="calculateAmountAsPerQty(this.value);"'; } if ($row->FieldType == 'text') { # IMEI if ($PackType == 3) { $strMaxLen = ''; if ($row->MaxLen > 0) $strMaxLen = "maxlength = '" . $row->MaxLen . "'"; $strMinLen = ''; if ($row->MinLen > 0) $strMinLen = "minlength = '" . $row->MinLen . "'"; $validateIMEI = ''; if ($row->UseAsIMEI && !$row->IsCustomIMEI) { $validateIMEI = ' onkeypress="if(checkImeiNew(this.value)) return false; else validateInteger(event)" id="txtIMEI" '; $strFields .= '<div class="input-group">'; $strMaxLen = "maxlength = '14'"; } $strFields .= '<input type="text" placeholder="Enter ' . $FieldLabel . '" name="fld' . $i . '" ' . $strMinLen . ' ' . $strMaxLen . ' ' . $validateIMEI . ' class="form-control" />'; if ($row->UseAsIMEI && !$row->IsCustomIMEI) { $strFields .= '<div class="input-group-append"> <input type="text" class="form-control text-center" style="width:50px; padding: 0;" name="txtIMEILastDigit" id="txtIMEILastDigit" readonly="" value="" placeholder="IMEI:"> </div></div><p style="color: #cac7c7">Only 15 digit Number (dial *#06# for IMEI Number)</p>'; } } else { $strMaxLen = ''; if ($row->MaxLen > 0) $strMaxLen = "maxlength = '" . $row->MaxLen . "'"; $strMinLen = ''; if ($row->MinLen > 0) $strMinLen = "minlength = '" . $row->MinLen . "'"; $strFields .= '<input type="text" placeholder="Enter ' . $FieldLabel . '" name="fld' . $i . '" ' . $strMinLen . ' ' . $strMaxLen . ' ' . $UseAsQuantity . ' class="form-control" />'; if ($UseAsQuantity) { if ($row->MinQnt > 1 && $row->MaxQnt > 1) { $strFields .= '<p style="margin-top: 5px;"><b>Quantity must be between ' . $row->MinQnt . ' and ' . $row->MaxQnt . '.</b></p>'; } else if ($row->MinQnt > 1) { $strFields .= '<p style="margin-top: 5px;"><b>Minimum Quantity Required is ' . $row->MinQnt . '</b></p>'; } else if ($row->MaxQnt > 1) { $strFields .= '<p style="margin-top: 5px;"><b>Maximum Quantity Required is ' . $row->MaxQnt . '</b></p>'; } } } } else if ($row->FieldType == 'textarea') { # IMEI if ($PackType == 3) { $validateIMEI = ''; if ($row->UseAsIMEI) { $validateIMEI = ' onkeypress="validateIntegerInTextArea(event)" id="imei" '; } $strFields .= '<textarea name="fld' . $i . '" ' . $validateIMEI . ' class="form-control"></textarea>'; if ($row->UseAsIMEI) { $strFields .= '<div style="color: #cac7c7" class="help-block mt-1">You can order max 122 of IMEI service.You can enter several serial numbers (one per line) if you have serial similar phones (for the same service and the same information)</div>'; } } else { $strFields .= '<textarea name="fld' . $i . '" class="form-control"></textarea>'; } } else if ($row->FieldType == 'dropdown') { if ($PackType == 3) { $strFields .= '<select id="ddOrdrQty" name="fld' . $i . '" class="form-control">'; $rsValues = explode(",", trim($row->FieldOptions, ", ")); foreach ($rsValues as $rw) { $strFields .= '<option value="' . $rw . '">' . $rw . '</option>'; } $strFields .= '</select>'; } else { $strFields .= '<select id="ddOrdrQty" name="fld' . $i . '" class="form-control" ' . $UseAsQuantity . '>'; $rsValues = explode(",", trim($row->FieldOptions, ", ")); if ($UseAsQuantity) $strFields .= '<option value="" selected="selected">Please Select ' . $FieldLabel . '</option>'; foreach ($rsValues as $rw) { $strFields .= '<option value="' . $rw . '">' . $rw . '</option>'; } $strFields .= '</select>'; } } else if ($row->FieldType == 'radio') { $rsValues = explode(",", trim($row->FieldOptions, ", ")); foreach ($rsValues as $rw) { $strFields .= '<input type="radio" class="form-control" name="fld' . $i . '" value="' . $rw . '"> ' . $rw . ' '; } } if ($row->Description != '') $strFields .= '<small>' . stripslashes($row->Description) . '</small><br/>'; if ($themeStyle == '0') $strFields .= '</div>'; else if ($themeStyle == '1') $strFields .= '</div></div>'; $strFields .= '<input type="hidden" name="colNm' . $i . '" value="' . $row->FieldName . '" />'; $strFields .= '<input type="hidden" name="mndtry' . $i . '" value="' . $row->Required . '" />'; $strFields .= '<input type="hidden" name="fieldId' . $i . '" value="' . $row->Id . '" />'; $strFields .= '<input type="hidden" name="lbl' . $i . '" value="' . $FieldLabel . '" />'; $strFields .= '<input type="hidden" name="customField' . $i . '" value="' . $row->CustomField . '" />'; # IMEI if ($PackType == 3) { $strFields .= '<input type="hidden" name="rstrctnAD' . $i . '" value="' . $row->AllowDigits . '" />'; $strFields .= '<input type="hidden" name="rstrctnASA' . $i . '" value="' . $row->AllowSmallAlphabets . '" />'; $strFields .= '<input type="hidden" name="rstrctnACA' . $i . '" value="' . $row->AllowCapitalAlphabets . '" />'; $strFields .= '<input type="hidden" name="useAsIMEI' . $i . '" value="' . $row->UseAsIMEI . '" />'; } else { $strFields .= '<input type="hidden" name="useAsQty' . $i . '" value="' . ($UseAsQuantity ? 1 : 0) . '" />'; $strFields .= '<input type="hidden" name="minQnt' . $i . '" value="' . $row->MinQnt . '" />'; $strFields .= '<input type="hidden" name="maxQnt' . $i . '" value="' . $row->MaxQnt . '" />'; } $i++; } $totalFields = count($customFields); $strFields .= '<input type="hidden" name="totalCustomFields" value="' . $totalFields . '" />'; //=================================== CUSTOM FIELDS ============================================// return $strFields; } function ajximeiorder() { $purifier = new HTMLPurifier(); $purpose = $this->input->post('purpose'); if ($purpose == 'getData') { $PCK_TITLE = 'PackageTitle'; $TIME_TAKEN = 'TimeTaken'; $IMP_INFO = 'MustRead'; $packId = ($this->input->post('packId')) ? $purifier->purify(check_input($this->input->post('packId'), $this->db->conn_id)) : '0'; $usrCurrId = ($this->input->post('usrCurrId')) ? $purifier->purify(check_input($this->input->post('usrCurrId'), $this->db->conn_id)) : '0'; $cnvrsnRt = ($this->input->post('cnvrsnRt')) ? $purifier->purify(check_input($this->input->post('cnvrsnRt'), $this->db->conn_id)) : '0'; $themeStyle = ($this->input->post('themeStyle')) ? $purifier->purify(check_input($this->input->post('themeStyle'), $this->db->conn_id)) : '0'; $msg = ''; $mustRead = ''; $timeTaken = ''; $apiId = 0; $pckTitle = ''; $dupIMEIs = 0; $extNtwrkId = 0; $strMobiles = ''; $strBrands = ''; $apiType = 0; $customFldId = 0; $redirectTo = ''; $rsPackage = $this->db->query("SELECT $PCK_TITLE, $TIME_TAKEN, $IMP_INFO, A.APIId, APIType, DuplicateIMEIsNotAllowed, IMEIFieldType, ExternalNetworkId, PackageImage, CalculatePreCodes, CustomFieldId, RedirectionURL, TOCs, ServiceType, VerifyOrders, CancelOrders FROM tbl_gf_packages A LEFT JOIN tbl_gf_api B ON (A.APIId = B.APIId) WHERE PackageId = '$packId'")->row(); if (isset($rsPackage->$PCK_TITLE) && $rsPackage->$PCK_TITLE != '') { $mustRead = htmlspecialchars_decode(stripslashes($rsPackage->$IMP_INFO)); $timeTaken = stripslashes($rsPackage->$TIME_TAKEN); $apiId = $rsPackage->APIId; $pckTitle = stripslashes($rsPackage->$PCK_TITLE); $dupIMEIs = $rsPackage->DuplicateIMEIsNotAllowed; $imeiFType = $rsPackage->IMEIFieldType; $bulkimeiFType = $rsPackage->bulkIMEIFieldType; $customimeiFType = $rsPackage->customIMEIFieldType; $imei_custom_name = $rsPackage->imei_custom_name; $imei_custom_length = $rsPackage->imei_custom_length; //ahmedTest $imei_custom_max_length = $rsPackage->imei_custom_max_length; $imei_custom_information = $rsPackage->imei_custom_information; $imei_allow_alphabit = $rsPackage->imei_allow_alphabit; $imei_allow_digits = $rsPackage->imei_allow_digits; $imei_capital_alphabets = $rsPackage->imei_capital_alphabets; $imei_small_alphabets = $rsPackage->imei_small_alphabets; $pckImg = $rsPackage->PackageImage; $preCode = $rsPackage->CalculatePreCodes; $apiType = $rsPackage->APIType; $extNtwrkId = $rsPackage->ExternalNetworkId == '' ? 0 : $rsPackage->ExternalNetworkId; $customFldId = $rsPackage->CustomFieldId; $redirectTo = $rsPackage->RedirectionURL; $toc = $rsPackage->TOCs; $strFeatures = $rsPackage->ServiceType == '0' ? '<i class="fa fa-reorder" title="Database"></i> ' : ''; $strFeatures .= $rsPackage->VerifyOrders == '1' ? '<i class="fa fa-refresh" title="Verifiable"></i> ' : ''; $strFeatures .= $rsPackage->CancelOrders == '1' ? '<i class="fa fa-times" title="Can be cancelled"></i>' : ''; } $myNetworkId = $packId; $USER_ID = $this->session->userdata('GSM_FUS_UserId'); $IMEI_TYPE = 0; $MY_CURRENCY_ID = $usrCurrId; $CONVERSION_RATE = $cnvrsnRt; //include '../../../getpackprice.php'; $rsPackPrice = $this->db->query("SELECT PackageId, Price FROM tbl_gf_users_packages_prices WHERE UserId = '$USER_ID' AND PackageId = '$myNetworkId'")->row(); if (isset($rsPackPrice->Price) && $rsPackPrice->Price != '') { $packagePrice = number_format($rsPackPrice->Price, 2, '.', ''); } else { $rsPackPrice = $this->db->query("SELECT PackageId, Price FROM tbl_gf_users A, tbl_gf_plans_packages_prices B WHERE A.PricePlanId = B.PlanId AND B.CurrencyId = '$MY_CURRENCY_ID' AND ServiceType = '$IMEI_TYPE' AND PackageId = '$myNetworkId' AND UserId = '$USER_ID'")->row(); if (isset($rsPackPrice->Price) && $rsPackPrice->Price != '') { $packagePrice = number_format($rsPackPrice->Price, 2, '.', ''); } else { $USER_CURRENCY_RATE = 1; $rwUsrRate = $this->db->query("SELECT ConversionRate FROM tbl_gf_users A, tbl_gf_currency B WHERE (A.CurrencyId = B.CurrencyId) AND UserId = '$USER_ID'")->row(); if (isset($rwUsrRate->ConversionRate) && $rwUsrRate->ConversionRate != '') $USER_CURRENCY_RATE = $rwUsrRate->ConversionRate; $rsPlanPr_DEFAULT = $this->db->query("SELECT PackageId, Price FROM tbl_gf_users A, tbl_gf_plans_packages_prices B, tbl_gf_currency C WHERE A.PricePlanId = B.PlanId AND B.CurrencyId = C.CurrencyId AND DefaultCurrency = 1 AND UserId = '$USER_ID' AND ServiceType = '$IMEI_TYPE' AND PackageId = '$myNetworkId'")->row(); if (isset($rsPlanPr_DEFAULT->Price) && $rsPlanPr_DEFAULT->Price != '') { $packagePrice = number_format($rsPlanPr_DEFAULT->Price * $USER_CURRENCY_RATE, 2, '.', ''); } else { $rsPackPrice = $this->db->query("SELECT A.PackageId, Price, PackagePrice FROM tbl_gf_packages A LEFT JOIN tbl_gf_packages_currencies B ON (A.PackageId = B.PackageId AND CurrencyId = '$MY_CURRENCY_ID') WHERE A.PackageId = '$myNetworkId'")->row(); if (isset($rsPackPrice->PackageId) && $rsPackPrice->PackageId != '') { if ($rsPackPrice->Price == '') { $packagePrice = number_format($rsPackPrice->PackagePrice * $CONVERSION_RATE, 2, '.', ''); } else $packagePrice = number_format($rsPackPrice->Price, 2, '.', ''); } } } } if ($pckImg != '') { $rowSettings = $this->db->query('SELECT Theme FROM tbl_gf_email_settings WHERE Id = 1')->row(); $pckImg = 'uplds' . $rowSettings->Theme . '/' . $rsPackage->PackageImage; } $brandAPIId = 0; $rsBrands = $this->db->query("SELECT DISTINCT A.BrandId AS Id, Brand AS Value, A.APIId FROM tbl_gf_packs_models A, tbl_gf_api_brands B WHERE A.APIId = B.APIId AND A.BrandId = B.BrandId AND ServiceId = '$packId' ORDER BY Brand")->result(); foreach ($rsBrands as $row) { $brandAPIId = $row->APIId; $strBrands .= "<option value='" . $row->Id . "'>" . stripslashes($row->Value) . "</option>"; } if ($strBrands != '') $strBrands = "<option value='0'>Please Select</option>" . $strBrands; //=================================== CUSTOM FIELDS ============================================// $rsFields = $this->User_model->get_custom_fields($packId); /* last_query(); echo "$packId<pre>"; print_r($rsFields); exit(); */ $totalFields = count($rsFields); $i = 1; $strFields = ''; foreach ($rsFields as $row) { if ($themeStyle == '0') $strFields .= '<label>' . $row->FieldLabel . ':'; else if ($themeStyle == '1') $strFields .= '<div class="control-group"><label class="control-label">' . $row->FieldLabel . ':'; else if ($themeStyle == '2') $strFields .= '<div class="control-group"><label class="col-md-3 control-label">' . $row->FieldLabel . ':'; if ($row->Mandatory == '1') $strFields .= '*'; if ($themeStyle == '0') $strFields .= '</label>'; else if ($themeStyle == '1') $strFields .= '</label><div class="controls">'; else if ($themeStyle == '2') $strFields .= '</label><div class="col-md-9">'; if ($row->FieldType == 'Text Box') { $strMaxLen = ''; if ($row->MaxLength > 0) $strMaxLen = "maxlength = '" . $row->MaxLength . "'"; if ($row->MinLength > 0 && is_numeric($row->MinLength)) $strMaxLen .= "minlength = '" . $row->MinLength . "'"; $strFields .= '<input type="text" placeholder="Enter ' . $row->FieldLabel . '" name="fld' . $i . '" ' . $strMaxLen . ' class="form-control" />'; } else if ($row->FieldType == 'Text Area') $strFields .= '<textarea name="fld' . $i . '" class="form-control"></textarea>'; else if ($row->FieldType == 'Drop Down') { $strFields .= '<br/><select name="fld' . $i . '" style="width: 100%;padding: 8px;border: 1px solid #ddd;">'; $strFields .= '<option value="0">Please Select</option>'; //$rsValues = $this->db->query("SELECT RegValue FROM tbl_gf_custom_field_values WHERE DisableRegValue = 0 AND FieldId = '" . $row->FieldId . "' ORDER BY RegValue")->result(); $rsValues = explode(",", $row->fieldOptions); foreach ($rsValues as $rw) { $strFields .= '<option value="' . $rw . '">' . $rw . '</option>'; } $strFields .= '</select>'; } else if ($row->FieldType == 'Radio Button') { $strFields .= "<br/>"; //$rsValues = $this->db->query("SELECT RegValue FROM tbl_gf_custom_field_values WHERE DisableRegValue = 0 AND FieldId = '" . $row->FieldId . "' ORDER BY RegValue")->result(); $rsValues = explode(",", $row->fieldOptions); foreach ($rsValues as $rw) { $strFields .= '<div class="form-check form-check-inline mt-0"><label class="form-check-label"><input type="radio" class="form-check-input" name="fld' . $i . '" checked="checked" value="' . $rw . '">' . $rw . '</label></div>'; } $strFields .= "<br/>"; } if ($row->FInstructions != '') $strFields .= '<small>' . stripslashes($row->FInstructions) . '</small><br/>'; if ($row->description != '') $strFields .= '<small>' . stripslashes($row->description) . '</small><br/>'; if ($themeStyle == '0') $strFields .= '</div>'; else if ($themeStyle == '1') $strFields .= '</div></div>'; else if ($themeStyle == '2') $strFields .= '</div></div><br /><br />'; $strFields .= '<input type="hidden" name="colNm' . $i . '" value="' . $row->FieldColName . '" />'; $strFields .= '<input type="hidden" name="mndtry' . $i . '" value="' . $row->Mandatory . '" />'; $strFields .= '<input type="hidden" name="rstrctn' . $i . '" value="' . $row->Restriction . '" />'; $strFields .= '<input type="hidden" name="lbl' . $i . '" value="' . $row->FieldLabel . '" />'; $i++; } $strFields .= '<input type="hidden" name="totalCustomFields" value="' . $totalFields . '" />'; //=================================== CUSTOM FIELDS ============================================// //=================================== CUSTOM FIELD INCASE OF NO IMEI ============================================// $strCustomFld = $mxLn = $mnLn = ''; $cusFldRes = 0; $validationCondition = 10; //echo "[$imei_allow_digits][$imei_capital_alphabets][$imei_small_alphabets]"; if ($imei_allow_digits == 1 && $imei_capital_alphabets == 0 && $imei_small_alphabets == 0) { $validationCondition = 1; } else if ($imei_allow_digits == 0 && $imei_capital_alphabets == 1 && $imei_small_alphabets == 0) { $validationCondition = 2; } else if ($imei_allow_digits == 0 && $imei_capital_alphabets == 0 && $imei_small_alphabets == 1) { $validationCondition = 3; } else if ($imei_allow_digits == 0 && $imei_capital_alphabets == 1 && $imei_small_alphabets == 1) { $validationCondition = 4; } else if ($imei_allow_digits == 1 && $imei_capital_alphabets == 1 && $imei_small_alphabets == 1) { $validationCondition = 5; } else if ($imei_allow_digits == 1 && $imei_capital_alphabets == 1 && $imei_small_alphabets == 0) { $validationCondition = 6; } else if ($imei_allow_digits == 1 && $imei_capital_alphabets == 0 && $imei_small_alphabets == 1) { $validationCondition = 7; } /* echo $validationCondition; exit(); */ if ($customimeiFType != 0) { $rwCustFld = $this->User_model->get_fields_by_id($customFldId); if (isset($imei_custom_name) && $imei_custom_name != '') { if ($imei_custom_length > 0 && is_numeric($imei_custom_length)) //minlength $mnLn = $imei_custom_length; if ($imei_custom_max_length > 0 && $imei_custom_max_length != '') //maxlength $mxLn = $imei_custom_max_length; $cusFldRes = $imei_allow_alphabit; //Restriction $strCustomFld = '<label id="lblCustomFld">' . $imei_custom_name . '</label> <textarea minlength="' . $mnLn . '" id="imeiCustomField" onkeypress="validateCustomfield(event)" placeholder="Please Enter ' . $imei_custom_name . '" rows="5" class="form-control" name="txtCustomFld"></textarea><div style="color: #cac7c7" class="help-block mt-1">' . $imei_custom_information . '</div>'; //var_dump($strCustomFld);die; } } //=================================== CUSTOM FIELD INCASE OF NO IMEI ============================================// //=================================== FEATURES ============================================// $strFeatures .= getServiceFeatures($packId, 0); //=================================== FEATURES ============================================// /*$msg = $mustRead . "~" . $timeTaken . "~" . $apiId . "~" . $pckTitle . "~" . $strCustomFld . "~" . $dupIMEIs . "~" . $imeiFType . "~" . $pckImg . "~" . $strMobiles . "~" . $preCode . "~" . $strBrands . "~" . $extNtwrkId . "~" . $brandAPIId . "~" . $packagePrice . "~" . $strFields . "~" . $redirectTo . "~" . $toc . "~" . $strFeatures . "~" . $mxLn . "~" . $cusFldRes . "~" . $mnLn;*/ $msg = $mustRead . "~" . $timeTaken . "~" . $apiId . "~" . $pckTitle . "~" . $strCustomFld . "~" . $dupIMEIs . "~" . $imeiFType . "~" . $pckImg . "~" . $strMobiles . "~" . $preCode . "~" . $strBrands . "~" . $extNtwrkId . "~" . $brandAPIId . "~" . $packagePrice . "~" . $strFields . "~" . $redirectTo . "~" . $toc . "~" . $strFeatures . "~" . $mxLn . "~" . $cusFldRes . "~" . $mnLn . "~" . $bulkimeiFType . "~" . $customimeiFType . "~" . $imei_custom_name . "~" . $validationCondition; } else if ($purpose == 'getMdls') { $brandAPIId = ($this->input->post('brandAPIId')) ? $purifier->purify(check_input($this->input->post('brandAPIId'), $this->db->conn_id)) : '0'; $brandId = ($this->input->post('brandId')) ? $purifier->purify(check_input($this->input->post('brandId'), $this->db->conn_id)) : '0'; $packId = ($this->input->post('packId')) ? $purifier->purify(check_input($this->input->post('packId'), $this->db->conn_id)) : '0'; $strModels = ''; $rsModels = $this->db->query("SELECT A.ModelId AS Id, Model AS Value FROM tbl_gf_packs_models A, tbl_gf_api_models B WHERE A.ModelId = B.ModelId AND A.BrandId = B.BrandId AND A.BrandId = '$brandId' AND ServiceId = '$packId' ORDER BY Model")->result(); $t = 0; $selectedModel = ''; foreach ($rsModels as $row) { if ($t == 0) { $selectedModel = stripslashes($row->Value); } $strModels .= "<option value='" . $row->Id . "'>" . stripslashes($row->Value) . "</option>"; $t++; } $msg = $strModels . '~GSMF~' . $selectedModel; } echo $msg; } //copied user imei services function public function ajximeiorderrr() { $purpose = $this->input->post_get('purpose'); if ($purpose == 'getData') { $imei_allow_digits = $imei_capital_alphabets = $imei_small_alphabets = ""; $PCK_TITLE = 'PackageTitle'; $TIME_TAKEN = 'TimeTaken'; $IMP_INFO = 'MustRead'; $packId = $this->input->post('packId') ?: '0'; $usrCurrId = $this->input->post('usrCurrId') ?: '0'; $cnvrsnRt = $this->input->post('cnvrsnRt') ?: '0'; $themeStyle = $this->input->post('themeStyle') ?: '0'; $msg = ''; $mustRead = ''; $timeTaken = ''; $apiId = 0; $pckTitle = ''; $dupIMEIs = 0; $extNtwrkId = 0; $strMobiles = ''; $strBrands = ''; $apiType = 0; $customFldId = 0; $redirectTo = ''; $rsPackage = $this->User_model->get_packages($PCK_TITLE, $TIME_TAKEN, $IMP_INFO, $packId); //var_dump($this->db->last_query());die; if (isset($rsPackage->PackageTitle) && $rsPackage->PackageTitle != '') { $mustRead = htmlspecialchars_decode(stripslashes($rsPackage->MustRead)); $timeTaken = stripslashes($rsPackage->TimeTaken); $apiId = $rsPackage->APIId; $pckTitle = stripslashes($rsPackage->PackageTitle); $dupIMEIs = $rsPackage->DuplicateIMEIsNotAllowed; $imeiFType = $rsPackage->IMEIFieldType; $bulkimeiFType = $rsPackage->bulkIMEIFieldType; $customimeiFType = $rsPackage->customIMEIFieldType; $imei_custom_name = $rsPackage->imei_custom_name; $imei_custom_length = $rsPackage->imei_custom_length; //ahmedTest $imei_custom_max_length = $rsPackage->imei_custom_max_length; $imei_custom_information = $rsPackage->imei_custom_information; $imei_allow_alphabit = $rsPackage->imei_allow_alphabit; $imei_allow_digits = $rsPackage->imei_allow_digits; $imei_capital_alphabets = $rsPackage->imei_capital_alphabets; $imei_small_alphabets = $rsPackage->imei_small_alphabets; $pckImg = $rsPackage->PackageImage; $preCode = $rsPackage->CalculatePreCodes; $apiType = $rsPackage->APIType; $extNtwrkId = $rsPackage->ExternalNetworkId == '' ? 0 : $rsPackage->ExternalNetworkId; $customFldId = $rsPackage->CustomFieldId; $redirectTo = $rsPackage->RedirectionURL; $toc = $rsPackage->TOCs; $strFeatures = $rsPackage->ServiceType == '0' ? '<li><i class="fa fa-reorder" title="Database"></i> Database</li>' : ''; $strFeatures .= $rsPackage->VerifyOrders == '1' ? '<li ><i class="fa fa-refresh" title="Verifiable"></i> Verifiable</li>' : ''; $strFeatures .= $rsPackage->CancelOrders == '1' ? '<li ><i class="fa fa-times" title="Can be cancelled"></i> Can be cancelled</li>' : ''; } $myNetworkId = $packId; $USER_ID = $this->session->userdata('GSM_FUS_UserId'); $IMEI_TYPE = 0; $MY_CURRENCY_ID = $usrCurrId; $CONVERSION_RATE = $cnvrsnRt; $packagePrice = getpackprice($myNetworkId, $MY_CURRENCY_ID, $IMEI_TYPE); if ($pckImg != '') { $rowSettings = $this->User_model->get_theme(); $pckImg = 'uplds' . $rowSettings->Theme . '/' . $rsPackage->PackageImage; } $brandAPIId = 0; $rsBrands = $this->User_model->get_brands($packId); foreach ($rsBrands as $row) { $brandAPIId = $row->APIId; $strBrands .= "<option value='" . $row->Id . "'>" . stripslashes($row->Value) . "</option>"; } //=================================== CUSTOM FIELDS ============================================// $rsFields = $this->User_model->get_custom_fields($packId); /* last_query(); echo "$packId<pre>"; print_r($rsFields); exit(); */ $totalFields = count($rsFields); $i = 1; $strFields = ''; foreach ($rsFields as $row) { if ($themeStyle == '0') $strFields .= '<label>' . $row->FieldLabel . ':'; else if ($themeStyle == '1') $strFields .= '<div class="control-group"><label class="control-label">' . $row->FieldLabel . ':'; else if ($themeStyle == '2') $strFields .= '<div class="control-group"><label class="col-md-3 control-label">' . $row->FieldLabel . ':'; if ($row->Mandatory == '1') $strFields .= '*'; if ($themeStyle == '0') $strFields .= '</label>'; else if ($themeStyle == '1') $strFields .= '</label><div class="controls">'; else if ($themeStyle == '2') $strFields .= '</label><div class="col-md-9">'; if ($row->FieldType == 'Text Box') { $strMaxLen = ''; if ($row->MaxLength > 0) $strMaxLen = "maxlength = '" . $row->MaxLength . "'"; if ($row->MinLength > 0 && is_numeric($row->MinLength)) $strMaxLen .= "minlength = '" . $row->MinLength . "'"; $strFields .= '<input type="text" placeholder="Enter ' . $row->FieldLabel . '" name="fld' . $i . '" ' . $strMaxLen . ' class="form-control" />'; } else if ($row->FieldType == 'Text Area') $strFields .= '<textarea name="fld' . $i . '" class="form-control"></textarea>'; else if ($row->FieldType == 'Drop Down') { $strFields .= '<br/><select name="fld' . $i . '" style="width: 100%;padding: 8px;border: 1px solid #ddd;">'; $strFields .= '<option value="0">Please Select</option>'; //$rsValues = $this->db->query("SELECT RegValue FROM tbl_gf_custom_field_values WHERE DisableRegValue = 0 AND FieldId = '" . $row->FieldId . "' ORDER BY RegValue")->result(); $rsValues = explode(",", $row->fieldOptions); foreach ($rsValues as $rw) { $strFields .= '<option value="' . $rw . '">' . $rw . '</option>'; } $strFields .= '</select>'; } else if ($row->FieldType == 'Radio Button') { $strFields .= "<br/>"; $rsValues = $this->db->query("SELECT RegValue FROM tbl_gf_custom_field_values WHERE DisableRegValue = 0 AND FieldId = '" . $row->FieldId . "' ORDER BY RegValue")->result(); foreach ($rsValues as $rw) { $strFields .= '<div class="form-check form-check-inline mt-0"><label class="form-check-label"><input type="radio" class="form-check-input" name="fld' . $i . '" checked="checked" value="' . $rw->RegValue . '">' . $rw->RegValue . '</label></div>'; } $strFields .= "<br/>"; } if ($row->FInstructions != '') $strFields .= '<small>' . stripslashes($row->FInstructions) . '</small><br/>'; if ($row->description != '') $strFields .= '<small>' . stripslashes($row->description) . '</small><br/>'; if ($themeStyle == '0') $strFields .= '</div>'; else if ($themeStyle == '1') $strFields .= '</div></div>'; else if ($themeStyle == '2') $strFields .= '</div></div><br /><br />'; $strFields .= '<input type="hidden" name="colNm' . $i . '" value="' . $row->FieldColName . '" />'; $strFields .= '<input type="hidden" name="mndtry' . $i . '" value="' . $row->Mandatory . '" />'; $strFields .= '<input type="hidden" name="rstrctn' . $i . '" value="' . $row->Restriction . '" />'; $strFields .= '<input type="hidden" name="lbl' . $i . '" value="' . $row->FieldLabel . '" />'; $i++; } $strFields .= '<input type="hidden" name="totalCustomFields" value="' . $totalFields . '" />'; //=================================== CUSTOM FIELDS ============================================// //=================================== CUSTOM FIELD INCASE OF NO IMEI ============================================// $strCustomFld = $mxLn = $mnLn = ''; $cusFldRes = 0; $validationCondition = 10; //echo "[$imei_allow_digits][$imei_capital_alphabets][$imei_small_alphabets]"; if ($imei_allow_digits == 1 && $imei_capital_alphabets == 0 && $imei_small_alphabets == 0) { $validationCondition = 1; } else if ($imei_allow_digits == 0 && $imei_capital_alphabets == 1 && $imei_small_alphabets == 0) { $validationCondition = 2; } else if ($imei_allow_digits == 0 && $imei_capital_alphabets == 0 && $imei_small_alphabets == 1) { $validationCondition = 3; } else if ($imei_allow_digits == 0 && $imei_capital_alphabets == 1 && $imei_small_alphabets == 1) { $validationCondition = 4; } else if ($imei_allow_digits == 1 && $imei_capital_alphabets == 1 && $imei_small_alphabets == 1) { $validationCondition = 5; } else if ($imei_allow_digits == 1 && $imei_capital_alphabets == 1 && $imei_small_alphabets == 0) { $validationCondition = 6; } else if ($imei_allow_digits == 1 && $imei_capital_alphabets == 0 && $imei_small_alphabets == 1) { $validationCondition = 7; } /* echo $validationCondition; exit(); */ if ($customimeiFType != 0) { $rwCustFld = $this->User_model->get_fields_by_id($customFldId); if (isset($imei_custom_name) && $imei_custom_name != '') { if ($imei_custom_length > 0 && is_numeric($imei_custom_length)) //minlength $mnLn = $imei_custom_length; if ($imei_custom_max_length > 0 && $imei_custom_max_length != '') //maxlength $mxLn = $imei_custom_max_length; $cusFldRes = $imei_allow_alphabit; //Restriction $strCustomFld = '<label id="lblCustomFld">' . $imei_custom_name . '</label> <textarea minlength="' . $mnLn . '" id="imeiCustomField" onkeypress="validateCustomfield(event)" placeholder="Please Enter ' . $imei_custom_name . '" rows="5" class="form-control" name="txtCustomFld"></textarea><div style="color: #cac7c7" class="help-block mt-1">' . $imei_custom_information . '</div>'; //var_dump($strCustomFld);die; } } //=================================== CUSTOM FIELD INCASE OF NO IMEI ============================================// //=================================== FEATURES ============================================// $strFeatures .= get_service_features($packId, 0); //=================================== FEATURES ============================================// //var_dump($strCustomFld,$imei_custom_name,$imei_custom_length,$imei_custom_information);die; $msg = $mustRead . "~" . $timeTaken . "~" . $apiId . "~" . $pckTitle . "~" . $strCustomFld . "~" . $dupIMEIs . "~" . $imeiFType . "~" . $pckImg . "~" . $strMobiles . "~" . $preCode . "~" . $strBrands . "~" . $extNtwrkId . "~" . $brandAPIId . "~" . $packagePrice . "~" . $strFields . "~" . $redirectTo . "~" . $toc . "~" . $strFeatures . "~" . $mxLn . "~" . $cusFldRes . "~" . $mnLn . "~" . $bulkimeiFType . "~" . $customimeiFType . "~" . $imei_custom_name . "~" . $validationCondition; } else if ($purpose == 'getMdls') { $brandAPIId = $this->input->post('brandAPIId') ?: '0'; $brandId = $this->input->post('brandId') ?: '0'; $packId = $this->input->post('packId') ?: '0'; $strModels = ''; $rsModels = $this->User_model->get_models($brandId, $packId); $t = 0; $selectedModel = ''; foreach ($rsModels as $row) { if ($t == 0) { $selectedModel = stripslashes($row->Value); } $strModels .= "<option value='" . $row->Id . "'>" . stripslashes($row->Value) . "</option>"; $t++; } $msg = $strModels . '~GSMF~' . $selectedModel; } echo $msg; exit(); } public function geteztoken() { $purifier = new HTMLPurifier(); $authToken = $purifier->purify(check_input($this->input->post_get('auth_token'), $this->db->conn_id)); $this->data['BASE_URL'] = base_url(); $this->data['authToken'] = $authToken; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/geteztoken'; } else { $this->data['view'] = 'template/geteztoken'; } $this->load->view($this->templatePath, $this->data); } public function order_placed() { $this->load->model('Retail_model'); $id = $this->input->post_get('id') ?: $id; //d($this->input->post()); //die; $message = ''; $this->data['orderDetails'] = NULL; if($id!=0) { $this->data['orderDetails'] = $this->Retail_model->getRetailOrdersById($id); $query = $this->Retail_model->getRetailOrdersMailDataById($id); //d($query); $email = $query->Email; $name = $query->Name; $imei = $query->IMEINo; $service = $query->RetailOrderId; $serviceId = $query->RetailOrderId; //$cSmbl = $query->Currency; $credits = $query->Amount; $altEmail = ''; $orderDt = date("d-m-Y"); $code = ''; $userId =''; //successfulRetailOrderEmail($email, $name, $service, $imei, $code, $orderDt, $serviceId, $altEmail, $credits, $userId, $notes='', $orderNo=''); } $this->data['message'] = $message; if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/order_placed'; } else { $this->data['view'] = 'template/order_placed'; } $this->load->view($this->templatePath, $this->data); } public function order_cancelled() { $id = $this->input->post_get('id') ?: 0; $errorMsg = $this->input->post_get('errorMsg') ?: ''; $message = ''; $this->data['errorMsg'] = $errorMsg; $this->data['message'] = $message; $this->load->model('Retail_model'); $query = $this->Retail_model->getRetailOrdersMailDataById($id); if($query){ $email = $query->Email; $name = $query->Name; $imei = $query->IMEINo; $service = $query->RetailOrderId; $serviceId = $query->RetailOrderId; //$cSmbl = $query->Currency; $credits = $query->Amount; $altEmail = ''; $orderDt = date("d-m-Y"); $code = ''; $userId =''; rejectedRetailOrderEmail($email, $name, $service, $imei, $code, $orderDt, $serviceId, $altEmail, $credits, $userId, $notes='', $orderNo=''); } if(isset($this->data['rsStngs']->Dtheme) && $this->data['rsStngs']->Dtheme!=0) { $this->data['view'] = 'template/' . $this->data['rsStngs']->Dtheme . '/order_cancelled'; } else { $this->data['view'] = 'template/order_cancelled'; } $this->load->view($this->templatePath, $this->data); } function ajxnewsletter() { $purpose = $this->input->post('purpose'); if ($purpose == 'newsltr') { $email = ($this->input->post('email')) ? check_input($this->input->post('email'), $this->db->conn_id) : ''; $type = ($this->input->post('type')) ? check_input($this->input->post('type'), $this->db->conn_id) : '0'; if ($email != '') { $captchaValid = false; // validating captcha if ($_SERVER['HTTP_HOST'] != 'localhost' && isset($_POST['g-recaptcha-response'])) { $GOOGLE_CAPTCHA_SECRET_KEY = $this->data['rsStngs']->GoogleCaptchaSecretKey; require_once APPPATH . "libraries/recaptchalib.php"; $response = null; $reCaptcha = new ReCaptcha($GOOGLE_CAPTCHA_SECRET_KEY); $response = $reCaptcha->verifyResponse( $this->input->server("REMOTE_ADDR"), $this->input->post("g-recaptcha-response") ); $captchaValid = ($response != null && $response->success); } else { $captchaValid = true; } if ($captchaValid) { $row = $this->db->query("SELECT Count(Id) AS TotalRecs FROM tbl_gf_subscriptions WHERE Email = '$email' AND EmailType = '$type'")->row(); if ($row->TotalRecs > 0) { $msg = "<b>$email</b> already exists, please select a different E-mail Address!~0"; } else { $this->db->query("INSERT INTO tbl_gf_subscriptions (Email, EmailType) VALUES ('$email', '$type')"); $msg = "Thank you! You've been added to our email list.!~1"; } } else { $msg = "Invalid Value for Captcha~0"; } } else { $msg = "Invalid E-mail Address!~0"; } } echo $msg; exit; } function addTestimonials() { $response = array(); $rowSettings = $this->Admin_login_model->fetch_email_settings(); $THEME = $rowSettings->Theme; $data['LOGIN_CAPTCHA'] = $rowSettings->AdminLoginCaptcha; $data['adminTitle'] = stripslashes($rowSettings->AdminTitle); $copyRight = stripslashes($rowSettings->Copyrights); $data['GOOGLE_CAPTCHA_SITE_KEY'] = $rowSettings->GoogleCaptchaSiteKey; $GOOGLE_CAPTCHA_SECRET_KEY = $rowSettings->GoogleCaptchaSecretKey; $type = ($this->input->post_get('type')) ? check_input($this->input->post_get('type'), $this->db->conn_id) : 0; $errorMsg = ''; if (($this->input->post('txtName'))) { $name = ($this->input->post('txtName')) ? check_input($this->input->post('txtName'), $this->db->conn_id) : ''; $review = ($this->input->post('txtReview')) ? check_input($this->input->post('txtReview'), $this->db->conn_id) : ''; $rating = ($this->input->post('radRating')) ? check_input($this->input->post('radRating'), $this->db->conn_id) : ''; if ($_SERVER['HTTP_HOST'] != 'localhost' && $data['LOGIN_CAPTCHA'] == '1') { require_once APPPATH . "libraries/recaptchalib.php"; $response = null; $reCaptcha = new ReCaptcha($GOOGLE_CAPTCHA_SECRET_KEY); $response = $reCaptcha->verifyResponse( $_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"] ); if ($response != null && $response->success) { // DO NOTHING } else { $errorMsg .= 'Invalid Value for Captcha'; $response['status'] = 0; $response['message'] = $errorMsg; } } if (trim($errorMsg) == '') { $this->db->query("INSERT INTO tbl_gf_reviews (CustomerName, Review, Rating, ReviewDate, ReviewType,Enabled) VALUES ('$name', '$review', '$rating' , NOW(), '$type','1')"); $message = 'Testimonial has been submitted successfully!'; $response['status'] = 1; $response['message'] = $message; } } echo json_encode($response); exit; } function addContactUsForm() { $response = array(); $rowSettings = $this->Admin_login_model->fetch_email_settings(); $THEME = $rowSettings->Theme; $data['LOGIN_CAPTCHA'] = $rowSettings->AdminLoginCaptcha; $data['adminTitle'] = stripslashes($rowSettings->AdminTitle); $copyRight = stripslashes($rowSettings->Copyrights); $data['GOOGLE_CAPTCHA_SITE_KEY'] = $rowSettings->GoogleCaptchaSiteKey; $GOOGLE_CAPTCHA_SECRET_KEY = $rowSettings->GoogleCaptchaSecretKey; $type = ($this->input->post_get('type')) ? check_input($this->input->post_get('type'), $this->db->conn_id) : 0; $errorMsg = ''; if (($this->input->post('txtName'))) { $name = ($this->input->post('txtName')) ? check_input($this->input->post('txtName'), $this->db->conn_id) : ''; $email = ($this->input->post('txtEmail')) ? check_input($this->input->post('txtEmail'), $this->db->conn_id) : ''; $phone = ($this->input->post('txtPhone')) ? check_input($this->input->post('txtPhone'), $this->db->conn_id) : ''; $comments = ($this->input->post('txtComments')) ? check_input($this->input->post('txtComments'), $this->db->conn_id) : ''; if ($_SERVER['HTTP_HOST'] != 'localhost' && $data['LOGIN_CAPTCHA'] == '1') { require_once APPPATH . "libraries/recaptchalib.php"; $response = null; $reCaptcha = new ReCaptcha($GOOGLE_CAPTCHA_SECRET_KEY); $response = $reCaptcha->verifyResponse( $_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"] ); if ($response != null && $response->success) { // DO NOTHING } else { $errorMsg .= 'Invalid Value for Captcha'; $response['status'] = 0; $response['message'] = $errorMsg; } } if (trim($errorMsg) == '') { $arr = getEmailDetails(); $emailMsg = '<p>Name: ' . $name . '</p> <p>Email: ' . $email . '</p> <p>Phone: ' . $phone . '</p> <p>Comments: ' . $comments . '</p>'; sendGeneralEmail($arr[5], $name, $arr[1], 'Admin', 'Review Submitted at ' . $arr[2], 'The following information was submitted via ' . $arr[2], $emailMsg); $message = 'Contact us form has been submitted successfully!'; $response['status'] = 1; $response['message'] = $message; } } echo json_encode($response); exit; } function updateWebCurrency() { $currency_id = $this->input->post('currencyId'); $languages = fetch_retail_currency_data($currency_id); $array_items = array('webCurrency' => $languages->Currency, 'webCurrencyId' => $currency_id, 'webConversionRate' => $languages->ConversionRate, 'webCurrencySymbol' => $languages->CurrencySymbol); if (@$this->session->userdata('webCurrency')) { $this->session->unset_userdata('webCurrency'); $this->session->unset_userdata('webCurrencyId'); $this->session->unset_userdata('webConversionRate'); $this->session->unset_userdata('webCurrencySymbol'); $this->session->set_userdata($array_items); } else { $this->session->set_userdata($array_items); } $msg = 'Currency Changed'; echo json_encode($msg); exit; } public function orderpmntntfctn() { $purifier = new HTMLPurifier(); $paymentId = '0'; $payment_status = ''; $req = 'cmd=_notify-validate'; foreach ($this->input->post() as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value \n"; if ($key == "item_number") $paymentId = $value; else if ($key == "payer_email") $payer_email = str_replace('%40', '@', $value); else if ($key == "txn_id") $transactionId = $value; else if ($key == "payment_status") $payment_status = trim(str_replace('%40', '@', $value)); } $receiver_email = $this->input->post('receiver_email'); $url = "http://www.paypal.com/cgi-bin/webscr"; $ch = curl_init(); // Starts the curl handler curl_setopt($ch, CURLOPT_URL, $url); // Sets the paypal address for curl curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns result to a variable instead of echoing curl_setopt($ch, CURLOPT_TIMEOUT, 3); // Sets a time limit for curl in seconds (do not set too low) curl_setopt($ch, CURLOPT_POST, 1); // Set curl to send data using post curl_setopt($ch, CURLOPT_POSTFIELDS, $req); // Add the request parameters to the post $result = curl_exec($ch); // run the curl process (and return the result to $result curl_close($ch); if ((strcmp($result, "VERIFIED") == 0 || strcmp(trim($result, "VERIFIED")) == 0 || strpos($result, "VERIFIED") !== 0) && $payment_status == 'Completed' && $paymentId != '0') { $paymentId = $purifier->purify(check_input($paymentId)); updateRetailOrderAndSendEmails($paymentId, '5', 1, 1, 1, $transactionId); } } public function registerConfirmationPage() { $this->data['view'] = 'template/register_confirmation_page'; $this->load->view($this->templatePath, $this->data); } public function order_declined() { $message = $errorMsg = ''; $this->data['errorMsg'] = $errorMsg; $this->data['message'] = $message; $this->data['view'] = 'template/order_declined'; $this->load->view($this->templatePath, $this->data); } public function trackOrder() { $message = ''; $errorMsg = $message = $strWhere = ''; $count = $countRetail = 0; $this->db->select("DisablePage"); $this->db->from("tbl_gf_pages"); $this->db->where("PageId", 2); $rwPg = $this->db->get()->result(); //var_dump($rwPg); if (isset($rwPg->DisablePage) && $rwPg->DisablePage == '1') { echo "<script>window.location = '" . $BASE_URL . "'</script>"; exit(); } $rsRetail = NULL; if ($this->input->post()) { $rsRetail = $this->db->query("SELECT PackageTitle, Category, Code, TimeTaken, ReplyDtTm, RequestedAt, CodeStatus, RetailOrderId FROM tbl_gf_retail_orders A, tbl_gf_code_status B, tbl_gf_retail_services C, tbl_gf_manufacturer D WHERE C.CategoryId = D.CategoryId AND A.OrderStatusId = B.CodeStatusId AND A.PackageId = C.PackageId AND RetailOrderId = " . $this->input->post('txtOrderId') . " AND A.Email = '" . $this->input->post('txtEmail') . "' ORDER BY RetailOrderId DESC")->result(); } $this->data['rsRetail'] = $rsRetail; $this->data['view'] = 'template/track_order'; $this->load->view($this->templatePath, $this->data); } private function saveRetailPaymentTransactionId($transactionId, $paymentId) { $this->load->model('Retail_model'); $dtTm = setDtTmWRTYourCountry(); $update_data = array( 'TransactionId' => $transactionId, ); $this->Retail_model->update_gf_retail_payments($update_data, $paymentId); } public function paytm(){ $this->load->view('template/layouts/header'); $this->load->view('template/paytm'); } public function testMail() { //echo '1234'; die; $email = $this->input->post_get('txtEmail'); $name = $this->input->post_get('txtName'); $imei = $this->input->post_get('fld2'); $service = $this->input->post_get('hdPckTitle'); $serviceId = $this->input->post_get('serviceId'); $cSmbl = $this->input->post_get('currSymbol'); $credits = $this->input->post_get('pPrice'); $altEmail = 'saleheen@astutesol.com'; $orderDt = 'date'; $code = ''; $userId ='';/* $email = 'saleheenhamid@gmail.com'; $name ='Saleheen'; $imei ='123456789'; $service ='service'; $serviceId ='sID123'; $cSmbl = '$'; $credits = '100'; $altEmail = 'saleheen@astutesol.com'; $orderDt = 'date'; $code = ''; $userId ='';*/ $snd = successfulRetailOrderEmail($email, $name, $service, $imei, $code, $orderDt, $serviceId, $altEmail, $credits, $userId, $notes='', $orderNo=''); if($snd){ echo'123 Success sent'; } die; updateRetailOrderAndSendEmails($invId, '5', 1, 1, 1); $this->session->set_flashdata("paymentMethodDescription", $paymentMethodDescription); $this->session->set_flashdata("OrderNumber", $order_id); redirect(base_url("home/order_placed")); } public function addNewsPopup() { //echo "<pre>"; $Title = $this->input->post('title'); $Message = $this->input->post('message'); $ValidKey = $this->input->post('validKey'); $Days = $this->input->post('days') ?: '2'; if($Title != '' && $Message != '') { include(FCPATH . 'system/core/validator.php'); if($Key == $ValidKey) { $this->db->insert('tbl_gf_gt_news', [ 'News' => "<b>".$Title."</b>\n".$Message, 'StartDate' => date('Y-m-d'), 'EndDate' => date('Y-m-d', strtotime('+'.$Days.' days', strtotime($exec->NewsDate))), ] ); } } } }