[727] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * phpGroupWare * |
---|
| 4 | * http://www.phpgroupware.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | \**************************************************************************/ |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | $phpgw_info = array(); |
---|
| 14 | if(!file_exists('header.inc.php')) |
---|
| 15 | { |
---|
| 16 | Header('Location: setup/index.php'); |
---|
| 17 | exit; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid']; |
---|
| 21 | if(!$GLOBALS['sessionid']) |
---|
| 22 | { |
---|
| 23 | Header('Location: login.php'. |
---|
| 24 | (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ? |
---|
| 25 | '?phpgw_forward='.urlencode('/index.php?'.$_SERVER['QUERY_STRING']):'')); |
---|
| 26 | exit; |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | /* |
---|
| 30 | This is the menuaction driver for the multi-layered design |
---|
| 31 | */ |
---|
| 32 | if(isset($_GET['menuaction'])) |
---|
| 33 | { |
---|
| 34 | list($app,$class,$method) = explode('.',@$_GET['menuaction']); |
---|
| 35 | if(! $app || ! $class || ! $method) |
---|
| 36 | { |
---|
| 37 | $invalid_data = True; |
---|
| 38 | } |
---|
| 39 | } |
---|
| 40 | else |
---|
| 41 | { |
---|
| 42 | //$phpgw->log->message('W-BadmenuactionVariable, menuaction missing or corrupt: %1',$menuaction); |
---|
| 43 | //$phpgw->log->commit(); |
---|
| 44 | |
---|
| 45 | $app = 'home'; |
---|
| 46 | $invalid_data = True; |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | if($app == 'phpgwapi') |
---|
| 50 | { |
---|
| 51 | $app = 'home'; |
---|
| 52 | $api_requested = True; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
| 56 | 'noheader' => True, |
---|
| 57 | 'nonavbar' => True, |
---|
| 58 | 'currentapp' => $app |
---|
| 59 | ); |
---|
| 60 | include('./header.inc.php'); |
---|
| 61 | |
---|
| 62 | if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on')) |
---|
| 63 | { |
---|
| 64 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
| 65 | exit; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | if($app == 'home' && !$api_requested) |
---|
| 69 | { |
---|
| 70 | Header('Location: ' . $GLOBALS['phpgw']->link('/home.php')); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | if($api_requested) |
---|
| 74 | { |
---|
| 75 | $app = 'phpgwapi'; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class)); |
---|
| 79 | if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data) |
---|
| 80 | { |
---|
| 81 | execmethod($_GET['menuaction']); |
---|
| 82 | unset($app); |
---|
| 83 | unset($class); |
---|
| 84 | unset($method); |
---|
| 85 | unset($invalid_data); |
---|
| 86 | unset($api_requested); |
---|
| 87 | } |
---|
| 88 | else |
---|
| 89 | { |
---|
| 90 | if(!$app || !$class || !$method) |
---|
| 91 | { |
---|
| 92 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
| 93 | { |
---|
| 94 | if($menuaction) |
---|
| 95 | { |
---|
| 96 | $GLOBALS['phpgw']->log->message(array( |
---|
| 97 | 'text' => "W-BadmenuactionVariable, menuaction missing or corrupt: $menuaction", |
---|
| 98 | 'p1' => $menuaction, |
---|
| 99 | 'line' => __LINE__, |
---|
| 100 | 'file' => __FILE__ |
---|
| 101 | )); |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method) |
---|
| 107 | { |
---|
| 108 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
| 109 | { |
---|
| 110 | if($menuaction) |
---|
| 111 | { |
---|
| 112 | $GLOBALS['phpgw']->log->message(array( |
---|
| 113 | 'text' => "W-BadmenuactionVariable, attempted to access private method: $method", |
---|
| 114 | 'p1' => $method, |
---|
| 115 | 'line' => __LINE__, |
---|
| 116 | 'file' => __FILE__ |
---|
| 117 | )); |
---|
| 118 | } |
---|
| 119 | } |
---|
| 120 | } |
---|
| 121 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
| 122 | { |
---|
| 123 | $GLOBALS['phpgw']->log->commit(); |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | $GLOBALS['phpgw']->redirect_link('/home.php'); |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | /*if(!isset($GLOBALS['phpgw_info']['nofooter'])) |
---|
| 130 | { |
---|
| 131 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
| 132 | }*/ |
---|
| 133 | ?> |
---|