public function print_field($field, $data, $object) { if (isset($data->id)) { $slugs = self::get_slugs($field, $data, $object); if (isset($field['format'])) { $format = strval($field['format']); } else { $format = '[slug]'; } if (count($slugs)) { ?> <div class="input"> <label<?php echo isset($field['invalid']) && $field['invalid'] ? ' class="invalid"' : ''; ?> ><?php echo isset($field['label']) ? $field['label'] : ucwords(preg_replace("/[^\\w-]+/i", " ", $field['name'])); ?> </label> <fieldset> <?php foreach ($slugs as $language => $slug) { if (!is_string($language)) { $language = $object_language; } set_language($language); $url = str_replace('[slug]', $slug, $format); $url = url(str_replace('[id]', $data->id, $url)); ?> <div><a class="button thin" href="<?php echo $url; ?> " target="_blank"><?php echo $url; ?> </a></div> <?php } $languages = array_keys(languages()); set_language(reset($languages)); ?> </fieldset> </div> <?php } } }
function multilingual_addon_import($post_id, $data, $import_options, $articleData) { global $multilingual_import_addon; $language = $data['multilingual_import_language']; $common_id = $data['multilingual_import_common_id']; if ($multilingual_import_addon->can_update_meta('_multilingual_entry_language', $import_options)) { echo 'Updating META'; update_post_meta($post_id, '_multilingual_entry_language', $language); } if ($multilingual_import_addon->can_update_meta('_multilingual_entry_common_id', $import_options)) { update_post_meta($post_id, '_multilingual_entry_common_id', $common_id); } set_language($post_id, $language, $common_id, $articleData['post_name']); // TODO Save current language and restore it at the end of the entry import... //$current_language = $sitepress->get_current_language(); global $sitepress; // We do this so taxonomies are imported in their correct language. $sitepress->switch_lang($language); }
$inputData = array("localeset" => form_sanitizer($_POST['localeset'], fusion_get_settings('locale'), "localeset"), "old_localeset" => form_sanitizer($_POST['old_localeset'], fusion_get_settings('locale'), "old_localeset"), "enabled_languages" => isset($_POST['enabled_languages']) ? form_sanitizer($_POST['enabled_languages'], "", "enabled_languages") : fusion_get_settings('locale'), "old_enabled_languages" => form_sanitizer($_POST['old_enabled_languages'], "", "old_enabled_languages")); // format both to . if (empty($inputData['enabled_languages'])) { $defender->stop(); addNotice("danger", "You need to enable at least one language"); } if (defender::safe()) { $inArray_SQLCond = array("enabled_languages" => str_replace(".", "','", $inputData['enabled_languages']), "old_enabled_languages" => str_replace(".", "','", $inputData['old_enabled_languages'])); $core_SQLVal = array("enabled_languages" => str_replace(",", ".", $inputData['enabled_languages']), "old_enabled_languages" => str_replace(",", ".", $inputData['old_enabled_languages'])); $array = array("old_enabled_languages" => explode(".", $inputData['old_enabled_languages']), "enabled_languages" => explode(",", $inputData['enabled_languages'])); // update current system locale dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . $inputData['localeset'] . "' WHERE settings_name='locale'"); // update on the new system locale. // Switch visible language to localeset if ($inputData['old_localeset'] !== $inputData['localeset']) { set_language($inputData['localeset']); } /** * Part II : Insert and Purge actions when add or drop languages */ if ($inputData['old_enabled_languages'] != $inputData['enabled_languages']) { // language family have changed $added_language = array_diff($array['enabled_languages'], $array['old_enabled_languages']); $removed_language = array_diff($array['old_enabled_languages'], $array['enabled_languages']); dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . $core_SQLVal['enabled_languages'] . "' WHERE settings_name='enabled_languages'"); dbquery("UPDATE " . DB_PANELS . " SET panel_languages='" . $core_SQLVal['enabled_languages'] . "'"); dbquery("UPDATE " . DB_USERS . " SET user_language='Default' WHERE user_language NOT IN ('" . $inArray_SQLCond['enabled_languages'] . "')"); if (!empty($added_language)) { foreach ($added_language as $language) { /** * Email templates
if (file_exists($outputfile)) { ?> <div id="errorheader"><?php echo $lang["setup-alreadyconfigured"]; ?> </div> </body> </html> <?php die(0); } if (!isset($_REQUEST['submit'])) { //No Form Submission, lets setup some defaults if (!isset($storagedir) | $storagedir == "") { $storagedir = dirname(__FILE__) . "/../filestore"; $lang = set_language($defaultlanguage); # Updates $lang with $storagedir which is used in some strings. } if (isset($_SERVER['HTTP_HOST'])) { $baseurl = 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strlen($_SERVER['PHP_SELF']) - 16); } else { $baseurl = 'http://' . php_uname('n'); } //Set the baseurl to the machine hostname. //Generate default random keys. $scramble_key = generatePassword(); $spider_password = generatePassword(); $api_scramble_key = generatePassword(); //Setup search paths (Currently only Linux/Mac OS X) $os = php_uname('s'); if ($os == 'Linux' || $os == "Darwin") {
function connexion_empr() { global $dbh, $msg, $opac_duration_session_auth; global $time_expired, $erreur_session, $login, $password; global $auth_ok, $lang, $code, $emprlogin; global $first_log; global $erreur_connexion; global $opac_opac_view_activate, $pmb_opac_view_class, $opac_view_class; global $opac_default_style; //a positionner si authentification exterieure global $ext_auth, $empty_pwd; global $base_path, $class_path; global $cms_build_activate; //a positionner si les vues OPAC sont activées global $include_path; $erreur_connexion = 0; $log_ok = 0; if (!$_SESSION["user_code"]) { if (!get_magic_quotes_gpc()) { $p_login = addslashes($_POST['login']); } else { $p_login = $_POST['login']; } if ($time_expired == 0) { // début if ($time_expired==0) 1 //Si pas de session en cours, vérification du login $verif_query = "SELECT id_empr, empr_cb, empr_nom, empr_prenom, empr_password, empr_lang, empr_date_expiration<sysdate() as isexp, empr_login, empr_ldap,empr_location, allow_opac \n\t\t\t\t\tFROM empr\n\t\t\t\t\tJOIN empr_statut ON empr_statut=idstatut\n\t\t\t\t\tWHERE empr_login='******'"; $verif_result = mysql_query($verif_query); // récupération des valeurs MySQL du lecteur et injection dans les variables while ($verif_line = mysql_fetch_array($verif_result)) { $verif_empr_cb = $verif_line['empr_cb']; $verif_empr_login = $verif_line['empr_login']; $verif_empr_ldap = $verif_line['empr_ldap']; $verif_empr_password = $verif_line['empr_password']; $verif_lang = $verif_line['empr_lang'] ? $verif_line['empr_lang'] : "fr_FR"; $verif_id_empr = $verif_line['id_empr']; $verif_isexp = $verif_line['isexp']; $verif_opac = $verif_line['allow_opac']; $empr_location = $verif_line['empr_location']; } $auth_ok = 0; if ($verif_opac) { if ($ext_auth) { $auth_ok = $ext_auth; } elseif ($code) { $auth_ok = connexion_auto(); } elseif ($verif_empr_ldap) { $auth_ok = auth_ldap($p_login, $password); } else { $auth_ok = ($empty_pwd || !$empty_pwd && $verif_empr_password) && $verif_empr_password == stripslashes($password) && $verif_empr_login != ""; } //auth standard } if ($auth_ok) { // début if ($auth_ok) 1 //Si mot de passe correct, enregistrement dans la session de l'utilisateur $log_ok = 1; if ($_SESSION["cms_build_activate"]) { $cms_build_activate = 1; } if ($_SESSION["build_id_version"]) { $build_id_version = $_SESSION["build_id_version"]; } //Récupération de l'environnement précédent $requete = "select session from opac_sessions where empr_id=" . $verif_id_empr; $res_session = mysql_query($requete); if (@mysql_num_rows($res_session)) { $temp_session = unserialize(mysql_result($res_session, 0, 0)); $_SESSION = $temp_session; } else { $_SESSION = array(); } $_SESSION["cms_build_activate"] = $cms_build_activate; $_SESSION["build_id_version"] = $build_id_version; if (!$code) { $_SESSION["connexion_empr_auto"] = 0; } $_SESSION["user_code"] = $verif_empr_login; $_SESSION["id_empr_session"] = $verif_id_empr; $_SESSION["connect_time"] = time(); $_SESSION["lang"] = $verif_lang; $_SESSION["empr_location"] = $empr_location; $req = "select location_libelle from docs_location where idlocation='" . $_SESSION["empr_location"] . "'"; $_SESSION["empr_location_libelle"] = mysql_result(mysql_query($req, $dbh), 0, 0); // change language and charset after login $lang = $_SESSION["lang"]; set_language($lang); if (!$verif_isexp) { recupere_pref_droits($_SESSION["user_code"]); $_SESSION["user_expired"] = $verif_isexp; } else { recupere_pref_droits($_SESSION["user_code"], 1); $_SESSION["user_expired"] = $verif_isexp; echo "<script>alert(\"" . $msg["empr_expire"] . "\");</script>"; $erreur_connexion = 1; } if ($opac_opac_view_activate) { $_SESSION["opac_view"] = 0; $_SESSION['opac_view_query'] = 0; if (!$pmb_opac_view_class) { $pmb_opac_view_class = "opac_view"; } require_once $base_path . "/classes/" . $pmb_opac_view_class . ".class.php"; $opac_view_class = new $pmb_opac_view_class($_SESSION["opac_view"], $_SESSION["id_empr_session"]); if ($opac_view_class->id) { $opac_view_class->set_parameters(); $opac_view_filter_class = $opac_view_class->opac_filters; $_SESSION["opac_view"] = $opac_view_class->id; if (!$opac_view_class->opac_view_wo_query) { $_SESSION['opac_view_query'] = 1; } } else { $_SESSION["opac_view"] = 0; } $css = $_SESSION["css"] = $opac_default_style; } $first_log = true; } else { //Sinon, on détruit la session créée if ($_SESSION["cms_build_activate"]) { $cms_build_activate = 1; } if ($_SESSION["build_id_version"]) { $build_id_version = $_SESSION["build_id_version"]; } @session_destroy(); if ($cms_build_activate) { session_start(); $_SESSION["cms_build_activate"] = $cms_build_activate; $_SESSION["build_id_version"] = $build_id_version; } if ($verif_empr_password != stripslashes($password) || $verif_empr_login == "" || $verif_empr_ldap || $code) { // la saisie du mot de passe ou du login est incorrect ou erreur de connexion avec le ldap $erreur_session = $empr_erreur_header; $erreur_session .= $msg["empr_type_card_number"] . "<br />"; $erreur_session .= $empr_erreur_footer; $erreur_connexion = 3; } elseif ($verif_isexp) { //Si l'abonnement est expiré echo "<script>alert(\"" . $msg["empr_expire"] . "\");</script>"; $erreur_connexion = 1; } elseif (!$verif_opac) { //Si la connexion à l'opac est interdite echo "<script>alert(\"" . $msg["empr_connexion_interdite"] . "\");</script>"; $erreur_connexion = 2; } else { // Autre cas au cas où... $erreur_session = $empr_erreur_header; $erreur_session .= $msg["empr_type_card_number"] . "<br />"; $erreur_session .= $empr_erreur_footer; $erreur_connexion = 3; } $log_ok = 0; $time_expired = 0; } // fin if ($auth_ok) 1 } else { // la session a expiré, on va le lui dire echo "<script>alert(\"" . sprintf($msg["session_expired"], round($opac_duration_session_auth / 60)) . "\");</script>"; } } else { //Si session en cours, pas de problème... $log_ok = 1; $login = $_SESSION["user_code"]; if ($_SESSION["user_expired"]) { recupere_pref_droits($login, 1); } else { recupere_pref_droits($login); } if (!$code) { $_SESSION["connexion_empr_auto"] = 0; } } // pour visualiser une notice issue de DSI avec une connexion auto if ($_SESSION["connexion_empr_auto"] && $log_ok) { global $connexion_empr_auto, $tab, $lvl; $connexion_empr_auto = 1; if (!$code) { if (!$tab) { $tab = "dsi"; } if (!$lvl) { $lvl = "bannette"; } } } return $log_ok; }
$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']); $_POST['timeservers'] = trim($_POST['timeservers']); foreach (explode(' ', $_POST['timeservers']) as $ts) { if (!is_domain($ts)) { $input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'."); } } if (!$input_errors) { update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']); update_if_changed("domain", $config['system']['domain'], $_POST['domain']); update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']); update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers'])); update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']); if ($_POST['language'] && $_POST['language'] != $config['system']['language']) { $config['system']['language'] = $_POST['language']; set_language($config['system']['language']); } /* pfSense themes */ if (!$g['disablethemeselection']) { update_if_changed("System Theme", $config['theme'], $_POST['theme']); } /* XXX - billm: these still need updating after figuring out how to check if they actually changed */ $olddnsservers = $config['system']['dnsserver']; unset($config['system']['dnsserver']); if ($_POST['dns1']) { $config['system']['dnsserver'][] = $_POST['dns1']; } if ($_POST['dns2']) { $config['system']['dnsserver'][] = $_POST['dns2']; } if ($_POST['dns3']) {
// $Id: localisation.inc.php,v 1.13 2007-03-10 10:05:50 touraine37 Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } if (!defined('LOCALISATION_INC')) { define('LOCALISATION_INC', 1); // récupération classe de gestion de fichier XML require_once $base_path . '/classes/XMLlist.class.php'; // variables $msg = ""; if (!$lang) { $lang = $opac_default_lang; } if ($lang == "ar") { $fichier = "./styles/" . $css . "rtl/" . $css . "rtl.css"; if (@fopen($fichier, "r")) { $css = $css . "rtl"; } } function set_language($lang) { global $msg; global $base_path; $messages = new XMLlist($base_path . "/includes/messages/{$lang}.xml", 0); $messages->analyser(); $msg = $messages->table; } // localisation set_language($lang); } // fin de définition de LOCALISATION_INC
/** * This is the User Control Panel Object. * * License for all code of this FreePBX module can be found in the license file inside the module directory * Copyright 2006-2014 Schmooze Com Inc. */ ob_start(); $bootstrap_settings = array(); $bootstrap_settings['freepbx_auth'] = false; //TODO: We need to make sure security is 100%! $restrict_mods = true; //Set to true so that we just load framework and the page wont bomb out because we have no session if (!@(include_once getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { include_once '/etc/asterisk/freepbx.conf'; } $lang = function_exists('set_language') ? set_language() : 'en_US'; include dirname(__FILE__) . '/includes/bootstrap.php'; try { $ucp = \UCP\UCP::create(); $ucp->Modgettext->textdomain("ucp"); } catch (\Exception $e) { if (isset($_REQUEST['quietmode'])) { echo json_encode(array("status" => false, "message" => "UCP is disabled")); } else { echo "<html><head><title>UCP</title></head><body style='background-color: rgb(211, 234, 255);'><div style='border-radius: 5px;border: 1px solid black;text-align: center;padding: 5px;width: 90%;margin: auto;left: 0px;right: 0px;background-color: rgba(53, 77, 255, 0.18);'>" . _('UCP is currently disabled. Please talk to your system Administrator') . "</div></body></html>"; } die; } ob_end_clean(); $user = $ucp->User->getUser(); if (isset($_REQUEST['logout']) && $user) {
//Check if config file already exists and die with an error if it does. if (file_exists($outputfile)){ ?> <div id="errorheader"><?php echo $lang["setup-alreadyconfigured"];?></div> </body> </html> <?php die(0); } if (!(isset($_REQUEST['submit']))){ //No Form Submission, lets setup some defaults if (!isset($storagedir) | $storagedir=="") { $storagedir = dirname(__FILE__)."/../filestore"; $lang = set_language($defaultlanguage); # Updates $lang with $storagedir which is used in some strings. } if (isset($_SERVER['HTTP_HOST'])) $baseurl = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'],0,strlen($_SERVER['PHP_SELF'])-16); else $baseurl = 'http://'.php_uname('n'); //Set the baseurl to the machine hostname. //Generate default random keys. $scramble_key = generatePassword(); $spider_password = generatePassword(); $api_scramble_key = generatePassword(); //Setup search paths (Currently only Linux/Mac OS X) $os=php_uname('s'); if($os=='Linux' || $os=="Darwin"){ $search_paths[]='/usr/bin'; $search_paths[]='/sw/bin';
function configurations() { return array('title' => 'Some name', 'lang' => set_language(), 'style' => 'styles/style.css', 'scripts' => array('js/jquery-1.8.1.min.js', 'js/awesome.js'), 'mailheader' => '[SSome header]', 'domaine' => 'some-domaine.com', 'sub-domaine' => 'www', 'url' => 'https://', 'cookie_salt' => '$5$rounds=2513$A3xbn9p2glIH1xTbYnctoVfIRY64lJLZ$', 'cookie_exp' => 90, 'user_lenght' => '50', 'password_lenght' => '50', 'projectname_lenght' => '50', 'version_lenght' => '20', 'upload_dir' => 'upload', 'lang_available' => array('fr' => 'Français', 'en' => 'English'), 'bugs' => array('Open' => array('Unconfirmed', 'Assigned'), 'Closed' => array('Fixed', 'WontFix', 'Invalid')), 'os' => array('Windows', 'Mac', 'Linux', 'Android'), 'arch' => array('x84', 'x64', 'arm'), 'base' => 'some_base', 'user' => 'users', 'project' => 'projects', 'bug' => 'bugs', 'inc' => 'inc'); }
echo set_language($data['forum_language']); } } } elseif (preg_match('/index.php/i', $_SERVER['PHP_SELF']) && (isset($_GET['viewforum']) && isnum($_GET['forum_id'])) && multilang_table("FO")) { $data = dbarray(dbquery("SELECT forum_cat, forum_branch, forum_language FROM " . DB_FORUMS . " WHERE forum_id='" . stripinput($_GET['forum_id']) . "'")); if ($data['forum_language'] . " != " . LANGUAGE) { echo set_language($data['forum_language']); } } elseif (preg_match('/photogallery.php/i', $_SERVER['PHP_SELF']) || preg_match('|/gallery/photo/([0-9]+)/|', $_SERVER['REQUEST_URI'], $matches) && multilang_table("PG")) { if (isset($_GET['photo_id']) && isnum($_GET['photo_id']) || !empty($matches) && $matches['1'] > 0) { $data = dbarray(dbquery("SELECT pha.album_id, pha.album_language, ph.album_id\n\t\t\t\t\t\t\t\t\tFROM " . DB_PHOTO_ALBUMS . " pha\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB_PHOTOS . " ph ON pha.album_id = ph.album_id\n\t\t\t\t\t\t\t\t\tWHERE ph.photo_id='" . (isset($_GET['photo_id']) ? $_GET['photo_id'] : $matches['1']) . "'\n\t\t\t\t\t\t\t\t\tGROUP BY ph.photo_id")); if ($data['album_language'] . " != " . LANGUAGE) { echo set_language($data['album_language']); } } } elseif (preg_match('/photogallery.php/i', $_SERVER['PHP_SELF']) || preg_match('|/gallery/([0-9]+)/|', $_SERVER['REQUEST_URI'], $matches) && multilang_table("PG")) { if (isset($_GET['album_id']) && isnum($_GET['album_id']) || !empty($matches) && $matches['1'] > 0) { $data = dbarray(dbquery("SELECT album_language FROM " . DB_PHOTO_ALBUMS . " WHERE album_id='" . (isset($_GET['album_id']) ? $_GET['album_id'] : $matches['1']) . "'")); if ($data['album_language'] . " != " . LANGUAGE) { echo set_language($data['album_language']); } } } elseif (preg_match('/weblinks.php/i', $_SERVER['PHP_SELF']) || preg_match('|/weblinks/([0-9]+)/|', $_SERVER['REQUEST_URI'], $matches) && multilang_table("WL")) { if (isset($_GET['cat_id']) && isnum($_GET['cat_id']) || !empty($matches) && $matches['1'] > 0) { $data = dbarray(dbquery("SELECT weblink_cat_language FROM " . DB_WEBLINK_CATS . " WHERE weblink_cat_id='" . (isset($_GET['cat_id']) ? $_GET['cat_id'] : $matches['1']) . "'")); if ($data['weblink_cat_language'] . " != " . LANGUAGE) { echo set_language($data['weblink_cat_language']); } } } }
function change_language($id) { setcookie('lang', $id, time() + 30000000); set_language($id); }
</form> </div> <?php } function print_hreflang() { global $languages; $url = get_url(); foreach ($languages as $language => $name) { echo " <link rel=\"alternate\" hreflang=\"{$language}\" href=\"" . preg_replace("/([^\\/]+\\/{2}[^\\/]+)\\//", "\$1/{$language}/", $url) . "\">\n"; } } start_session(); get_languages(); if (!isset($_SESSION["language"])) { set_language(array_keys($languages)); } $file = __DIR__ . "/translations/" . $_SESSION["language"]; require_once "{$file}.php"; if ($hash != ($file_hash = sha1_file("{$file}.lang"))) { $last_index = ""; $translations = array(); $append_next_line = false; foreach (file("{$file}.lang", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) { if ($append_next_line) { $translations[$last_index] = substr($translations[$last_index], 0, -1) . "\n{$line}"; } else { $tmparray = explode("=", $line); $last_index = $tmparray[0]; $translations[$last_index] = $tmparray[1]; }
/** * 构造函数 */ function __construct() { set_language(); c_lib()->load('sql', 'ip')->add('sql', new Sql(cfg()->get('sql', 'write'), cfg()->get('sql', 'read'))); l_h("system.php", 'theme.php'); }
function main() { set_language(); test(); }
/** * \brief Default page header for each page * * \param p_theme default theme * \param $p_script * \param $p_script2 another js script * Must be called only once * \return none */ function html_page_start($p_theme = "", $p_script = "", $p_script2 = "") { // check not called twiced static $already_call = 0; if ($already_call == 1) { return; } $already_call = 1; $cn = new Database(); if ($p_theme != "") { $Res = $cn->exec_sql("select the_filestyle from theme\n where the_name='" . $p_theme . "'"); if (Database::num_row($Res) == 0) { $style = "style-classic.css"; } else { $s = Database::fetch_array($Res, 0); $style = $s['the_filestyle']; } } else { $style = "style-classic.css"; } // end if $title = "NOALYSS"; if (isset($_REQUEST['ac'])) { if (strpos($_REQUEST['ac'], '/') != 0) { $m = explode('/', $_REQUEST['ac']); $title = $m[count($m) - 1] . " " . $title; } else { $title = $_REQUEST['ac'] . " " . $title; } } $is_msie = is_msie(); if ($is_msie == 0) { echo '<!doctype html>'; printf("\n"); echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">'; printf("\n"); } else { echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN" >'; printf("\n"); } echo "<HTML>"; if ($p_script2 != "") { $p_script2 = '<script src="' . $p_script2 . '?version=' . SVNINFO . '" type="text/javascript"></script>'; } $style = trim($style); echo "<HEAD>"; if ($is_msie == 1) { echo ' <meta http-equiv="x-ua-compatible" content="IE=edge"/>'; } echo "\n <TITLE>{$title}</TITLE>\n\t<link rel=\"icon\" type=\"image/ico\" href=\"favicon.ico\" />\n <META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <LINK REL=\"stylesheet\" type=\"text/css\" href=\"" . $style . "?version=" . SVNINFO . "\" media=\"screen\"/>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"./style-print.css?version=" . SVNINFO . "\" media=\"print\"/>" . $p_script2 . "\n "; echo '<script language="javascript" src="js/calendar.js"></script> <script type="text/javascript" src="js/lang/calendar-en.js"></script> <script language="javascript" src="js/calendar-setup.js"></script> <LINK REL="stylesheet" type="text/css" href="./calendar-blue.css" media="screen"> '; echo load_all_script(); echo ' </HEAD> '; echo "<BODY {$p_script}>"; echo '<div id="info_div"></div>'; echo '<div id="error_div">' . HtmlInput::title_box(_("Erreur"), 'error_div', 'hide') . '<div id="error_content_div">' . '</div>' . '<p style="text-align:center">' . HtmlInput::button_action('Valider', '$(\'error_div\').style.visibility=\'hidden\';$(\'error_content_div\').innerHTML=\'\';') . '</p>' . '</div>'; // language if (isset($_SESSION['g_lang'])) { set_language(); } }
/** * Get Languages * * This gets unique languges: * OUT > Array * ( * [en] => English * [en_GB] => English (United Kingdom) * ) * @return [type] [description] */ public function getLanguages() { $names = $this->getLanguageNames(); $locations = $this->getLocationNames(); $packagelangs = array(); $packages = $this->getPackages(); if (!empty($packages)) { foreach ($packages as $package) { if (!empty($package['installed'])) { //Try to use local_get_display_name if it's installed if (function_exists('locale_get_display_name')) { $language = set_language(); $name = locale_get_display_name($package['language'], $language); } else { $lang = explode('_', $package['language'], 2); if (count($lang) == 2 && !empty($locations[$lang[1]]) && !empty($names[$lang[0]])) { $name = $names[$lang[0]] . ' - ' . $locations[$lang[1]]; } else { if (!empty($names[$lang[0]])) { $name = $names[$lang[0]]; } else { $name = $lang[0]; } } } $packagelangs[$package['language']] = $name; } } } $customlangs = array(); $customs = $this->getCustomLanguages(); if (!empty($customs)) { foreach ($customs as $customlang) { $customlangs[$customlang['language']] = $customlang['description']; } } $languages = array_merge($packagelangs, $customlangs); if (empty($languages)) { $languages = array('en' => $names['en']); } asort($languages); return $languages; }
/** * Logs the user in * @param string $uname username * @param string $pass password * @param string $cookieVal y or n if we are using cookie * @param string $isCookie id value of user stored in the cookie * @param string $resume page to forward the user to after a login * @param string $lang language code to set * @return any error message that occured during login */ function doLogin($uname, $pass, $cookieVal = null, $isCookie = false, $resume = '', $lang = '') { global $conf; $msg = ''; if (empty($resume)) { $resume = 'ctrlpnl.php'; } // Go to control panel by default $_SESSION['sessionID'] = null; $_SESSION['sessionName'] = null; $_SESSION['sessionAdmin'] = null; $_SESSION['hourOffset'] = null; $uname = stripslashes($uname); $pass = stripslashes($pass); $ok_user = $ok_pass = false; $use_logonname = (bool) $conf['app']['useLogonName']; $adminemail = strtolower($conf['app']['adminEmail']); if ($isCookie !== false) { // Cookie is set $cookieValue = $isCookie; if (($id = $this->verifyCookie($cookieValue)) !== false) { $ok_user = $ok_pass = true; } else { $ok_user = $ok_pass = false; setcookie('ID', '', time() - 3600, '/'); // Clear out all cookies $msg .= translate('That cookie seems to be invalid') . '<br/>'; } } else { if ($conf['ldap']['authentication']) { // Include LDAPEngine class include_once 'LDAPEngine.class.php'; $ldap = new LDAPEngine($uname, $pass); if ($ldap->connected()) { $mail = $ldap->getUserEmail(); if ($mail) { $id = $this->db->userExists($mail); if ($id) { // check if LDAP and local DB are in consistancy. $updates = $ldap->getUserData(); if ($this->db->check_updates($id, $updates)) { $this->db->update_user($id, $updates); } } else { $data = $ldap->getUserData(); $id = $this->do_register_user($data, false); } $ok_user = true; $ok_pass = true; } else { $msg .= translate('This system requires that you have an email address.'); } } else { $msg .= translate('Invalid User Name/Password.'); } $ldap->disconnect(); } else { // If we cant find email, set message and flag if (!($id = $this->db->userExists($uname, $use_logonname))) { $msg .= translate('We could not find that logon in our database.') . '<br/>'; $ok_user = false; } else { $ok_user = true; } // If password is incorrect, set message and flag if ($ok_user && !$this->db->isPassword($uname, $pass, $use_logonname)) { $msg .= translate('That password did not match the one in our database.') . '<br/>'; $ok_pass = false; } else { $ok_pass = true; } } } // If the login failed, notify the user and quit the app if (!$ok_user || !$ok_pass) { $msg .= translate('You can try'); return $msg; } else { $this->is_loggedin = true; $user = new User($id); // Get user info // If the user wants to set a cookie, set it // for their ID and fname. Expires in 30 days (2592000 seconds) if (!empty($cookieVal)) { //die ('Setting cookie'); setcookie('ID', $this->generateCookie($user->get_id()), time() + 2592000, '/'); } // If it is the admin, set session variable if ($user->get_email() == $adminemail || $user->get_isadmin()) { $_SESSION['sessionAdmin'] = $user->get_email(); } // Set other session variables $_SESSION['sessionID'] = $user->get_id(); $_SESSION['sessionName'] = $user->get_fname(); $_SESSION['hourOffset'] = $user->get_timezone() - $conf['app']['timezone']; if ($lang != '') { set_language($lang); if ($lang != $user->get_lang()) { $user->set_lang($lang); // Language changed so update the DB } } // Send them to the control panel CmnFns::redirect(urldecode($resume)); } }
$header['title'] = framework_server_name(); $header['amp_conf'] = $amp_conf; $header['use_popover_css'] = $fw_popover || $fw_popover_process; $o = FreePBX::create()->Less->generateMainStyles(); $header['compiled_less_files'] = $o['compiled_less_files']; $header['extra_compiled_less_files'] = $o['extra_compiled_less_files']; //if we have a module loaded, load its css if (isset($module_name)) { $header['module_name'] = $module_name; } echo load_view($amp_conf['VIEW_HEADER'], $header); if (isset($module_name)) { echo framework_include_css(); } // set the language so local module languages take $language = set_language(); // send menu $menu['fpbx_menu'] = $fpbx_menu; //array of modules & settings $menu['display'] = $display; //currently displayed item $menu['authtype'] = $amp_conf['AUTHTYPE']; $menu['reload_confirm'] = $amp_conf['RELOADCONFIRM']; $menu['language'] = array('en_US' => _('English') . " (US)"); $langKey = !empty($_COOKIE['lang']) ? $_COOKIE['lang'] : 'en_US'; foreach (glob($amp_conf['AMPWEBROOT'] . "/admin/i18n/*", GLOB_ONLYDIR) as $langDir) { $lang = basename($langDir); $menu['language'][$lang] = function_exists('locale_get_display_name') ? locale_get_display_name($lang, $langKey) : $lang; } //add menu to final output echo load_view($amp_conf['VIEW_MENU'], $menu);
} @(include_once SYSTEM_CONF_FILE); if (!defined('SESSIONMANAGER_HOST')) { die('NO Session Manager host defined'); } define('ADMIN_ROOT', realpath(dirname(dirname(__FILE__)))); define('CLASSES_DIR', ADMIN_ROOT . '/classes'); function __autoload($class_name) { //what about NameSpaces ? $class_files = array(); if (!class_exists($class_name)) { $class_files[] = CLASSES_DIR . '/' . $class_name . '.class.php'; foreach ($class_files as $class_file) { if (file_exists($class_file)) { require_once $class_file; return; } } if (isset($autoload_die) && $autoload_die === true) { die_error('Class \'' . $class_name . '\' not found', __FILE__, __LINE__); } } } if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $buf = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); $buf = explode(';', $buf[0]); set_language($buf[0]); } require_once dirname(__FILE__) . '/template_server.inc.php'; @session_start();
<?php require_once "../includes/init.php"; $lang = set_language(); if (isset($_POST["submit"])) { if (isset($_POST["list_id"])) { $list_id = $_POST["list_id"]; } if (isset($_FILES["file"])) { if ($_FILES["file"]["error"] > 0) { //echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; __('You have not selected a file!'); } else { //if file already exists if (file_exists("../Temp/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { $storagename = $_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"], "../Temp/" . $storagename); $storage_path = "../Temp/" . $storagename; $subject_count = 0; if (($handle = fopen("../Temp/" . $_FILES["file"]["name"], "r")) !== FALSE) { while (($data = fgetcsv($handle, 0, ",")) !== FALSE) { /* csv file format: * nume * prenume * sex - (m/f) * data nasterii - (yyyy-mm-dd) * email * status - (p/a); p = pending, a = approved */
/** * Logs the user in * @param string $login login * @param string $pass password * @param string $cookieVal y or n if we are using cookie * @param string $isCookie id value of user stored in the cookie * @param string $resume page to forward the user to after a login * @param string $lang language code to set * @return any error message that occured during login */ function doLogin($login, $pass, $cookieVal = null, $isCookie = false, $resume = '', $lang = '', $domain = '') { global $conf; $msg = ''; $allowedToLogin = true; if (empty($resume)) { $resume = 'summary.php'; } // Go to control panel by default $_SESSION['sessionID'] = null; $_SESSION['sessionName'] = null; $_SESSION['sessionMail'] = null; $_SESSION['sessionAdmin'] = null; $_SESSION['sessionMailAdmin'] = null; $_SESSION['sessionNav'] = null; $login = stripslashes($login); $pass = stripslashes($pass); $ok_user = $ok_pass = false; $authMethod = $conf['auth']['serverType']; if ($isCookie != false) { // Cookie is set $id = $isCookie; if ($this->db->verifyID($id)) { $ok_user = $ok_pass = true; } else { $ok_user = $ok_pass = false; setcookie('ID', '', time() - 3600, '/'); // Clear out all cookies $msg .= translate('That cookie seems to be invalid') . '<br/>'; } } else { switch (strtolower($authMethod)) { case "ad": case "ldap": // Added this check for LDAP servers that switch to anonymous bind whenever // provided password is left blank if ($pass == '') { return translate('Invalid User Name/Password.'); } // Include LDAPEngine class include_once 'LDAPEngine.class.php'; $ldap = new LDAPEngine(); if ($ldap->connect()) { // Get user DN // For AD it could be of the form of 'user@domain' or standard LDAP dn $dn = $ldap->getUserDN($login); // Check if user is allowed to log in if (!$this->isAllowedToLogin($login)) { $allowedToLogin = false; $msg .= 'User is not allowed to login'; // If user is allowed to log in try a bind } elseif ($dn != '' && $ldap->authBind($dn, $pass)) { $ldap->logonName = $login; $ldap->loadUserData($dn); $data = $ldap->getUserData(); $ok_user = true; $ok_pass = true; } else { $msg .= 'Invalid User Name/Password.'; } $ldap->disconnect(); } break; case "sql": // Include DBAuth class include_once 'DBAuth.class.php'; $db = new DBAuth(); // Check if user is allowed to log in if (!$this->isAllowedToLogin($login)) { $allowedToLogin = false; $msg .= 'User is not allowed to login'; // If user is allowed to log in try to authenticate } elseif ($db->authUser($login, $pass)) { $data = $db->getUserData(); $ok_user = true; $ok_pass = true; } else { $msg .= 'Invalid User Name/Password.'; } break; case "exchange": // Include ExchAuth class include_once 'ExchAuth.class.php'; $exch = new ExchAuth(); // Check if user is allowed to log in if (!$this->isAllowedToLogin($login)) { $allowedToLogin = false; $msg .= 'User is not allowed to login'; // If user is allowed to log in try to authenticate } elseif ($exch->authUser($login, $pass, $domain)) { $data = $exch->getUserData(); $ok_user = true; $ok_pass = true; } else { $msg .= 'Invalid User Name/Password.'; } break; case "imap": // Include IMAPAuth class include_once 'IMAPAuth.class.php'; $imap = new IMAPAuth(); // Check if user is allowed to log in if (!$this->isAllowedToLogin($login)) { $allowedToLogin = false; $msg .= 'User is not allowed to login'; // If user is allowed to log in try to authenticate } elseif ($imap->authUser($login, $pass)) { $data = $imap->getUserData(); $ok_user = true; $ok_pass = true; } else { $msg .= 'Invalid User Name/Password.'; } break; default: CmnFns::do_error_box(translate('Unknown server type'), '', false); break; } } // If the login failed, notify the user and quit the app if (!$ok_user || !$ok_pass || !$allowedToLogin) { CmnFns::write_log('Authentication failed' . ', ' . $msg, $login); return translate($msg); } else { $this->is_loggedin = true; CmnFns::write_log('Authentication successful', $login); /* $user = new User($id); // Get user info // If the user wants to set a cookie, set it // for their ID and fname. Expires in 30 days (2592000 seconds) if (!empty($cookieVal)) { //die ('Setting cookie'); setcookie('ID', $user->get_id(), time() + 2592000, '/'); } */ // Set other session variables $_SESSION['sessionID'] = $data['logonName']; $_SESSION['sessionName'] = $data['firstName']; $_SESSION['sessionMail'] = $data['emailAddress']; // If it is the super admin, set session variable foreach ($conf['auth']['s_admins'] as $s_admin) { if (strtolower($s_admin) == strtolower($_SESSION['sessionID'])) { $_SESSION['sessionAdmin'] = true; } } // If it is the mail admin, set session variable foreach ($conf['auth']['m_admins'] as $m_admin) { if (strtolower($m_admin) == strtolower($_SESSION['sessionID'])) { $_SESSION['sessionMailAdmin'] = true; } } if ($lang != '') { set_language($lang); } // Send them to the control panel CmnFns::redirect(urldecode($resume)); } }
# it's easy to have a little too much whitespace in the field, clean it up for the user before processing. $_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']); $_POST['timeservers'] = trim($_POST['timeservers']); foreach (explode(' ', $_POST['timeservers']) as $ts) { if (!is_domain($ts)) { $input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'."); } } if (!$input_errors) { update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']); update_if_changed("domain", $config['system']['domain'], $_POST['domain']); update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']); update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers'])); if ($_POST['language'] && $_POST['language'] != $config['system']['language']) { $config['system']['language'] = $_POST['language']; set_language(); } unset($config['system']['webgui']['webguileftcolumnhyper']); $config['system']['webgui']['webguileftcolumnhyper'] = $_POST['webguileftcolumnhyper'] ? true : false; unset($config['system']['webgui']['dashboardavailablewidgetspanel']); $config['system']['webgui']['dashboardavailablewidgetspanel'] = $_POST['dashboardavailablewidgetspanel'] ? true : false; unset($config['system']['webgui']['systemlogsfilterpanel']); $config['system']['webgui']['systemlogsfilterpanel'] = $_POST['systemlogsfilterpanel'] ? true : false; unset($config['system']['webgui']['systemlogsmanagelogpanel']); $config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false; unset($config['system']['webgui']['statusmonitoringsettingspanel']); $config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false; /* XXX - billm: these still need updating after figuring out how to check if they actually changed */ $olddnsservers = $config['system']['dnsserver']; unset($config['system']['dnsserver']); if ($_POST['dns1']) {
<?php require 'adminarea/functions.php'; set_language($language, $language_to, $home, $aboutus, $sevices, $transparency, $news, $ourpartners, $contuctus); set_all_visitors(); $language = $_SESSION['language']; $id = $_GET['id']; $conn = connect(); $query = "select* from news where lang='{$language}' and id='{$id}'"; $res = mysqli_query($conn, $query); $row = mysqli_fetch_assoc($res); $content = $row['content']; $path = get_image_src($id); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $row['title']; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta property="og:title" content="<?php echo $row['title']; ?> "/> <meta property="og:url" content="http://<?php echo $_SERVER['SERVER_NAME'] . "/one_news?id={$id}"; ?> "/>