[2] | 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 | { |
---|
[141] | 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; |
---|
[2] | 27 | } |
---|
| 28 | |
---|
| 29 | /* |
---|
| 30 | This is the menuaction driver for the multi-layered design |
---|
[2991] | 31 | */ |
---|
[2] | 32 | if(isset($_GET['menuaction'])) |
---|
| 33 | { |
---|
[2991] | 34 | |
---|
[2] | 35 | list($app,$class,$method) = explode('.',@$_GET['menuaction']); |
---|
| 36 | if(! $app || ! $class || ! $method) |
---|
| 37 | { |
---|
| 38 | $invalid_data = True; |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | else |
---|
| 42 | { |
---|
| 43 | //$phpgw->log->message('W-BadmenuactionVariable, menuaction missing or corrupt: %1',$menuaction); |
---|
| 44 | //$phpgw->log->commit(); |
---|
| 45 | |
---|
| 46 | $app = 'home'; |
---|
| 47 | $invalid_data = True; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | if($app == 'phpgwapi') |
---|
| 51 | { |
---|
| 52 | $app = 'home'; |
---|
| 53 | $api_requested = True; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
| 57 | 'currentapp' => $app |
---|
| 58 | ); |
---|
| 59 | include('./header.inc.php'); |
---|
| 60 | |
---|
[141] | 61 | if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on')) |
---|
| 62 | { |
---|
| 63 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
| 64 | exit; |
---|
| 65 | } |
---|
| 66 | |
---|
[2623] | 67 | if ( $app == 'home' && ! $api_requested ) |
---|
[2] | 68 | { |
---|
[2674] | 69 | $target = 'home.php'; |
---|
| 70 | if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] && $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']]) |
---|
| 71 | $target = $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] . '/index.php'; |
---|
| 72 | |
---|
[2691] | 73 | $target = '( function( ){ var target = window.location.hash; target = (' |
---|
| 74 | . '( arguments.length && ( target && target.length > 1 ) ) ?' |
---|
[2703] | 75 | . 'URL_SERVER + target.substr( 1 ) : "' . $GLOBALS[ 'phpgw' ] -> link( $target ). '" ); ExpressoLivre.link( target ); } )'; |
---|
[2674] | 76 | |
---|
[2687] | 77 | if ( array_key_exists( 'HTTP_BACKGROUNDREQUEST', $_SERVER ) || array_key_exists( 'BackgroundRequest', $_GET ) ) |
---|
[2691] | 78 | $target = "{$target}( );"; |
---|
[2687] | 79 | else |
---|
| 80 | $target = "XEvents.add( window, 'onload', {$target} );"; |
---|
| 81 | |
---|
[2991] | 82 | echo "<script type='text/javascript'>{$target}</script>"; |
---|
[2687] | 83 | |
---|
[2656] | 84 | exit; |
---|
[2] | 85 | } |
---|
| 86 | |
---|
| 87 | if($api_requested) |
---|
| 88 | { |
---|
| 89 | $app = 'phpgwapi'; |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class)); |
---|
[2707] | 93 | if ( is_object( $GLOBALS[ $class ] ) && ( ( ! property_exists( $class, 'public_functions' ) ) || (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data ) ) |
---|
[2] | 94 | { |
---|
[2802] | 95 | echo execmethod( $_GET[ 'menuaction' ], $_REQUEST ); |
---|
[2] | 96 | unset($app); |
---|
| 97 | unset($class); |
---|
| 98 | unset($method); |
---|
| 99 | unset($invalid_data); |
---|
| 100 | unset($api_requested); |
---|
| 101 | } |
---|
| 102 | else |
---|
| 103 | { |
---|
| 104 | if(!$app || !$class || !$method) |
---|
| 105 | { |
---|
| 106 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
| 107 | { |
---|
[237] | 108 | if($menuaction) |
---|
| 109 | { |
---|
| 110 | $GLOBALS['phpgw']->log->message(array( |
---|
| 111 | 'text' => "W-BadmenuactionVariable, menuaction missing or corrupt: $menuaction", |
---|
| 112 | 'p1' => $menuaction, |
---|
| 113 | 'line' => __LINE__, |
---|
| 114 | 'file' => __FILE__ |
---|
| 115 | )); |
---|
| 116 | } |
---|
[2] | 117 | } |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method) |
---|
| 121 | { |
---|
| 122 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
[237] | 123 | { |
---|
| 124 | if($menuaction) |
---|
| 125 | { |
---|
| 126 | $GLOBALS['phpgw']->log->message(array( |
---|
| 127 | 'text' => "W-BadmenuactionVariable, attempted to access private method: $method", |
---|
| 128 | 'p1' => $method, |
---|
| 129 | 'line' => __LINE__, |
---|
| 130 | 'file' => __FILE__ |
---|
| 131 | )); |
---|
| 132 | } |
---|
[2] | 133 | } |
---|
| 134 | } |
---|
| 135 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
| 136 | { |
---|
| 137 | $GLOBALS['phpgw']->log->commit(); |
---|
| 138 | } |
---|
| 139 | |
---|
[2991] | 140 | echo '<script type="text/javascript">ExpressoLivre.link( "' . $GLOBALS[ 'phpgw' ] -> link( '/home.php' ) . '", true );/* ??? */</script>'; |
---|
[2656] | 141 | exit; |
---|
[2] | 142 | } |
---|
| 143 | ?> |
---|