Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: MY_Controller.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class MY_Controller extends CI_Controller { public $data = array(); private $keys = null; public $user_id = 0; public $UPLOAD_FOLDER; public function __construct() { parent::__construct(); /* //For DEMO Server $restrictionPost = count($this->input->post()); if($restrictionPost != '' || $restrictionPost != NULL || $restrictionPost > 0 || isset($_GET['del']) || isset($_GET['delete'])) { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')) { echo "this is Demo only.!~1"; die; } $url = $_SERVER['REQUEST_URI']; $array = explode('/',$url); $count = count($array); $this->session->set_flashdata("message", "This is Demo only."); redirect(base_url($this->config->item('apanel_name'))); }*/ //ALTER TABLE `tbl_gf_email_settings` ADD `AdminIPRestriction` TINYINT NOT NULL DEFAULT '0' $mainRow = $this->db->query('SELECT * FROM tbl_gf_maintenance WHERE DisableMaintenance = 1')->row(); if(isset($mainRow->Id) && $mainRow->Id != '' && $this->uri->segment(1) !== $this->config->item('apanel_name')) { echo $this->load->view('maintenance', array('row' => $mainRow), true); exit(); } $this->config->set_item('log_threshold', 0); $supportValid = validateKey(); if($supportValid == 0) { $this->data['supportExpired'] = "1"; } else { $this->data['supportExpired'] = "0"; } //============================ Check IP ================================ $res = $this->db->select('AdminIPRestriction')->where('Id', 1)->get('tbl_gf_email_settings')->row(); $i=0; if($res->AdminIPRestriction == 1 && ($this->uri->segment(1) == $this->config->item('apanel_name'))){ $allowedIps = $this->db->select('*')->get('tbl_gf_allowed_ips')->result(); $ipFlag = false; foreach($allowedIps as $key){ $ips[] = theString_Decrypt($key->IP, 'WLIP', 10); if($_SERVER['REMOTE_ADDR'] == $ips[$i]){ //redirect(base_url('404')); $ipFlag = true; break; }else{ //echo 'found'; die; //print_r($_SERVER['REMOTE_ADDR'] .' / '); print_r($ips[$i]); } $i++; } if(!$ipFlag) { echo '<h1>Page not found, please contact GSM Support...!!!</h1>'; die; } } $this->data['META_KW_CONTENTS'] = ""; $this->data['META_DESC_CONTENTS'] = ""; $this->data['SITE_TITLE'] = ""; $this->load->model('Miscellaneous_model'); $this->data['frmId'] = $this->input->post_get('frmId') ?: 0; $this->data['fTypeId'] = $this->input->post_get('fTypeId') ?: 0; $this->data['cldFrm'] = $this->input->post_get('cldFrm') ?: 0; $this->data['rms'] = $this->input->post_get('rms') ?: 0; $this->data['telegramStatus'] = $this->db->where("UserId", $this->session->userdata('GSM_FUS_UserId'))->select("*")->from("tbl_gf_telegram_auth")->order_by("CreatedAt")->get()->result(); if($this->session->flashdata("gt_news")) { $GTNews = $this->db->query("SELECT News FROM tbl_gf_gt_news WHERE '".date('Y-m-d')."' BETWEEN StartDate AND EndDate ORDER BY Id"); if($GTNews) { $GTNewsStr = ''; foreach($GTNews->result() as $GTNewsRow) { if(trim($GTNewsRow->News) != '') $GTNewsStr .= $GTNewsRow->News . '<br><br>'; } if($GTNewsStr) $this->data['gt_news'] = $GTNewsStr; } } $this->data['mainMenu'] = $this->Clients_model->getClientMenu(); $this->data['OrderNowPageSetting'] = 1; if($this->uri->segment(1) == $this->config->item('apanel_name')){ checkAdminLoginState(); if(stripos($_SERVER['HTTP_HOST'], 'localhost') === false) { // checkAdminIPAccess(); } $language= sitelanguage(); //$language= 'portuguese'; $this->lang->load('labels', $language); $this->load->library('pagination'); $this->UPLOAD_FOLDER = 'uplds'; //$CURRENT_PAGE = basename($this->input->server('PHP_SELF')); $this->data['CURRENT_PAGE'] =$this->router->fetch_method(); $this->data['QUERY_STRING'] = $this->input->server('QUERY_STRING'); $this->data['CRON_FOLDER'] = 'cron'; $this->data['rsStngs'] = $this->General_model->fetch_email_settings(); if($this->data['rsStngs']->SiteTitle !== "") { $this->config->set_item('app_name', $this->data['rsStngs']->SiteTitle); } $daysLeftInSupport = 32; if($this->data['rsStngs']->sptdt && $this->data['rsStngs']->sptdt != '0000-00-00 00:00:00') { $SupportDate = date("d-F-Y", strtotime($this->data['rsStngs']->sptdt)); $spDate = strtotime($this->data['rsStngs']->sptdt); $now = strtotime(date("Y-m-d")); // or your date as well $datediff = $spDate - $now; $daysLeftInSupport = round($datediff / (60 * 60 * 24)); $this->data['SupportDate'] = $SupportDate; $this->data['daysLeftInSupport'] = $daysLeftInSupport; } else { $this->data['SupportDate'] = $this->data['rsStngs']->sptdt; $this->data['daysLeftInSupport'] = 100; } if($this->data['supportExpired'] == 1 || $daysLeftInSupport <= 31) { $this->data['InvoiceLink'] = $this->data['rsStngs']->InString; } $this->config->set_item('assets_version', $this->data['rsStngs']->assets_version); if($this->data['rsStngs']->isv == '0') redirect(base_url('page/invalidsite')); $this->data['currDt'] = setDtTmWRTYourCountry(); $row = $this->General_model->get_users_count($this->data['currDt']); $this->data['onlineUsers'] = $row->TotalUsers; $TICKETS = array(); $this->data['TICKETS'] = $this->General_model->get_tickets_sum(); //d($this->data['TICKETS']); $this->data['totalTickets'] = $this->data['TICKETS']->NEW + $this->data['TICKETS']->CLOSED + $this->data['TICKETS']->ANSWERED + $this->data['TICKETS']->CUSTOMERREPLIED; $this->data['fTypeId'] = $this->input->post_get('fTypeId') ? $this->input->post_get('fTypeId') : 0; $this->data['frmId'] =$this->input->post_get('frmId') ? $this->input->post_get('frmId') : 0; //============================================= ADMIN FORMS ================================================// $strAndAdminForms = ''; $showTicketInHdr = false; $this->data['showSettingsInHdr'] = false; $showDashboard = false; $ARR_ADMIN_FORMS = array(); if($this->session->userdata('IsAdmin') == '1') { $rsAdminForms = $this->General_model->fetch_formsdata(); } else { $rsAdminForms = $this->General_model->fetch_formsdata_by_id(); } $this->data['rsAdminForms'] = $rsAdminForms; $this->data['mn'] = $this->input->post_get('mn')?: ''; $this->data['iFrm'] = $this->input->post_get('iFrm') ?: 0; $this->data['rsTcktStatus'] = $this->General_model->fetch_tckt_status(); $this->data['IS_DEMO'] = false; if($rsAdminForms) { $prevFTypeId = 0; $strLeftMenu = '<li class="nav-item dropdown" style=""> <input autocomplete="off" type="text" placeholder="'.$this->lang->line('BE_GNRL_BTN_1').'" class="form-control ml-1 SideBarSearch" id="inputString" onkeyup="lookup(this.value);"> <div class="ml-1" id="suggestions" style="display:none;"></div> </li>'; $prevH_FTypeId = 0; $strTopMenu = ''; foreach($rsAdminForms as $row) { $strLeftMenuCopy = $strLeftMenu; $strTopMenuCopy = $strTopMenu; $arrForm = explode('?', $row->FormUrlNew); if(isset($arrForm[0] )&& $arrForm[0] != '') $ARR_ADMIN_FORMS[$row->FormId] = $arrForm[0]; if($row->FormTypeId == '1') $showDashboard = true; if($row->FormTypeId == '12') $showTicketInHdr = true; if($row->FormTypeId == '13') $this->data['showSettingsInHdr'] = true; if(InStr($row->FormUrlNew, '?')){ $formURL = $row->FormUrlNew.'&frmId='.$row->FormId.'&fTypeId='.$row->FormTypeId; } else $formURL = $row->FormUrlNew.'?frmId='.$row->FormId.'&fTypeId='.$row->FormTypeId; if(/*$row->FormTypeId != '1' && */ $row->HiddenForm == '0') { if($row->InHeader == '0') { $cart_icon_menu = array('IMEI Services','File Services','Server Services','Retail Services','Ecommerce Products'); $chat_icon_menu = array('Live Chat','Tickets'); $person_icon_menu = array('Clients','System Administrators'); $file_icon_menu = array('CMS','Templates'); $dollar_icon_menu = array('Sales'); $cogs_icon_menu = array('Settings'); $list_icon_menu = array('Miscellaneous'); $cog_icon_menu = array('Reports'); if(in_array($row->FormType,$cart_icon_menu)){ $icon = 'icon-cart2'; }elseif(in_array($row->FormType,$chat_icon_menu)){ $icon = 'icon-bubbles6'; }elseif(in_array($row->FormType,$person_icon_menu)){ $icon = 'icon-user'; }elseif(in_array($row->FormType,$file_icon_menu)){ $icon = 'icon-files-empty2'; }elseif(in_array($row->FormType,$dollar_icon_menu)){ $icon = 'icon-coins'; }elseif(in_array($row->FormType,$cogs_icon_menu)){ $icon = 'icon-cogs'; }elseif(in_array($row->FormType,$list_icon_menu)){ $icon = 'icon-list'; }elseif(in_array($row->FormType,$cog_icon_menu)){ $icon = 'icon-cog52'; } if($row->FormType == 'Dashboard'){ if($prevFTypeId > 0) { if($row->FormTypeId != $prevFTypeId) { $class = ''; if($this->data['fTypeId'] == $row->FormTypeId) $strLeftMenu .= '<li class="nav-item "> <a href="'.base_url().$formURL.'" class="nav-link' . $class . '"> <i class="icon-home5"></i><span>'.stripslashes($row->FormType). '</span></a>' ; } } else { $class = ''; if($row->Form == 'Youtube') { if($this->data['fTypeId'] == $row->FormTypeId && $this->router->fetch_method() == "YouTubeVideos") $class = ' active'; $strLeftMenu .= '<li class="nav-item ' . $class . '"> <a href="'.base_url().$formURL.'" class="nav-link' . $class . '"> <i class="icon-play"></i><span>'.stripslashes($row->Form). '</span></a> '; } else { if($this->data['fTypeId'] == $row->FormTypeId && $this->router->fetch_method() == "index") $class = ' active'; $strLeftMenu .= '<li class="nav-item ' . $class . '"> <a href="'.base_url().$formURL.'" class="nav-link' . $class . '"> <i class="icon-home"></i><span>'.stripslashes($row->FormType). '</span></a> '; } } $strLeftMenu .= '</a></li>'; } else{ if($prevFTypeId > 0) { if($row->FormTypeId != $prevFTypeId) { $class = ''; if($this->data['fTypeId'] == $row->FormTypeId) $class = ' nav-item-expanded nav-item-open'; $strLeftMenu .= '</ul></li>'; $strLeftMenu .= '<li class="nav-item nav-item-submenu' . $class . '"> <a href="" class="nav-link' . $class . '"> <i class="'.$icon.'"></i><span>'.stripslashes($row->FormType). '</span></a> <ul class="nav nav-group-sub" data-submenu-title="Layouts">' ; } } else { $class = ''; if($this->data['fTypeId'] == $row->FormTypeId) $class = ' nav-item-expanded nav-item-open'; $strLeftMenu .= '<li class="nav-item nav-item-submenu ' . $class . '"> <a href="javascript:;" class="nav-link' . $class . '"> <i class="'.$icon.'"></i><span>'.stripslashes($row->FormType). '</span></a> <ul class="nav nav-group-sub" data-submenu-title="Layouts">'; } $prevFTypeId = $row->FormTypeId; $liClass = ''; if($this->data['frmId'] == $row->FormId) $liClass = ' active'; $strLeftMenu .= '<li class="nav-item"> <a href="'.base_url().$formURL.'" class="nav-link' . $liClass . '">'; $strLeftMenu .= stripslashes($row->Form); /*if($row->IsNew) { $strLeftMenu .= '<span class="badge bg-transparent align-self-center ml-auto">new</span>'; }*/ $strLeftMenu .= '</a></li>'; } } else if($row->InHeader == '1' && $row->HiddenForm == '0') { if($prevH_FTypeId > 0) { if($row->FormTypeId != $prevH_FTypeId) { $class = ''; $strTopMenu .= '</div></li>'; $strTopMenu .= '<li class="nav-item dropdown"> <a class="navbar-nav-link dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" href="javascript:;"><span class="selected"></span>'.stripslashes($row->FormType).' </a><div class="dropdown-menu dropdown-menu-left">'; } } else { $class = ''; $strTopMenu .= '<li class="nav-item dropdown"> <a class="navbar-nav-link dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" href="javascript:;"><span class="selected"></span>'.stripslashes($row->FormType).' </a><div class="dropdown-menu dropdown-menu-left">'; } $prevH_FTypeId = $row->FormTypeId; $liClass = ''; if($this->data['CURRENT_PAGE'] == 'category') $liClass = 'active'; $strTopMenu .= '<a class="dropdown-item" href="'.base_url().$formURL.'">'; $strTopMenu.= stripslashes($row->Form) ; if($row->IsNew) { $strTopMenu .= '<span class="badge badge-roundless badge-warning">new</span>'; } $strTopMenu .= '</a>'; } } // hide all links with .php in Menus if(strpos($row->FormUrlNew, '.php') !== false || $row->Form == 'Custom Fields' || $row->Form == 'Quick Price Change' || $row->Form == 'Database Backup'){ $strLeftMenu = $strLeftMenuCopy; $strTopMenu = $strTopMenuCopy; } } $strLeftMenu .= '</ul></li>'; $strTopMenu .= '</div></li>'; } $this->data['ARR_ADMIN_FORMS'] = $ARR_ADMIN_FORMS; $this->data['strLeftMenu'] = $strLeftMenu; $this->data['strTopMenu'] = $strTopMenu ; $CURRENT_CLASS = strtolower($this->router->fetch_class()); $pages_array = array_map('strtolower', array_map('filename', $this->data['ARR_ADMIN_FORMS'])); if($this->session->userdata('IsAdmin') != '1') { if(($CURRENT_CLASS != 'errorcontroller') && ($CURRENT_CLASS != 'dashboard') && ($this->data['CURRENT_PAGE'] != 'department' && $this->data['CURRENT_PAGE'] != 'ajxdepartment') && ($this->data['CURRENT_PAGE'] != 'ticket' && $this->data['CURRENT_PAGE'] != 'ajxticket') && ($this->data['CURRENT_PAGE'] != 'lookuplist') && ($this->data['CURRENT_PAGE'] != 'onlinecustomers') && $this->session->userdata('GSM_FSN_AdmId') != '1' && $this->session->userdata('AdminRoleId')!='1') { if (!in_array(strtolower($this->data['CURRENT_PAGE']), $pages_array)) { redirect(base_url($this->config->item('apanel_name').'/error')); } } } $adminLogoRow = $this->db->query("SELECT LogoPath FROM tbl_gf_logo WHERE DisableLogo = 0 AND ForAdminPanel = 1 ORDER BY LogoId DESC")->row(); $this->data['AdminLogo'] = ''; if($adminLogoRow && $adminLogoRow->LogoPath) { $CI = &get_instance(); $rowSettings = $CI->db->query("SELECT * FROM `tbl_gf_email_settings` WHERE Id = 1")->row(); $this->data['AdminLogo'] = base_url("uplds$rowSettings->Theme/".$adminLogoRow->LogoPath) . '?v=' . filemtime(FCPATH . "uplds$rowSettings->Theme/".$adminLogoRow->LogoPath); } } else { checkUserLoginState(); $isUserActive = $this->db->where('UserId', $this->session->userdata('GSM_FUS_UserId')) ->get('tbl_gf_users')->row()->DisableUser; if($isUserActive == true){ //$this->session->sess_destroy(); $this->session->set_userdata(array( "home_popup_title" => $this->lang->line('CUST_LBL_315'), "home_popup_desc" => $this->lang->line('CUST_CH_113').' '.$this->lang->line('CUST_CH_106').', please contact support!', "sessionNotFound" => true, )); //d($_SESSION); redirect(base_url()); } $this->data['rsNews'] = $this->Miscellaneous_model->getAllNews(0); $this->data['rwUN'] = $this->Miscellaneous_model->getChangesNews(); $this->data['LIVE_CHAT_CODE'] = ''; $objLiveChat = $this->Util_model->getLiveChat(); if (isset($objLiveChat->ScriptCode) && $objLiveChat->ScriptCode != '') { $this->data['LIVE_CHAT_CODE'] = stripslashes($objLiveChat->ScriptCode); } $this->data['rsStngs'] = $this->General_model->fetch_email_settings(); if($this->data['rsStngs']->SiteTitle !== "") { $this->config->set_item('app_name', $this->data['rsStngs']->SiteTitle); } $this->config->set_item('assets_version', $this->data['rsStngs']->assets_version); $this->data['newsPopup'] = $this->db->where('Id', 1)->get('tbl_gf_user_news_popup')->row(); if($this->data['newsPopup']->DisableNews == 0) { $news_popup_opened = $this->db->where('UserId', $this->session->userdata('GSM_FUS_UserId'))->get('tbl_gf_user_news_popup_opened')->row(); if(empty($news_popup_opened)) { $this->db->insert('tbl_gf_user_news_popup_opened', array( 'UserId' => $this->session->userdata('GSM_FUS_UserId'), 'CreatedAt' => date('Y-m-d H:i:s') )); } $this->data['newsPopup']->UserOpened = $news_popup_opened ? 1 : 0; } $mainRow = $this->db->query('SELECT * FROM tbl_gf_maintenance WHERE DisableMaintenance = 1')->row(); if((isset($mainRow->Id) && $mainRow->Id != '' && empty($this->session->userdata('IsAdmin')))) { echo $this->load->view('maintenance', array('row' => $mainRow), true); exit(); } else{ $this->user_id = $this->session->userdata('GSM_FUS_UserId'); $this->data['userDetails'] = $this->User_model->getUserDetails($this->session->userdata('GSM_FUS_UserId')); $this->lang->load('labels', "english"); $this->data['PACK_PRICES_USER'] = array(); $this->data['PACK_PRICES_PLAN'] = array(); $this->data['PACK_PRICES_BASE'] = array(); $sc = 0; if($this->input->post_get('sc') !== false ){ $sc = $this->input->post_get('sc') ?: 0; }else{ $sc = 1; } $s_ids=getServiceIds($sc); $s_ids = explode(',' , $s_ids); $s_ids = array_map('trim', $s_ids); $default_currency = fetch_currency_data(); if($this->router->fetch_method() == 'server_services' || $this->router->fetch_method() == 'searchServers' || $this->router->fetch_method() == 'searchAllServers' || $this->router->fetch_method() == 'searchCatAllServers' || ($this->router->fetch_method() == 'product_and_services' && $sc == 2) ){ $this->data['PACK_PRICES_USER'] = $this->User_model->get_log_pack_prices_user($this->user_id); $this->data['PACK_PRICES_PLAN'] = $this->User_model->get_log_pack_prices_plan($this->user_id, $this->data['userDetails']->CurrencyId); $this->data['PACK_PRICES_BASE'] = $this->User_model->get_log_pack_prices_base($this->data['userDetails']->CurrencyId, $this->data["userDetails"]->ConversionRate); }else{ $this->data['PACK_PRICES_USER'] = $this->User_model->get_pack_prices_user($this->user_id , $s_ids); $this->data['PACK_PRICES_PLAN'] = $this->User_model->get_pack_prices_plan($sc , $s_ids , $this->data['userDetails']->CurrencyId); $this->data['PACK_PRICES_BASE'] = $this->User_model->get_pack_prices_base($sc , $s_ids , $this->data['userDetails']->CurrencyId, $this->data["userDetails"]->ConversionRate); } $this->data['settings'] = $this->General_model->fetch_email_settings(); if($this->data['userDetails']->Credits != '') { $this->crypt_key((string)($this->session->userdata('GSM_FUS_UserId'))); $this->data['userDetails']->Credits = $this->decrypt($this->data['userDetails']->Credits); $this->data['myCredits'] = number_format((float) $this->data['userDetails']->Credits, 2, '.', ''); } if($this->data['userDetails']->PinCode != '') { $this->data['userDetails']->PinCode = $this->theString_Decrypt($this->data['userDetails']->PinCode); } if($this->data['userDetails']->APIKey != '') { $this->data['userDetails']->APIKey = $this->theString_Decrypt($this->data['userDetails']->APIKey); } } $this->data['CUSTOMER_LOGO_PATH'] = ''; $this->data['CUSTOMER_FAV_ICO'] = ''; $rSetLogo = $this->General_model->fetch_logos_by_ids(); foreach($rSetLogo as $rw ) { if (isset($rw->LogoPath) && $rw->LogoPath != '') { $CI = &get_instance(); $rowSettings = $CI->db->query("SELECT * FROM `tbl_gf_email_settings` WHERE Id = 1")->row(); if($rw->LogoId == '2') $this->data['CUSTOMER_LOGO_PATH'] = base_url("uplds$rowSettings->Theme/".$rw->LogoPath) . '?v=' . filemtime(FCPATH . "uplds$rowSettings->Theme/".$rw->LogoPath); if($rw->LogoId == '6') $this->data['CUSTOMER_FAV_ICO'] = base_url("uplds$rowSettings->Theme/".$rw->LogoPath); } } $this->data['THEME'] = 1 ; $this->data['EDIT_TXT'] = ''; if($this->session->userdata('GSM_FSN_AdmId') && $this->session->userdata('GSM_FSN_AdmId') != '') { $this->data['EDIT_TXT'] = "data-popover='true' data-html='true' data-content='ANCHORLINK'"; } $rsLinks = $this->General_model->fetch_pages(); $this->data['META_KW_CNTNTS'] = $this->data['META_DESC_CNTNTS'] = $this->data['META_KW_CONTENTS'] = $this->data['META_DESC_CONTENTS'] = $this->data['strFtrLnks'] = $this->data['aboutUsTxt'] = $this->data['strHeaderLnks'] = $this->data['title1'] = $this->data['text1'] = $img1 = $lnk1 = $this->data['title2'] = $this->data['text2'] = $img2 = $lnk2 = $this->data['title3'] = $this->data['text3'] = $img3 = $lnk3 = $homeTitle = $homeTxt = $this->data['title4'] = $this->data['text4'] = $title5 = $text5 = $title6 = $text6 = $title7 = $this->data['text7'] = $textBT = $this->data['USERVICESTITLE'] = $this->data['img19'] = $this->data['strSubMenuLnks'] = $this->data['strFtrLnksNew'] = $this->data['strFtrLnksFooter'] = ''; $this->data['USERVICES'] = '0,0,0'; $i = 1; foreach($rsLinks as $row) { $target = ''; if($row->FileName == '') $lnk = base_url()."home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk = base_url().'home/page/'.$row->SEOURLName; if($row->FileName != '') $lnk = base_url().$row->FileName; if($row->URL != '') { $lnk = $row->URL; $target = 'target="_blank"'; } if($row->PageId == '15') { $titleBT = stripslashes($row->PageTitle); $textBT = stripslashes($row->PageText); $imgBT = $row->Image; } else if($row->PageId == '12') { $this->data['OrderNowPageSetting'] = stripslashes($row->DisablePage); $this->data['USERVICESTITLE'] = stripslashes($row->LinkTitle); $this->data['USERVICES'] = trim(stripslashes(strip_tags($row->PageText))); } else if($row->PageId == '13') { $textBT2 = stripslashes($row->PageText); } else if($row->PageId == '16') { $this->data['title16'] = $row->PageTitle; $this->data['text16'] = stripslashes($row->PageText); $img16 = $row->Image; } else if($row->PageId == '18') { $this->data['text18'] = stripslashes($row->PageText); } else if($row->PageId == '19') { $title19 = $row->PageTitle; $text19 = substr(stripslashes($row->PageText), 0, 200); if(strlen($row->PageText) > 200) $text19 .= '...</p>'; if($row->FileName == '') $lnk19 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk19 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk19 = $row->FileName; $this->data['img19'] = $row->Image; $lnkTitle19 = $row->LinkTitle; } else if($row->PageId == '20') { $title20 = $row->PageTitle; $text20 = substr(stripslashes($row->PageText), 0, 200); if(strlen($row->PageText) > 200) $text20 .= '...</p>'; if($row->FileName == '') $lnk20 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk20 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk20 = $row->FileName; $img20 = $row->Image; $lnkTitle20 = $row->LinkTitle; } else if($row->PageId == '21') { $title21 = $row->PageTitle; $text21 = substr(stripslashes($row->PageText), 0, 200); if(strlen($row->PageText) > 200) $text21 .= '...</p>'; if($row->FileName == '') $lnk21 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk21 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk21 = $row->FileName; $img21 = $row->Image; $lnkTitle21 = $row->LinkTitle; } else if($row->PageId == '3') { $titleTtm = $row->PageTitle; $imgTtm = $row->Image; } else if($row->PageId == '22') { $img22 = $row->Image; } else if($row->PageId == '23') { $img23 = $row->Image; } else if($row->PageId == '24') { $img24 = $row->Image; } else if($row->PageId == '25') { $this->data['title25'] = $row->PageTitle; $this->data['text25'] = stripslashes($row->PageText); $img25 = $row->Image; } else if($row->PageId == '26') { $title26 = $row->PageTitle; $text26 = stripslashes($row->PageText); $img26 = $row->Image; if($row->FileName == '') $lnk26 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk26 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk26 = $row->FileName; } else if($row->PageId == '27') { $text27 = stripslashes($row->PageText); $img27 = $row->Image; } else if($row->PageId == '28') { $text28 = stripslashes($row->PageText); $img28 = $row->Image; } else if($row->PageId == '29') { $text29 = stripslashes($row->PageText); $img29 = $row->Image; } else if($row->PageId == '30') { $img30 = $row->Image; } else if($row->PageId == '31') { $img31 = $row->Image; } else if($row->PageId == '4') { $titleH4 = $row->PageTitle; $textH4 = stripslashes($row->PageText); $imgH4 = $row->Image; if($row->FileName == '') $lnkH4 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnkH4 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnkH4 = $row->FileName; } else if($row->PageId == '6') { $this->data['title1'] = $row->PageTitle; $this->data['text1'] = stripslashes($row->PageText); if($row->FileName == '') $lnk1 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk1 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk1 = $row->FileName; $img1 = $row->Image; } else if($row->PageId == '7') { $this->data['title2'] = $row->PageTitle; $this->data['text2'] = stripslashes($row->PageText); if($row->FileName == '') $lnk2 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk2 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk2 = $row->FileName; $img2 = $row->Image; } else if($row->PageId == '8') { $this->data['title3'] = $row->PageTitle; $this->data['text3'] = stripslashes($row->PageText); if($row->FileName == '') $lnk3 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk3 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk3 = $row->FileName; $img3 = $row->Image; } else if($row->PageId == '14') { $this->data['title4'] = $row->PageTitle; $this->data['text4'] = stripslashes($row->PageText); if($row->FileName == '') $lnk4 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk4 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk4 = $row->FileName; $img4 = $row->Image; } else if($row->PageId == '2' || $row->PageId == '15') { $title5 = $row->PageTitle; $text5 = stripslashes($row->PageText); if($row->FileName == '') $lnk5 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk5 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk5 = $row->FileName; $img5 = $row->Image; } else if($row->PageId == '9') { $title6 = $row->PageTitle; $text6 = stripslashes($row->PageText); if($row->FileName == '') $lnk6 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk6 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk6 = $row->FileName; $img6 = $row->Image; } else if($row->PageId == '17') { $this->data['text7'] = stripslashes($row->PageText); } else if($row->PageId == '11') { $this->data['title11'] = $row->PageTitle; $this->data['text11'] = stripslashes($row->PageText); $img11 = $row->Image; } if($row->PageId == '1') { $homeTitle = $row->PageTitle; $homeTxt = stripslashes($row->PageText); $homeImg = $row->Image; $this->data['META_KW_CNTNTS'] = stripslashes($row->MetaKW); $this->data['META_DESC_CNTNTS'] = stripslashes($row->MetaTags); $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); } if($row->HeaderLinkCP == '1' && $row->PageId != '12') { $class = 'menu_links'; if ($this->data['THEME'] == '1') { $edtLnk = ''; if (trim($this->data['EDIT_TXT']) != '') $edtLnk = str_replace('ANCHORLINK', '<a href="' . base_url() . 'home/page?id=' . $row->PageId . '&frmId=44&fTypeId=8" target="blank">Edit Link</a>', $this->data['EDIT_TXT']); $this->data['strHeaderLnks'] = '<li ' . $edtLnk . '><a ' . $target . ' href="' . $lnk . '"><span>' . $row->LinkTitle . '</span></a></li>'; } else if ($this->data['THEME'] == '4') { $edtLnk = ''; $this->data['strHeaderLnks'] = '<li><a ' . $target . ' href="' . $lnk . '">' . $row->LinkTitle . '</a></li>'; } else if ($this->data['THEME'] == '5') { $edtLnk = ''; $this->data['strHeaderLnks'] = '<li><a ' . $target . ' href="' . $lnk . '"><span>' . $row->LinkTitle . '</span></a></li>'; } } if($row->FooterLink == '1') { $edtLnk = ''; if(trim($this->data['EDIT_TXT']) != '') $edtLnk = str_replace('ANCHORLINK', '<a style="color:#000;" href="'.base_url().'home/page?id='.$row->PageId.'&frmId=44&fTypeId=8" target="blank">Edit Link</a>', $this->data['EDIT_TXT']); $this->data['strFtrLnks'] .= '<li '.$edtLnk.'><a '.$target.' href="'.$lnk.'">'.$row->LinkTitle.'</a></li>'; $this->data['strFtrLnksNew'] .= '<li '.$edtLnk.'><a '.$target.' href="'.$lnk.'"><span>'.$row->LinkTitle.'</span></a></li>'; $this->data['strFtrLnksFooter'] .= '<li style="margin-bottom:10px" '.$edtLnk.'><span style="color:#f94203;margin-right:10px">→</span><a '.$target.' href="'.$lnk.'">'.$row->LinkTitle.'</a></li>'; } if($row->SubMenuLink == '1') { $edtLnk = ''; if(trim($this->data['EDIT_TXT']) != '') $edtLnk = str_replace('ANCHORLINK','<a href="'.base_url().'home/page?id='.$row->PageId.'&frmId=44&fTypeId=8" target="blank">Edit Link</a>', $this->data['EDIT_TXT']); $this->data['strSubMenuLnks'] .= '<li '.$edtLnk.' class="nav-item"><a class="nav-link" style="color:#FFF;" '.$target.' href="'.$lnk.'">'.$row->LinkTitle.'</a></li>'; } $i++; } // price notifications $this->data['strPr'] = ''; if(!$this->session->userdata("GSM_FSN_AdmId") && (($this->router->fetch_method() != 'imei_services' && $this->router->fetch_method() != 'file_services' && $this->router->fetch_method() != 'server_services') || ( ($this->router->fetch_method() == 'imei_services' || $this->router->fetch_method() == 'file_services' || $this->router->fetch_method() == 'server_services') && empty($this->input->post()))) ) { } else { } // POPUP if($this->session->userdata('login_popup') == true){ if($this->data['rsStngs']->chkPriceNotification == true && $this->data['strPr'] == ''){ if ($this->data['userDetails']->PricePlanId > 0) { $rsPr = $this->db->query("SELECT DISTINCT PackTitle, Price, updatedAt FROM tbl_gf_group_prices_notice WHERE PlanId = '" . $this->data['userDetails']->PricePlanId . "' and PackageId NOT IN (select PackageId from tbl_gf_users_packages_prices where UserId = " . $this->session->userdata('GSM_FUS_UserId') . ") ORDER BY updatedAt DESC LIMIT 0,20")->result(); foreach ($rsPr as $row) { $this->data['strPr'] .= 'New Price for ' . stripslashes($row->PackTitle) . ' is <b>' . ($row->Price * $this->data['userDetails']->ConversionRate) . ' ' . $this->data['userDetails']->CurrencyAbb . '</b><br /><br />'; } } else { $this->data['rsNews'] = $this->Miscellaneous_model->getAllNews(0); $rsPr = $this->db->query("SELECT DISTINCT PackageId, ServiceType, PackTitle, Price, updatedAt FROM tbl_gf_default_prices_notice WHERE PackageId NOT IN (select PackageId from tbl_gf_users_packages_prices where UserId = " . $this->session->userdata('GSM_FUS_UserId') . " UNION SELECT PackageId FROM tbl_gf_group_prices_notice WHERE PlanId = '" . $this->data['userDetails']->PricePlanId . "' ) ORDER BY updatedAt DESC LIMIT 0,20")->result(); foreach ($rsPr as $row) { $this->data['strPr'] .= 'New Price for ' . stripslashes($row->PackTitle) . ' is <b>' . ($row->Price * $this->data['userDetails']->ConversionRate) . ' ' . $this->data['userDetails']->CurrencyAbb . '</b><br /><br />'; } } } if($this->data['rsStngs']->chkAnnonceNotification == true){ $this->data['newsPopup'] = $this->db->where('Id', 1)->get('tbl_gf_user_news_popup')->row(); if($this->data['newsPopup']->DisableNews == 0) { $news_popup_opened = $this->db->where('UserId', $this->session->userdata('GSM_FUS_UserId'))->get('tbl_gf_user_news_popup_opened')->row(); if(!empty($news_popup_opened)) { $this->db->insert('tbl_gf_user_news_popup_opened', array( 'UserId' => $this->session->userdata('GSM_FUS_UserId'), 'CreatedAt' => date('Y-m-d H:i:s') )); $this->data['newsPopup']->UserOpened = 0; }else{ $this->data['newsPopup']->UserOpened = 1; } } } unset($_SESSION['login_popup']); } } // ========== E-COMM MY_Controller ========= // $CI = &get_instance(); $ecomm = $CI->db->get('tbl_gf_email_settings')->row()->M2E; $arr_ecom1 = str_split($ecomm); if($arr_ecom1[2] != '1') { $childRef = new \ReflectionClass(get_class($this)); if(get_class($this) == 'Ecomm' || basename(dirname($childRef->getFileName())) == 'ecomm'){ redirect(base_url($this->config->item('apanel_name')."/dashboard")); } } } public function crypt_key($ckey){ $this->keys = array(); $c_key = base64_encode(sha1(md5($ckey))); $c_key = substr($c_key, 0, round(ord($ckey[0])/5)); $c2_key = base64_encode(md5(sha1($ckey))); $last = strlen($ckey) - 1; $c2_key = substr($c2_key, 1, round(ord($ckey[$last])/7)); $c3_key = base64_encode(sha1(md5($c_key).md5($c2_key))); $mid = strval(round($last/2)); $c3_key = substr($c3_key, 1, round(ord($ckey[$mid])/9)); $c_key = $c_key.$c2_key.$c3_key; $c_key = base64_encode($c_key); for($i = 0; $i < strlen($c_key); $i++){ $this->keys[] = $c_key[$i]; } } public function encrypt($string){ if($this->keys==null) { return 0; } $string = base64_encode($string); $keys = $this->keys; for($i = 0; $i < strlen($string); $i++){ $id = $i % count($keys); $ord = ord($string[$i]); $ord = $ord OR ord($keys[$id]); $id++; $ord = $ord AND ord($keys[$id]); $id++; $ord = $ord XOR ord($keys[$id]); $id++; $ord = $ord + ord($keys[$id]); $string[$i] = chr($ord); } return base64_encode($string); } public function decrypt($string){ if($this->keys==null) { return 0; } $string = base64_decode($string); $keys = $this->keys; for($i = 0; $i < strlen($string); $i++){ $id = $i % count($keys); $ord = ord($string[$i]); $ord = $ord XOR ord($keys[$id]); $id++; $ord = $ord AND ord($keys[$id]); $id++; $ord = $ord OR ord($keys[$id]); $id++; $ord = $ord - ord($keys[$id]); $string[$i] = chr($ord); } return base64_decode($string); } public function theString_Decrypt($enc_text, $password = 'P@88W04D', $iv_len = 16) { $enc_text = base64_decode($enc_text); $n = strlen($enc_text); $i = $iv_len; $plain_text = ''; $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512); while ($i < $n) { $block = substr($enc_text, $i, 16); $plain_text .= $block ^ pack('H*', md5($iv)); $iv = substr($block . $iv, 0, 512) ^ $password; $i += 16; } return preg_replace('/\\x13\\x00*$/', '', $plain_text); } public function updateGSMTool() { $CurrentVersion = 2; $startDate = date("d-m-Y-H-i-s"); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "Starting:" . date('m/d/Y h:i:s a', time()) ); $downloadURL = ''; $CI = &get_instance(); $rowSettings = $CI->db->query("SELECT * FROM `tbl_gf_email_settings` WHERE Id = 1")->row(); include(FCPATH . "system/core/Validator.php"); $Domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']); # Checking if update is available or not and key is valid. if(!isset($rowSettings->CurrentVersion)) { $CurrentVersion = 2; } else { $CurrentVersion = $rowSettings->CurrentVersion; } $ch = curl_init('https://gsmtoolv2.net/keyvalidate/getLatestVersion.php'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['ver' => $CurrentVersion, 'key' => $Key, 'dom' => $Domain, 'theme' => $rowSettings->Dtheme,])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); $exec = curl_exec($ch); $info = curl_getinfo($ch); $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); $filenameRand = random_string(); curl_close($ch); unset($ch); if($contentType == "application/json") { $exec = json_decode($exec); $this->session->set_flashdata("message", $exec->message); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "JSON response: {$exec->message}" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $this->db->query("UPDATE `tbl_gf_email_settings` SET `UpdateAvailable` = 0 WHERE `Id` = 1"); redirect(base_url($this->config->item('apanel_name')."/dashboard")); } elseif($info['http_code'] == 200) { @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "GOT ZIP: Starting Download" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $filename = FCPATH . 'update' . $filenameRand . '.zip'; $fp = fopen($filename, 'w'); fwrite($fp, $exec); fclose($fp); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "GOT ZIP: Completed Download" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $this->db->where('Id', 1) ->update('tbl_gf_maintenance', array('DisableMaintenance' =>1)); /* copy(FCPATH . ('assets/AstuteSol.css'), FCPATH . ('assets/AstuteSol_copy' . $filenameRand . '.css')); copy(FCPATH . ('assets/AstuteSol_admin.css'), FCPATH . ('assets/AstuteSol_admin_copy' . $filenameRand . '.css')); copy(FCPATH . ('assets/template1/css/green_css/main.css'), FCPATH . ('assets/template1/css/green_css/main_copy' . $filenameRand . '.css')); copy(FCPATH . ('assets/template1/css/green_css/inner_pages.css'), FCPATH . ('assets/template1/css/green_css/inner_pages' . $filenameRand . '.css')); copy(FCPATH . ('application/views/template/layouts/header.php'), FCPATH . ('application/views/template/layouts/header' . $filenameRand . '.php')); copy(FCPATH . ('application/views/layouts/header.php'), FCPATH . ('application/views/layouts/header' . $filenameRand . '.php'));*/ @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "EXTRACT ZIP: START" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); if (!extension_loaded('zip')) { $errorMsg = 'ZIP extension has not been installed on your server. Please install it at your hosting to get this update.'; @file_put_contents(FCPATH . 'update'. $startDate .'.txt', $errorMsg . "\n", FILE_APPEND); } $zip = new ZipArchive; $res = $zip->open($filename); if ($res === TRUE) { $zip->extractTo(FCPATH); $zip->close(); unlink($filename); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "EXTRACT ZIP: END" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); // Get array of all source files @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "COPYING controllers: Start" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $files = scandir(FCPATH . "application/controllers/ArabPanel4"); // Identify directories $source = FCPATH . "application/controllers/ArabPanel4/"; $destination = FCPATH . "application/controllers/" . $this->config->item('apanel_name') . "/"; // Cycle through all source files if($this->config->item('apanel_name') != 'ArabPanel4') { $delete = array(); foreach ($files as $file) { if (in_array($file, array(".",".."))) continue; // If we copied this successfully, mark it for deletion if (copy($source.$file, $destination.$file)) { $delete[] = $source.$file; } } // Delete all successfully-copied files foreach ($delete as $file) { unlink($file); } } $cronFound = glob(FCPATH . 'application/controllers/Cron.php'); if(count($cronFound) > 0) { $search_results = glob(FCPATH . 'application/controllers/[Cc]*.php'); $cronName = ''; foreach($search_results as $filename) { if(!(strpos($filename, "Cron.php") !== false)) { $fileArray = explode("/", $filename); $cronName = $fileArray[count($fileArray)-1]; unlink($filename); } } if($cronName!='') { copy(FCPATH . 'application/controllers/Cron.php', FCPATH . 'application/controllers/' . $cronName); $fileText = file_get_contents(FCPATH . 'application/controllers/Cron.php'); $fileText = str_replace("class Cron", "class " . substr($cronName, 0, strlen($cronName) - 4), $fileText); file_put_contents(FCPATH . 'application/controllers/' . $cronName, $fileText); unlink(FCPATH . 'application/controllers/Cron.php'); } } $CurrentVersion = updateDB($CurrentVersion); $this->db->where('Id', 1) ->update('tbl_gf_maintenance', array('DisableMaintenance' =>0)); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "COPYING controllers: END" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $this->session->set_flashdata("message", "GSM Tool Updated"); redirect(base_url($this->config->item('apanel_name')."/dashboard")); } else { $this->session->set_flashdata("message", "There was some issue in update, please contact support team."); redirect(base_url($this->config->item('apanel_name')."/dashboard")); } $this->db->query("UPDATE `tbl_gf_email_settings` SET `UpdateAvailable` = 0 WHERE `Id` = 1"); } } public function updateGSMToolAuto() { $CurrentVersion = 2; $startDate = date("d-m-Y-H-i-s"); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "Starting:" . date('m/d/Y h:i:s a', time()) ); $downloadURL = ''; $CI = &get_instance(); $rowSettings = $CI->db->query("SELECT * FROM `tbl_gf_email_settings` WHERE Id = 1")->row(); include(FCPATH . "system/core/Validator.php"); $Domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']); # Checking if update is available or not and key is valid. if(!isset($rowSettings->CurrentVersion)) { $CurrentVersion = 2; } else { $CurrentVersion = $rowSettings->CurrentVersion; } $ch = curl_init(base_url('keyvalidate/getLatestVersion.php')); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['ver' => $CurrentVersion, 'key' => $Key, 'dom' => $Domain])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); $exec = curl_exec($ch); $info = curl_getinfo($ch); $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); $filenameRand = random_string(); curl_close($ch); unset($ch); if($contentType == "application/json") { $exec = json_decode($exec); $this->session->set_flashdata("message", $exec->message); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "JSON response: {$exec->message}" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $this->db->query("UPDATE `tbl_gf_email_settings` SET `UpdateAvailable` = 0 WHERE `Id` = 1"); redirect(base_url($this->config->item('apanel_name')."/dashboard")); } elseif($info['http_code'] == 200) { @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "GOT ZIP: Starting Download" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $filename = FCPATH . 'update' . $filenameRand . '.zip'; $fp = fopen($filename, 'w'); fwrite($fp, $exec); fclose($fp); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "GOT ZIP: Completed Download" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $this->db->where('Id', 1) ->update('tbl_gf_maintenance', array('DisableMaintenance' =>1)); /* copy(FCPATH . ('assets/AstuteSol.css'), FCPATH . ('assets/AstuteSol_copy' . $filenameRand . '.css')); copy(FCPATH . ('assets/AstuteSol_admin.css'), FCPATH . ('assets/AstuteSol_admin_copy' . $filenameRand . '.css')); copy(FCPATH . ('assets/template1/css/green_css/main.css'), FCPATH . ('assets/template1/css/green_css/main_copy' . $filenameRand . '.css')); copy(FCPATH . ('assets/template1/css/green_css/inner_pages.css'), FCPATH . ('assets/template1/css/green_css/inner_pages' . $filenameRand . '.css')); copy(FCPATH . ('application/views/template/layouts/header.php'), FCPATH . ('application/views/template/layouts/header' . $filenameRand . '.php')); copy(FCPATH . ('application/views/layouts/header.php'), FCPATH . ('application/views/layouts/header' . $filenameRand . '.php'));*/ @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "EXTRACT ZIP: START" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); if (!extension_loaded('zip')) { $errorMsg = 'ZIP extension has not been installed on your server. Please install it at your hosting to get this update.'; @file_put_contents(FCPATH . 'update'. $startDate .'.txt', $errorMsg . "\n", FILE_APPEND); } $zip = new ZipArchive; $res = $zip->open($filename); if ($res === TRUE) { $zip->extractTo(FCPATH); $zip->close(); unlink($filename); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "EXTRACT ZIP: END" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); // Get array of all source files @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "COPYING controllers: Start" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $files = scandir(FCPATH . "application/controllers/ArabPanel4"); // Identify directories $source = FCPATH . "application/controllers/ArabPanel4/"; $destination = FCPATH . "application/controllers/" . $this->config->item('apanel_name') . "/"; // Cycle through all source files if($this->config->item('apanel_name') != 'ArabPanel4') { $delete = array(); foreach ($files as $file) { if (in_array($file, array(".",".."))) continue; // If we copied this successfully, mark it for deletion if (copy($source.$file, $destination.$file)) { $delete[] = $source.$file; } } // Delete all successfully-copied files foreach ($delete as $file) { unlink($file); } } $cronFound = glob(FCPATH . 'application/controllers/Cron.php'); if(count($cronFound) > 0) { $search_results = glob(FCPATH . 'application/controllers/[Cc]*.php'); $cronName = ''; foreach($search_results as $filename) { if(!(strpos($filename, "Cron.php") !== false)) { $fileArray = explode("/", $filename); $cronName = $fileArray[count($fileArray)-1]; unlink($filename); } } if($cronName!='') { copy(FCPATH . 'application/controllers/Cron.php', FCPATH . 'application/controllers/' . $cronName); $fileText = file_get_contents(FCPATH . 'application/controllers/Cron.php'); $fileText = str_replace("class Cron", "class " . substr($cronName, 0, strlen($cronName) - 4), $fileText); file_put_contents(FCPATH . 'application/controllers/' . $cronName, $fileText); unlink(FCPATH . 'application/controllers/Cron.php'); } } $CurrentVersion = updateDB($CurrentVersion); $this->db->where('Id', 1) ->update('tbl_gf_maintenance', array('DisableMaintenance' =>0)); @file_put_contents(FCPATH . 'update'. $startDate .'.txt', "COPYING controllers: END" . date('m/d/Y h:i:s a', time()) . "\n", FILE_APPEND); $this->session->set_flashdata("message", "GSM Tool Updated"); redirect(base_url($this->config->item('apanel_name')."/dashboard")); } else { $this->session->set_flashdata("message", "There was some issue in update, please contact support team."); redirect(base_url($this->config->item('apanel_name')."/dashboard")); } $this->db->query("UPDATE `tbl_gf_email_settings` SET `UpdateAvailable` = 0 WHERE `Id` = 1"); } } } class MY_Home_Controller extends CI_Controller { public function __construct() { parent::__construct(); $this->config->set_item('log_threshold', 0); $this->data['META_KW_CONTENTS'] = ""; $this->data['META_DESC_CONTENTS'] = ""; $this->data['SITE_TITLE'] = ""; $this->load->model('Miscellaneous_model'); $this->data['rsNews'] = $this->Miscellaneous_model->getAllNews(0); $this->data['rwUN'] = $this->Miscellaneous_model->getChangesNews(); $this->data['rsStngs'] = $this->General_model->fetch_email_settings(); $this->lang->load('labels', "english"); $this->data['OrderNowPageSetting'] = 1; $mainRow = $this->db->query('SELECT * FROM tbl_gf_maintenance WHERE DisableMaintenance = 1')->row(); if(isset($mainRow->Id) && $mainRow->Id != '') { echo $this->load->view('maintenance', array('row' => $mainRow), true); exit(); } $this->data['THEME'] = 1; $this->data['mainMenu'] = $this->Clients_model->getClientMenu(); $SHOWEPRICESATWEB = '1'; $this->data['rsStngs'] = $this->General_model->fetch_email_settings(); if($this->data['rsStngs']->SiteTitle !== "") { $this->config->set_item('app_name', $this->data['rsStngs']->SiteTitle); } $this->config->set_item('assets_version', $this->data['rsStngs']->assets_version); if($this->data['rsStngs']->ShowEPricesAtWeb == '0') { if($this->session->userdata('GSM_FUS_ECustomerId')) $SHOWEPRICESATWEB = 0; } $this->data['BRANDING_NAME'] = ''; $this->data['BRANDING_URL'] = ''; if($this->data['rsStngs']->Brnd != '') { $ARR_BRND = explode('|', $this->data['rsStngs']->Brnd); if(isset($ARR_BRND[0])) $this->data['BRANDING_NAME'] = $ARR_BRND[0]; if(isset($ARR_BRND[1])) $this->data['BRANDING_URL'] = $ARR_BRND[1]; } $this->data['LOGO_PATH'] = ''; $this->data['FAV_ICO'] = ''; $rSetLogo = $this->General_model->fetch_logos_by_ids(); foreach($rSetLogo as $rw ) { if (isset($rw->LogoPath) && $rw->LogoPath != '') { $CI = &get_instance(); $rowSettings = $CI->db->query("SELECT * FROM `tbl_gf_email_settings` WHERE Id = 1")->row(); if($rw->LogoId == '4') $this->data['LOGO_PATH'] = base_url("uplds$rowSettings->Theme/".$rw->LogoPath).'?v='.filemtime(FCPATH . trim("uplds$rowSettings->Theme/".$rw->LogoPath, '/')); if($rw->LogoId == '6') $this->data['FAV_ICO'] = base_url("uplds$rowSettings->Theme/".$rw->LogoPath); } } $this->data['LIVE_CHAT_CODE'] = ''; $this->data['GANALYTICS_CODE'] = ''; $this->data['MARQUEE_CODE'] = ''; $this->data['AT_WEBSITE'] = 0; $this->data['IN_CLIENT_PANEL'] = 0; $this->data['MARQUEE_POS'] = 0; $rsLiveChat = $this->General_model->fetch_live_chat_data(); if (isset($rsLiveChat->ScriptCode) && $rsLiveChat->ScriptCode != '') { $this->data['LIVE_CHAT_CODE'] = stripslashes($rsLiveChat->ScriptCode); $this->data['AT_WEBSITE'] = stripslashes($rsLiveChat->AtWebsite); $this->data['IN_CLIENT_PANEL'] = stripslashes($rsLiveChat->InClientPanel); } $rsAnalytics = $this->General_model->fetch_analytics(); if (isset($rsAnalytics->Code) && $rsAnalytics->Code != '') { $this->data['GANALYTICS_CODE'] = stripslashes($rsAnalytics->Code); } $rsMarquee = $this->General_model->fetch_marquee(); if (isset($rsMarquee->Code) && $rsMarquee->Code != '') { $this->data['MARQUEE_CODE'] = stripslashes($rsMarquee->Code); $this->data['MARQUEE_POS'] = $rsMarquee->Position; } $this->data['FLAG_COUNTER_CODE'] = ''; $rsFC = $this->General_model->fetch_flag_counter(); if (isset($rsFC->ScriptCode) && $rsFC->ScriptCode != '') $this->data['FLAG_COUNTER_CODE'] = stripslashes($rsFC->ScriptCode); $this->data['BrandLogos'] = fetch_brand_logos(); $rsSMLinks = $this->General_model->fetch_socialmedia_data(); $SOCIAL_FACEBOOK = $SOCIAL_TWITTER = 0; $this->data['strSocialMedia'] = $FACEBOOK_LNK = $FACEBOOK_APPID = ''; foreach($rsSMLinks as $rwSMLnk ) { $css = ''; if(Instr($rwSMLnk->Link, 'facebook')) { $css = 'facebook'; $SOCIAL_FACEBOOK = '1'; $FACEBOOK_LNK = $rwSMLnk->Link; $FACEBOOK_APPID = $rwSMLnk->APPID; } else if(Instr($rwSMLnk->Link, 'twitter')) { $css = 'twitter'; $SOCIAL_TWITTER = 1; } else if(Instr($rwSMLnk->Link, 'linkedin')) { $css = 'linkedin'; } else if(Instr($rwSMLnk->Link, 'instagram')) { $css = 'instagram'; } else if(Instr($rwSMLnk->Link, 't.me')) { $css = 'telegram'; } $this->data['strSocialMedia'] .= '<li class="social-icons-'.$css.'"><a href="'.$rwSMLnk->Link.'" target="_blank" title="'.stripslashes($rwSMLnk->Title).'"><i class="fa fa-'.$css.'"></i></a></li>'; } $this->data['EDIT_TXT'] = ''; if($this->session->userdata('GSM_FSN_AdmId') && $this->session->userdata('GSM_FSN_AdmId') != '') { $this->data['EDIT_TXT'] = "data-popover='true' data-html='true' data-content='ANCHORLINK'"; } $rsLinks = $this->General_model->fetch_pages(); $this->data['META_KW_CNTNTS'] = $this->data['META_DESC_CNTNTS'] = $this->data['META_KW_CONTENTS'] = $this->data['META_DESC_CONTENTS'] = $this->data['strFtrLnks'] = $this->data['aboutUsTxt'] = $this->data['strHeaderLnks'] = $this->data['title1'] = $this->data['text1'] = $img1 = $lnk1 = $this->data['title2'] = $this->data['text2'] = $img2 = $lnk2 = $this->data['title3'] = $this->data['text3'] = $img3 = $lnk3 = $homeTitle = $homeTxt = $this->data['title4'] = $this->data['text4'] = $title5 = $text5 = $title6 = $text6 = $title7 = $this->data['text7'] = $textBT = $this->data['USERVICESTITLE'] = $this->data['img19'] = $this->data['strSubMenuLnks'] = $this->data['strFtrLnksNew'] = $this->data['strFtrLnksFooter'] = ''; $this->data['USERVICES'] = '0,0,0'; $this->data['RETAIL'] = $this->data['rsStngs']->Retail; $this->data['rsHBrands'] = $this->db->query('SELECT CategoryId, Category, SEOURLName FROM tbl_gf_manufacturer WHERE DisableCategory = 0 AND ArchivedCategory = 0 ORDER BY OrderBy')->result(); $i = 1; $this->data['THEME'] = 1 ; $headerCounter = 0; $pagesLink = 0; if($this->data['rsStngs']->pageslink) $pagesLink = $this->data['rsStngs']->pageslink; foreach($rsLinks as $row) { $target = ''; if($row->FileName == '') $lnk = base_url()."home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk = base_url().'home/page/'.$row->SEOURLName; if($row->FileName != '') $lnk = base_url().$row->FileName; if($row->URL != '') { $lnk = $row->URL; $target = 'target="_blank"'; } if($row->PageId == '15') { $titleBT = stripslashes($row->PageTitle); $textBT = stripslashes($row->PageText); $imgBT = $row->Image; } else if($row->PageId == '12') { $this->data['OrderNowPageSetting'] = stripslashes($row->DisablePage); $this->data['USERVICESTITLE'] = stripslashes($row->LinkTitle); $this->data['USERVICES'] = trim(stripslashes(strip_tags($row->PageText))); } else if($row->PageId == '13') { $textBT2 = stripslashes($row->PageText); } else if($row->PageId == '16') { $this->data['title16'] = $row->PageTitle; $this->data['text16'] = stripslashes($row->PageText); $img16 = $row->Image; } else if($row->PageId == '18') { $this->data['text18'] = stripslashes(strip_tags(str_replace("strong>","span>",$row->PageText), "<span>")); } else if($row->PageId == '19') { $title19 = $row->PageTitle; $text19 = substr(stripslashes($row->PageText), 0, 200); if(strlen($row->PageText) > 200) $text19 .= '...</p>'; if($row->FileName == '') $lnk19 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk19 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk19 = $row->FileName; $this->data['img19'] = $row->Image; $lnkTitle19 = $row->LinkTitle; } else if($row->PageId == '20') { $title20 = $row->PageTitle; $text20 = substr(stripslashes($row->PageText), 0, 200); if(strlen($row->PageText) > 200) $text20 .= '...</p>'; if($row->FileName == '') $lnk20 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk20 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk20 = $row->FileName; $img20 = $row->Image; $lnkTitle20 = $row->LinkTitle; } else if($row->PageId == '21') { $title21 = $row->PageTitle; $text21 = substr(stripslashes($row->PageText), 0, 200); if(strlen($row->PageText) > 200) $text21 .= '...</p>'; if($row->FileName == '') $lnk21 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk21 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk21 = $row->FileName; $img21 = $row->Image; $lnkTitle21 = $row->LinkTitle; } else if($row->PageId == '3') { $titleTtm = $row->PageTitle; $imgTtm = $row->Image; } else if($row->PageId == '22') { $img22 = $row->Image; } else if($row->PageId == '23') { $img23 = $row->Image; } else if($row->PageId == '24') { $img24 = $row->Image; } else if($row->PageId == '25') { $this->data['title25'] = $row->PageTitle; $this->data['text25'] = stripslashes($row->PageText); $img25 = $row->Image; } else if($row->PageId == '26') { $title26 = $row->PageTitle; $text26 = stripslashes($row->PageText); $img26 = $row->Image; if($row->FileName == '') $lnk26 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk26 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk26 = $row->FileName; } else if($row->PageId == '27') { $text27 = stripslashes($row->PageText); $img27 = $row->Image; } else if($row->PageId == '28') { $text28 = stripslashes($row->PageText); $img28 = $row->Image; } else if($row->PageId == '29') { $text29 = stripslashes($row->PageText); $img29 = $row->Image; } else if($row->PageId == '30') { $img30 = $row->Image; } else if($row->PageId == '31') { $img31 = $row->Image; } else if($row->PageId == '4') { $titleH4 = $row->PageTitle; $textH4 = stripslashes($row->PageText); $imgH4 = $row->Image; if($row->FileName == '') $lnkH4 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnkH4 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnkH4 = $row->FileName; } else if($row->PageId == '6') { $this->data['title1'] = $row->PageTitle; $this->data['text1'] = stripslashes($row->PageText); if($row->FileName == '') $lnk1 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk1 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk1 = $row->FileName; $img1 = $row->Image; } else if($row->PageId == '7') { $this->data['title2'] = $row->PageTitle; $this->data['text2'] = stripslashes($row->PageText); if($row->FileName == '') $lnk2 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk2 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk2 = $row->FileName; $img2 = $row->Image; } else if($row->PageId == '8') { $this->data['title3'] = $row->PageTitle; $this->data['text3'] = stripslashes($row->PageText); if($row->FileName == '') $lnk3 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk3 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk3 = $row->FileName; $img3 = $row->Image; } else if($row->PageId == '14') { $this->data['title4'] = $row->PageTitle; $this->data['text4'] = stripslashes($row->PageText); if($row->FileName == '') $lnk4 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk4 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk4 = $row->FileName; $img4 = $row->Image; } else if($row->PageId == '2' || $row->PageId == '15') { $title5 = $row->PageTitle; $text5 = stripslashes($row->PageText); if($row->FileName == '') $lnk5 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk5 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk5 = $row->FileName; $img5 = $row->Image; } else if($row->PageId == '9') { $title6 = $row->PageTitle; $text6 = stripslashes($row->PageText); if($row->FileName == '') $lnk6 = "home/page?id=".$row->PageId; if($row->SEOURLName != '') $lnk6 = $row->SEOURLName.'.xhtml'; else if($row->FileName != '') $lnk6 = $row->FileName; $img6 = $row->Image; } else if($row->PageId == '17') { $this->data['text7'] = stripslashes($row->PageText); } else if($row->PageId == '11') { $this->data['title11'] = $row->PageTitle; $this->data['text11'] = stripslashes($row->PageText); $img11 = $row->Image; } if($row->PageId == '1') { $homeTitle = $row->PageTitle; $homeTxt = stripslashes($row->PageText); $homeImg = $row->Image; $this->data['META_KW_CNTNTS'] = stripslashes($row->MetaKW); $this->data['META_DESC_CNTNTS'] = stripslashes($row->MetaTags); $this->data['SITE_TITLE'] = stripslashes($row->HTMLTitle); } if($row->HeaderLink == '1' && $row->PageId != '12') { if($pagesLink == 0) { $class = 'menu_links'; if ($this->data['THEME'] == '1') { $edtLnk = ''; if (trim($this->data['EDIT_TXT']) != '') $edtLnk = str_replace('ANCHORLINK', '<a href="' . base_url() . 'home/page?id=' . $row->PageId . '&frmId=44&fTypeId=8" target="blank">Edit Link</a>', $this->data['EDIT_TXT']); $this->data['strHeaderLnks'] = '<li ' . $edtLnk . '><a ' . $target . ' href="' . $lnk . '"><span>' . $row->LinkTitle . '</span></a></li>'; } else if ($this->data['THEME'] == '4') { $edtLnk = ''; $this->data['strHeaderLnks'] = '<li><a ' . $target . ' href="' . $lnk . '">' . $row->LinkTitle . '</a></li>'; } else if ($this->data['THEME'] == '5') { $edtLnk = ''; $this->data['strHeaderLnks'] = '<li><a ' . $target . ' href="' . $lnk . '"><span>' . $row->LinkTitle . '</span></a></li>'; } } else { $headerCounter++; if ($headerCounter < 3) { $class = 'menu_links'; if ($this->data['THEME'] == '1') { $edtLnk = ''; if (trim($this->data['EDIT_TXT']) != '') $edtLnk = str_replace('ANCHORLINK', '<a href="' . base_url() . 'home/page?id=' . $row->PageId . '&frmId=44&fTypeId=8" target="blank">Edit Link</a>', $this->data['EDIT_TXT']); $this->data['strHeaderLnks'] .= '<li ' . $edtLnk . '><a ' . $target . ' href="' . $lnk . '"><span>' . $row->LinkTitle . '</span></a></li>'; } else if ($this->data['THEME'] == '4') { $edtLnk = ''; $this->data['strHeaderLnks'] .= '<li><a ' . $target . ' href="' . $lnk . '">' . $row->LinkTitle . '</a></li>'; } else if ($this->data['THEME'] == '5') { $edtLnk = ''; $this->data['strHeaderLnks'] .= '<li><a ' . $target . ' href="' . $lnk . '"><span>' . $row->LinkTitle . '</span></a></li>'; } } } } if($row->FooterLink == '1') { $edtLnk = ''; if(trim($this->data['EDIT_TXT']) != '') $edtLnk = str_replace('ANCHORLINK', '<a style="color:#000;" href="'.base_url().'home/page?id='.$row->PageId.'&frmId=44&fTypeId=8" target="blank">Edit Link</a>', $this->data['EDIT_TXT']); $this->data['strFtrLnks'] .= '<li '.$edtLnk.'><a '.$target.' href="'.$lnk.'">'.$row->LinkTitle.'</a></li>'; $this->data['strFtrLnksNew'] .= '<li '.$edtLnk.'><a '.$target.' href="'.$lnk.'"><span>'.$row->LinkTitle.'</span></a></li>'; $this->data['strFtrLnksFooter'] .= '<li style="margin-bottom:10px" '.$edtLnk.'><span style="color:#f94203;margin-right:10px">→</span><a '.$target.' href="'.$lnk.'">'.$row->LinkTitle.'</a></li>'; } if($row->SubMenuLink == '1') { $edtLnk = ''; if(trim($this->data['EDIT_TXT']) != '') $edtLnk = str_replace('ANCHORLINK','<a href="'.base_url().'home/page?id='.$row->PageId.'&frmId=44&fTypeId=8" target="blank">Edit Link</a>', $this->data['EDIT_TXT']); $this->data['strSubMenuLnks'] .= '<li '.$edtLnk.' class="nav-item"><a class="nav-link" style="color:#FFF;" '.$target.' href="'.$lnk.'">'.$row->LinkTitle.'</a></li>'; } $i++; } $this->data['rsBanners'] = $this->General_model->fetch_banners(); $this->data['rsProds'] = $this->General_model->fetch_products(); $this->data['rsSrvcs'] = $this->General_model->fetch_retail_services(); $row = $this->General_model->fetch_page_by_id(); 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); $currDt = setDtTmWRTYourCountry(); $row = $this->General_model->fetch_userlog_count($currDt); $onlineUsers = $row->TotalUsers; $rsHBrands = $this->General_model->fetch_manufacturer(); // ========== E-COMM MY_Home_Controller ========= // $CI = &get_instance(); $ecomm = $CI->db->get('tbl_gf_email_settings')->row()->M2E; $arr_ecom1 = str_split($ecomm); if(count($arr_ecom1) >= 3 && $arr_ecom1[2] == '1') { if($CI->db->table_exists('tbl_gf_ecomm_category')){ $this->data['ecomm_categories'] = $ecomm_categories = $CI->db->where(array('status' => 1))->order_by('category_name', 'ASC')->get('tbl_gf_ecomm_category')->result(); foreach($ecomm_categories as $cats): $ecomm_products[] = $CI->db->where(array('status' => 1, 'category_id' => $cats->id))->order_by('product_title', 'ASC')->get('tbl_gf_ecomm_product')->result(); endforeach; $this->data['ecomm_categories_products'] = $ecomm_products; if($this->session->userdata('GSM_FUS_UserId') != null) $this->data['userDetails'] = $this->User_model->getUserDetails($this->session->userdata('GSM_FUS_UserId')); // check login } } else { $childRef = new \ReflectionClass(get_class($this)); if(get_class($this) == 'Ecomm' || basename(dirname($childRef->getFileName())) == 'ecomm'){ redirect(base_url()); } } } public function checkSupport() { // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); require_once FCPATH . "system/core/Validator.php"; $M2E = NULL; $supportValid = NULL; $supportDate = NULL; $ServerKey = $this->input->post('Key'); if($Key !== $ServerKey) { echo "wrong call"; die(); } $UpdateAvailable = $this->input->post('UpdateAvailable'); $IsValid = $this->input->post('IsValid'); $M2E = $this->input->post('M2E'); $supportValid = $this->input->post('SupportValid'); $supportDate = $this->input->post('SupportDate'); $InString = $this->input->post('InString'); $News = array_filter(array_map('trim', explode("\n", $this->input->post('News')))); if($News) { foreach ($News as $SingleNews) { if (!empty(trim($SingleNews))) { $NewsId = $this->db->query("SELECT Id FROM tbl_gf_gt_news WHERE News = '" . $SingleNews . "'")->row(); if (empty($NewsId)) { $this->db->insert('tbl_gf_gt_news', [ 'News' => $SingleNews, 'StartDate' => date('Y-m-d'), 'EndDate' => date('Y-m-d', strtotime('+2 days', strtotime($exec->NewsDate))), ]); } } } } if($supportValid) { echo "Support Valid"; var_dump($supportDate); $this->db->query("UPDATE `tbl_gf_email_settings` SET `LastUpdateCheckedAt` = '{$TodayDate}', `UpdateAvailable` = $UpdateAvailable, `M2E` = $M2E, sptdt = '{$supportDate}'"); } else { var_dump($supportDate); echo "Support Invalid<br>"; $this->db->query("UPDATE `tbl_gf_email_settings` SET sptdt = '{$supportDate}', `UpdateAvailable` = 1, `M2E` = $M2E, InString = '{$InString}'"); last_query(); } } } class Cron_class extends CI_Controller { function __construct() { parent::__construct(); //validateKey(); } } function validateKey() { // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); $CI = &get_instance(); $rowSettings = $CI->db->query("SELECT * FROM `tbl_gf_email_settings` WHERE Id = 1")->row(); $TodayDate = date('Y-m-d'); require_once FCPATH . "system/core/Validator.php"; $Domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']); if(!isset($rowSettings->CurrentVersion)) { $db_debug = $CI->db->db_debug; //save setting $CI->db->db_debug = FALSE; //disable debugging for queries }else{ $CurrentVersion = $rowSettings->CurrentVersion; $LastUpdateCheckedAt = $rowSettings->LastUpdateCheckedAt; $UpdateAvailable = $rowSettings->UpdateAvailable; } //Call new function::Done $CurrentVersion = updateDB($CurrentVersion); if($LastUpdateCheckedAt != $TodayDate) { # Checking if update is available or not and key is valid. curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['ver' => $CurrentVersion, 'key' => $Key, 'dom' => $Domain, 'theme' => $rowSettings->Dtheme,])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_TIMEOUT_MS, 5000); $exec = @json_decode(curl_exec($ch)); $info = curl_getinfo($ch); $M2E = NULL; $supportValid = NULL; $supportDate = NULL; $InString = ""; if($info['http_code'] != 200 && $info['http_code'] != 0) { $UpdateAvailable = 0; $IsValid = 1; }else if(curl_error($ch)) { $UpdateAvailable = 0; $IsValid = 1; /*echo curl_error($ch); exit();*/ } if(curl_error($ch['CURLOPT_TIMEOUT_MS']) || $exec == NULL) { $timeOut = $CI->db->query("SELECT `timeOut` FROM `tbl_gf_email_settings` WHERE `Id` = {$rowSettings->Id}"); $rsTimeOut = $timeOut->row(); if($rsTimeOut->timeOut < 10){ } } $News = array_filter(array_map('trim', explode("\n", $exec->News))); if($News) { foreach ($News as $SingleNews) { if (!empty(trim($SingleNews))) { $NewsId = $CI->db->query("SELECT Id FROM tbl_gf_gt_news WHERE News = '" . $SingleNews . "'")->row(); if (empty($NewsId)) { $CI->db->insert('tbl_gf_gt_news', [ 'News' => $SingleNews, 'StartDate' => $exec->NewsDate, 'EndDate' => date('Y-m-d', strtotime('+2 days', strtotime($exec->NewsDate))), ]); } } } } if($supportValid) { $CI->db->query("UPDATE `tbl_gf_email_settings` SET `LastUpdateCheckedAt` = '{$TodayDate}', `UpdateAvailable` = $UpdateAvailable, `M2E` = $M2E, sptdt = '{$supportDate}' WHERE `Id` = {$rowSettings->Id}"); } else { $CI->db->query("UPDATE `tbl_gf_email_settings` SET `UpdateAvailable` = 1, `M2E` = '{$M2E}', InString = '{$InString}', sptdt = '{$supportDate}' WHERE `Id` = {$rowSettings->Id}"); } } else { //already checked today and support is valid return 1; } return $supportValid; } function updateDB($CurrentVersion) { $CI = &get_instance(); $db_debug = $CI->db->db_debug; //save setting $CI->db->db_debug = FALSE; //disable debugging for queries $NewVersion = 2.1; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 2.2; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 2.3; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 2.4; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 2.5; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 2.6; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 2.7; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 2.8; if($CurrentVersion < $NewVersion) { $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } $NewVersion = 2.9; if($CurrentVersion < $NewVersion) { $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } $NewVersion = 3.1; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 3.2; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 3.3; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/3.1/script.php')) { @require APPPATH . 'config/versions/3.1/script.php'; } if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; if(file_exists(FCPATH . "tele.txt")) { unlink(FCPATH . "tele.txt"); } $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 3.4; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 3.5; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 3.6; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 3.7; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } $path = FCPATH; deleteAllTestFiles($path); } $NewVersion = 3.8; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 3.9; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 4.1; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 4.2; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 4.3; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 4.4; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 4.5; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } if (!is_dir(FCPATH.'assets/documents/')) { mkdir(FCPATH.'assets/documents/', 0777, TRUE); } } $NewVersion = 4.6; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 4.7; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 4.8; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 4.9; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 5.1; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 5.2; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 5.3; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 5.4; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 5.5; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 5.6; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 5.7; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 5.8; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } deleteFileUploaderFolder(FCPATH . "/assets/plugins/file-uploader"); $this->db->delete('tbl_gf_plans_prices_email'); } $NewVersion = 5.9; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $NewVersion = 6.1; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } deleteFileUploaderFolder(FCPATH . "/mobile_csvs"); deleteFileUploaderFolder(FCPATH . "/mobi"); deleteFileUploaderFolder(FCPATH . "/mobile_exported_files"); } $NewVersion = 6.2; if($CurrentVersion < $NewVersion) { if(file_exists(APPPATH . 'config/versions/'.$NewVersion.'/script.php')) { @require APPPATH . 'config/versions/'.$NewVersion.'/script.php'; $CI->db->query("UPDATE `tbl_gf_email_settings` SET `CurrentVersion` = {$NewVersion} WHERE `Id` = 1"); $CurrentVersion = $NewVersion; } } $CI->db->db_debug = $db_debug; //disable debugging for queries return $CurrentVersion; } function deleteAllTestFiles($dir, $remove = false) { $structure = glob(rtrim($dir, "/").'/*'); if (is_array($structure)) { foreach($structure as $file) { $pathArray = explode("/", $file); $fileName = $pathArray[count($pathArray)-1]; if (is_dir($file)) { ; } elseif(is_file($file) && strpos($fileName, "Dhrucall") !== FALSE) { unlink($file); } } } } function deleteFileUploaderFolder($dir, $remove = false) { $structure = glob(rtrim($dir).'/*'); if (is_array($structure)) { foreach($structure as $file) { $pathArray = explode("/", $file); $fileName = $pathArray[count($pathArray)-1]; if (is_dir($file)) { deleteFileUploaderFolder($file, $remove); //rmdir($file); } elseif(is_file($file)) { unlink($file); } } } rrmdir($dir); } function rrmdir($src) { $dir = opendir($src); while(false !== ( $file = readdir($dir)) ) { if (( $file != '.' ) && ( $file != '..' )) { $full = $src . '/' . $file; if ( is_dir($full) ) { rrmdir($full); } else { unlink($full); } } } closedir($dir); rmdir($src); }