/* Load plugin */ if (is_file("{$plugin_dir}/main.inc")) { $display = ""; require "{$plugin_dir}/main.inc"; } else { msg_dialog::display(_("Plugin"), sprintf(_("Fatal error: Cannot find any plugin definitions for plugin '%s' ('%s' is not a file)!"), $plug, "{$plugin_dir}/main.inc"), FATAL_ERROR_DIALOG); exit; } /* Print_out last ErrorMessage repeated string. */ $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->assign("contents", $display); $smarty->assign("sessionLifetime", $config->get_cfg_value("sessionLifetime", 60 * 60 * 2)); /* If there's some post, take a look if everything is there... */ if (isset($_POST) && count($_POST)) { if (!isset($_POST['php_c_check'])) { msg_dialog::display(_("Configuration Error"), sprintf(_("Fatal error: not all POST variables have been transfered by PHP - please inform your administrator!")), FATAL_ERROR_DIALOG); exit; } } /* Assign errors to smarty */ if (session::is_set('errors')) { $smarty->assign("errors", session::get('errors')); } if ($error_collector != "") { $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>"); } else { $smarty->assign("php_errors", ""); } /* Set focus to the error button if we've an error message */ $focus = ""; if (session::is_set('errors') && session::get('errors') != "") {
static function casLoginProcess() { global $config, $message, $ui; self::init(); /* Reset error messages */ $message = ''; //~ phpCAS::setDebug(); // Initialize phpCAS phpCAS::client(CAS_VERSION_2_0, $config->get_cfg_value('casHost', 'localhost'), (int) $config->get_cfg_value('casPort', 443), $config->get_cfg_value('casContext', '')); // Set the CA certificate that is the issuer of the cert phpCAS::setCasServerCACert($config->get_cfg_value('casServerCaCertPath')); //~ phpCAS::setNoCasServerValidation(); // force CAS authentication phpCAS::forceAuthentication(); self::$username = phpCAS::getUser(); $ldap = $config->get_ldap_link(); $ldap->cd($config->current['BASE']); $verify_attr = explode(',', $config->get_cfg_value('loginAttribute', 'uid')); $filter = ''; foreach ($verify_attr as $attr) { $filter .= '(' . $attr . '=' . self::$username . ')'; } $ldap->search('(&(|' . $filter . ')(objectClass=inetOrgPerson))'); $attrs = $ldap->fetch(); if ($ldap->count() < 1) { msg_dialog::display(_('Error'), sprintf(_('CAS user "%s" could not be found in the LDAP'), self::$username), FATAL_ERROR_DIALOG); exit; } elseif ($ldap->count() > 1) { msg_dialog::display(_('Error'), sprintf(_('CAS user "%s" match several users in the LDAP'), self::$username), FATAL_ERROR_DIALOG); exit; } $ui = new userinfo($config, $attrs['dn']); $ui->loadACL(); $success = self::runSteps(array('loginAndCheckExpired', 'runSchemaCheck', 'checkForLockingBranch')); if ($success) { /* Everything went well, redirect to main.php */ self::redirect(); } }
function displayLogin() { global $smarty, $message, $config, $ssl, $error_collector, $error_collector_mailto; $lang = session::global_get('lang'); error_reporting(E_ALL | E_STRICT); /* Fill template with required values */ $username = ""; if (isset($_POST["username"])) { $username = trim($_POST['username']); } $smarty->assign('date', gmdate("D, d M Y H:i:s")); $smarty->assign('username', $username); $smarty->assign('personal_img', "geticon.php?context=types&icon=user&size=48"); $smarty->assign('password_img', "geticon.php?context=status&icon=dialog-password&size=48"); $smarty->assign('directory_img', "geticon.php?context=places&icon=network-server&size=48"); $smarty->append('css_files', get_template_path('login.css')); /* Some error to display? */ if (!isset($message)) { $message = ""; } $smarty->assign("message", $message); /* Displasy SSL mode warning? */ if ($ssl != "" && $config->get_cfg_value('warnSSL') == 'TRUE') { $smarty->assign("ssl", _("Warning") . ": <a style=\"color:red;\" href=\"{$ssl}\">" . _("Session is not encrypted!") . "</a>"); } else { $smarty->assign("ssl", ""); } if (!$config->check_session_lifetime()) { $smarty->assign("lifetime", _("Warning") . ": " . _("The session lifetime configured in your fusiondirectory.conf will be overridden by php.ini settings.")); } else { $smarty->assign("lifetime", ""); } /* Generate server list */ $servers = array(); if (isset($_POST['server'])) { $selected = $_POST['server']; } else { $selected = $config->data['MAIN']['DEFAULT']; } foreach ($config->data['LOCATIONS'] as $key => $ignored) { $servers[$key] = $key; } $smarty->assign("server_options", $servers); $smarty->assign("server_id", $selected); /* show login screen */ $smarty->assign("PHPSESSID", session_id()); if (session::is_set('errors')) { $smarty->assign("errors", session::get('errors')); } if ($error_collector != "") { $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>"); } else { $smarty->assign("php_errors", ""); } $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->assign("usePrototype", "false"); $smarty->assign("date", date("l, dS F Y H:i:s O")); $smarty->assign("lang", preg_replace('/_.*$/', '', $lang)); $smarty->assign("rtl", language_is_rtl($lang)); $smarty->display(get_template_path('headers.tpl')); $smarty->assign("version", FD_VERSION); $smarty->display(get_template_path('login.tpl')); exit; }
exit; } $ui = session::get('ui'); $config = session::get('config'); /* Check ACL's */ $dn = ""; if (isset($_GET['n'])) { $dn = base64_decode($_GET['n']); $acl_dn = base64_decode($_GET['d']) . base64_decode($_GET['n']); } elseif (isset($_GET['dn'])) { $dn = base64_decode($_GET['dn']); $acl_dn = base64_decode($_GET['dn']); } $acl = $ui->get_permissions($acl_dn, "ldapmanager/ldif"); if (!preg_match("/r/", $acl)) { msg_dialog::display(_("Permission error"), _("You have no permission to do LDAP exports!"), FATAL_ERROR_DIALOG); exit; } header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); header("Cache-Control: post-check=0, pre-check=0"); header("Content-type: text/plain"); switch ($_GET['ivbb']) { case 2: dump_ldap(2); break; case 3: dump_ldap(3); break;
$params = preg_replace('/^&/', '?', $params); $smarty->assign('params', $params); /* Fill template with required values */ $smarty->assign('date', gmdate("D, d M Y H:i:s")); $smarty->assign('uid', $uid); $smarty->assign('password_img', get_template_path('images/password.png')); /* Displasy SSL mode warning? */ if ($ssl != "" && $config->get_cfg_value("core", "warnSSL") == 'true') { $smarty->assign("ssl", "<b>" . _("Warning") . ":</b> " . _("Session will not be encrypted.") . " <a style=\"color:red;\" href=\"" . htmlentities($ssl) . "\"><b>" . _("Enter SSL session") . "</b></a>!"); } else { $smarty->assign("ssl", ""); } /* show login screen */ $smarty->assign("JS", session::global_get('js')); $smarty->assign("PHPSESSID", session_id()); if (session::is_set('errors')) { $smarty->assign("errors", session::get('errors')); } if ($error_collector != "") { $smarty->assign("php_errors", $error_collector . "</div>"); } else { $smarty->assign("php_errors", ""); } $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); displayPWchanger(); ?> </body> </html> // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
if (is_file("{$plugin_dir}/main.inc")) { $display = ""; require "{$plugin_dir}/main.inc"; } else { msg_dialog::display(_("Plug-in"), sprintf(_("Fatal error: Cannot find any plugin definitions for plugin %s!"), bold($plug)), FATAL_ERROR_DIALOG); exit; } /* Print_out last ErrorMessage repeated string. */ $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->assign("pathMenu", $plist->genPathMenu()); $smarty->assign("contents", $display); $smarty->assign("sessionLifetime", $config->get_cfg_value('core', 'sessionLifetime')); /* If there's some post, take a look if everything is there... */ if (isset($_POST) && count($_POST)) { if (!isset($_POST['php_c_check'])) { msg_dialog::display(_("Warning"), _("Not all POST variables have been transfered by PHP - Returning to main menu!"), INFO_DIALOG); header("Location: main.php"); exit; } } /* Assign erros to smarty */ if (session::is_set('errors')) { $smarty->assign("errors", session::get('errors')); } if ($error_collector != "") { $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>"); } else { $smarty->assign("php_errors", ""); } /* Set focus to the error button if we've an error message */ $focus = "";
/** * Display the login page and exit(). * */ function displayLogin() { global $smarty, $message, $config, $ssl, $error_collector, $BASE_DIR; error_reporting(E_ALL | E_STRICT); /* Check theme compatibility */ $theme = $config->get_cfg_value("core", 'theme'); if (file_exists("{$BASE_DIR}/ihtml/themes/{$theme}/blacklist")) { $blocks = file("{$BASE_DIR}/ihtml/themes/{$theme}/blacklist"); foreach ($blocks as $block) { if (preg_match('/' . preg_quote($block) . '/', $_SERVER['HTTP_USER_AGENT'])) { die(sprintf(_("Your browser (%s) is blacklisted for the current theme!"), $block)); } } } /* Fill template with required values */ $username = ""; if (isset($_POST["username"])) { $username = get_post("username"); } $smarty->assign("title", "GOsa - " . $_SERVER['SERVER_NAME']); $smarty->assign("logo", image(get_template_path("images/logo.png"))); $smarty->assign('date', gmdate("D, d M Y H:i:s")); $smarty->assign('username', $username); $smarty->assign('personal_img', get_template_path('images/login-head.png')); $smarty->assign('password_img', get_template_path('images/password.png')); $smarty->assign('directory_img', get_template_path('images/ldapserver.png')); /* Some error to display? */ if (!isset($message)) { $message = ""; } $smarty->assign("message", $message); /* Displasy SSL mode warning? */ if ($ssl != "" && $config->get_cfg_value("core", 'warnSSL') == 'true') { $smarty->assign("ssl", sprintf(_("This session is not encrypted. Click %s to enter an encrypted session."), "<a href=\"{$ssl}\">" . bold(_("here")) . "</a>")); } else { $smarty->assign("ssl", ""); } if (!$config->check_session_lifetime()) { $smarty->assign("lifetime", _("The configured session lifetime will be overridden by php.ini settings!")); } else { $smarty->assign("lifetime", ""); } /* Generate server list */ $servers = array(); if (isset($_POST['server'])) { $selected = get_post('server'); } else { $selected = $config->data['MAIN']['DEFAULT']; } foreach ($config->data['LOCATIONS'] as $key => $ignored) { $servers[$key] = $key; } $smarty->assign("server_options", $servers); $smarty->assign("server_id", $selected); /* show login screen */ $smarty->assign("PHPSESSID", session_id()); if (session::is_set('errors')) { $smarty->assign("errors", session::get('errors')); } if ($error_collector != "") { $smarty->assign("php_errors", $error_collector . "</div>"); } else { $smarty->assign("php_errors", ""); } $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->display(get_template_path('headers.tpl')); $smarty->assign("version", get_gosa_version()); $smarty->display(get_template_path('login.tpl')); exit; }