| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/dcb/application/modules/admin/controllers/ |
Upload File : |
<?php
/* * *************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name :ForexratesController.php
* File Description :Forexrates controller managed all rates
* Created By : Praveen Kumar
* Created Date: 27-September-2014
* ************************************************************* */
class Admin_ForexratesController extends Catabatic_ValidateDcb {
var $dbAdapter;
public function init() {
parent::init();
$this->dbAdapter = Zend_Db_Table::getDefaultAdapter();
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->perPageLimit = $aConfig['bootstrap']['perPageLimit'];
$this->username = Admin_Model_UserAuth::getIdentity()->username;
$this->admin_type = Admin_Model_UserAuth::getIdentity()->type;
}
/**
* index() method is used to admin login for form call
* @param Null
* @return Array
*/
public function indexAction() {
}
/**
* add() method is used to admin can add slider
* @param string
* @return ture
*/
public function addAction() {
//Check admin logedin or not
$this->checklogin();
$frates = new Admin_Model_Forexrates();
$form = new Admin_Form_Forexrates();
//echo "<pre>";print_r($form);die;
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
//echo "<pre>";print_r($getData);die;
if ($form->isValid($getData)) {
$res = $frates->getForexratesDetails();
$fid = $res['id'];
if ($fid != "") {
$orignalFIleName = $_FILES['forex_rates_file']['name'];
$ext = @substr($_FILES['forex_rates_file']['name'], strrpos($_FILES['forex_rates_file']['name'], '.'));
$image = "frates_" . time() . $ext;
if ($orignalFIleName != "") {
$res = $frates->getForexratesDetails();
$up_file = $res['forex_rates_file'];
@unlink("upload/forexrates/" . $up_file);
$addimage = $image;
}
try {
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination("upload/forexrates/");
$upload->addFilter('Rename', "upload/forexrates/" . $image);
$file = $upload->getFileName();
$upload->receive();
try {
$frates->edit($addimage, $fid);
} catch (Exception $e) {
print_r($e, TRUE);
}
$this->_helper->flashMessenger->addMessage("Forex rates file uploaded successfully.");
$this->_helper->redirector('add', 'forexrates', 'admin');
} catch (Zend_File_Transfer_Exception $e) {
$e->getMessage();
}
} else {
$orignalFIleName = $_FILES['forex_rates_file']['name'];
$ext = @substr($_FILES['forex_rates_file']['name'], strrpos($_FILES['forex_rates_file']['name'], '.'));
$image = "frates_" . time() . $ext;
if ($orignalFIleName != "") {
$addimage = $image;
} else {
$addimage = "";
}
try {
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination("upload/forexrates/");
$upload->addFilter('Rename', "upload/forexrates/" . $image);
$file = $upload->getFileName();
$upload->receive();
try {
$frates->add($addimage);
} catch (Exception $e) {
print_r($e, false);
}
$this->_helper->flashMessenger->addMessage("Forex rates file uploaded successfully.");
$this->_helper->redirector('add', 'forexrates', 'admin');
} catch (Zend_File_Transfer_Exception $e) {
$e->getMessage();
}
}
}
}
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function sanitize_data($input_data) {
$searchArr = array("document", "write", "alert", "%", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "AND", "JAVASCRIPT");
$input_data = str_replace("script", "", $input_data);
$input_data = str_replace("iframe", "", $input_data);
$input_data = str_replace($searchArr, "", $input_data);
return htmlentities(stripslashes($input_data), ENT_QUOTES);
}
/**
* checklogin() method is used to check admin logedin or not
* @param Null
* @return Array
*/
public function checklogin() {
if (($this->admin_type == "superadmin") || ($this->admin_type == "admin")) {
} else {
$this->_redirect('admin/index/logout');
}
}
}