source: trunk/expressoAdmin1_2/controller.php @ 2364

Revision 2364, 2.7 KB checked in by amuller, 14 years ago (diff)

Ticket #1008 - Adicionando licença aos arquivos php

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2
3        /***************************************************************************
4        * Expresso Livre                                                           *
5        * http://www.expressolivre.org                                             *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12if(!isset($GLOBALS['phpgw_info'])){
13        $GLOBALS['phpgw_info']['flags'] = array(
14                'currentapp' => 'expressoAdmin1_2',
15                'nonavbar'   => true,
16                'noheader'   => true
17        );
18}
19require_once '../header.session.inc.php';
20
21        //      Explode action from cExecuteForm function
22        $cExecuteFormReturn = false;
23        if($_POST['_action']) {                 
24                if($_FILES) {
25                        $count_files = $_POST['countFiles'];
26                        $array_files = array();                 
27                        for($idx = 1; $idx <= $count_files; $idx++) {           
28                                if($_FILES['file_'.$idx] && !$_FILES['file_'.$idx]['error'])
29                                        $array_files[] = $_FILES['file_'.$idx];                                         
30                        }
31                        $_POST['FILES'] = $array_files;
32                }                               
33                list($app,$class,$method) = explode('.',@$_POST['_action']);
34                $cExecuteFormReturn = true;
35        }
36        //      Explode action from cExecute function
37        else if($_GET['action'])
38                list($app,$class,$method) = explode('.',@$_GET['action']);
39        // NO ACTION
40        else
41                return $_SESSION['response'] = 'false';
42       
43        // Load dinamically class file.
44        if($app == '$this')
45                $filename = 'inc/class.'.$class.'.inc.php';
46        else if( strpos($app, '$this/') !== false)
47        {
48                $filename = str_replace('$this/','',$app) . '.php';
49                include_once($filename);
50                exit;
51        }
52        else
53                $filename = '../'.$app.'/inc/class.'.$class.'.inc.php';
54               
55        include_once($filename);
56       
57        // Create new Object  (class loaded).   
58        $obj = new $class;
59       
60        // Prepare parameters for execution.   
61        $params = array();
62       
63        // If array $_POST is not null , the submit method is POST.
64        if($_POST) {
65                $params = $_POST;
66        }
67        // If array $_POST is null , and the array $_GET > 1, the submit method is GET.
68        else if(count($_GET) > 1)       {               
69                array_shift($_GET);
70                $params = $_GET;
71        }
72
73        $result = array();
74       
75       
76        // if params is not empty, then class method with parameters.   
77        if($params)
78                $result = $obj -> $method($params);
79        else           
80                $result = $obj -> $method();
81               
82        // Return result serialized.   
83       
84
85        if(!$cExecuteFormReturn)
86                echo serialize($result);
87        else
88                $_SESSION['response'] = $result;
89?>
Note: See TracBrowser for help on using the repository browser.