Exemple #1
0
 function parse()
 {
     global $osC_Language;
     $module = '';
     $action = '';
     $response['success'] = false;
     if (isset($_SESSION['admin']) || $_REQUEST['module'] == 'login') {
         //valid token before all request
         if ($_REQUEST['module'] != 'login') {
             toc_verify_token();
         }
         if (isset($_REQUEST['module'])) {
             $module = $_REQUEST['module'];
             $_SESSION['module'] = $_REQUEST['module'];
             $osC_Language->loadIniFile($module . '.php');
         }
         if (isset($_REQUEST['action'])) {
             $action = $_REQUEST['action'];
         }
         if (!empty($module) && !empty($action)) {
             if (file_exists('includes/jsons/' . $module . '.php')) {
                 include 'includes/jsons/' . $module . '.php';
                 //process action
                 $words = explode('_', $action);
                 $action = $words[0];
                 if (sizeof($words) > 1) {
                     for ($i = 1; $i < sizeof($words); $i++) {
                         $action .= ucfirst($words[$i]);
                     }
                 }
                 call_user_func(array('toC_Json_' . ucfirst($module), $action));
                 exit;
             }
         }
     } else {
         $response = array('success' => false, 'error' => 'session_timeout');
     }
     echo $this->encode($response);
 }
  http://www.tomatocart.com

  Copyright (c) 2009 Wuxi Elootec Technology Co., Ltd

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT");
header("Pragma: no-cache");
header("Content-Type: application/pdf");
require 'includes/application_top.php';
require 'includes/classes/toc_pdf.php';
toc_verify_token();
$dir_fs_www_root = dirname(__FILE__);
if (isset($_SESSION['admin'])) {
    if (isset($_REQUEST['module'])) {
        $module = $_REQUEST['module'];
        $osC_Language->loadIniFile($module . '.php');
    }
    if (isset($_REQUEST['pdf'])) {
        $pdf = preg_replace('/[^a-zA-Z_]/iu', '', $_REQUEST['pdf']);
    }
    if (!empty($module) && !empty($pdf)) {
        if (file_exists('includes/modules/pdf/' . $pdf . '.php')) {
            include 'includes/modules/pdf/' . $pdf . '.php';
            $pdf_class = 'toC_' . ucfirst($pdf) . '_PDF';
            $object = new $pdf_class();
            $object->render();