本文整理汇总了PHP中set_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP set_lang函数的具体用法?PHP set_lang怎么用?PHP set_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_lang函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page_admin_menu_edit
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;
}
示例2: page_admin_menu_edit
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;
}
示例3: set_emoncms_lang
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);
}
}
示例4: set_emoncms_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);
}
}
示例5: defined
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
示例6: set_include_path
<?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>
示例7: user_login
/**
* 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();
}
示例8: requires_admin
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");
}
}
示例9: set_lang_by_user
$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;
}
示例10: Smarty
<?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');
示例11: get_lang
/**
* @see set_lang()
* @return string The language available.
*/
function get_lang()
{
return set_lang();
}