function page_admin_menu_edit($parent_id = "", $act = "", $id = "") { requires_admin(); set_lang("other"); use_layout("admin"); if (!$parent_id) { $parent_id = 0; } $o = ""; if ($act == "del") { $rec = db_object_get("menu", $id); if ($rec->fixed == 'Y') { $act = "-"; $o .= '<script>alert("Эту запись нельзя удалить.")</script>'; } } global $tables; $tables['menu']['fields'][] = "title"; $tables['menu']['fields'][] = "link"; $tables['menu']['weight'] = true; if ($parent_id) { $o .= menu_path($parent_id); } global $table_edit_props; $table_edit_props->use_rename_icon_for_edit = true; $o .= table_edit("menu", "admin/menu/edit/{$parent_id}", $act, $id, "parent_id", $parent_id, "", "on_menu"); $o .= "<style> input[type='submit'] { padding: 5px 10px; width: auto;}\r\n\t input{ width:400px; }\r\n\t</style>"; return $o; }
function page_admin_menu_edit($parent_id = "", $act = "", $id = "") { requires_admin(); set_lang("other"); use_template("admin"); if (!$parent_id) { $parent_id = 0; } $o = ""; if ($act == "del") { $rec = db_object_get("menu", $id); if ($rec->fixed == 'Y') { $act = "-"; $o .= '<script>alert("Эту запись нельзя удалить.")</script>'; } } global $tables; $tables['menu']['fields'][] = "title"; $tables['menu']['fields'][] = "link"; $tables['menu']['weight'] = true; if ($parent_id) { $o .= menu_path($parent_id); } $o .= table_edit("menu", "admin/menu/edit/{$parent_id}", $act, $id, "parent_id", $parent_id, "", "on_menu"); return $o; }
function set_emoncms_lang($lang) { // If no language defined use the language browser if ($lang == '') { set_lang(lang_http_accept()); } else { set_lang_by_user($lang); } }
function set_emoncms_lang($userid) { // Get language from database user $lang = get_user_lang($userid); // If no language defined use the language browser if ($lang == '') { set_lang(lang_http_accept()); } else { set_lang_by_user($lang); } }
All Emoncms code is released under the GNU Affero General Public License. See COPYRIGHT.txt and LICENSE.txt. --------------------------------------------------------------------- Emoncms - open source energy visualisation Part of the OpenEnergyMonitor project: http://openenergymonitor.org */ // no direct access defined('EMONCMS_EXEC') or die('Restricted access'); global $path, $session, $allowusersregister; require_once 'Includes/locale.php'; // gets the accepted language browser list $accepted_languages = lang_http_accept(); // set to the apropiated language set_lang($accepted_languages); ?> <div style="margin: 0px auto; max-width:392px; padding:10px;"> <div style="max-width:392px; margin-right:20px; padding-top:45px; padding-bottom:15px; color: #888;"> <img style="margin:12px;" src="<?php echo get_theme_path(); ?> /emoncms_logo.png" /> </div> <div class="login-container"> <div style="text-align:left"> <form class="well" action="" method="post"> <p> <?php
<?php set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); include_once "aur.inc.php"; set_lang(); check_sid(); include_once 'stats.inc.php'; html_header(__("Home")); ?> <div id="content-left-wrapper"> <div id="content-left"> <div id="intro" class="box"> <h2>AUR <?php echo __("Home"); ?> </h2> <p> <?php echo __('Welcome to the AUR! Please read the %sAUR User Guidelines%s and %sAUR TU Guidelines%s for more information.', '<a href="https://wiki.archlinux.org/index.php/AUR_User_Guidelines">', '</a>', '<a href="https://wiki.archlinux.org/index.php/AUR_Trusted_User_Guidelines">', '</a>'); ?> <?php echo __('Contributed PKGBUILDs %smust%s conform to the %sArch Packaging Standards%s otherwise they will be deleted!', '<strong>', '</strong>', '<a href="https://wiki.archlinux.org/index.php/Arch_Packaging_Standards">', '</a>'); ?> <?php echo __('Remember to vote for your favourite packages!'); ?> <?php echo __('Some packages may be provided as binaries in [community].'); ?> </p>
/** * Effectively logs the user in * @param string $login * @param string $passwd */ function user_login($login, $passwd) { global $input; global $template_folder; global $error; global $ezplayer_url; // 0) Sanity checks if (empty($login) || empty($passwd)) { $error = template_get_message('empty_username_password', get_lang()); view_login_form(); die; } $login_parts = explode("/", $login); // checks if runas if (count($login_parts) == 2) { if (!file_exists('admin.inc')) { $error = "Not admin. runas login failed"; view_login_form(); die; } include 'admin.inc'; //file containing an assoc array of admin users if (!isset($admin[$login_parts[0]])) { $error = "Not admin. runas login failed"; view_login_form(); die; } $_SESSION['user_is_admin'] = true; $_SESSION['user_runas'] = true; } else { if (file_exists('admin.inc')) { include 'admin.inc'; //file containing an assoc array of admin users if (isset($admin[$login])) { $_SESSION['user_is_admin'] = true; } } } $res = checkauth(strtolower($login), $passwd); if (!$res) { $error = checkauth_last_error(); view_login_form(); die; } // 1) Initializing session vars $_SESSION['ezplayer_logged'] = "user_logged"; // "boolean" stating that we're logged $_SESSION['user_login'] = $res['login']; $_SESSION['user_real_login'] = $res['real_login']; $_SESSION['user_full_name'] = $res['full_name']; $_SESSION['user_email'] = $res['email']; $_SESSION['admin_enabled'] = false; //check flash plugin or GET parameter no_flash if (!isset($_SESSION['has_flash'])) { //no noflash param when login //check flash plugin if ($input['has_flash'] == 'N') { $_SESSION['has_flash'] = false; } else { $_SESSION['has_flash'] = true; } } // 2) Initializing the ACLs acl_init($login); // 3) Setting correct language set_lang($input['lang']); // 4) Resetting the template path to the one of the language chosen template_repository_path($template_folder . get_lang()); // 5) Logging the login operation log_append("login"); log_append("user's browser : " . $_SESSION['browser_full']); // lvl, action, browser_name, browser_version, user_os, browser_full_info trace_append(array("1", "login", $_SESSION['browser_name'], $_SESSION['browser_version'], $_SESSION['user_os'], $_SESSION['browser_full'], session_id())); // 6) Displaying the page // view_main(); if (count($_SESSION['first_input']) > 0) { $ezplayer_url .= '/index.php?'; } foreach ($_SESSION['first_input'] as $key => $value) { $ezplayer_url .= "{$key}={$value}&"; } header("Location: " . $ezplayer_url); load_page(); }
function requires_admin() { global $apptitle; if (admin()) { set_lang("ru"); return true; } else { $pass = db_result(db_query("SELECT admin_pass FROM settings")); if ($pass == "") { session_set("admin", true); return true; } redir("admin/login"); } }
$lang = 'fr_FR'; break; case 'it': $lang = 'it_IT'; break; case 'nl': $lang = 'nl_NL'; break; //case 'nl': $lang='nl_BE'; break; } set_lang_by_user($lang); } } // get browser language. //to do: get user config set_lang(lang_http_accept()); // Loaded like JS File, so we need to specify domain for getText translation $domain = "messages"; bindtextdomain($domain, "locale"); bind_textdomain_codeset($domain, 'UTF-8'); textdomain($domain); ?> // Create a Javascript associative array who contain all sentences from module var LANG_JS = new Array(); function _Tr(key) { // will return the default value if LANG_JS[key] is not defined. return LANG_JS[key] || key; }
<?php require_once 'inc/functions.php'; require 'inc/languages.php'; require 'Smarty.class.php'; $smarty = new Smarty(); $current_lang = set_lang(); $smarty->assign('lang', $lang[$current_lang]); $loaded_ext = get_loaded_extensions(); foreach ($loaded_ext as $ext) { $extensions .= $ext . ', '; } $smarty->assign('extensions', $extensions); if (extension_loaded('mysqli') && @mysqli_connect('localhost', 'root', 'vertrigo')) { $smarty->assign('password_status', false); } else { $smarty->assign('password_status', true); } $smarty->assign('php_version', phpversion()); $smarty->display('index.tpl');
/** * @see set_lang() * @return string The language available. */ function get_lang() { return set_lang(); }
/** * Effectively logs the user in * @param string $login * @param string $passwd */ function user_login($login, $passwd) { global $input; global $template_folder; global $error; global $ezadmin_url; // 0) Sanity checks if (empty($login) || empty($passwd)) { $error = template_get_message('empty_username_password', get_lang()); view_login_form(); die; } $login_parts = explode("/", $login); // checks if runas if (count($login_parts) >= 2) { $error = "No runas here !"; view_login_form(); die; } if (!file_exists('admin.inc')) { $error = "User not authorized"; view_login_form(); die; } include 'admin.inc'; //file containing an assoc array of admin users if (!isset($users[$login_parts[0]])) { $error = "User not authorized"; view_login_form(); die; } $res = checkauth(strtolower($login), $passwd); if (!$res) { $error = checkauth_last_error(); view_login_form(); die; } // 1) Initializing session vars $_SESSION['podcastcours_logged'] = "LEtimin"; // "boolean" stating that we're logged $_SESSION['user_login'] = $login; $_SESSION['user_real_login'] = $res['real_login']; $_SESSION['user_full_name'] = $res['full_name']; $_SESSION['user_email'] = $res['email']; // 3) Setting correct language set_lang($input['lang']); // 4) Resetting the template path to the one of the language chosen template_repository_path($template_folder . get_lang()); // 5) Logging the login operation log_append("login"); // 6) Displaying the page header("Location: " . $ezadmin_url); view_main(); }
/** * Effectively logs the user in * @param string $login * @param string $passwd */ function user_login($login, $passwd) { global $input; global $template_folder; global $error; global $ezmanager_url; // 0) Sanity checks if (empty($login) || empty($passwd)) { $error = template_get_message('empty_username_password', get_lang()); view_login_form(); die; } $login_parts = explode("/", $login); // checks if runas if (count($login_parts) == 2) { if (!file_exists('admin.inc')) { $error = "Not admin. runas login failed"; view_login_form(); die; } include 'admin.inc'; //file containing an assoc array of admin users if (!isset($admin[$login_parts[0]])) { $error = "Not admin. runas login failed"; view_login_form(); die; } } $res = checkauth(strtolower($login), $passwd); if (!$res) { $error = checkauth_last_error(); view_login_form(); die; } // 1) Initializing session vars $_SESSION['podman_logged'] = "LEtimin"; // "boolean" stating that we're logged $_SESSION['user_login'] = $res['login']; $_SESSION['user_real_login'] = $res['real_login']; $_SESSION['user_full_name'] = $res['full_name']; $_SESSION['user_email'] = $res['email']; //check flash plugin or GET parameter no_flash if (!isset($_SESSION['has_flash'])) { //no noflash param when login //check flash plugin if ($input['has_flash'] == 'N') { $_SESSION['has_flash'] = false; } else { $_SESSION['has_flash'] = true; } } // 2) Initializing the ACLs acl_init($login); // 3) Setting correct language set_lang($input['lang']); if (count(acl_authorized_albums_list()) == 0) { error_print_message(template_get_message('not_registered', get_lang()), false); log_append('warning', $res['login'] . ' tried to access ezmanager but doesn\'t have permission to manage any album.'); session_destroy(); view_login_form(); die; } // 4) Resetting the template path to the one of the language chosen template_repository_path($template_folder . get_lang()); // 5) Logging the login operation log_append("login"); // 6) Displaying the page header("Location: " . $ezmanager_url); view_main(); }