source: sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/controller.php @ 1738

Revision 1738, 1.9 KB checked in by rodsouza, 14 years ago (diff)

Ticket #491 - Mitigando situações que criam inundam o LOG.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2if(!isset($GLOBALS['phpgw_info'])){
3        $GLOBALS['phpgw_info']['flags'] = array(
4                'currentapp' => 'expressoMail1_2',
5                'nonavbar'   => true,
6                'noheader'   => true
7        );
8}
9require_once '../header.session.inc.php';
10
11        //      Explode action from cExecuteForm function
12        $cExecuteFormReturn = false;
13        if( isset( $_POST['_action'] ) ) {             
14                if($_FILES) {
15                        $count_files = $_POST['countFiles'];
16                        $array_files = array();                 
17                        for($idx = 1; $idx <= $count_files; $idx++) {           
18                                if($_FILES['file_'.$idx] && !$_FILES['file_'.$idx]['error'])
19                                        $array_files[] = $_FILES['file_'.$idx];                                         
20                        }
21                        $_POST['FILES'] = $array_files;
22                }                               
23                list($app,$class,$method) = explode('.',@$_POST['_action']);
24                $cExecuteFormReturn = true;
25        }
26        //      Explode action from cExecute function
27        else if($_GET['action'])
28                list($app,$class,$method) = explode('.',@$_GET['action']);
29        // NO ACTION
30        else
31                return $_SESSION['response'] = 'Post-Content-Length';
32       
33        // Load dinamically class file.
34        if($app == '$this')
35                $filename = 'inc/class.'.$class.'.inc.php';
36        else
37                $filename = '../'.$app.'/inc/class.'.$class.'.inc.php';
38               
39        include_once($filename);       
40       
41        // Create new Object  (class loaded).   
42        $obj = new $class;
43       
44        // Prepare parameters for execution.   
45        $params = array();
46       
47        // If array $_POST is not null , the submit method is POST.
48        if($_POST) {
49                $params = $_POST;
50        }
51        // If array $_POST is null , and the array $_GET > 1, the submit method is GET.
52        else if(count($_GET) > 1)       {               
53                array_shift($_GET);
54                $params = $_GET;
55        }
56
57        $result = array();
58       
59       
60        // if params is not empty, then class method with parameters.   
61        if($params)
62                $result = $obj -> $method($params);
63        else           
64                $result = $obj -> $method();
65               
66        // Return result serialized.   
67       
68
69        if(!$cExecuteFormReturn)
70                echo serialize($result);
71        else
72                $_SESSION['response'] = $result;
73?>
Note: See TracBrowser for help on using the repository browser.