} else {
$locale = "en";
}
$_SESSION['userlocale'] = $locale;
}
// if detected locale doesnt have a corresponding langfile , use system default locale
// if, for whatever reason, no system default language is set, default to english as a last resort
if (!file_exists(CL_ROOT . "/language/{$locale}/lng.conf")) {
$locale = $settings['locale'];
$_SESSION['userlocale'] = $locale;
}
// Set locale directory
$template->config_dir = CL_ROOT . "/language/{$locale}/";
//Smarty 3 seems to have a problem with re-compiling the config if the user config is different than the system config.
//this forces a compile of the config.
$template->compileAllConfig('.config', true);
// read language file into PHP array
$langfile = readLangfile($locale);
$template->assign("langfile", $langfile);
$template->assign("locale", $locale);
// css classes for headmenue
// this indicates which of the 3 main stages the user is on
$mainclasses = array("desktop" => "desktop", "profil" => "profil", "admin" => "admin");
$template->assign("mainclasses", $mainclasses);
$they = date("Y");
$them = date("n");
$template->assign("theM", $them);
$template->assign("theY", $they);
// Get the user's projects for the quickfinder in the sidebar
if (isset($userid)) {
$project = new project();