?
Current Path : /home1/savoy/public_html/savoyglobal.net/application/controllers/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/application/controllers/admin.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <?php class Admin extends MY_Controller { public function __construct() { parent::MY_Controller(); $this->load->model('adminmodel'); $this->load->model('mastermodel'); $this->load->library('Fpaginate'); $this->load->library('mail'); } function home() { $_SESSION['admin_page']='home'; $this->load->view('admin/home'); } function single_page($id) { $data['id'] = $id; $this->load->view('admin/single_page',$data); } function banner($pagenum="1") { $_SESSION['admin_page']='banner'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('banner','banner_id','desc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['banner']=$output['results']; $this->load->view('admin/banner',$data); } function add_banner($id="") { $_SESSION['admin_page']='banner'; $postdata=$this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $path = './assets/uploads/banner'; $file_name = $this->mastermodel->generateRandomString(); if (isset($_FILES['banner_image']) && $_FILES['banner_image']['name'] != "") { $uploaded_file = pathinfo($_FILES["banner_image"]["name"]); $extension = $uploaded_file['extension']; $model_question_document_file = $file_name . '.' . $extension; $_FILES['banner_image']['name'] = $model_question_document_file; if (!is_file("$path/" . $_FILES["banner_image"]["name"])) { if (move_uploaded_file($_FILES["banner_image"]["tmp_name"], $path . "/" . $_FILES["banner_image"]["name"])) { $postdata['banner_image'] = $_FILES["banner_image"]["name"]; $res=$this->adminmodel->add_banner($postdata); } } else { echo "File already exists"; $postdata['banner_image'] = ''; } } else { $postdata['banner_image'] = ""; } redirect('admin/banner'); } $this->load->view('admin/add_banner'); } function update_banner($id="") { $_SESSION['admin_page']='banner'; if(isset($_POST['savep'])) { $postdata=$this->mastermodel->get_post_values(); $res=$this->adminmodel->update_banner($postdata); redirect('admin/banner'); } $data['banner']=$this->mastermodel->get_data_srow('banner',$id,'banner_id'); $this->load->view('admin/edit_banner',$data); } function news($pagenum="1") { $_SESSION['admin_page']='news'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('news','news_id','desc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['news']=$output['results']; $this->load->view('admin/news',$data); } function add_news($id="") { $_SESSION['admin_page']='news'; $postdata=$this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $path = './assets/uploads/news'; $file_name = $this->mastermodel->generateRandomString(); if (isset($_FILES['news_thumbnail']) && $_FILES['news_thumbnail']['name'] != "") { $uploaded_file = pathinfo($_FILES["news_thumbnail"]["name"]); $extension = $uploaded_file['extension']; $model_question_document_file = $file_name . '.' . $extension; $_FILES['news_thumbnail']['name'] = $model_question_document_file; if (!is_file("$path/" . $_FILES["news_thumbnail"]["name"])) { if (move_uploaded_file($_FILES["news_thumbnail"]["tmp_name"], $path . "/" . $_FILES["news_thumbnail"]["name"])) { $postdata['news_thumbnail'] = $_FILES["news_thumbnail"]["name"]; $res=$this->adminmodel->add_news($postdata); } } else { echo "File already exists"; $postdata['news_thumbnail'] = ''; } } else { $postdata['news_thumbnail'] = ""; } redirect('admin/news'); } $this->load->view('admin/add_news'); } function update_news($id="") { $_SESSION['admin_page']='news'; if(isset($_POST['savep'])) { $postdata=$this->mastermodel->get_post_values(); $res=$this->adminmodel->update_news($postdata); redirect('admin/news'); } $data['news']=$this->mastermodel->get_data_srow('news',$id,'news_id'); $this->load->view('admin/edit_news',$data); } function gallery($pagenum="1") { $_SESSION['admin_page']='gallery'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('gallery','gallery_id','desc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['gallery']=$output['results']; $this->load->view('admin/gallery',$data); } function add_gallery($id="") { $_SESSION['admin_page']='gallery'; $postdata=$this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $path = './assets/uploads/gallery'; $file_name = $this->mastermodel->generateRandomString(); if (isset($_FILES['image']) && $_FILES['image']['name'] != "") { $uploaded_file = pathinfo($_FILES["image"]["name"]); $extension = $uploaded_file['extension']; $model_question_document_file = $file_name . '.' . $extension; $_FILES['image']['name'] = $model_question_document_file; if (!is_file("$path/" . $_FILES["image"]["name"])) { if (move_uploaded_file($_FILES["image"]["tmp_name"], $path . "/" . $_FILES["image"]["name"])) { $postdata['image'] = $_FILES["image"]["name"]; $res=$this->adminmodel->add_gallery($postdata); } } else { echo "File already exists"; $postdata['image'] = ''; } } else { $postdata['image'] = ""; } redirect('admin/gallery'); } $this->load->view('admin/add_gallery'); } function update_gallery($id="") { $_SESSION['admin_page']='gallery'; if(isset($_POST['savep'])) { $postdata=$this->mastermodel->get_post_values(); $res=$this->adminmodel->update_gallery($postdata); redirect('admin/gallery'); } $data['gallery']=$this->mastermodel->get_data_srow('gallery',$id,'gallery_id'); $this->load->view('admin/edit_gallery',$data); } function client($pagenum="1") { $_SESSION['admin_page']='client'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('client','client_id','desc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['client']=$output['results']; $this->load->view('admin/client',$data); } function add_client($id="") { $_SESSION['admin_page']='client'; $postdata=$this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $path = './assets/uploads/client'; $file_name = $this->mastermodel->generateRandomString(); if (isset($_FILES['client_logo']) && $_FILES['client_logo']['name'] != "") { $uploaded_file = pathinfo($_FILES["client_logo"]["name"]); $extension = $uploaded_file['extension']; $model_question_document_file = $file_name . '.' . $extension; $_FILES['client_logo']['name'] = $model_question_document_file; if (!is_file("$path/" . $_FILES["client_logo"]["name"])) { if (move_uploaded_file($_FILES["client_logo"]["tmp_name"], $path . "/" . $_FILES["client_logo"]["name"])) { $postdata['client_logo'] = $_FILES["client_logo"]["name"]; $res=$this->adminmodel->add_client($postdata); } } else { echo "File already exists"; $postdata['client_logo'] = ''; } } else { $postdata['client_logo'] = ""; } redirect('admin/client'); } $this->load->view('admin/add_client'); } function update_client($id="") { $_SESSION['admin_page']='client'; if(isset($_POST['savep'])) { $postdata=$this->mastermodel->get_post_values(); $res=$this->adminmodel->update_client($postdata); redirect('admin/client'); } $data['client']=$this->mastermodel->get_data_srow('client',$id,'client_id'); $this->load->view('admin/edit_client',$data); } function directory($pagenum="1") { $_SESSION['admin_page']='directory'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('directory','directory_id','desc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['directory']=$output['results']; $this->load->view('admin/directory',$data); } function add_directory($id="") { $_SESSION['admin_page']='directory'; $postdata=$this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $path = './assets/uploads/directory'; $file_name = $this->mastermodel->generateRandomString(); if (isset($_FILES['image']) && $_FILES['image']['name'] != "") { $uploaded_file = pathinfo($_FILES["image"]["name"]); $extension = $uploaded_file['extension']; $model_question_document_file = $file_name . '.' . $extension; $_FILES['image']['name'] = $model_question_document_file; if (!is_file("$path/" . $_FILES["image"]["name"])) { if (move_uploaded_file($_FILES["image"]["tmp_name"], $path . "/" . $_FILES["image"]["name"])) { $postdata['image'] = $_FILES["image"]["name"]; $res=$this->adminmodel->add_directory($postdata); } } else { echo "File already exists"; $postdata['image'] = ''; } } else { $postdata['image'] = ""; } redirect('admin/directory'); } $this->load->view('admin/add_directory'); } function update_directory($id="") { $_SESSION['admin_page']='directory'; if(isset($_POST['savep'])) { $postdata=$this->mastermodel->get_post_values(); $res=$this->adminmodel->update_directory($postdata); redirect('admin/directory'); } $data['directory']=$this->mastermodel->get_data_srow('directory',$id,'directory_id'); $this->load->view('admin/edit_directory',$data); } function contact_details($pagenum="1") { $_SESSION['admin_page']='contact_details'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('contact','contact_id','desc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['contact']=$output['results']; $this->load->view('admin/contact_details',$data); } function add_contact($id="") { $_SESSION['admin_page']='directory'; if(isset($_POST['savep'])) { $postdata=$this->mastermodel->get_post_values(); $res=$this->adminmodel->add_contact($postdata); redirect('admin/contact_details'); } $this->load->view('admin/add_contact'); } function email() { $_SESSION['admin_page']='email'; $this->load->view('admin/email'); } function load_email_list($singles,$doubles,$mixed) { $data['viewinfo']=$this->adminmodel->get_contacts_list($singles,$doubles,$mixed); $this->load->view('admin/email_list',$data); } function load_sms_list($singles,$doubles,$mixed) { $data['viewinfo']=$this->adminmodel->get_contacts_list($singles,$doubles,$mixed); $this->load->view('admin/sms_list',$data); } function settings() { $_SESSION['admin_page']='settings'; $this->load->view('admin/settings'); } function update_password() { $_SESSION['admin_page']='settings'; $postdata = $this->mastermodel->get_post_values(); $this->adminmodel->update_password($postdata); $this->load->view('admin/settings'); } public function logout() { session_destroy(); redirect('site/login'); } function delete($table,$field,$id,$function) { $this->mastermodel->deletedata($table,$field,$id); try { $res=$this->mastermodel->deletedata($table,$field,$id); if($res!=1) { throw new Exception("Error"); } redirect('admin/'.$function); } catch(Exception $exception) { redirect('admin/'.$function); } } function send_email() { $postdata = $this->mastermodel->get_post_values(); $this->adminmodel->send_email($postdata); $data['msg'] = "Email Sent! "; $_SESSION['admin_page']='email_list'; $this->load->view('admin/view-message',$data); } } ?>