diff --git a/index.php b/index.php index ed741a76eb..cf26970114 100755 --- a/index.php +++ b/index.php @@ -1,7 +1,7 @@ True, 'nonavbar' => True, + 'enable_network_class' => True, + 'enable_contacts_class' => True, + 'enable_nextmatchs_class' => True, 'currentapp' => $app ); include('./header.inc.php'); - - if($app == 'home' && !$api_requested) + + +// Check if we are using windows or normal webpage + $windowed = false; + $settings = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] . '/settings/settings.inc.php'; + + if(@file_exists($settings)) { - Header('Location: ' . $GLOBALS['phpgw']->link('/home.php')); - } - - if($api_requested) - { - $app = 'phpgwapi'; - } - - $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class)); - if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data) - { - execmethod($_GET['menuaction']); - unset($app); - unset($class); - unset($method); - unset($invalid_data); - unset($api_requested); - } - else - { - if(!$app || !$class || !$method) - { - if(@is_object($GLOBALS['phpgw']->log)) + + include($settings); + if(isset($template_info)) { + if($template_info['idots2']['windowed']) { - $GLOBALS['phpgw']->log->message(array( - 'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1', - 'p1' => $menuaction, - 'line' => __LINE__, - 'file' => __FILE__ - )); - } + $windowed = true; + + } } - - if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method) + } + + + if($app == 'home' && !$api_requested && !$windowed) + { + if ($GLOBALS['phpgw_info']['server']['force_default_app'] && $GLOBALS['phpgw_info']['server']['force_default_app'] != 'user_choice') { - if(@is_object($GLOBALS['phpgw']->log)) - { - $GLOBALS['phpgw']->log->message(array( - 'text' => 'W-BadmenuactionVariable, attempted to access private method: %1', - 'p1' => $method, - 'line' => __LINE__, - 'file' => __FILE__ - )); - } + $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] = $GLOBALS['phpgw_info']['server']['force_default_app']; + } - if(@is_object($GLOBALS['phpgw']->log)) - { - $GLOBALS['phpgw']->log->commit(); + if($GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] && !$hasupdates) { + + Header('Location: ' . $GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'].'/index.php')); + exit(); } - - $GLOBALS['phpgw']->redirect_link('/home.php'); + else { + Header('Location: ' . $GLOBALS['phpgw']->link('home/index.php')); + } + } - if(!isset($GLOBALS['phpgw_info']['nofooter'])) + if($windowed && $_GET['cd'] == "yes") { + + $GLOBALS['phpgw_info']['flags'] = array( + 'noheader' => False, + 'nonavbar' => False, + 'enable_network_class' => True, + 'enable_contacts_class' => True, + 'enable_nextmatchs_class' => True, + 'currentapp' => 'eGroupWare' + ); + $GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['phpgw']->common->phpgw_footer(); + + } + else { + if($api_requested) + { + + $app = 'phpgwapi'; + } + + $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class)); + if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data) + { + execmethod($_GET['menuaction']); + unset($app); + unset($class); + unset($method); + unset($invalid_data); + unset($api_requested); + } + else + { + if(!$app || !$class || !$method) + { + if(@is_object($GLOBALS['phpgw']->log)) + { + $GLOBALS['phpgw']->log->message(array( + 'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1', + 'p1' => $menuaction, + 'line' => __LINE__, + 'file' => __FILE__ + )); + } + } + + if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method) + { + if(@is_object($GLOBALS['phpgw']->log)) + { + $GLOBALS['phpgw']->log->message(array( + 'text' => 'W-BadmenuactionVariable, attempted to access private method: %1', + 'p1' => $method, + 'line' => __LINE__, + 'file' => __FILE__ + )); + } + } + if(@is_object($GLOBALS['phpgw']->log)) + { + $GLOBALS['phpgw']->log->commit(); + } + + $GLOBALS['phpgw']->redirect_link('home/index.php'); + } + + if(!isset($GLOBALS['phpgw_info']['nofooter'])) + { + $GLOBALS['phpgw']->common->phpgw_footer(); + } } ?> diff --git a/login.php b/login.php index 9485708b65..35517df81f 100755 --- a/login.php +++ b/login.php @@ -13,15 +13,18 @@ /* $Id$ */ + $egw_info = array(); $submit = False; // set to some initial value - $GLOBALS['egw_info'] = array( - 'flags' => array( - 'disable_Template_class' => True, - 'login' => True, - 'currentapp' => 'login', - 'noheader' => True, - ) + $GLOBALS['egw_info']['flags'] = array( + 'disable_Template_class' => True, + 'login' => True, + 'enable_network_class' => True, + 'enable_contacts_class' => True, + 'enable_nextmatchs_class' => True, + 'currentapp' => 'login', + 'noheader' => True + ); if(file_exists('./header.inc.php')) @@ -29,7 +32,7 @@ include('./header.inc.php'); if(function_exists('CreateObject')) { - $GLOBALS['egw']->session = CreateObject('phpgwapi.sessions',array_keys($GLOBALS['egw_domain'])); + $GLOBALS['egw']->session = CreateObject('phpgwapi.sessions'); } else { @@ -44,8 +47,7 @@ } $GLOBALS['egw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['egw_info']['login_template_set']; - $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['egw_info']['server']['template_dir']); - + $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['egw_info']['server']['template_dir']); // read the images from the login-template-set, not the (maybe not even set) users template-set $GLOBALS['egw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['egw_info']['login_template_set']; @@ -67,7 +69,7 @@ exit; } $tmpl->set_file(array('login_form' => 'login.tpl')); - + // !! NOTE !! // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file. // If there is a problem, tell me and I will fix it. (jengo) @@ -76,7 +78,7 @@ /* if($GLOBALS['egw_info']['server']['usecookies'] == True) { - $GLOBALS['egw']->session->phpgw_setcookie('eGroupWareLoginTime', time()); + $GLOBALS['egw']->session->egw_setcookie('eGroupWareLoginTime', time()); } */ /* @@ -151,20 +153,6 @@ { $passwd = $_POST['passwd']; $passwd_type = $_POST['passwd_type']; - - if($GLOBALS['egw_info']['server']['allow_cookie_auth']) - { - $eGW_remember = unserialize(stripslashes($_COOKIE['eGW_remember'])); - - if($eGW_remember['login'] && $eGW_remember['passwd'] && $eGW_remember['passwd_type']) - { - $_SERVER['PHP_AUTH_USER'] = $login = $eGW_remember['login']; - $_SERVER['PHP_AUTH_PW'] = $passwd = $eGW_remember['passwd']; - $passwd_type = $eGW_remember['passwd_type']; - $submit = True; - } - } - } # Apache + mod_ssl style SSL certificate authentication @@ -206,7 +194,6 @@ if(getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' && !isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['SSL_CLIENT_S_DN'])) { - $GLOBALS['phpgw']->session->phpgw_setcookie('eGW_remember'); $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/login.php','cd=5')); } #if(!isset($_COOKIE['eGroupWareLoginTime'])) @@ -219,69 +206,23 @@ { $login = $_POST['login']; } - - //conference - for strings like vinicius@thyamad.com@default , allows - //that user have a login that is his e-mail. (viniciuscb) - $login_parts = explode('@',$login); - $got_login = false; - if (count($login_parts) > 1) + + if(strstr($login,'@') === False && isset($_POST['logindomain'])) { - //Last part of login string, when separated by @, is a domain name - if (array_key_exists(array_pop($login_parts),$GLOBALS['egw_domain'])) - { - $got_login = true; - } + $login .= '@' . $_POST['logindomain']; } - - if (!$got_login) + elseif(!isset($GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']])) { - if(isset($_POST['logindomain'])) - { - $login .= '@' . $_POST['logindomain']; - } - elseif(!isset($GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']])) - { - $login .= '@'.$GLOBALS['egw_info']['server']['default_domain']; - } + $login .= '@'.$GLOBALS['egw_info']['server']['default_domain']; } $GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($login,$passwd,$passwd_type,'u'); if(!isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid']) { - $GLOBALS['phpgw']->session->phpgw_setcookie('eGW_remember'); $GLOBALS['egw']->redirect($GLOBALS['egw_info']['server']['webserver_url'] . '/login.php?cd=' . $GLOBALS['egw']->session->cd_reason); } else { - /* set auth_cookie */ - if($GLOBALS['egw_info']['server']['allow_cookie_auth'] && $_POST['remember_me'] && $_POST['passwd']) - { - switch ($_POST['remember_me']) - { - case '1hour' : - $remember_time = time()+60*60; - break; - case '1day' : - $remember_time = time()+60*60*24; - break; - case '1week' : - $remember_time = time()+60*60*24*7; - break; - case '1month' : - $remember_time = time()+60*60*24*30; - break; - case 'forever' : - default: - $remember_time = 2147483647; - break; - } - $GLOBALS['egw']->session->phpgw_setcookie('eGW_remember',serialize(array( - 'login' => $login, - 'passwd' => $passwd, - 'passwd_type' => $passwd_type)), - $remember_time); - } - if ($_POST['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2}){0,1}$/',$_POST['lang']) && $_POST['lang'] != $GLOBALS['egw_info']['user']['preferences']['common']['lang']) { @@ -292,17 +233,22 @@ { $GLOBALS['egw']->translation->autoload_changed_langfiles(); } - $forward = isset($_GET['phpgw_forward']) ? urldecode($_GET['phpgw_forward']) : @$_POST['phpgw_forward']; + $forward = isset($_GET['egw_forward']) ? urldecode($_GET['egw_forward']) : @$_POST['egw_forward']; if (!$forward) { $extra_vars['cd'] = 'yes'; - $forward = '/home.php'; + if($GLOBALS['egw']->hooks->single('hasUpdates', 'home')) + { + $extra_vars['hasupdates'] = 'yes'; + } + $forward = '/index.php'; } else { list($forward,$extra_vars) = explode('?',$forward,2); } //echo "redirecting to ".$GLOBALS['egw']->link($forward,$extra_vars); + $GLOBALS['egw']->redirect_link($forward,$extra_vars); } } @@ -351,9 +297,7 @@ } } - $tmpl->set_block('login_form','domain_selection'); $domain_select = ' '; - $lang_domain_select = ' '; $last_loginid = $_COOKIE['last_loginid']; if($GLOBALS['egw_info']['server']['show_domain_selectbox']) { @@ -369,8 +313,9 @@ $domain_select .= '>' . $domain_name . "\n"; } $domain_select .= "\n"; - $lang_domain_select = lang('Domain'); - } + $tmpl->set_var('select_domain',$domain_select); +} + elseif($last_loginid !== '') { reset($GLOBALS['egw_domain']); @@ -381,18 +326,10 @@ $last_loginid .= '@' . $_COOKIE['last_domain']; } } - $tmpl->set_var('lang_select_domain',$lang_domain_select); - $tmpl->set_var('select_domain',$domain_select); - - if(!$GLOBALS['egw_info']['server']['show_domain_selectbox']) - { - /* trick to make domain selection disappear */ - $tmpl->set_var('domain_selection',''); - } foreach($_GET as $name => $value) { - if(ereg('phpgw_',$name)) + if(ereg('epgw_',$name)) { $extra_vars .= '&' . $name . '=' . urlencode($value); } @@ -412,73 +349,18 @@ $cnf_reg->read_repository(); $config_reg = $cnf_reg->config_data; - if($config_reg[enable_registration]=='True') + if($config_reg[enable_registration]=='True' && $config_reg[register_link]=='True') { - if ($config_reg[register_link]=='True') - { - $reg_link=' '.lang('Not a user yet? Register now').'
'; - } - if ($config_reg[lostpassword_link]=='True') - { - $lostpw_link=' '.lang('Lost password').'
'; - } - if ($config_reg[lostid_link]=='True') - { - $lostid_link=' '.lang('Lost Login Id').'
'; - } - - /* if at least one option of "registration" is activated display the registration section */ - if($config_reg[register_link]=='True' || $config_reg[lostpassword_link]=='True' || $config_reg[lostid_link]=='True') - { - $tmpl->set_var('register_link',$reg_link); - $tmpl->set_var('lostpassword_link',$lostpw_link); - $tmpl->set_var('lostid_link',$lostid_link) ; - - //$tmpl->set_var('registration_url',$GLOBALS['egw_info']['server']['webserver_url'] . '/registration/'); - } - else - { - /* trick to make registration section disapear */ - $tmpl->set_block('login_form','registration'); - $tmpl->set_var('registration',''); - } + $reg_link=' '.lang('Not a user yet? Register now').'
'; } - /********************************************************\ - * Check if authentification via cookies is allowed * - * and place a time selectbox, how long cookie is valid * - \********************************************************/ - - if($GLOBALS['egw_info']['server']['allow_cookie_auth']) - { - $html = CreateObject('phpgwapi.html'); /* Why the hell was nobody useing this here before??? */ - $tmpl->set_block('login_form','remember_me_selection'); - $tmpl->set_var('lang_remember_me',lang('Remember me')); - $tmpl->set_var('select_remember_me',$html->select('remember_me', 'forever', array( - false => lang('not'), - '1hour' => lang('1 Hour'), - '1day' => lang('1 Day'), - '1week'=> lang('1 Week'), - '1month' => lang('1 Month'), - 'forever' => lang('Forever')),true - )); - } - else - { - /* trick to make remember_me section disapear */ - $tmpl->set_block('login_form','remember_me_selection'); - $tmpl->set_var('remember_me_selection',''); - } - - - // add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv) - header('Content-type: text/html; charset='.$GLOBALS['egw']->translation->charset()); - $GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw_info']['login_template_set']; + $tmpl->set_var('register_link',$reg_link); $tmpl->set_var('charset',$GLOBALS['egw']->translation->charset()); $tmpl->set_var('login_url', $GLOBALS['egw_info']['server']['webserver_url'] . '/login.php' . $extra_vars); - $tmpl->set_var('version',$GLOBALS['egw_info']['server']['versions']['phpgwapi']); + $tmpl->set_var('registration_url',$GLOBALS['egw_info']['server']['webserver_url'] . '/registration/'); + $tmpl->set_var('version',$GLOBALS['egw_info']['server']['versions']['egwapi']); $tmpl->set_var('cd',check_logoutcode($_GET['cd'])); $tmpl->set_var('cookie',$last_loginid); @@ -497,7 +379,7 @@ } else { - $var['logo_file'] = $GLOBALS['egw']->common->image('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo'); + $var['logo_file'] = $GLOBALS['egw']->common->image('egwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo'); } $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; if (substr($var['logo_url'],0,4) != 'http') @@ -507,11 +389,9 @@ $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org'; $tmpl->set_var($var); - - /* language section if activated in site config */ if (@$GLOBALS['egw_info']['server']['login_show_language_selection']) { - $select_lang = ''; $langs = $GLOBALS['egw']->translation->get_installed_langs(); uasort($langs,'strcasecmp'); foreach ($langs as $key => $name) // if we have a translation use it @@ -526,7 +406,6 @@ } else { - /* trick to make language section disapear */ $tmpl->set_block('login_form','language_select'); $tmpl->set_var('language_select',''); } diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index 23a77661bc..6f81953817 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -644,7 +644,7 @@ { $appname = $GLOBALS['egw_info']['flags']['currentapp']; } - if ($appname == 'home' || $appname == 'logout' || $appname == 'login') + if ($appname == 'logout' || $appname == 'login') { $appname = 'phpgwapi'; } @@ -678,7 +678,7 @@ { $appname = $GLOBALS['egw_info']['flags']['currentapp']; } - if ($appname == 'home' || $appname == 'logout' || $appname == 'login' || $appname == 'about') + if ($appname == 'logout' || $appname == 'login' || $appname == 'about') { $appname = 'phpgwapi'; } @@ -779,7 +779,7 @@ { $appname = $GLOBALS['egw_info']['flags']['currentapp']; } - if ($appname == 'home' || $appname == 'logout' || $appname == 'login') + if ($appname == 'logout' || $appname == 'login') { $appname = 'phpgwapi'; } @@ -1108,10 +1108,7 @@ */ function navbar() { - $GLOBALS['egw_info']['navbar']['home']['title'] = 'Home'; - $GLOBALS['egw_info']['navbar']['home']['url'] = $GLOBALS['egw']->link('/home.php'); - $GLOBALS['egw_info']['navbar']['home']['icon'] = $this->image('phpgwapi',Array('home','nonav')); - $GLOBALS['egw_info']['navbar']['home']['icon_hover'] = $this->image_on('phpgwapi',Array('home','nonav'),'-over'); + list($first) = each($GLOBALS['egw_info']['user']['apps']); if(is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin') @@ -1170,7 +1167,7 @@ // } } } - if ($GLOBALS['egw_info']['flags']['currentapp'] == 'home' || $GLOBALS['egw_info']['flags']['currentapp'] == 'preferences' || $GLOBALS['egw_info']['flags']['currentapp'] == 'about') + if ($GLOBALS['egw_info']['flags']['currentapp'] == 'preferences' || $GLOBALS['egw_info']['flags']['currentapp'] == 'about') { $app = $app_title = 'eGroupWare'; } diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index df1552bd76..01a84fb010 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -442,8 +442,7 @@ /*************************************************************************\ * Verify that the users session is still active otherwise kick them out * \*************************************************************************/ - if ($GLOBALS['egw_info']['flags']['currentapp'] != 'home' && - $GLOBALS['egw_info']['flags']['currentapp'] != 'about') + if ($GLOBALS['egw_info']['flags']['currentapp'] != 'about') { // This will need to use ACL in the future if (! $GLOBALS['egw_info']['user']['apps'][$GLOBALS['egw_info']['flags']['currentapp']] || diff --git a/setup/templates/default/head.tpl b/setup/templates/default/head.tpl index 99eee6e389..d485244392 100644 --- a/setup/templates/default/head.tpl +++ b/setup/templates/default/head.tpl @@ -95,7 +95,7 @@ - +
ball{user_login}ball{user_login}