public function __construct(OrganizationManager $organizationManager) { $this->organizationManager = $organizationManager; Validator::extendImplicit('unique_lang', function ($attribute, $value, $parameters, $validator) { $languages = []; foreach ($value as $narrative) { $language = $narrative['language']; if (in_array($language, $languages)) { return false; } $languages[] = $language; } return true; }); Validator::extendImplicit('unique_default_lang', function ($attribute, $value, $parameters, $validator) { $languages = []; $defaultLanguage = getDefaultLanguage(); $validator->addReplacer('unique_default_lang', function ($message, $attribute, $rule, $parameters) use($validator, $defaultLanguage) { return str_replace(':language', app(GetCodeName::class)->getActivityCodeName('Language', $defaultLanguage), $message); }); $check = true; foreach ($value as $narrative) { $languages[] = $narrative['language']; } if (count($languages) === count(array_unique($languages))) { if (in_array("", $languages) && in_array($defaultLanguage, $languages)) { $check = false; } } return $check; }); }
/** * Parse the accepted languages from the HTTP Header, and return the preferred one, if available, otherwise the default. * * @return string */ public static function getDefaultLanguageFromHeader() { $lang_settings = LangSettings::get(); $default = $lang_settings->default; $available = array_keys($lang_settings->available); require_once 'LanguageDetection.php'; return getDefaultLanguage($available, $default); }
function DoceboConnectorDoceboCourses($params) { $this->default_cols['lang_code'] = getDefaultLanguage(); if ($params === NULL) { return; } else { $this->set_config($params); } // connection }
/** * Load language file * * @param string $language - if left empty loads saved language selection (from cookie) or default language * @return bool success */ function i18n_load_language($language = NULL) { global $i18n_lang, $i18n_current_language; if ($language == NULL) { $language = $_COOKIE["i18n_language"]; if (!$language) { $language = getDefaultLanguage(); } } $i18n_current_language = $language; if ($i18n_lang = Horde_Yaml::loadFile("../languages/{$language}.yaml")) { return true; } else { return false; } }
function __construct() { Validator::extendImplicit('unique_lang', function ($attribute, $value, $parameters, $validator) { $languages = []; foreach ($value as $narrative) { $language = $narrative['language']; if (in_array($language, $languages)) { return false; } $languages[] = $language; } return true; }); Validator::extendImplicit('unique_default_lang', function ($attribute, $value, $parameters, $validator) { $languages = []; $defaultLanguage = getDefaultLanguage(); $validator->addReplacer('unique_default_lang', function ($message, $attribute, $rule, $parameters) use($validator, $defaultLanguage) { return str_replace(':language', app(GetCodeName::class)->getActivityCodeName('Language', $defaultLanguage), $message); }); $check = true; foreach ($value as $narrative) { $languages[] = $narrative['language']; } if (count($languages) === count(array_unique($languages))) { if (in_array("", $languages) && in_array($defaultLanguage, $languages)) { $check = false; } } return $check; }); Validator::extendImplicit('sum', function ($attribute, $value, $parameters, $validator) { return false; }); Validator::extendImplicit('required_with_language', function ($attribute, $value, $parameters, $validator) { $language = preg_replace('/([^~]+).narrative/', '$1.language', $attribute); return !(Input::get($language) && !Input::get($attribute)); }); Validator::extend('exclude_operators', function ($attribute, $value, $parameters, $validator) { return !preg_match('/[\\/\\&\\|\\?|]+/', $value); }); }
} ?> </div> </div> </div> </section> <?php include "__footer.php"; ?> <?php include "_top.php"; ?> <?php if (getDefaultLanguage() == "pt-br") { ?> <h3 >Falha de precondição!</h3> <h4>A condição necessária para a requisição da URL foi avaliada como falsa.</h4> <?php } else { ?> <h3 >Precondition failed!</h3> <h4>The precondition on the request for the URL failed positive evaluation.</h4> <?php } ?> <?php include "_bottom.php"; ?>
<?php // PASTT: PHP Android Translation Tool // http://code.google.com/p/android-php-translator/ // Licensed Apache License 2.0 // http://www.apache.org/licenses/LICENSE-2.0 define('DIRECT_ACCESSIBLE', TRUE); include 'includes/common.php'; // Default language to select? include 'includes/checklanguage.php'; $defaultLanguage = getDefaultLanguage('aa'); if (strlen($defaultLanguage) > 2) { // Remove regional identifier $defaultLanguage = substr($defaultLanguage, 0, 2); } $pageTitle = $appname; include 'includes/header.php'; echo ' <h1>' . $appname . '</h1>'; echo ' <table> <tr> <th colspan="3">Existing translations</td> </tr>'; $isuneven = false; $classuneven = ' class="uneven"'; if (isset($languages)) { sort($languages); foreach ($languages as $language) { // Show the language and an edit link $langgroup = substr($language, 0, 2);
/* * Read language informations * 1. reads default-language file * 2. reads requested language file * 3. make some editing (Upper-Case etc.) * * Not in each translated file need to be each all translations, only in the default-lang-file (english) */ //http_negotiate_language($langs, $result); //print_r($result); unset($LANG); $tables = $zendDb->listTables(); //TEST: print db tables /*if upgrading from old version then getDefaultLang wont work during install*/ if (in_array(TB_PREFIX . 'system_defaults', $tables)) { $language = getDefaultLanguage(); } else { $language = "en_GB"; } function getLanguageArray() { global $language; global $config; $langPath = "./lang/"; $langFile = "/lang.php"; //$getLanguage = getenv("HTTP_ACCEPT_LANGUAGE"); //$language = getDefaultLanguage(); //include english as default - so if the selected lang doesnt have the required lang then it still loads include $langPath . "en_GB" . $langFile; include $langPath . $language . $langFile; foreach ($config->extension as $extension) {
public function applyRulesMultiLang($log_action, $arr_users, $id_org, $id_entity = false, $user_temp = false) { $ent = array(); if ($id_org != false) { $acl_man = Docebo::aclm(); $oc_sn = $acl_man->getGroupST('oc_' . $id_org); $um_adm = new UsermanagementAdm(); $ancestor = $um_adm->getAncestorInfoFolders($id_org); $ancestor['idst_ocd'][] = $oc_sn; $ent = $ancestor['idst_ocd']; } if ($id_entity != false) { $ent[] = $id_entity; } if (empty($ent)) { return false; } // FORMA: if we have the user_temp param we have to use user_temp table $user_table = "%adm_user"; if ($user_temp) { $user_table = "%adm_user_temp"; } $query = "SELECT DISTINCT u.idst, us.value " . " FROM " . $user_table . " AS u " . " LEFT JOIN %adm_setting_user AS us " . " ON ( u.idst = us.id_user AND us.path_name = 'ui.language' ) " . " WHERE u.idst IN ( " . implode(",", $arr_users) . " )"; // END FORMA $re_query = $this->db->query($query); if (!$re_query) { return false; } $arr_users = array(); $langs = array(); $default_lang = getDefaultLanguage(); while (list($idst_user, $value) = $this->db->fetch_row($re_query)) { if ($value == '') { $value = $default_lang; } $langs[$value] = $value; $arr_users[$value][] = $idst_user; } // find rules for evry language in the array require_once _lms_ . '/lib/lib.subscribe.php'; $cs = new CourseSubscribe_Management(); $applicable = $this->getApplicableRuleForEntityMultiLang($ent); $course_list = $applicable['course_list']; if (!isset($course_list['all'])) { $course_list['all'] = array(); } $this->db->start_transaction(); // create a entry log $id_log = $this->addLogEntry($log_action, $applicable['rules']); if (!$id_log) { return false; } foreach ($langs as $i => $lang_code) { if (!empty($course_list[$lang_code])) { $courses = array_unique(array_merge($course_list['all'], $course_list[$lang_code])); } else { $courses = array_unique($course_list['all']); } if (!empty($arr_users[$lang_code]) && !empty($courses)) { $re = $cs->multipleSubscribe($arr_users[$lang_code], $courses, 3, $id_log); } } $this->db->commit(); return $re; }
<?php require_once 'IP2Country.php'; $conf = array('db_server' => 'localhost', 'db_port' => 3306, 'db_name' => 'dnscheck', 'db_user' => 'dnscheck_webui', 'db_pass' => 'demo_pwd'); define('STATUS_OK', 'OK'); define('STATUS_WARN', 'WARNING'); define('STATUS_ERROR', 'ERROR'); define('STATUS_DOMAIN_DOES_NOT_EXIST', 'ERROR_DOMAIN_DOES_NOT_EXIST'); define('STATUS_DOMAIN_SYNTAX', 'ERROR_DOMAIN_SYNTAX'); define('STATUS_NO_NAMESERVERS', 'ERROR_NO_NAMESERVERS'); define('STATUS_IN_PROGRESS', 'IN_PROGRESS'); define('STATUS_INTERNAL_ERROR', 'INTERNAL_ERROR'); define('PAGER_SIZE', 10); define('GUI_TIMEOUT', 300); $sourceIdentifiers = array('standard' => 'webgui', 'undelegated' => 'webgui-undelegated'); define('DEFAULT_LANGUAGE_ID', getDefaultLanguage()); /* Provide a place where settings can be overridden, to make Debian packaging easier. */ if (is_readable('/etc/dnscheck/webui_config.php')) { require_once '/etc/dnscheck/webui_config.php'; }
/** * Get the language name for the given language code. * @param $code * @return */ function getLanguage($code) { $code ?: ($code = getDefaultLanguage()); $languages = json_decode(file_get_contents(app_path() . config('filesystems.languages.v201.activity.language_codelist_path')), true); foreach ($languages['Language'] as $lang) { if ($lang['code'] === $code) { return $lang['name']; } } }
function actionEvent(&$event) { parent::actionEvent($event); // initializing require_once _adm_ . '/lib/lib.field.php'; $acl_man =& Docebo::user()->getACLManager(); $field_man = new FieldList(); $send_to_field = Get::sett('sms_cell_num_field'); $arr_mail_recipients = array(); $arr_sms_recipients = array(); // recover event information $arr_recipients = explode(',', $event->getProperty('recipientid')); $msg_composer = unserialize(urldecode($event->getProperty('MessageComposer'))); $msg_composer->after_unserialize(); $force_email_send = $event->getProperty('force_email_send'); if (!is_array($arr_recipients) || empty($arr_recipients)) { return; } // recover user info and convert to idst if required if (is_numeric($arr_recipients[0])) { $idst_users =& $arr_recipients; } else { $idst_users = $acl_man->fromUseridToIdst($arr_recipients); } $users_info =& $acl_man->getUsers($idst_users); // recove setting $users_lang = $acl_man->getSettingValueOfUsers('ui.language', false, true); $users_sms = $field_man->showFieldForUserArr($idst_users, array($send_to_field)); // scan all users if (!is_array($users_info) || empty($users_info)) { return; } while (list(, $user_dett) = each($users_info)) { if ($user_dett[ACL_INFO_VALID] == '1') { // recover media setting $idst_user = $user_dett[ACL_INFO_IDST]; $media = usernotifier_getUserEventChannel($idst_user, $event->getClassName()); $lang = isset($users_lang[$idst_user]) && $users_lang[$idst_user] !== NULL ? $users_lang[$idst_user] : getDefaultLanguage(); if (in_array('email', $media) || $force_email_send == 'true') { if ($user_dett[ACL_INFO_EMAIL] != '') { $arr_mail_recipients[$lang][$idst_user] = $user_dett[ACL_INFO_EMAIL]; } } if (in_array('sms', $media)) { if ($users_sms[$idst_user][$send_to_field] != '') { $arr_sms_recipients[$lang][$idst_user] = $users_sms[$idst_user][$send_to_field]; } } } } if (!empty($arr_mail_recipients)) { $lang_mail = array_keys($arr_mail_recipients); foreach ($lang_mail as $lang_code) { reset($arr_mail_recipients[$lang_code]); $this->_sendMail($msg_composer->getSubject('email', $lang_code), $msg_composer->getBody('email', $lang_code), $arr_mail_recipients[$lang_code], $users_info); } } if (!empty($arr_sms_recipients)) { $lang_sms = array_keys($arr_sms_recipients); foreach ($lang_sms as $lang_code) { reset($arr_sms_recipients[$lang_sms]); $this->_sendSms($msg_composer->getBody('sms', $lang_code), $arr_sms_recipients[$lang_code], $users_info); } } return true; }
public function multimodTask() { if (!$this->permissions['mod_user']) { $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission')); echo $this->json->encode($output); return; } $title = Lang::t('_MOD', 'admin_directory'); $users_count = Get::req('users_count', DOTY_INT, 0); if ($users_count <= 0) { $output = array('success' => true, 'header' => $title, 'body' => Lang::t('_EMPTY_SELECTION', 'admin_directory')); echo $this->json->encode($output); return; } $acl_man = Docebo::user()->getAclManager(); $level = ADMIN_GROUP_USER; $arr_levels = $acl_man->getAdminLevels(); //index = idst; value = groupid; $levels = array(); foreach ($arr_levels as $groupid_level => $idst_level) { $levels[$groupid_level] = Lang::t('_DIRECTORY_' . $groupid_level, 'admin_directory'); } $info = array('firstname' => '', 'lastname' => '', 'email' => '', 'level' => '', 'facebook_id' => '', 'twitter_id' => '', 'linkedin_id' => '', 'google_id' => ''); $language = getDefaultLanguage(); $languages = Docebo::langManager()->getAllLanguages(); require_once _base_ . '/lib/lib.platform.php'; $pman =& PlatformManager::createInstance(); // = new PlatformManager(); $platforms = $pman->getPlatformList(); require_once _adm_ . '/lib/lib.field.php'; $fman = new FieldList(); $field_list = $fman->getFlatAllFields(array_keys($platforms)); $fields_to_exclude = $fman->getFieldsByType('upload'); $preference = new UserPreferences(0); $modify_mask = $preference->getModifyMask('ui.', true, true); $fields_mask = $fman->playFieldsForUser(-1, false, false, true, false, true); //build edit mask $this->render('multimod', array('users_count' => $users_count, 'title' => $title, 'levels' => $levels, 'modify_mask' => $modify_mask, 'fields_mask' => $fields_mask, 'fields_to_exclude' => is_array($fields_to_exclude) ? $fields_to_exclude : array(), 'info' => $info, 'json' => $this->json)); }
function findLanguageFromBrowserCode() { if (!isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { return getDefaultLanguage(); } $accept_language = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; $al_arr = explode(",", $accept_language); $i = 0; $res = ""; while (list(, $value) = each($al_arr)) { $bl_arr = explode(";", $value); $browser_language = $bl_arr[0]; $browser_language = mysql_escape_string(substr($browser_language, 0, 5)); $query = "SELECT lang_code " . " FROM " . $this->_getTableLanguage() . " WHERE lang_browsercode LIKE '%" . $browser_language . "%'"; $rs = sql_query($query); if (sql_num_rows($rs) != 0) { list($lang_code) = sql_fetch_row($rs); return $lang_code; } } return getDefaultLanguage(); }
} else { $lang[$val] = 1.0; } } #return default language (highest q-value) $qval = 0.0; foreach ($lang as $key => $value) { if ($value > $qval) { $qval = (double) $value; $deflang = $key; } } } return strtolower($deflang); } $defaultBrowserLanguage = getDefaultLanguage(); $mobileCommerceClustersLbl = "Mobile Commerce Clusters"; $mobileCommerceClustersDescLbl = "Measures partnerships among banks, mobile networks, and governments."; $environmentLbl = "Environment"; $environmentDescLbl = "Measures economic, technological, and demographic factors within a market."; $infrastructureLbl = "Infrastructure"; $infrastructureDescLbl = "Measures the sophistication and penetration of the mobile phone industry and NFC terminalization."; $consumerReadinessLbl = "Consumer Readiness"; $consumerReadinessDescLbl = "Measures how familiar with, how willing to use, and how frequently consumers are currently using all three types of mobile payments."; $financialServicesLbl = "Financial Services"; $financialServicesDescLbl = "Measures the effectiveness and penetration of consumer financial products."; $regulationLbl = "Regulation"; $regulationDescLbl = "Measures legal and regulatory structures and how they affect businesses."; $backToIndex = "Back to Index"; $btnDownloadReport = "btn-downloadreport"; $downloadReport = "Download the Report";