Beispiel #1
0
 static function redirect()
 {
     global $config;
     /* Not account expired or password forced change go to main page */
     new log('security', 'login', '', array(), 'User "' . self::$username . '" logged in successfully.');
     session::global_set('connected', 1);
     $config->checkLdapConfig();
     // check that newly installed plugins have their configuration in the LDAP
     session::global_set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL'));
     header('Location: main.php?global_check=1');
     exit;
 }
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Basic setup, remove eventually registered sessions */
@(require_once "../include/php_setup.inc");
@(require_once "functions.inc");
@(require_once "variables.inc");
session_cache_limiter("private");
session::start();
session::global_set('errorsAlreadyPosted', array());
/* Logged in? Simple security check */
if (!session::global_is_set('ui')) {
    new log("security", "unknown", "", array(), "Error: autocomplete.php called without session");
    header("Location: index.php");
    exit;
}
/* Base completition or filter completition? */
if (isset($_GET['type']) && $_GET['type'] == "base") {
    // Find dn based on name and description
    if (session::is_set("pathMapping") && count($_POST) == 1) {
        $res = "";
        $pathMapping = session::get("pathMapping");
        $search = preg_replace('/"/', '"', current($_POST));
        $config = session::global_get('config');
        foreach ($config->department_info as $dn => $info) {
Beispiel #3
0
        /* If empty, force displaying the index */
        if (empty($_GET['pg'])) {
            $helpobject['currentplug'] = "";
            $helpobject['file'] = "index.html";
        }
        /* Create new helpdir (The path where the requested page is located)*/
        $helpdir = "../doc/core/" . $helpobject['lang'] . "/html/" . preg_replace("/^.*\\//i", "", $helpobject['currentplug']);
        /* If helpdir is empty, force index */
        if (empty($helpobject['currentplug'])) {
            $helpdir = "";
        }
    }
}
$helpdir .= "/";
/* Save current settings */
session::global_set('helpobject', $helpobject);
/* 
 * Display management 
 */
$files = array();
$f = opendir($helpdir);
while ($file = readdir($f)) {
    $files[$file] = $file;
}
/* Some replacements */
$backwardlink = "<a href=\"?pg=%s\"  class=\"maintitlebar\">\n                  <img src='images/back.png' class=\"center\" align=\"middle\" alt=\"" . _("previous") . "\" border=\"0\">\n                 </a>";
$forwardlink = "<a href=\"?pg=%s\"  class=\"maintitlebar\">\n                  <img src='images/forward.png' class=\"center\" align=\"middle\" alt=\"" . _("next") . "\" border=\"0\">\n                 </a>";
$back = $for = "";
if ($helpobject['file'] == "index.html") {
    $back = "&nbsp;";
    $for = sprintf($forwardlink, $prefix . "1" . $suffix);
Beispiel #4
0
$focus .= '</script>';
$smarty->assign("focus", $focus);
/* Set channel if needed */
//TODO: * move all global session calls to global_
//      * create a new channel where needed (mostly management dialogues)
//      * remove regulary created channels when not needed anymore
//      * take a look at external php calls (i.e. get fax, ldif, etc.)
//      * handle aborted sessions (by pressing anachors i.e. Main, Menu, etc.)
//      * check lock removals, is "dn" global or not in this case?
//      * last page request -> global or not?
//      * check that filters are still global
//      * maxC global?
if (isset($_POST['_channel_'])) {
    echo "DEBUG - current channel: " . $_POST['_channel_'];
    $smarty->assign("channel", $_POST['_channel_']);
} else {
    $smarty->assign("channel", "");
}
$smarty->assign("title", "FusionDirectory");
if (class_available('Game')) {
    $smarty->assign('game_screen', Game::run());
} else {
    $smarty->assign('game_screen', '');
}
$display = $smarty->fetch(get_template_path('headers.tpl')) . $smarty->fetch(get_template_path('framework.tpl'));
/* Show page... */
echo $display;
/* Save plist and config */
session::global_set('plist', $plist);
session::global_set('config', $config);
session::set('errorsAlreadyPosted', array());
Beispiel #5
0
            if ($config->get_cfg_value("handleExpiredAccounts") == "TRUE") {
                $expired = $ui->expired_status();
                if ($expired == POSIX_ACCOUNT_EXPIRED) {
                    $message = _("Account locked. Please contact your system administrator!");
                    $smarty->assign('nextfield', 'password');
                    new log("security", "login", "", array(), "Account for user \"{$username}\" has expired");
                    displayLogin();
                    exit;
                }
            }
            /* Not account expired or password forced change go to main page */
            new log("security", "login", "", array(), "User \"{$username}\" logged in successfully");
            session::global_set('connected', 1);
            $config->checkLdapConfig();
            // check that newly installed plugins have their configuration in the LDAP
            session::global_set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL'));
            header("Location: main.php?global_check=1");
            exit;
        }
    }
}
/* Translation of cookie-warning. Whether to display it, is determined by JavaScript */
$smarty->assign("cookies", "<b>" . _("Warning") . ":<\\/b> " . _("Your browser has cookies disabled. Please enable cookies and reload this page before logging in!"));
/* Set focus to the error button if we've an error message */
$focus = "";
if (session::is_set('errors') && session::get('errors') != "") {
    $focus = '<script type="text/javascript">';
    $focus .= 'document.forms[0].error_accept.focus();';
    $focus .= '</script>';
}
$smarty->assign("focus", $focus);
Beispiel #6
0
    $uid = validate($_GET['uid']);
    $smarty->assign('display_username', false);
} elseif (isset($_POST['uid'])) {
    $uid = get_post('uid');
    $smarty->assign('display_username', true);
} else {
    $uid = "";
    $smarty->assign('display_username', true);
}
$current_password = "";
$smarty->assign("changed", false);
/* Got a formular answer, validate and try to log in */
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])) {
    /* Destroy old sessions, they cause a successfull login to relog again ...*/
    if (session::global_is_set('_LAST_PAGE_REQUEST')) {
        session::global_set('_LAST_PAGE_REQUEST', time());
    }
    // Get posted values
    $current_password = get_post('current_password');
    $new_password = get_post('new_password');
    $repeated_password = get_post('new_password_repeated');
    // Get configuration flags for further input checks.
    $check_differ = $config->get_cfg_value("core", "passwordMinDiffer") != "";
    $differ = $config->get_cfg_value("core", "passwordMinDiffer");
    $check_length = $config->get_cfg_value("core", "passwordMinLength") != "";
    $length = $config->get_cfg_value("core", "passwordMinLength");
    // Once an error has occured it is stored here.
    $message = array();
    // Perform GOsa password policy checks
    if (!tests::is_uid($uid)) {
        $message[] = msgPool::invalid(_("Login"));
Beispiel #7
0
}
if (isset($_POST['lang_selected'])) {
    if ($_POST['lang_selected'] != "") {
        session::global_set('lang', $_POST['lang_selected']);
    } else {
        session::global_set('lang', get_browser_language());
    }
}
/* Check for js */
if (!isset($_GET['js']) && !session::global_is_set('js')) {
    echo '<script language="JavaScript" type="text/javascript">';
    echo '  location = "setup.php?js=true";';
    echo '</script>';
    session::global_set('js', FALSE);
} elseif (isset($_GET['js'])) {
    session::global_set('js', TRUE);
}
$lang = session::global_get('lang');
/* Append .UTF-8 to language string if necessary */
if (!preg_match("/utf(-)8\$/i", $lang)) {
    $lang .= ".UTF-8";
}
putenv("LANGUAGE=");
putenv("LANG={$lang}");
setlocale(LC_ALL, $lang);
$GLOBALS['t_language'] = $lang;
$GLOBALS['t_gettext_message_dir'] = $BASE_DIR . '/locale/';
/* Set the text domain as 'messages' */
$domain = 'messages';
bindtextdomain($domain, LOCALE_DIR);
textdomain($domain);
Beispiel #8
0
 $config->make_idepartments();
 session::global_set('config', $config);
 /* Restore filter settings from cookie, if available */
 if ($config->get_cfg_value("core", "storeFilterSettings") == "true") {
     if (isset($_COOKIE['GOsa_Filter_Settings']) || isset($HTTP_COOKIE_VARS['GOsa_Filter_Settings'])) {
         if (isset($_COOKIE['GOsa_Filter_Settings'])) {
             $cookie_all = unserialize(base64_decode($_COOKIE['GOsa_Filter_Settings']));
         } else {
             $cookie_all = unserialize(base64_decode($HTTP_COOKIE_VARS['GOsa_Filter_Settings']));
         }
         if (isset($cookie_all[$ui->dn])) {
             $cookie = $cookie_all[$ui->dn];
             $cookie_vars = array("MultiDialogFilters", "CurrentMainBase", "plug");
             foreach ($cookie_vars as $var) {
                 if (isset($cookie[$var])) {
                     session::global_set($var, $cookie[$var]);
                 }
             }
             if (isset($cookie['plug'])) {
                 $plug = $cookie['plug'];
             }
         }
     }
 }
 /* are we using accountexpiration */
 if ($config->boolValueIsTrue("core", "handleExpiredAccounts")) {
     $expired = ldap_expired_account($config, $ui->dn, $ui->username);
     if ($expired == POSIX_ACCOUNT_EXPIRED) {
         $message = _("Account locked. Please contact your system administrator!");
         $smarty->assign('nextfield', 'password');
         new log("security", "login", "", array(), "Account for user \"{$username}\" has expired");