%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php session_start(); defined('BASEPATH') OR exit('No direct script access allowed'); class UploadPrescription extends MY_Controller { private $num_rows = 20; public function __construct() { parent::__construct(); $this->load->model(array('Api_model', 'admin/Brands_model')); $this->load->library('form_validation','session'); } public function index($page = 0) { $data = array(); $head = array(); $arrSeo = $this->Public_model->getSeo('upload prescription'); $head['title'] = @$arrSeo['title']; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->render('upload_priscription', $head, $data); } /* * Used from greenlabel template * shop page */ public function prescription() { $data = array(); $head = array(); $user_mobile = $this->input->post('mobile'); $name = $this->input->post('name'); $files = $this->input->post('files'); $prescription = $this->input->post('prescription'); if($user_mobile>=10){ echo $response = $this->Api_model->sendOTPToPrescription($user_mobile, $name, $prescription); } else { $this->form_validation->set_rules('advisor_mobile', 'Mobile Number ', 'required|regex_match[/^[0-9]{10}$/]'); if(!preg_match('/^[0-9,]+$/', $advisor_mobile)){ $response = "Invalid"; echo json_encode($response); } else { echo $response = $this->Api_model->sendOTPToUserRequest($user_mobile, $name); echo json_encode($response); } } exit(); } public function prescriptionUpload() { $data = array(); $head = array(); $user_mobile = $this->input->post('mobile'); $name = $this->input->post('name'); $otp = $this->input->post('otp'); if($user_mobile>=10){ $response = $this->Api_model->validateOTPPrescription($user_mobile, $name, $otp); echo json_encode($response); } else { $this->form_validation->set_rules('advisor_mobile', 'Mobile Number ', 'required|regex_match[/^[0-9]{10}$/]'); if(!preg_match('/^[0-9,]+$/', $advisor_mobile)){ $response = '0'; echo json_encode($response); } else { echo $response = $this->Api_model->validateOTPPrescription($advisor_mobile); echo json_encode($response); } } exit(); } /*upload image function */ public function uploadImage() { $filetype = array('jpeg','jpg','png','pdf','txt','docx'); foreach ($_FILES as $key ) { echo filesize($key['name']); $file_ext = pathinfo($key['name'], PATHINFO_EXTENSION); $file_name = pathinfo($key['name'], PATHINFO_FILENAME); if($_SESSION['logged_user']['id']){ $name = $_SESSION['logged_user']['id'].$file_name.'.'.$file_ext; } else { $name = rand(222,999).$file_name.'.'.$file_ext; } $path='attachments/prescription/'.$name; if(in_array(strtolower($file_ext), $filetype)) { if(filesize($key['name'])<2000000) { @move_uploaded_file($key['tmp_name'],$path); echo $name; } else { echo "FILE_SIZE_ERROR"; } } else { echo "FILE_TYPE_ERROR"; } exit(); } } /* * Used from greenlabel template * shop page */ public function advisor() { $data = array(); $head = array(); $advisor_mobile = $this->input->post('mobile'); $mobile_otp = $this->input->post('otp'); if($mobile_otp>=4 && $advisor_mobile>=10){ echo $response = $this->Api_model->validateOTPAdvisor($advisor_mobile, $mobile_otp); } else { $this->form_validation->set_rules('advisor_mobile', 'Mobile Number ', 'required|regex_match[/^[0-9]{10}$/]'); if(!preg_match('/^[0-9,]+$/', $advisor_mobile)){ echo $response = "Invalid"; } else { echo $response = $this->Api_model->sendOTPToAdvisor($advisor_mobile); } } exit(); } /* * Login/Signup */ public function loginsignup(){ $data = array(); $head = array(); $advisor_mobile = $this->input->post('mobile'); $current_pack_id = $this->input->post('current_pack_id'); $mobile_otp = $this->input->post('otp'); if($mobile_otp>=4 && $advisor_mobile>=10){ echo $response = $this->Api_model->validateUserOTP($advisor_mobile, $mobile_otp); } else { $this->form_validation->set_rules('advisor_mobile', 'Mobile Number ', 'required|regex_match[/^[0-9]{10}$/]'); if(!preg_match('/^[0-9,]+$/', $advisor_mobile)){ echo $response = "Invalid"; } else { echo $response = $this->Api_model->sendOTPToUser($advisor_mobile,'User',$current_pack_id); //users_public } } exit(); } /* * Used from greenlabel template * shop page */ public function callHealthAdvisor() { $data = array(); $head = array(); $advisor_mobile = $this->input->post('mobile'); $advisor_full_name = $this->input->post('full_name'); $mobile_otp = $this->input->post('otp'); if($mobile_otp>=4 && $advisor_mobile>=10){ echo $response = $this->Api_model->validateOTPAdvisor($advisor_mobile, $mobile_otp); } else { $this->form_validation->set_rules('advisor_mobile', 'Mobile Number ', 'required|regex_match[/^[0-9]{10}$/]'); if(!preg_match('/^[0-9,]+$/', $advisor_mobile)){ echo $response = "Invalid"; } else { echo $response = $this->Api_model->sendOTPToAdvisor($advisor_mobile, $advisor_full_name); } } exit(); } /* * Used from greenlabel template * shop page */ public function shop($page = 0) { $data = array(); $head = array(); $arrSeo = $this->Public_model->getSeo('shop'); $head['title'] = @$arrSeo['title']; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $all_categories = $this->Public_model->getShopCategories(); $data['home_categories'] = $this->getHomeCategories($all_categories); $data['all_categories'] = $all_categories; $data['showBrands'] = $this->Home_admin_model->getValueStore('showBrands'); $data['brands'] = $this->Brands_model->getBrands(); $data['showOutOfStock'] = $this->Home_admin_model->getValueStore('outOfStock'); $data['shippingOrder'] = $this->Home_admin_model->getValueStore('shippingOrder'); $data['products'] = $this->Public_model->getProducts($this->num_rows, $page, $_GET); $rowscount = $this->Public_model->productsCount($_GET); $data['links_pagination'] = pagination('home', $rowscount, $this->num_rows); $this->render('shop', $head, $data); } private function getHomeCategories($categories) { /* * Tree Builder for categories menu */ function buildTree(array $elements, $parentId = 0) { $branch = array(); foreach ($elements as $element) { if ($element['sub_for'] == $parentId) { $children = buildTree($elements, $element['id']); if ($children) { $element['children'] = $children; } $branch[] = $element; } } return $branch; } return buildTree($categories); } /* * Called to add/remove quantity from cart * If is ajax request send POST'S to class ShoppingCart */ public function manageShoppingCart() { if (!$this->input->is_ajax_request()) { exit('No direct script access allowed'); } $this->shoppingcart->manageShoppingCart(); } /* * function: callHealthAdvisorInstantly */ public function callHealthAdvisorInstantly(){ $mobile_number = $_SESSION['logged_user']['phone']; echo $response_id = $this->Api_model->callHealthAdvisorInstantly($mobile_number); exit(); } /* * Called to remove product from cart * If is ajax request and send $_GET variable to the class */ public function removeFromCart() { $backTo = $_GET['back-to']; $this->shoppingcart->removeFromCart(); $this->session->set_flashdata('deleted', lang('deleted_product_from_cart')); redirect(LANG_URL . '/' . $backTo); } public function clearShoppingCart() { $this->shoppingcart->clearShoppingCart(); } public function viewProduct($id) { $data = array(); $head = array(); $data['product'] = $this->Public_model->getOneProduct($id); $data['sameCagegoryProducts'] = $this->Public_model->sameCagegoryProducts($data['product']['shop_categorie'], $id); if ($data['product'] === null) { show_404(); } $vars['publicDateAdded'] = $this->Home_admin_model->getValueStore('publicDateAdded'); $this->load->vars($vars); $head['title'] = $data['product']['title']; $description = url_title(character_limiter(strip_tags($data['product']['description']), 130)); $description = str_replace("-", " ", $description) . '..'; $head['description'] = $description; $head['keywords'] = str_replace(" ", ",", $data['product']['title']); $this->render('view_product', $head, $data); } public function confirmLink($md5) { if (preg_match('/^[a-f0-9]{32}$/', $md5)) { $result = $this->Public_model->confirmOrder($md5); if ($result === true) { $data = array(); $head = array(); $head['title'] = ''; $head['description'] = ''; $head['keywords'] = ''; $this->render('confirmed', $head, $data); } else { show_404(); } } else { show_404(); } } public function discountCodeChecker() { if (!$this->input->is_ajax_request()) { exit('No direct script access allowed'); } $result = $this->Public_model->getValidDiscountCode($_POST['enteredCode']); if ($result == null) { echo 0; } else { echo json_encode($result); } } public function sitemap() { header("Content-Type:text/xml"); echo '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $products = $this->Public_model->sitemap(); $blogPosts = $this->Public_model->sitemapBlog(); foreach ($blogPosts->result() as $row1) { echo '<url> <loc>' . base_url('blog/' . $row1->url) . '</loc> <changefreq>monthly</changefreq> <priority>0.1</priority> </url>'; } foreach ($products->result() as $row) { echo '<url> <loc>' . base_url($row->url) . '</loc> <changefreq>monthly</changefreq> <priority>0.1</priority> </url>'; } echo '</urlset>'; } }