HEX
Server: Apache/2.2.15 (CentOS)
System: Linux ip-10-0-2-146.eu-west-1.compute.internal 2.6.32-754.35.1.el6.centos.plus.x86_64 #1 SMP Sat Nov 7 11:33:42 UTC 2020 x86_64
User: root (0)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /www/exchange0old/exchange/classes/Controller/CInvestorGlobalSettings.php
<?php

class Controller_CInvestorGlobalSettings
{
	/**
	 * Controller CInvestorGlobalSettings
	 */
	function Controller_CInvestorGlobalSettings()
	{
		if(!isset($_SESSION['user']['userid']) )
			header("Location:?do=login");
			
		include_once('classes/Model/MHelpers.php');
		$application 				= Model_MHelpers::redirectToCreateApplication();
		
		include_once('classes/Model/MInvestorGlobalSettings.php');
		include_once('classes/Display/DInvestorGlobalSettings.php');
	}
	/**
	 * Check Automatic Trading
	 */
	function setAutomaticTrading(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		$output['notify']		= Model_MInvestorGlobalSettings::getAutomatedTradeStatus();
		
		if($_SESSION['result1'] !=''){
			$output['result'] 	= $_SESSION['result1'];	
		}
		
		//Template View
		Bin_Template::createTemplate('auto_trading.html',$output);
		unset($_SESSION['result1']);

	}
	/**
	 * Check Automatic Trading
	 */
	function saveAutomaticTrading(){
		
		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		$post['status']			= trim($_POST['status']);
		
		if($post['status'] == '1'){
			
			$notify				= Model_MInvestorGlobalSettings::updateTrading($post);
			$_SESSION['result']	= 'Automated Trading Activated Successfully';
			
			header('Location: index.php?do=auto_trade_notify');
			exit;
		}else{
			$notify				= Model_MInvestorGlobalSettings::updateTrading($post);
			$_SESSION['result1']= 'Automated Trading DeActivated Successfully';
			
			header('Location: index.php?do=auto_trading');
			exit;
			
		}
		
	}
	/**
	 * Check Notification Setting
	 */
	function setNotificationSettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		//Check For Trading Status
		$this->_unwantedRedirect();
		
		$output['email']		= Model_MInvestorGlobalSettings::getNotificationEmail();
		$output['notify']		= Model_MInvestorGlobalSettings::getNotificationSetting();
		$output['status']		= Model_MInvestorGlobalSettings::getAutomatedTradeStatus();
		
		if($_SESSION['result'] !=''){
			$output['result'] 	= $_SESSION['result'];	
		}

		//Template View
		Bin_Template::createTemplate('auto_trade_notify.html',$output);
		unset($_SESSION['result']);

	}
	/**
	 * Save Notification Settings
	 */
	function saveNotificationSettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		//Check For Trading Status
		$this->_unwantedRedirect();

		$post					= $_POST;
		
		//Save Data
		$notify					= Model_MInvestorGlobalSettings::updateNotification($post);
		$_SESSION['result']		= 'Notification updated Successfully';
		
		header('Location: index.php?do=auto_trade_notify');
		exit;


	}
	/**
	 * Check Trade Setting
	 */
	function setTradeSettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		//Check For Trading Status
		$this->_unwantedRedirect();
		$output['notify']		= Model_MInvestorGlobalSettings::getAutomatedTradeStatus();

		//Template View
		Bin_Template::createTemplate('auto_trade_trade.html',$output);

	}
	/**
	 * Save Trade Setting
	 */
	function saveTradeSettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);

		//Template View
		Bin_Template::createTemplate('investor_my_profile.html',$output);

	}
	/**
	 * Check Category Setting
	 */
	function setCategorySettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		//Check For Trading Status
		$this->_unwantedRedirect();
		
		$output['listNace']		= Model_MInvestorGlobalSettings::getNaceCategory();
		$output['notify']		= Model_MInvestorGlobalSettings::getAutomatedTradeStatus();

		//Template View
		Bin_Template::createTemplate('auto_trade_category.html',$output);

	}
	/**
	 * Save Category Setting
	 */
	function saveCategorySettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);

		//Check For Trading Status
		$this->_unwantedRedirect();

		//Template View
		Bin_Template::createTemplate('investor_my_profile.html',$output);

	}
	/**
	 * Check Debtors Setting
	 */
	function setDebtorsSettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		//Check For Trading Status
		$this->_unwantedRedirect();

		$output['listDebtor']	= Model_MInvestorGlobalSettings::getMasterDebtor();
		$output['notify']		= Model_MInvestorGlobalSettings::getAutomatedTradeStatus();
		
		//Template View
		Bin_Template::createTemplate('auto_trade_debtors.html',$output);

	}
	/**
	 * Save Debtors Settings
	 */
	function saveDebtorsSettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		//Check For Trading Status
		$this->_unwantedRedirect();

		//Template View
		Bin_Template::createTemplate('investor_my_profile.html',$output);

	}
	/**
	 * Check Trader Setting
	 */
	function setTraderSettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		//Check For Trading Status
		$this->_unwantedRedirect();

		$output['listOrg']		= Model_MInvestorGlobalSettings::getTraderOrganisation();
		$output['notify']		= Model_MInvestorGlobalSettings::getAutomatedTradeStatus();
		
		//Template View
		Bin_Template::createTemplate('auto_trade_originator.html',$output);

	}
	/**
	 * save Trader Setting
	 */
	function saveTraderSettings(){

		//Check Previledge of the Web User
		$this->_checkLogin(1,2);
		
		//Check For Trading Status
		$this->_unwantedRedirect();

		//Template View
		Bin_Template::createTemplate('investor_my_profile.html',$output);

	}
	/**
	 * Check Previledge of the Web User	
	 */
	function _checkLogin($type, $type1){
		
		if($_SESSION["user"]["userid"]=='' || ($_SESSION['user']['usertype'] != $type && $_SESSION['user']['usertype'] != $type1)){
			
			//Redirects
			header('Location: index.php?do=login');
			exit;
		}
		
	}
	/**
	 * Check Previledge of the Web User	
	 */
	function _provisionAll(){
		
		if($_SESSION["user"]["userid"]==''){
			//Redirects
			header('Location: index.php?do=login');
			exit;
		}
		
	}
	/**
	 * Redirect User to the Auto Trading	
	 */
	public function _unwantedRedirect(){
		
		$status					= Model_MInvestorGlobalSettings::getAutomatedTradeStatus();

		if($status['auto_trade'] != '1'){
			//Redirects
			header('Location: index.php?do=auto_trading');
			exit;
		}
	}

}
?>