Пример #1
0
function FileFolderList($path, $depth = 0, $current = '', $level = 0, $ignore = FALSE)
{
    if ($level == 0 && !@file_exists($path)) {
        return false;
    }
    if (is_dir($path)) {
        $handle = @opendir($path);
        if ($depth == 0 || $level < $depth) {
            while ($filename = @readdir($handle)) {
                if ($filename != '.' && $filename != '..') {
                    $current = @FileFolderList($path . '/' . $filename, $depth, $current, $level + 1);
                }
            }
        }
        @closedir($handle);
        $current[folder][] = $path . '/' . $filename;
    } else {
        if (is_file($path)) {
            $current[file][] = $path;
        }
    }
    return $current;
}
Пример #2
0
function available_languages()
{
    global $aj_buildid;
    $lffl = FileFolderList("inc/lang", 1);
    $languages = $lffl[file];
    if (!empty($languages)) {
        foreach ($languages as $null => $languagefile) {
            $language_data = GetContents($languagefile);
            preg_match("{Languagefile:(.*)}i", $language_data, $language[name]);
            preg_match("{Language Name:(.*)}i", $language_data, $language[localname]);
            preg_match("{Author:(.*)}i", $language_data, $language[author]);
            preg_match("{Author URI:(.*)}i", $language_data, $language[uri]);
            preg_match("{Author Email:(.*)}i", $language_data, $language[email]);
            preg_match("{For Version:(.*)}i", $language_data, $language[version]);
            // Skip plugins designed for other versions
            settype($aj_buildid, "int");
            $testlang = trim($language[version][1]);
            settype($testlang, "int");
            if ($aj_buildid > $testlang) {
                continue;
            }
            $available_languages[] = array(name => trim($language[name][1]), localname => trim($language[localname][1]), author => trim($language[author][1]), uri => trim($language[uri][1]), email => trim($language[email][1]), version => trim($language[version][1]), filename => trim($languagefile));
        }
    } else {
        $available_languages = array();
    }
    return $available_languages;
}
Пример #3
0
# 	$User will be false if no login could be found
# 	User data is accessible via $Userclass->username, etc, or $User[username], etc.
#
#	Now, load the language file chosen or load default one
if ($User->language) {
    include_once KNIFE_PATH . '/lang/' . $User->language;
} else {
    include_once KNIFE_PATH . '/lang/' . $Settings->co[general][defaultlanguage];
}
#
#	We need to display the login form if no good login data is found
if (!$User->username) {
    $moduletitle = SCRIPT_TITLE . " - " . i18n("login_modtitle");
    $menus[0] = "";
    # FIXME: Insert menu filter?
    $i18nfiles = FileFolderList("./lang/", $depth = 1, $current = '', $level = 0);
    $available_languages = available_languages($i18nfiles);
    foreach ($available_languages as $null => $languagedata) {
        unset($langchecked);
        if ($languagedata[file] == $_COOKIE[allegory_language]) {
            $langchecked = 'checked="checked" ';
        }
        $lang_input_fields .= '<input id="ls' . $languagedata[file] . '" type="radio" name="language" value="' . $languagedata[file] . '" ' . $langchecked . '/> 
		<label for="ls' . $languagedata[file] . '">' . $languagedata[langinternational] . ' ( ' . $languagedata[langnational] . ' )</label><br />';
    }
    $main_content = '
	<div id="login_wrapper">
		<div class="div_normal">
		<fieldset>
		<legend>' . i18n("login_Login") . '</legend><p>' . i18n("login_AuthReq") . '</p>
	<form id="login" method="post" action="">