/admin/cake/app_controller.php
PHP | 240 lines | 109 code | 20 blank | 111 comment | 9 complexity | 9c47b236144d6ed049b9258695598a7c MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
- <?php
- /* SVN FILE: $Id: app_controller.php 4409 2007-02-02 13:20:59Z phpnut $ */
- /**
- * Short description for file.
- *
- * This file is application-wide controller file. You can put all
- * application-wide controller-related methods here.
- *
- * PHP versions 4 and 5
- *
- * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
- * Copyright 2005-2007, Cake Software Foundation, Inc.
- * 1785 E. Sahara Avenue, Suite 490-204
- * Las Vegas, Nevada 89104
- *
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- *
- * @filesource
- * @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
- * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
- * @package cake
- * @subpackage cake.cake
- * @since CakePHP(tm) v 0.2.9
- * @version $Revision: 4409 $
- * @modifiedby $LastChangedBy: phpnut $
- * @lastmodified $Date: 2007-02-02 07:20:59 -0600 (Fri, 02 Feb 2007) $
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
- */
- /**
- * This is a placeholder class.
- * Create the same file in app/app_controller.php
- *
- * Add your application-wide methods in the class below, your controllers
- * will inherit them.
- *
- * @package cake
- * @subpackage cake.cake
- */
- class AppController extends Controller {
- var $components = array('RequestHandler','Gcheckout','Paypal');
- //the public variables are used for PAYPAL
- //put tha clock of code in
- public $returnUrl="";
- public $cancelUrl="";
- public $notifyUrl="";
- public $amountPay=NULL;
- public $userEmail=NULL;
- public $eventId=NULL;
- public $userId=NULL;
- public $merchantEmail=NULL;
- public $itemName=NULL;
- public $itemNumber=NULL;
- public $itemQuantity=NULL;
- public $invoice=NULL;
- public $custom=NULL;
- public $paypalUrl='https://www.sandbox.paypal.com/cgi-bin/webscr';
- public $ticketPaymentMsg=NULL;
- function paypal() {
-
- if(isset($this->ticketPaymentMsg))
- $this->Paypal->ticketPayment=$this->ticketPaymentMsg;
-
- $this->Paypal->paypal_class();
- $this->Paypal->paypal_url = $this->paypalUrl;
- $this->Paypal->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
-
- $this->Paypal->add_field('business', $this->merchantEmail);
- $this->Paypal->add_field('return', $this->returnUrl);
- //$this->Paypal->add_field('cancel_return', $this->cancelUrl);
- $this->Paypal->add_field('notify_url', $this->notifyUrl);
- $this->Paypal->add_field('item_name', $this->itemName);
- $this->Paypal->add_field('amount', $this->amountPay);
- $this->Paypal->add_field('quantity', $this->itemQuantity);
- $this->Paypal->add_field('custom', $this->custom);
- $this->Paypal->add_field('invoice',$this->invoice);
- $this->Paypal->add_field('cbt','Return to Xoimages.com to complete your transaction');
- $this->Paypal->submit_paypal_post(); // submit the fields to paypal
- }
- //-----
- function transactionMaster($transactionDesc = null,$transactionHead = null,$transactionTitle = null, $invoice = null,$invoiceId = null) {
- mysql_query("
- INSERT INTO
- xouser_transactions(transaction_desc,transaction_head,transaction_title,invoice,invoice_id)
- VALUES('".$transactionDesc."','".$transactionHead."','".$transactionTitle."','".$invoice."','".$invoiceId."')") or die("Error on line ".__LINE__.mysql_error());
-
- return $xouserTransactionId=mysql_insert_id();
- }
-
- //'-1' entry implies that buyer has been charged
- //'+1' entry implies thar he has paid the amount that is charged
- //At the time of commission calculation we will make the charged entry against the user
- function transactionDetail($buyer = null,$amount = null,$DbCr = null,$lastTransactionId = null, $receipient = null) {
-
- mysql_query("INSERT INTO
- xouser_transaction_details(user_id,amount,DrCr,xouser_transaction_id,payment_to)
- VALUES('".$buyer."','".$amount."','".$DbCr."','".$lastTransactionId."','".$receipient."')");
-
- }
-
- function getPaymentMethods($userId) {
- /*$queryAdminPaymentSetup=mysql_query("SELECT paypal_email,gcheckout_email FROM user_payment_setup WHERE user_id='".$userId."'") or die("Error on line :".__LINE__.mysql_error());*/
-
- $queryAdminPaymentSetup=mysql_query("SELECT paypal_email FROM user_payment_setup WHERE user_id='".$userId."'") or die("Error on line :".__LINE__.mysql_error());
- $fetchAdminPaymentSetup=mysql_fetch_assoc($queryAdminPaymentSetup);
- return $fetchAdminPaymentSetup;
- }
-
- function getUserDetails($userId) {
- $qry2=mysql_query("SELECT UD.*,U.* FROM user_details UD,users U WHERE UD.user_id=U.id AND U.id='".$userId."'");
- $rowQry=mysql_fetch_assoc($qry2);
-
- return $rowQry;
- }
-
- function senderMail($sender=null,$receiver=null,$subject=null,$body=null) {
- $mailQry = "
- INSERT INTO sent_mails(user_id, reciever_id, email_subject, email_body)
- VALUES(".$sender.", ".$receiver.", '".$subject."', '".addslashes($body)."')";
- $sentMailUpdate = mysql_query($mailQry) or die("1 - ".mysql_error());
- }
-
- function receiverMail($receiver=null,$sender=null,$subject=null,$body=null) {
- $eMailQry = "
- INSERT INTO
- emails(user_id, email_creater, email_subject, email_body)
- VALUES(".$receiver.", ".$sender.", '".$subject."', '".addslashes($body)."')";
- $inboxUpdate = mysql_query($eMailQry) or die("2 - ".mysql_error());
- }
-
- function parseXmlArray($xmlData) {
- $data = $xmlData;
- $xml_parser = xml_parser_create();
- xml_parse_into_struct($xml_parser, $data, $vals, $index);
- xml_parser_free($xml_parser);
-
- $params = array();
- $level = array();
- foreach ($vals as $xml_elem) {
- if ($xml_elem['type'] == 'open') {
- if (array_key_exists('attributes',$xml_elem)) {
- list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']);
- }
- else {
- $level[$xml_elem['level']] = $xml_elem['tag'];
- }
- }
-
- if ($xml_elem['type'] == 'complete') {
- $start_level = 1;
- $php_stmt = '$params';
- while($start_level < $xml_elem['level']) {
- $php_stmt .= '[$level['.$start_level.']]';
- $start_level++;
- }
- $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
- eval($php_stmt);
- }
- }
-
- return $params;
- }
-
- function checkSession() {
- // If the session info hasn't been set...
- if (!$this->Session->check('Admin')) {
- // Force the user to login
- $this->redirect('/admins/login');
- }
- else {
- $this->layout = 'default_after_login';
- /*$hours = date("H");
- $minutes = date("i");
- $seconds = date("s");
- $month = date("m");
- $day = date("d");
- $year = date("Y");
- $total = date("m-d-Y-H-i-s");
- $now = mktime($hours, $minutes, $seconds, $month, $day, $year);
- $page_qry = "select * from sites where page='$_SERVER[REQUEST_URI]'";
- $res_page = mysql_query($page_qry);
- if(mysql_num_rows($res_page)==0)
- {
- $qry = "insert into `sites` (page, time, referrer, browser, ip, timeStamp, pagetitle, visits) values ('$_SERVER[REQUEST_URI]', '$total', '$_SERVER[HTTP_REFERER]', '$_SERVER[HTTP_USER_AGENT]', '$_SERVER[REMOTE_ADDR]', '$now', '".$this->pageTitle."', 1 )";
- $res = mysql_query($qry);
- }
- else
- {
- $qry = "UPDATE `sites` SET visits = visits + 1 WHERE `page` ='$_SERVER[REQUEST_URI]'";
- $res = mysql_query($qry);
- }*/
- }
- }
-
- /*function checkAccess()
- {
- // Check access using the component:
- $access = $_SESSION['Admin_type'];
-
- //access denied
- if ($access == 1)
- {
- return true;
- //exit;
- }
- //access allowed
- else
- {
- return false;
-
- }
- }
-
-
- function checkAccess1($menu_name,$permission_type)
- {
-
- // Check access using the component:
- //$access = $_SESSION[$menu_name]['modify'];
- $access = $this->Acl->check($_SESSION['Admin_cat'],$menu_name,$permission_type);
-
-
-
- //access denied
- if ($access)
- {
- return true;
- //exit;
- }
- //access allowed
- else
- {
- $this->redirect('admins/access_denied');
- return false;
-
- }
- }*/
-
- }
- ?>