本文整理汇总了PHP中DevblocksPlatform::setLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::setLocale方法的具体用法?PHP DevblocksPlatform::setLocale怎么用?PHP DevblocksPlatform::setLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::setLocale方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
public function handleRequest(DevblocksHttpRequest $request)
{
$stack = $request->path;
$module_uri = array_shift($stack);
// Set locale in scope
$default_locale = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_DEFAULT_LOCALE, 'en_US');
DevblocksPlatform::setLocale($default_locale);
switch ($module_uri) {
case 'login':
$this->doLogin();
break;
case 'logout':
$this->doLogout();
break;
default:
$modules = $this->_getModules();
$controller = null;
if (isset($modules[$module_uri])) {
$controller = $modules[$module_uri];
}
array_unshift($stack, $module_uri);
if (!is_null($controller)) {
$controller->handleRequest(new DevblocksHttpRequest($stack));
}
break;
}
}
示例2: authenticateAction
function authenticateAction()
{
// Pull from $_POST
@($original_path = explode(',', DevblocksPlatform::importGPC($_POST['original_path'])));
@($email = DevblocksPlatform::importGPC($_POST['email']));
@($password = DevblocksPlatform::importGPC($_POST['password']));
$url_service = DevblocksPlatform::getUrlService();
$worker = DAO_Worker::login($email, $password);
if (!is_null($worker)) {
$session = DevblocksPlatform::getSessionService();
$visit = new UsermeetVisit();
$visit->setWorker($worker);
$session->setVisit($visit);
//authentication passed
if ($original_path[0] == '') {
unset($original_path[0]);
}
$devblocks_response = new DevblocksHttpResponse($original_path);
// Worker
$worker = UsermeetApplication::getActiveWorker();
// Timezone
if (null != ($timezone = DAO_WorkerPref::get($worker->id, 'timezone'))) {
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
}
// Language
if (null != ($lang_code = DAO_WorkerPref::get($worker->id, 'locale'))) {
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
}
if (empty($devblocks_response->path)) {
$tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
$next_page = $tour_enabled ? 'welcome' : 'home';
$devblocks_response = new DevblocksHttpResponse(array($next_page));
}
} else {
//authentication failed
$devblocks_response = new DevblocksHttpResponse(array('login', 'failed'));
}
DevblocksPlatform::redirect($devblocks_response);
}
示例3: authenticateAction
function authenticateAction()
{
@($original_path = explode(',', DevblocksPlatform::importGPC($_POST['original_path'])));
$manifest = DevblocksPlatform::getExtension('login.default');
$inst = $manifest->createInstance();
/* @var $inst Extension_LoginAuthenticator */
$url_service = DevblocksPlatform::getUrlService();
if ($inst->authenticate()) {
//authentication passed
if ($original_path[0] == '') {
unset($original_path[0]);
}
$devblocks_response = new DevblocksHttpResponse($original_path);
// Worker
$worker = CerberusApplication::getActiveWorker();
// Timezone
if (null != ($timezone = DAO_WorkerPref::get($worker->id, 'timezone'))) {
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
}
// Language
if (null != ($lang_code = DAO_WorkerPref::get($worker->id, 'locale'))) {
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
}
if (!empty($devblocks_response->path) && $devblocks_response->path[0] == 'login') {
$tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
$next_page = $tour_enabled ? 'welcome' : 'home';
$devblocks_response = new DevblocksHttpResponse(array($next_page));
}
} else {
//authentication failed
$devblocks_response = new DevblocksHttpResponse(array('login', 'failed'));
}
DevblocksPlatform::redirect($devblocks_response);
}
示例4: header
header('Location: ' . dirname($_SERVER['PHP_SELF']) . '/install/index.php');
// [TODO] change this to a meta redirect
exit;
}
require APP_PATH . '/api/Application.class.php';
DevblocksPlatform::init();
DevblocksPlatform::setExtensionDelegate('C4_DevblocksExtensionDelegate');
// Request
$request = DevblocksPlatform::readRequest();
// Patches (if not on the patch page)
if (@0 != strcasecmp(@$request->path[0], "update") && !DevblocksPlatform::versionConsistencyCheck()) {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('update', 'locked')));
}
//DevblocksPlatform::readPlugins();
$session = DevblocksPlatform::getSessionService();
// Localization
DevblocksPlatform::setLocale(isset($_SESSION['locale']) && !empty($_SESSION['locale']) ? $_SESSION['locale'] : 'en_US');
if (isset($_SESSION['timezone'])) {
@date_default_timezone_set($_SESSION['timezone']);
}
// Initialize Logging
if (method_exists('DevblocksPlatform', 'getConsoleLog')) {
$timeout = ini_get('max_execution_time');
$logger = DevblocksPlatform::getConsoleLog();
$logger->info("[Devblocks] ** Platform starting (" . date("r") . ") **");
$logger->info('[Devblocks] Time Limit: ' . ($timeout ? $timeout : 'unlimited') . " secs");
$logger->info('[Devblocks] Memory Limit: ' . ini_get('memory_limit'));
}
// [JAS]: HTTP Request (App->Platform)
CerberusApplication::processRequest($request);
exit;
示例5: authenticateAction
function authenticateAction()
{
@($email = DevblocksPlatform::importGPC($_POST['email']));
@($password = DevblocksPlatform::importGPC($_POST['password']));
@($original_path = explode(',', DevblocksPlatform::importGPC($_POST['original_path'])));
@($original_query_str = DevblocksPlatform::importGPC($_POST['original_query']));
$manifest = DevblocksPlatform::getExtension('login.default');
$inst = $manifest->createInstance();
/* @var $inst CerberusLoginPageExtension */
$url_service = DevblocksPlatform::getUrlService();
if ($inst->authenticate(array('email' => $email, 'password' => $password))) {
//authentication passed
$original_query = $url_service->parseQueryString($original_query_str);
if ($original_path[0] == '') {
unset($original_path[0]);
}
$devblocks_response = new DevblocksHttpResponse($original_path, $original_query);
if ($devblocks_response->path[0] == 'login') {
$session = DevblocksPlatform::getSessionService();
$visit = $session->getVisit();
$tour_enabled = false;
if (!empty($visit) && !is_null($visit->getWorker())) {
$worker = $visit->getWorker();
$tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
// Timezone
if (null != ($timezone = DAO_WorkerPref::get($worker->id, 'timezone'))) {
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
}
// Language
if (null != ($lang_code = DAO_WorkerPref::get($worker->id, 'locale'))) {
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
}
}
$next_page = $tour_enabled ? 'welcome' : 'home';
$devblocks_response = new DevblocksHttpResponse(array($next_page));
}
} else {
//authentication failed
$devblocks_response = new DevblocksHttpResponse(array('login'));
}
DevblocksPlatform::redirect($devblocks_response);
}
示例6: die
@chmod(APP_STORAGE_PATH . '/mail/fail/', 0774);
if (!is_writeable(APP_STORAGE_PATH)) {
die(APP_STORAGE_PATH . " is not writeable by the webserver. Please adjust permissions and reload this page.");
}
//if(!is_writeable(APP_STORAGE_PATH . "/import/fail/")) {
// die(APP_STORAGE_PATH . "/import/fail/ is not writeable by the webserver. Please adjust permissions and reload this page.");
//}
//
//if(!is_writeable(APP_STORAGE_PATH . "/import/new/")) {
// die(APP_STORAGE_PATH . "/import/new/ is not writeable by the webserver. Please adjust permissions and reload this page.");
//}
if (!is_writeable(APP_STORAGE_PATH . "/attachments/")) {
die(APP_STORAGE_PATH . "/attachments/ is not writeable by the webserver. Please adjust permissions and reload this page.");
}
// [TODO] Move this to the framework init (installer blocks this at the moment)
DevblocksPlatform::setLocale('en_US');
// Get a reference to the template system and configure it
$tpl = DevblocksPlatform::getTemplateService();
$tpl->template_dir = APP_PATH . '/install/templates';
$tpl->caching = 0;
$tpl->assign('application_name', INSTALL_APP_NAME);
$tpl->assign('step', $step);
switch ($step) {
// [TODO] Check server + php environment (extensions + php.ini)
default:
case STEP_ENVIRONMENT:
$results = array();
$fails = 0;
// PHP Version
if (version_compare(PHP_VERSION, "5.2") >= 0) {
$results['php_version'] = PHP_VERSION;
示例7: saveDefaultsAction
function saveDefaultsAction()
{
@($timezone = DevblocksPlatform::importGPC($_REQUEST['timezone'], 'string'));
@($lang_code = DevblocksPlatform::importGPC($_REQUEST['lang_code'], 'string', 'en_US'));
@($default_signature = DevblocksPlatform::importGPC($_REQUEST['default_signature'], 'string'));
@($default_signature_pos = DevblocksPlatform::importGPC($_REQUEST['default_signature_pos'], 'integer', 0));
@($reply_box_height = DevblocksPlatform::importGPC($_REQUEST['reply_box_height'], 'integer'));
$worker = CerberusApplication::getActiveWorker();
$translate = DevblocksPlatform::getTranslationService();
$tpl = DevblocksPlatform::getTemplateService();
$pref_errors = array();
// Time
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
DAO_WorkerPref::set($worker->id, 'timezone', $timezone);
// Language
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
DAO_WorkerPref::set($worker->id, 'locale', $lang_code);
@($new_password = DevblocksPlatform::importGPC($_REQUEST['change_pass'], 'string'));
@($verify_password = DevblocksPlatform::importGPC($_REQUEST['change_pass_verify'], 'string'));
//[mdf] if nonempty passwords match, update worker's password
if ($new_password != "" && $new_password === $verify_password) {
$session = DevblocksPlatform::getSessionService();
$fields = array(DAO_Worker::PASSWORD => md5($new_password));
DAO_Worker::updateAgent($worker->id, $fields);
}
@($assist_mode = DevblocksPlatform::importGPC($_REQUEST['assist_mode'], 'integer', 0));
DAO_WorkerPref::set($worker->id, 'assist_mode', $assist_mode);
@($keyboard_shortcuts = DevblocksPlatform::importGPC($_REQUEST['keyboard_shortcuts'], 'integer', 0));
DAO_WorkerPref::set($worker->id, 'keyboard_shortcuts', $keyboard_shortcuts);
@($mail_inline_comments = DevblocksPlatform::importGPC($_REQUEST['mail_inline_comments'], 'integer', 0));
DAO_WorkerPref::set($worker->id, 'mail_inline_comments', $mail_inline_comments);
@($mail_always_show_all = DevblocksPlatform::importGPC($_REQUEST['mail_always_show_all'], 'integer', 0));
DAO_WorkerPref::set($worker->id, 'mail_always_show_all', $mail_always_show_all);
// Alternate Email Addresses
@($new_email = DevblocksPlatform::importGPC($_REQUEST['new_email'], 'string', ''));
@($email_delete = DevblocksPlatform::importGPC($_REQUEST['email_delete'], 'array', array()));
// Confirm deletions are assigned to the current worker
if (!empty($email_delete)) {
foreach ($email_delete as $e) {
if (null != ($worker_address = DAO_AddressToWorker::getByAddress($e)) && $worker_address->worker_id == $worker->id) {
DAO_AddressToWorker::unassign($e);
}
}
}
// Assign a new e-mail address if it's legitimate
if (!empty($new_email)) {
if (null != ($addy = DAO_Address::lookupAddress($new_email, true))) {
if (null == ($assigned = DAO_AddressToWorker::getByAddress($new_email))) {
$this->_sendConfirmationEmail($new_email, $worker);
} else {
$pref_errors[] = vsprintf($translate->_('prefs.address.exists'), $new_email);
}
} else {
$pref_errors[] = vsprintf($translate->_('prefs.address.invalid'), $new_email);
}
}
$tpl->assign('pref_errors', $pref_errors);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('preferences')));
}
示例8: saveTabGeneralAction
function saveTabGeneralAction()
{
@($timezone = DevblocksPlatform::importGPC($_REQUEST['timezone'], 'string'));
@($lang_code = DevblocksPlatform::importGPC($_REQUEST['lang_code'], 'string', 'en_US'));
$worker = PortSensorApplication::getActiveWorker();
$translate = DevblocksPlatform::getTranslationService();
$tpl = DevblocksPlatform::getTemplateService();
// Time
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
DAO_WorkerPref::set($worker->id, 'timezone', $timezone);
// Language
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
DAO_WorkerPref::set($worker->id, 'locale', $lang_code);
@($new_password = DevblocksPlatform::importGPC($_REQUEST['change_pass'], 'string'));
@($verify_password = DevblocksPlatform::importGPC($_REQUEST['change_pass_verify'], 'string'));
//[mdf] if nonempty passwords match, update worker's password
if ($new_password != "" && $new_password === $verify_password) {
$session = DevblocksPlatform::getSessionService();
$fields = array(DAO_Worker::PASS => md5($new_password));
DAO_Worker::update($worker->id, $fields);
}
@($assist_mode = DevblocksPlatform::importGPC($_REQUEST['assist_mode'], 'integer', 0));
DAO_WorkerPref::set($worker->id, 'assist_mode', $assist_mode);
@($keyboard_shortcuts = DevblocksPlatform::importGPC($_REQUEST['keyboard_shortcuts'], 'integer', 0));
DAO_WorkerPref::set($worker->id, 'keyboard_shortcuts', $keyboard_shortcuts);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('preferences')));
}