* Check is the registration app is installed, activated * * And if the register link must be placed * \********************************************************/ $cnf_reg = createobject('phpgwapi.config', 'registration'); $cnf_reg->read_repository(); $config_reg = $cnf_reg->config_data; if ($config_reg[enable_registration] == 'True' && $config_reg[register_link] == 'True') { $reg_link = ' <a href="registration/">' . lang('Not a user yet? Register now') . '</a><br/>'; } $GLOBALS['phpgw_info']['server']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; $tmpl->set_var('register_link', $reg_link); $tmpl->set_var('charset', $GLOBALS['phpgw']->translation->charset()); $tmpl->set_var('login_url', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/login.php' . $extra_vars); $tmpl->set_var('registration_url', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/registration/'); $tmpl->set_var('version', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); $tmpl->set_var('cd', check_logoutcode($_GET['cd'])); if ($_GET['cd'] == 97) { /*$GLOBALS['phpgw']->db->query('select data from other_data where lang=\''. $GLOBALS['phpgw_info']['user']['preferences']['common']['lang']. '\' and name = \'privacy_confirmation_text\'');*/ $GLOBALS['phpgw']->db->query('select data from other_data where name = \'privacy_confirmation_text\''); $GLOBALS['phpgw']->db->next_record; $tmpl->set_var('privacy_confirmation', '<tr><td colspan=4><pre>' . $GLOBALS['phpgw']->db->Query_ID->fields['data'] . '</pre></td></tr><tr><td colspan=3 align="right">' . lang('i agree') . ': </td><td align="left"><input name="privacy_confirmed" id="privacy_confirmed" type="checkbox" value="1"/></td></tr>'); $tmpl->set_var('divLoginboxStyle', 'divPrivacyLoginbox'); $tmpl->set_var('divMain', 'divPrivacyMain'); } else { $tmpl->set_var('divLoginboxStyle', 'divLoginbox'); $tmpl->set_var('divMain', 'divMain'); } $tmpl->set_var('cookie', $last_loginid); $tmpl->set_var('lang_username', lang('username'));
/** * displays a login screen * * @param string $extra_vars for login url */ function login_screen($extra_vars) { $tmpl = new Template($GLOBALS['egw_info']['server']['template_dir']); $tmpl->set_file(array('login_form' => 'login.tpl')); $tmpl->set_var('lang_message', $GLOBALS['loginscreenmessage']); $last_loginid = $_COOKIE['last_loginid']; if ($GLOBALS['egw_info']['server']['show_domain_selectbox']) { foreach ($GLOBALS['egw_domain'] as $domain => $data) { $domains[$domain] = $domain; } $tmpl->set_var(array('lang_domain' => lang('domain'), 'select_domain' => html::select('logindomain', $_COOKIE['last_domain'], $domains, true, 'tabindex="2"'))); } else { /* trick to make domain section disapear */ $tmpl->set_block('login_form', 'domain_selection'); $tmpl->set_var('domain_selection', $GLOBALS['egw_info']['user']['domain'] ? html::input_hidden('logindomain', $GLOBALS['egw_info']['user']['domain']) : ''); if ($last_loginid !== '') { reset($GLOBALS['egw_domain']); list($default_domain) = each($GLOBALS['egw_domain']); if ($_COOKIE['last_domain'] != $default_domain && !empty($_COOKIE['last_domain'])) { $last_loginid .= '@' . $_COOKIE['last_domain']; } } } $config_reg = config::read('registration'); if ($config_reg['enable_registration'] == 'True') { if ($config_reg['register_link'] == 'True') { $reg_link = ' <a href="' . $GLOBALS['egw']->link('/registration/index.php', 'lang_code=' . $_GET['lang']) . '">' . lang('Not a user yet? Register now') . '</a><br/>'; } if ($config_reg['lostpassword_link'] == 'True') { $lostpw_link = ' <a href="' . $GLOBALS['egw']->link('/registration/index.php', 'menuaction=registration.uireg.lostpw_step1_ask_login&lang_code=' . $_GET['lang']) . '">' . lang('Lost password') . '</a><br/>'; } if ($config_reg['lostid_link'] == 'True') { $lostid_link = ' <a href="' . $GLOBALS['egw']->link('/registration/index.php', 'menuaction=registration.uireg.lostid_step1_ask_email&lang_code=' . $_GET['lang']) . '">' . lang('Lost Login Id') . '</a><br/>'; } /* 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(array('register_link' => $reg_link, 'lostpassword_link' => $lostpw_link, 'lostid_link' => $lostid_link)); } else { /* trick to make registration section disapear */ $tmpl->set_block('login_form', 'registration'); $tmpl->set_var('registration', ''); } } $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('cd', check_logoutcode($_GET['cd'])); $tmpl->set_var('cookie', $last_loginid); $tmpl->set_var('lang_username', lang('username')); $tmpl->set_var('lang_password', lang('password')); $tmpl->set_var('lang_login', lang('login')); $tmpl->set_var('website_title', $GLOBALS['egw_info']['server']['site_title']); $tmpl->set_var('template_set', $this->template); if (substr($GLOBALS['egw_info']['server']['login_logo_file'], 0, 4) == 'http' || strpos($GLOBALS['egw_info']['server']['login_logo_file'], '//') !== false) { $var['logo_file'] = $GLOBALS['egw_info']['server']['login_logo_file']; } else { $var['logo_file'] = common::image('phpgwapi', $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') { $var['logo_url'] = 'http://' . $var['logo_url']; } $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']) { $tmpl->set_var(array('lang_language' => lang('Language'), 'select_language' => html::select('lang', $GLOBALS['egw_info']['user']['preferences']['common']['lang'], translation::get_installed_langs(), true, 'tabindex="1"'))); } else { $tmpl->set_block('login_form', 'language_select'); $tmpl->set_var('language_select', ''); } /********************************************************\ * 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']) { $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', '', array('' => lang('not'), '1hour' => lang('1 Hour'), '1day' => lang('1 Day'), '1week' => lang('1 Week'), '1month' => lang('1 Month'), 'forever' => lang('Forever')), true, 'tabindex="3"')); } else { /* trick to make remember_me section disapear */ $tmpl->set_block('login_form', 'remember_me_selection'); $tmpl->set_var('remember_me_selection', ''); } $tmpl->set_var('autocomplete', $GLOBALS['egw_info']['server']['autocomplete_login'] ? 'autocomplete="off"' : ''); $GLOBALS['egw']->js->set_onload('document.login_form.login.focus();'); $this->render($tmpl->fp('loginout', 'login_form'), false, false); }
} //FIXME switch to an array $extra_vars = array(); foreach ($_GET as $name => $value) { if (preg_match('/phpgw_/', $name)) { $extra_vars[$name] = urlencode(phpgw::clean_value($value)); } } $cd = 0; if (isset($_GET['cd'])) { $cd = (int) $_GET['cd']; } $tmpl->set_var('login_url', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/property/login.php?' . http_build_query($extra_vars)); $tmpl->set_var('registration_url', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/registration/'); $tmpl->set_var('version', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); $tmpl->set_var('cd', check_logoutcode($cd)); $tmpl->set_var('last_loginid', $last_loginid); $tmpl->set_var('lang_username', lang('username')); $tmpl->set_var('lang_password', lang('password')); $tmpl->set_var('lang_login', lang('login')); $tmpl->set_var('lang_testjs', lang('Your browser does not support javascript and/or css, please use a modern standards compliant browser. If you have disabled either of these features please enable them for this site.')); $tmpl->set_var('website_title', isset($GLOBALS['phpgw_info']['server']['site_title']) ? $GLOBALS['phpgw_info']['server']['site_title'] : 'phpGroupWare'); $tmpl->set_var('template_set', $GLOBALS['phpgw_info']['login_template_set']); // This really should just use the API CSS, which would fix any conflicts if (is_file(PHPGW_SERVER_ROOT . "/property/templates/{$GLOBALS['phpgw_info']['login_template_set']}/css/base.css")) { $base_css = "{$GLOBALS['phpgw_info']['server']['webserver_url']}/property/templates/{$GLOBALS['phpgw_info']['login_template_set']}/css/base.css"; } else { $base_css = "{$GLOBALS['phpgw_info']['server']['webserver_url']}/property/templates/base/css/base.css"; } // ditto if (is_file(PHPGW_SERVER_ROOT . "/property/templates/{$GLOBALS['phpgw_info']['login_template_set']}/css/login.css")) {
break; case 9: clear_session(); return 'User ' . $_REQUEST['login'] . ' was not found'; break; case 10: clear_session(); return 'An email was sent to verify your account'; break; default: return ' '; } } #get the username from whatever's in the username field $tpl = CreateObject('s3dbapi.Template', $GLOBALS['s3db_info']['server']['template_dir']); $tpl->set_var('error', check_logoutcode($_GET['error'])); //$tpl->set_var('login_url', S3DB_URI_BASE . '/login.php' . $extra_vars); $tpl->set_var('login_url', 'login.php' . $extra_vars); $tpl->set_var('registration_url', $GLOBALS['s3db_info']['server']['webserver_url'] . '/registration/'); //$tpl->set_var('version',$GLOBALS['s3db_info']['server']['versions']); if (is_file('version.txt')) { $ver = file_get_contents('version.txt'); } if (!$ver) { $ver = '3.5.3'; } $tpl->set_var('version', $ver); #$tpl->set_var('version','3.5.2'); ##Now for the license information $li = @file_get_contents('license.txt'); if ($li) {