public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = $this->defFields(); $storeVar = isset($_GET['act']) && $_GET['act'] == 'list'; // if true store the filter variables $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); if ($init || $reset) { $storeVar = true; } $this->id = initVar('id'); $this->last_id = initVar('last_id'); $this->parent_act = initVar('parent_act'); $this->tab_mode = initVar('tab_mode'); $this->act = initVar('act', 'list'); $this->do_id = $_SESSION['do_id']; $this->gpr_id = initVar('gpr_id'); $this->order = PageVar('order', '1A', $init, false, $this->baseName, $storeVar); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName, $storeVar); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('submitFormData'); $this->registerAjaxFunction('askDelGlobalPlainGauge'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); $this->id = initVar('id'); $this->ge_id = (int) initVar('ge_id'); $this->gs_id = (int) initVar('gs_id'); $this->gc_id = initVar('gc_id'); $this->act = initVar('act', initVar('parent_act', 'mod')); $this->parent_act = initVar('parent_act', 'mod'); $this->kind = strToUpper(initVar('kind')); $this->new_udm_divider = initVar('udm_divider'); $this->merge_municipality_data = PageVar('merge_municipality_data', 'T') == 'T' ? true : false; $this->toggle_subcategory = initVar('toggle_subcategory'); $this->do_id = PageVar('do_id', $_SESSION['do_id'], $init | $reset, false, $this->baseName); $this->pr_id = PageVar('pr_id', null, $init | $reset, false, $this->baseName); $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName); $this->bpu_id = PageVar('bpu_id', null, $init | $reset, false, $this->baseName); $this->order = PageVar('order', '1A', $init, false, $this->baseName); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('getHelp'); $this->registerAjaxFunction('toggleSubcategory'); $this->registerAjaxFunction('updateLastOpenCloseStatus'); }
function userLogin($username, $password, $log = true) { global $USER, $MSG; if ($username == "") { array_push($MSG, getstring('warning.login.noemail')); return false; } if ($password == "") { array_push($MSG, getstring('warning.login.nopassword')); return false; } $USER = new User($username); $USER->setUsername($username); $USER->password = $password; if ($USER instanceof User) { if ($USER->validPassword($password)) { $_SESSION["session_username"] = $USER->getUsername(); setcookie("user", $USER->getUsername(), time() + 60 * 60 * 24 * 30, "/"); setLang($USER->getProp('lang')); if ($log) { writeToLog('info', 'login', 'user logged in'); } return true; } else { array_push($MSG, getstring('warning.login.invalid')); writeToLog('info', 'loginfailure', 'username: ' . $username); unset($USER); return false; } } else { return false; } }
public function testSetLang() { // set default lang setLang(""); $this->assertEquals(getLang(), "testLang"); //set lang testLang2 setLang("testLang2"); $this->assertEquals(getLang(), "testLang2"); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = $this->defFields(); $this->act = initVar('act', 'mod'); $this->do_id = $_SESSION['do_id']; setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('getHelp'); $this->registerAjaxFunction('submitFormData'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $init = array_key_exists('init', $this->request); $this->act = initVar('act', 'list'); $this->sl_id = PageVar('sl_id'); $this->last_id = initVar('consumption_last_id'); $this->parent_act = PageVar('parent_act'); $this->tab_mode = initVar('tab_mode'); $this->order = PageVar('order', '6A', $init, false, $this->baseName); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = $this->defFields(); $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); $this->id = initVar('id'); $this->act = initVar('act', 'list'); $this->kind = PageVar('kind'); $this->em_id = PageVar('em_id', null, $init | $reset, false, $this->baseName); $this->tabMode = PageVar('tab_mode', null, $init | $reset, false, $this->baseName); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('confirm_delete_device'); $this->registerAjaxFunction('submitFormData'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->kind = initVar('kind'); $this->act = initVar('act', 'add'); $this->mu_id = initVar('mu_id'); $this->mu_name = initVar('mu_name'); if ($this->mu_name != '') { // Convert municipality text into id $db = ezcDbInstance::get(); $lang = R3Locale::getLanguageID(); $this->mu_id = (int) $db->query("SELECT mu_id FROM municipality WHERE mu_name_{$lang} ILIKE " . $db->quote($request['mu_name']))->fetchColumn(); } setLang(R3Locale::getLanguageCode()); $this->registerAjaxFunction('submitFormData'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $storeVar = isset($_GET['act']) && $_GET['act'] == 'list'; // if true store the filter variables $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); if ($init || $reset) { $storeVar = true; } $this->gc_id_filter = PageVar('gc_id_filter', null, $init | $reset, false, $this->baseName, $storeVar); $this->gp_name = PageVar('gp_name', null, $init | $reset, false, $this->baseName, $storeVar); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('getHelp'); $this->registerAjaxFunction('countGaugeAndMonitor'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); $this->id = initVar('id'); $this->act = initVar('act', 'list'); $this->kind = PageVar('kind'); $this->em_id = PageVar('em_id', null, $init | $reset, false, $this->baseName); $this->sl_id = PageVar('sl_id', null, $init | $reset, false, $this->baseName); $this->tabMode = PageVar('tab_mode', null, $init | $reset, false, $this->baseName); $data = R3EcoGisHelper::getMeterData($_SESSION['do_id'], $this->em_id); $this->fields = $this->defFields($data['em_is_production'] == 'T'); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('confirm_delete_consumption'); $this->registerAjaxFunction('submitFormData'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = $this->defFields(); $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); $this->do_id = $_SESSION['do_id']; $this->id = initVar('id'); $this->act = initVar('act', 'list'); $this->kind = initVar('kind'); $this->bu_id = initVar('bu_id'); $this->tabMode = initVar('tab_mode'); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('fetchUDM'); $this->registerAjaxFunction('getEnergySourceList'); $this->registerAjaxFunction('getUtilityProductList'); $this->registerAjaxFunction('confirmDeleteMeter'); $this->registerAjaxFunction('submitFormData'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->id = initVar('id'); $this->act = initVar('act', 'list'); $this->tab_mode = initVar('tab_mode'); $this->kind = initVar('kind'); $this->ge_id = (int) initVar('ge_id'); $this->gc_id = (int) initVar('gc_id'); $this->limit = 0; $this->do_id = PageVar('do_id', $_SESSION['do_id'], false, false, $this->baseName); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->fields = $this->defFields(); $this->registerAjaxFunction('fetchUDM'); $this->registerAjaxFunction('performEnergySourceRowCalc'); $this->registerAjaxFunction('confirmDeleteGlobalConsumptionRow'); $this->registerAjaxFunction('getEnergySource'); $this->registerAjaxFunction('getEnergyUDM'); $this->registerAjaxFunction('performActionCatalogCalc'); $this->registerAjaxFunction('submitFormData'); }
function initLang() { global $languageArray; if (isset($_COOKIE["Language"])) { $browerLang = $_COOKIE["Language"]; } else { if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $browerLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); } else { $browerLang = "en"; } } if (isset($_SESSION["langindex"])) { $index = $_SESSION["langindex"]; } else { $index = array_search($browerLang, $languageArray); } if ($index) { setLang($index); } else { setLang(0); } }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = $this->defFields(); $storeVar = isset($_GET['act']) && $_GET['act'] == 'list'; // if true store the filter variables $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); if ($init || $reset) { $storeVar = true; } $this->id = initVar('id'); if (initVar('sl_id') !== null) { $this->id = initVar('sl_id'); } $this->act = initVar('act', 'list'); $this->last_id = initVar('last_id'); $this->parent_act = initVar('parent_act'); $this->do_id = $_SESSION['do_id']; $this->pr_id = PageVar('pr_id', null, $init | $reset, false, $this->baseName, $storeVar); $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName, $storeVar); $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName, $storeVar); $this->st_id = PageVar('st_id', null, $init | $reset, false, $this->baseName, $storeVar); $this->st_name = PageVar('st_name', null, $init | $reset, false, $this->baseName, $storeVar); $this->sl_full_name = PageVar('sl_full_name', null, $init | $reset, false, $this->baseName, $storeVar); $this->sl_to_check = PageVar('sl_to_check', null, $init | $reset, false, $this->baseName, $storeVar); $this->order = PageVar('order', '1A', $init, false, $this->baseName, $storeVar); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName, $storeVar); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('getHelp'); $this->registerAjaxFunction('getMunicipalityList'); $this->registerAjaxFunction('getStreetList'); $this->registerAjaxFunction('getStreetLength'); $this->registerAjaxFunction('confirmDeleteStreetLighting'); $this->registerAjaxFunction('submitFormData'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = array(); $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); $this->id = initVar('id'); $this->act = initVar('act', 'list'); $this->order = PageVar('order', '1A', $init, false, $this->baseName); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName); $storeVar = isset($_GET['act']) && $_GET['act'] == 'list' || $reset || $init; // if true store the filter variables if ($init || $reset) { $storeVar = true; } $this->do_id_filter = (int) PageVar('do_id_filter', null, $init | $reset, false, $this->baseName, $storeVar); $this->mu_name_collection = PageVar('mu_name_collection', null, $init | $reset, false, $this->baseName, $storeVar); $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName, $storeVar); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('submitFormData'); $this->registerAjaxFunction('confirmDeleteMunicipalityCollection'); $this->registerAjaxFunction('getAvailableMunicipalityForCollection'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = array(); $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); $this->id = initVar('id'); $this->act = 'list'; $this->order = PageVar('order', '1A', $init, false, $this->baseName); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName); $this->do_id = $_SESSION['do_id']; $storeVar = isset($_GET['act']) && $_GET['act'] == 'list' || $reset || $init; if ($init || $reset) { $storeVar = true; } $this->us_name_email = PageVar('us_name_email', null, $init | $reset, false, $this->baseName, $storeVar); $this->us_status = PageVar('us_status', null, $init | $reset, false, $this->baseName, $storeVar); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('askEnablePublicUser'); $this->registerAjaxFunction('askDelPublicUser'); $this->registerAjaxFunction('enablePublicUser'); $this->registerAjaxFunction('delPublicUser'); }
tsdefine('THEME_NAME', C('THEME_NAME')); } else { tsdefine('THEME_NAME', 'stv1'); } //默认静态文件、模版文件目录 tsdefine('THEME_PATH', ADDON_PATH . '/theme/' . THEME_NAME); tsdefine('THEME_URL', ADDON_URL . '/theme/' . THEME_NAME); tsdefine('THEME_PUBLIC_PATH', THEME_PATH . '/_static'); tsdefine('THEME_PUBLIC_URL', THEME_URL . '/_static'); tsdefine('APP_PUBLIC_PATH', APP_PATH . '/_static'); tsdefine('APP_PUBLIC_URL', APP_URL . '/_static'); tsdefine('APP_TPL_PATH', APP_PATH . '/Tpl/default'); tsdefine('APP_TPL_URL', APP_URL . '/Tpl/default'); tsdefine('CANVAS_PATH', SITE_PATH . '/config/canvas/'); //设置语言包 setLang(); //载入应用函数库 if (file_exists(APP_COMMON_PATH . '/common.php')) { tsload(APP_COMMON_PATH . '/common.php'); } //合并应用配置 if (file_exists(APP_CONFIG_PATH . '/config.php')) { tsconfig(include APP_CONFIG_PATH . '/config.php'); } //根据应用配置重定义以下常量 if (C('THEME_NAME')) { tsdefine('THEME_NAME', C('THEME_NAME')); } //根据应用配置重定义以下常量 if (C('APP_TPL_PATH')) { tsdefine('APP_TPL_PATH', C('APP_TPL_PATH'));
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); $this->id = initVar('id'); $this->act = initVar('act', 'list'); $this->order = PageVar('order', '1A', $init, false, $this->baseName); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName); $this->fields = $this->defFields(); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('getHelp'); $this->registerAjaxFunction('validateDomain'); $this->registerAjaxFunction('getSRIDDesc'); $this->registerAjaxFunction('getMunicipality'); $this->registerAjaxFunction('submitFormData'); $this->registerAjaxFunction('confirmDeleteCustomer'); $this->registerAjaxFunction('vacuum'); $this->registerAjaxFunction('create_grid'); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = $this->defFields(); $storeVar = isset($_GET['act']) && $_GET['act'] == 'list'; // if true store the filter variables $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); if ($init || $reset) { $storeVar = true; } $this->id = (int) initVar('id'); $this->last_id = initVar('last_id'); $this->act = initVar('act', 'list'); $this->parent_act = initVar('parent_act'); $this->do_id = PageVar('do_id', $_SESSION['do_id'], $init | $reset, false, $this->baseName, $storeVar); $this->pr_id = PageVar('pr_id', null, $init | $reset, false, $this->baseName, $storeVar); $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName, $storeVar); $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName, $storeVar); $this->gst_name = PageVar('gst_name', null, $init | $reset, false, $this->baseName, $storeVar); $this->order = PageVar('order', '1A', $init, false, $this->baseName, $storeVar); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName, $storeVar); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('getHelp'); $this->registerAjaxFunction('loadGE_GS'); $this->registerAjaxFunction('submitFormData'); $this->registerAjaxFunction('exportPAES'); $this->registerAjaxFunction('exportPAESDlg'); $this->registerAjaxFunction('getExportPAESStatus'); $this->registerAjaxFunction('askDelGlobalStrategy'); }
function init() { if (!oreInstall::isInstalled() && !(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) { $this->redirect(array('/install')); } setLang(); $modulesToCheck = ConfigurationModel::getModulesList(); foreach ($modulesToCheck as $module) { if (param('module_enabled_' . $module) === null) { ConfigurationModel::createValue('module_enabled_' . $module, 0); Yii::app()->params['module_enabled_' . $module] = 0; } } unset($modulesToCheck); $this->assetsGenPath = Yii::getPathOfAlias('webroot.assets'); $this->assetsGenUrl = Yii::app()->getBaseUrl(true) . '/assets/'; Yii::app()->user->setState('menu_active', ''); $this->pageTitle = tt('siteName', 'seo'); $this->pageKeywords = tt('siteKeywords', 'seo'); $this->pageDescription = tt('siteDescription', 'seo'); Yii::app()->name = $this->pageTitle; $this->defaultTheme = Themes::getDefaultTheme(); if (!$this->defaultTheme) { $this->defaultTheme = 'classic'; } Yii::app()->theme = $this->defaultTheme; $this->baseUrl = Yii::app()->baseUrl; $this->baseThemeUrl = Yii::app()->theme->baseUrl; if (Yii::app()->getModule('menumanager')) { if (!(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) { $this->infoPages = Menu::getMenuItems(true, 2); } } $subItems = array(); if (!Yii::app()->user->isGuest) { $subItems = HUser::getMenu(); } $this->aData['userCpanelItems'] = Menu::getMenuItems(true, 1); $this->aData['userCpanelItems'][] = array('label' => tt('Reserve apartment', 'common'), 'url' => array('/booking/main/mainform'), 'visible' => Yii::app()->user->checkAccess('backend_access') === false, 'linkOptions' => array('class' => 'fancy'), 'itemOptions' => array('class' => 'depth_zero')); $this->aData['userCpanelItems'][] = array('label' => Yii::t('common', 'Control panel'), 'url' => array('/usercpanel/main/index'), 'visible' => Yii::app()->user->checkAccess('backend_access') === false, 'items' => $subItems, 'itemOptions' => array('class' => 'depth_zero'), 'submenuOptions' => array('class' => 'sub_menu_dropdown')); if (!Yii::app()->user->isGuest) { $user = HUser::getModel(); $this->aData['userCpanelItems'][] = array('label' => '(' . $user->username . ') ' . tt('Logout', 'common'), 'url' => array('/site/logout'), 'itemOptions' => array('class' => 'depth_zero')); } $this->aData['topMenuItems'] = $this->infoPages; // comparison list if (issetModule('comparisonList')) { if (!Yii::app()->user->isGuest) { $resultCompare = ComparisonList::model()->findAllByAttributes(array('user_id' => Yii::app()->user->id)); } else { $resultCompare = ComparisonList::model()->findAllByAttributes(array('session_id' => Yii::app()->session->sessionId)); } if ($resultCompare) { foreach ($resultCompare as $item) { $this->apInComparison[] = $item->apartment_id; } } } $this->currentUserIp = Yii::app()->request->getUserHostAddress(); $this->currentUserIpLong = ip2long($this->currentUserIp); $this->datePickerLang = Yii::app()->language; if ($this->datePickerLang == 'en') { $this->datePickerLang = 'en-GB'; } if (demo()) { if (isset($_GET['theme']) && array_key_exists($_GET['theme'], Themes::getColorThemesList())) { $theme = $_GET['theme']; $cookie = new CHttpCookie('theme', $theme); $cookie->expire = time() + 86400; Yii::app()->request->cookies['theme'] = $cookie; } } parent::init(); }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = $this->defFields(); $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); $this->id = initVar('id'); $this->last_id = initVar('last_id'); $this->act = initVar('act', 'list'); $this->do_id = $_SESSION['do_id']; // PageVar('do_id', $_SESSION['do_id'], $init | $reset, false, $this->baseName); $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName); $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName); $this->es_id = PageVar('es_id', null, $init | $reset, false, $this->baseName); $this->order = PageVar('order', '1A', $init, false, $this->baseName); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('getHelp'); $this->registerAjaxFunction('submitFormData'); $this->registerAjaxFunction('askDelUtility'); }
function checkLang() { if (isset(Flight::request()->query['lang'])) { setLang(substr(Flight::request()->query['lang'], 0, 2)); } }
/** * Submit login data * @ingroup pages * - check login / password * - probably send notification-mail */ function loginFormSubmit() { global $PH; global $auth; global $g_languages; global $g_valid_login_params; ### get formdata #### $name = get('login_name'); $password = get('login_password'); if (!is_null(get('login_password'))) { $password_md5 = md5(get('login_password')); } else { if (!is_null(get('login_password_md5'))) { # required for auto login $password_md5 = get('login_password_md5'); } } /** * try to login using ldap */ if ($auth->checkLdapOption($name)) { if ($auth->tryLoginUserByLdap($name, $password)) { $PH->messages = array(); $auth->storeUserCookie(); if (isset($g_languages[$auth->cur_user->language])) { setLang($auth->cur_user->language); } ### display taskView #### $projects = $auth->cur_user->getProjects(); ### if go-parameter was present before logging in if ($go_after = get('go_after')) { $params = array(); foreach ($g_valid_login_params as $var) { if (get($var)) { $params[$var] = get($var); } } log_message("show(go_after=" . get('go_after') . ")", LOG_MESSAGE_DEBUG); $PH->show(get('go_after'), $params); } else { if (count($projects) == 1) { setWelcomeToProjectMessage($projects[0]); $PH->show('projView', array('prj' => $projects[0]->id)); } else { $PH->messages[] = sprintf(__("Welcome to %s", "Notice after login"), confGet('APP_NAME')); $PH->show('home', array()); } } } else { log_message("invalid login. Show loginForm again", LOG_MESSAGE_DEBUG); $PH->messages[] = __('invalid login', 'message when login failed'); $PH->show('loginForm'); } } else { /** * try to login with nickname / password */ if ($auth->tryLoginUser($name, $password_md5)) { $PH->messages = array(); $auth->storeUserCookie(); if (isset($g_languages[$auth->cur_user->language])) { setLang($auth->cur_user->language); } ### display taskView #### $projects = $auth->cur_user->getProjects(); ### if go-parameter was present before logging in if ($go_after = get('go_after')) { $params = array(); foreach ($g_valid_login_params as $var) { if (get($var)) { $params[$var] = get($var); } } log_message("show(go_after=" . get('go_after') . ")", LOG_MESSAGE_DEBUG); $PH->show(get('go_after'), $params); } else { if (count($projects) == 1) { setWelcomeToProjectMessage($projects[0]); $PH->show('projView', array('prj' => $projects[0]->id)); } else { $PH->messages[] = sprintf(__("Welcome to %s", "Notice after login"), confGet('APP_NAME')); $PH->show('home', array()); } } } else { log_message("invalid login. Show loginForm again", LOG_MESSAGE_DEBUG); $PH->messages[] = __('invalid login', 'message when login failed'); $PH->show('loginForm'); } } }
private function resetCurrentUser() { global $auth; $auth->cur_user = $this->keep_cur_user; if (isset($auth->cur_user->language)) { setLang($auth->cur_user->language); } }
public function lang(string $lang = 'tr') : bool { setLang($lang); }
/** * 系统入口 * 并且支持配置自动加载路径 * @return void */ public static function start($appDirectory,$conf='config.php', $debug=false){ //var_dump( $_SERVER); // 设定错误和异常处理 //register_shutdown_function(array('YYK','fatalError')); self::$debug = $debug; set_error_handler(array('YYK','appError'), E_ALL); set_exception_handler(array('YYK','appException')); //取当前框架路径 self::$YYK_path = pathinfo(__FILE__, PATHINFO_DIRNAME); //取当前项目路径 self::$APP_path = realpath( $appDirectory); //self::$APP_path = pathinfo(realpath( $appDirectory), PATHINFO_DIRNAME);//pathinfo($_SERVER["SCRIPT_FILENAME"], PATHINFO_DIRNAME); //加载常用方法 include self::$YYK_path. DIRECTORY_SEPARATOR . 'common.php'; if (file_exists(self::$APP_path. DIRECTORY_SEPARATOR . 'common.php')) { //加载项目自定义方法 include self::$APP_path. DIRECTORY_SEPARATOR . 'common.php'; } //加载默认配置 /* $tmp = array(); if (file_exists(self::$YYK_path. DIRECTORY_SEPARATOR . 'config.php')) { $tmp = include self::$YYK_path. DIRECTORY_SEPARATOR . 'config.php'; } */ //加载用户配置 $conf = empty($conf) ? "config.php" : $conf; if (file_exists(self::$APP_path. DIRECTORY_SEPARATOR . $conf)){ self::$config = include self::$APP_path. DIRECTORY_SEPARATOR . $conf; } //合并配置 /* self::$config = array_merge($tmp, self::$config); unset($tmp); */ // 注册AUTOLOAD方法 //加载用户控制器类 spl_autoload_register(array('YYK', 'appCtrl')); //加载用户模型类 spl_autoload_register(array('YYK', 'appModel')); //加载YYK核心类 spl_autoload_register(array('YYK', 'YYKClass')); //加载框架扩展类 //加载第三方类 spl_autoload_register(array('YYK', 'otherClass')); //启动session session_start(); //设置时区 date_default_timezone_set(self::$config['timeZone']); //启用smart static server 智能选择静态服务器 /**/ if (isset(self::$config['cacheRedis']) && count(self::$config['cacheRedis'])>0 && isset(self::$config['s3']) && count(self::$config['s3'])>0){ $mem = CacheRedis::create(); $s3_key = 's3_' . ip2long(getIp()); $country = $mem->get($s3_key); if (!$country) { if($ipInfo = getIpInfo(getIP())){ $country = $ipInfo['country_id']; } } if (isset(self::$config['s3'][$country]) && is_array(self::$config['s3'][$country]) ) { self::$config['tplConst'] =array_merge( self::$config['tplConst'], self::$config['s3'][$country]); } $mem->set($s3_key, $country); $mem->expire($s3_key, 600); } //路由分析 $requestRoute = self::parseRoute(); self::$ctrlName = $requestRoute[0]; self::$methodName = $requestRoute[1]; //启用语言包 if (isset(self::$config['useMultiLang']) && self::$config['useMultiLang']==true ) { if (isset($_GET['l'])) { setLang($_GET['l']); self::$defaultLang = $_GET['l']; } else{ setLang(getLang()); self::$defaultLang = getLang(); } } //检查是否开启了模板静态缓存 $staticCacheRoute = strstr($_SERVER['REQUEST_URI'], self::$ctrlName . DIRECTORY_SEPARATOR . self::$methodName); $staticCacheType = false; if (isset( self::$config['staticCache'][$staticCacheRoute] )) { $staticCacheType = $staticCacheType = isset(self::$config['staticCacheType']) ? self::$config['staticCacheType'] : 'FS'; $staticCacheKey = 'staticCache' . str_replace(DIRECTORY_SEPARATOR, '_', self::$APP_path) . str_replace(DIRECTORY_SEPARATOR, '_', $staticCacheRoute); header('Server: Microsoft-IIS/8.0'); header('X-Powered-By: ASP.NET'); $content =''; switch(strtolower($staticCacheType)) { case 'redis': $redis = CacheRedis::create(); $cacheTtl = $redis->ttl($staticCacheKey); $cacheTtl = $cacheTtl>0 ? $cacheTtl : 0; $cacheModifyTime = time() -( self::$config['staticCache'][$staticCacheRoute] - $cacheTtl); $requestModifyTime= isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])-3600*8 : 0 ; $cacheExpire = $cacheModifyTime + self::$config['staticCache'][$staticCacheRoute]; if ($cacheExpire > time()) { if ($cacheModifyTime <= $requestModifyTime ) { header("HTTP/1.1 304 Not Modified"); header("Date: " . date('D, d M Y H:i:s', time()) . ' GMT'); header("Last-Modified: " . date('D, d M Y H:i:s', $cacheModifyTime) . ' GMT'); header("Cache-Control: max-age=" . $cacheTtl); header("Expires: ".date('D, d M Y H:i:s', $cacheExpire) . ' GMT'); exit(0); } $content = $redis->get($staticCacheKey); } break; case 'memcache': $memcache = CacheMem::create(); $content = $memcache->get($staticCacheKey); $cacheModifyTime = substr($content, 0, strpos($content, ',')); $cacheTtl = self::$config['staticCache'][$staticCacheRoute] - ( time()-$cacheModifyTime ); $cacheTtl = $cacheTtl>0 ? $cacheTtl : 0; $requestModifyTime= isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])-3600*8 : 0 ; $cacheExpire = $cacheModifyTime + self::$config['staticCache'][$staticCacheRoute]; if ($cacheExpire > time()) { if ($cacheModifyTime <= $requestModifyTime ) { header("HTTP/1.1 304 Not Modified"); header("Date: " . date('D, d M Y H:i:s', time()) . ' GMT'); header("Last-Modified: " . date('D, d M Y H:i:s', $cacheModifyTime) . ' GMT'); header("Cache-Control: max-age=" . $cacheTtl); header("Expires: ".date('D, d M Y H:i:s', $cacheExpire) . ' GMT'); exit(0); } $content = substr($content, strpos($content, ',')+1); } break; default: //默认文件系统缓存 $tplCache = self::$APP_path . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . self::$ctrlName . DIRECTORY_SEPARATOR . self::$methodName . '.html'; if (!file_exists($tplCache)) { break; } $cacheModifyTime = filemtime($tplCache); $cacheTtl = self::$config['staticCache'][$staticCacheRoute] - ( time()-$cacheModifyTime ); $cacheTtl = $cacheTtl>0 ? $cacheTtl : 0; $requestModifyTime= isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])-3600*8 : 0 ; $cacheExpire = $cacheModifyTime + self::$config['staticCache'][$staticCacheRoute]; //echo $cacheModifyTime . "<br>"; //echo $requestModifyTime . "<br>"; //echo time(); if ($cacheExpire > time()) { if ($cacheModifyTime <= $requestModifyTime ) { header("HTTP/1.1 304 Not Modified"); header("Date: " . date('D, d M Y H:i:s', time()) . ' GMT'); header("Last-Modified: " . date('D, d M Y H:i:s', $cacheModifyTime) . ' GMT'); header("Cache-Control: max-age=" . $cacheTtl); header("Expires: ".date('D, d M Y H:i:s', $cacheExpire) . ' GMT'); exit(0); } else{ $content = file_get_contents($tplCache); } } break; } if (strlen($content)>0) { header("Date: " . date('D, d M Y H:i:s', time()) . ' GMT'); header("Last-Modified: " . date('D, d M Y H:i:s', $cacheModifyTime) . ' GMT'); header("Cache-Control: max-age=" . $cacheTtl); header("Expires: ".date('D, d M Y H:i:s', $cacheExpire) . ' GMT'); echo $content;exit(0); } } self::$ctrlName = $requestRoute[0] . 'Ctrl'; //检查路由是否存在 if (class_exists(self::$ctrlName)){ $C = new self::$ctrlName(); if (method_exists($C, self::$methodName)){ self::$ctrlName = $requestRoute[0]; call_user_func(array($C, self::$methodName)); } else{ //E( 'None method:'.self::$methodName); _404(); } } else{ //控制器不存在 //E( 'None Controller:' . self::$ctrlName); _404(); } }
public function __construct(array $request = array(), array $opt = array()) { parent::__construct($request, $opt); $this->fields = $this->defFields(); $storeVar = isset($_GET['act']) && $_GET['act'] == 'list'; // if true store the filter variables $init = array_key_exists('init', $this->request); $reset = array_key_exists('reset', $this->request); if ($init || $reset) { $storeVar = true; } $this->id = initVar('id'); $this->last_id = initVar('last_id'); $this->parent_act = initVar('parent_act'); $this->tab_mode = initVar('tab_mode'); $this->act = initVar('act', 'list'); $this->do_id = $_SESSION['do_id']; $this->bu_id = initVar('bu_id'); $this->pr_id = PageVar('pr_id', null, $init | $reset, false, $this->baseName, $storeVar); $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName, $storeVar); $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName, $storeVar); $this->ac_name = PageVar('ac_name', null, $init | $reset, false, $this->baseName, $storeVar); $this->gc_id = PageVar('gc_id', null, $init | $reset, false, $this->baseName, $storeVar); $this->gpa_name = PageVar('gpa_name', null, $init | $reset, false, $this->baseName, $storeVar); $this->gpa_name = PageVar('ac_alternative_simulation', null, $init | $reset, false, $this->baseName, $storeVar); $this->order = PageVar('order', '1A', $init, false, $this->baseName, $storeVar); $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName, $storeVar); $this->tableURL = array('bu_id' => $this->bu_id); setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); $this->registerAjaxFunction('getHelp'); $this->registerAjaxFunction('submitFormData'); $this->registerAjaxFunction('getGlobalCategory'); $this->registerAjaxFunction('getGlobalSubCategory'); $this->registerAjaxFunction('getRelatedActionsList'); $this->registerAjaxFunction('getEnergySource'); $this->registerAjaxFunction('getEnergyUDM'); $this->registerAjaxFunction('performActionCatalogCalc'); $this->registerAjaxFunction('askDelActionCatalog'); $this->registerAjaxFunction('updateActionName'); $this->registerAjaxFunction('checkSubActionMapLink'); }
<?php if (isset($_GET['lang'])) { setLang($_GET['lang']); } if (isset($_SERVER['HTTP_REFERER'])) { redirectUrl($_SERVER['HTTP_REFERER']); } else { redirect("homepage"); }
/** * Send notication mail for one person right now @ingroup pages */ function peopleFlushNotifications() { global $PH; global $auth; ### get person #### $ids = getPassedIds('person', 'people_*'); if (!$ids) { $PH->abortWarning(__("Select some people to notify")); return; } $counter = 0; $errors = 0; foreach ($ids as $id) { if (!($person = Person::getEditableById($id))) { $PH->abortWarning("Invalid person-id!"); } require_once confGet('DIR_STREBER') . 'std/class_email_notification.inc.php'; $email = new EmailNotification($person); if ($email->information_count) { $send_result = $email->send(); if ($send_result === true) { $counter++; } else { $errors++; } } } ### reset language ### setLang($auth->cur_user->language); if ($errors) { new FeedbackWarning(sprintf(__("Failed to mail %s people"), $errors)); } else { new FeedbackMessage(sprintf(__("Sent notification to %s person(s)"), $counter)); } ### display taskView #### if (!$PH->showFromPage()) { $PH->show('projView', array('prj' => $person->project)); } }
/** * Constructor */ public function __construct(array $request = array(), array $opt = array()) { if (!isset($request['act'])) { $request['act'] = 'list'; } $this->request = $request; $this->opt = $opt; $this->baseName = substr(get_class($this), strlen(CLASS_PREFIX)); $this->imagePath = defined('BUILD') ? R3_APP_URL . substr(R3_IMAGES_URL, strlen(R3_APP_URL)) . BUILD . '/' : R3_IMAGES_URL; setLang(R3Locale::getLanguageCode()); setLangInfo(array('thousands_sep' => ".")); if (defined('USE_JQGRID') && USE_JQGRID === true) { $this->registerAjaxFunction('getListData'); } $this->method = isset($request['method']) ? $request['method'] : null; $this->isAjaxCall = false; // Apply filter $this->mangleFilter($request); }