本文整理汇总了PHP中Configuration::Instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::Instance方法的具体用法?PHP Configuration::Instance怎么用?PHP Configuration::Instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::Instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ParseTemplate
function ParseTemplate($data = NULL)
{
$cur_mod = $dispt->mModule;
$cur_sub_mod = $dispt->mSubmodule;
if (empty($data)) {
$this->mrTemplate->addVar('menulist', 'MENU_DESC', 'No demo is available!');
$this->mrTemplate->addVar('menulist', 'MENU_URL', '#');
} else {
foreach ($data as $key => $value) {
if (Security::Instance()->mSecurityEnabled) {
$allow = Security::Instance()->AllowedToAccess($value['Module'], $value['SubModule'], 'view', $value['Type']);
} else {
$allow = true;
}
if ($value['Module'] == $cur_mod && $value['SubModule'] == $cur_sub_mod) {
$this->mrTemplate->addVar('menulist', 'STRONG_OPEN', '<strong>');
$this->mrTemplate->addVar('menulist', 'STRONG_CLOSE', '</strong>');
} else {
$this->mrTemplate->addVar('menulist', 'STRONG_OPEN', '');
$this->mrTemplate->addVar('menulist', 'STRONG_CLOSE', '');
}
if ($allow) {
$this->mrTemplate->addVar('menulist', 'MENU_NAME', $value['MenuName']);
$this->mrTemplate->addVar('menulist', 'MENU_DESC', $value['Description']);
$this->mrTemplate->addVar('menulist', 'MENU_URL', Configuration::Instance()->GetValue('application', 'baseaddress') . Dispatcher::Instance()->GetUrl($value['Module'], $value['SubModule'], 'view', $value['Type']));
$this->mrTemplate->parseTemplate('menulist', 'a');
}
}
}
}
示例2: GetUser
/**
* @name GetUser
* @description Loads the requested user by Id
* @response UserResponse
* @param int $userId
* @return void
*/
public function GetUser($userId)
{
$responseCode = RestResponse::OK_CODE;
$hideUsers = Configuration::Instance()->GetSectionKey(ConfigSection::PRIVACY, ConfigKeys::PRIVACY_HIDE_USER_DETAILS, new BooleanConverter());
$userSession = $this->server->GetSession();
$repository = $this->repositoryFactory->Create($userSession);
$user = $repository->LoadById($userId);
$loadedUserId = $user->Id();
if (empty($loadedUserId)) {
$this->server->WriteResponse(RestResponse::NotFound(), RestResponse::NOT_FOUND_CODE);
return;
}
$attributes = $this->attributeService->GetAttributes(CustomAttributeCategory::USER, array($userId));
if ($userId == $userSession->UserId || !$hideUsers || $userSession->IsAdmin) {
$response = new UserResponse($this->server, $user, $attributes);
} else {
$me = $repository->LoadById($userSession->UserId);
if ($me->IsAdminFor($user)) {
$response = new UserResponse($this->server, $user, $attributes);
} else {
$response = RestResponse::Unauthorized();
$responseCode = RestResponse::UNAUTHORIZED_CODE;
}
}
$this->server->WriteResponse($response, $responseCode);
}
示例3: __construct
/**
* @param ReservationItemView $res
* @param UserSession $currentUser
* @param IPrivacyFilter $privacyFilter
* @param string|null $summaryFormat
*/
public function __construct($res, UserSession $currentUser, IPrivacyFilter $privacyFilter, $summaryFormat = null)
{
if ($summaryFormat == null) {
$summaryFormat = Configuration::Instance()->GetSectionKey(ConfigSection::RESERVATION_LABELS, ConfigKeys::RESERVATION_LABELS_ICS_SUMMARY);
}
$factory = new SlotLabelFactory($currentUser);
$this->ReservationItemView = $res;
$canViewUser = $privacyFilter->CanViewUser($currentUser, $res, $res->UserId);
$canViewDetails = $privacyFilter->CanViewDetails($currentUser, $res, $res->UserId);
$privateNotice = 'Private';
$this->DateCreated = $res->CreatedDate;
$this->DateEnd = $res->EndDate;
$this->DateStart = $res->StartDate;
$this->Description = $canViewDetails ? $res->Description : $privateNotice;
$fullName = new FullName($res->OwnerFirstName, $res->OwnerLastName);
$this->Organizer = $canViewUser ? $fullName->__toString() : $privateNotice;
$this->OrganizerEmail = $canViewUser ? $res->OwnerEmailAddress : $privateNotice;
$this->RecurRule = $this->CreateRecurRule($res);
$this->ReferenceNumber = $res->ReferenceNumber;
$this->Summary = $canViewDetails ? $factory->Format($res, $summaryFormat) : $privateNotice;
$this->ReservationUrl = sprintf("%s/%s?%s=%s", Configuration::Instance()->GetScriptUrl(), Pages::RESERVATION, QueryStringKeys::REFERENCE_NUMBER, $res->ReferenceNumber);
$this->Location = $res->ResourceName;
$this->StartReminder = $res->StartReminder;
$this->EndReminder = $res->EndReminder;
if ($res->UserId == $currentUser->UserId) {
$this->OrganizerEmail = str_replace('@', '-noreply@', $res->OwnerEmailAddress);
}
}
示例4: showRecaptcha
private function showRecaptcha()
{
Log::Debug('CaptchaControl using Recaptcha');
require_once ROOT_DIR . 'lib/external/recaptcha/recaptchalib.php';
$response = recaptcha_get_html(Configuration::Instance()->GetSectionKey(ConfigSection::RECAPTCHA, ConfigKeys::RECAPTCHA_PUBLIC_KEY));
echo $response;
}
示例5: PageLoad
public function PageLoad()
{
ob_clean();
$this->presenter->PageLoad();
$config = Configuration::Instance();
$feed = new FeedWriter(ATOM);
$title = $config->GetKey(ConfigKeys::APP_TITLE);
$feed->setTitle("{$title} Reservations");
$url = $config->GetScriptUrl();
$feed->setLink($url);
$feed->setChannelElement('updated', date(DATE_ATOM, time()));
$feed->setChannelElement('author', array('name' => $title));
foreach ($this->reservations as $reservation) {
/** @var FeedItem $item */
$item = $feed->createNewItem();
$item->setTitle($reservation->Summary);
$item->setLink($reservation->ReservationUrl);
$item->setDate($reservation->DateCreated->Timestamp());
$item->setDescription(sprintf('<div><span>Start</span> %s</div>
<div><span>End</span> %s</div>
<div><span>Organizer</span> %s</div>
<div><span>Description</span> %s</div>', $reservation->DateStart->ToString(), $reservation->DateEnd->ToString(), $reservation->Organizer, $reservation->Description));
$feed->addItem($item);
}
$feed->genarateFeed();
}
示例6: ProcessRequest
function ProcessRequest()
{
$mainMsg = '';
$detailMsg = '';
$type = '';
// implements component messenger
$msg = Messenger::Instance()->Receive(__FILE__, $this->mComponentName);
if (!empty($msg)) {
$codeMainMsg = $msg[0][0];
Configuration::Instance()->Load('error.conf.php', 'default');
$mainMsgConf = Configuration::Instance()->GetValue('error', $codeMainMsg);
$mainMsg = $mainMsgConf['lang'];
$detailMsg = $msg[0][1];
$type = $mainMsgConf['type'];
} else {
// for compatibility backward, delete me!
if (isset($this->mComponentParameters['notebox_mainmsg'])) {
$codeMainMsg = $this->mComponentParameters['notebox_mainmsg'];
Configuration::Instance()->Load('error.conf.php', 'default');
$mainMsgConf = Configuration::Instance()->GetValue('error', $codeMainMsg);
$mainMsg = $mainMsgConf['lang'];
$detailMsg = $this->mComponentParameters['notebox_detailmsg'];
$type = $mainMsgConf['type'];
}
}
return array('mainMsg' => $mainMsg, 'detailMsg' => $detailMsg, 'type' => $type);
}
示例7: __construct
function __construct($dbConfig = NULL)
{
parent::__construct($dbConfig);
// set debug mode via configuration
$GLOBALS['debug'] = (bool) $this->mDbConfig['db_debug_enabled'];
// preparing wsdl cache configuration
if (!isset($this->mDbConfig['db_wsdl_cache_enabled'])) {
$this->mDbConfig['db_wsdl_cache_enabled'] = TRUE;
}
$this->mDbConfig['db_wsdl_cache_lifetime'] = $this->mDbConfig['db_wsdl_cache_lifetime'] != '' ? (int) $this->mDbConfig['db_wsdl_cache_lifetime'] : 60 * 60 * 24;
// defaults to 1 day
$this->mDbConfig['db_wsdl_cache_path'] = file_exists($this->mDbConfig['db_wsdl_cache_path']) ? $this->mDbConfig['db_wsdl_cache_path'] : Configuration::Instance()->GetTempDir();
$this->mDbConfig['db_connection_timeout'] = $this->mDbConfig['db_connection_timeout'] != '' ? (int) $this->mDbConfig['db_connection_timeout'] : 30;
// default to 30
$this->mDbConfig['db_response_timeout'] = $this->mDbConfig['db_response_timeout'] != '' ? (int) $this->mDbConfig['db_response_timeout'] : 30;
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.nusoap_base.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soap_val.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soap_parser.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soap_fault.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soap_transport_http.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.xmlschema.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.wsdl.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soapclient.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.wsdlcache.php';
SysLog::Instance()->log('SoapDatabaseEngine::__construct', 'DatabaseEngine');
}
示例8: ProcessRequest
function ProcessRequest()
{
$msg = Messenger::Instance()->Receive(__FILE__);
@($return['Pesan'] = $msg[0][1]);
@($return['Data'] = $msg[0][0]);
$applicationId = Configuration::Instance()->GetValue('application', 'application_id');
$idDec = Dispatcher::Instance()->Decrypt($_REQUEST['grp']);
if ($idDec == '') {
@($idDec = Dispatcher::Instance()->Decrypt($return['Data']['0']['grp']));
}
$groupObj = new AppGroup();
$menuGroup = $groupObj->GetAllPrivilege($idDec, $applicationId);
$return['menuGroup'] = $menuGroup;
$dataGroup = $groupObj->GetDataGroupById($idDec);
$dataUnitKerja = $groupObj->GetComboUnitKerja($applicationId);
#action
$actionTemp = $groupObj->GetAllAksiByGroupId($idDec);
foreach ($actionTemp as $values) {
$key = $values['MenuId'];
$actionGroup[$key][] = $values;
}
//print_r($actionGroup);
//exit;
$return['actionGroup'] = $actionGroup;
if (isset($dataGroup['0']['group_unit_id'])) {
$unit_selected = $dataGroup['0']['group_unit_id'];
} else {
@($unit_selected = $return['Data']['0']['unit_kerja']);
}
Messenger::Instance()->SendToComponent('combobox', 'Combobox', 'view', 'html', 'unit_kerja', array('unit_kerja', $dataUnitKerja, $unit_selected, 'false'), Messenger::CurrentRequest);
$return['decDataId'] = $idDec;
$return['dataGroup'] = $dataGroup;
return $return;
}
示例9: DoLogin
function DoLogin()
{
$this->mUser->mUserName = $this->mUserName;
$this->FetchUserInfo();
SysLog::Instance()->log('User (' . $this->mUserName . ') active: ' . $this->GetCurrentUser()->GetActive(), 'login');
if ($this->GetCurrentUser()->GetActive() != 'Yes') {
return FALSE;
}
$hashed = $this->IsPasswordHashed();
$salt = $this->GetSalt();
if ($hashed) {
$hash = md5(md5($salt . $this->GetCurrentUser()->GetPassword()));
} else {
$hash = $this->mUser->mPassword;
}
SysLog::Instance()->log('comparing: ' . $this->mPassword . ' == ' . $hash . ' hashed=' . $hashed . ' salt=' . $salt, 'login');
if (md5($this->mPassword) == $hash) {
SysLog::Instance()->log('Logged in!', 'login');
$this->mIsLoggedIn = true;
$_SESSION['is_logged_in'] = true;
$_SESSION['username'] = (string) $this->mUserName;
Session::Instance()->Restart();
// regenerate session_id, prevent session fixation
} else {
$this->mIsLoggedIn = false;
$_SESSION['is_logged_in'] = false;
$_SESSION['username'] = Configuration::Instance()->GetValue('application', 'default_user');
}
return $this->mIsLoggedIn;
}
示例10: __construct
function __construct()
{
if ($this->mUseNewLibrary) {
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/WriteExcel/Writer.php';
$this->mrWorkbook = new Spreadsheet_Excel_Writer_Workbook('-');
$this->mrWorkbook->setVersion(8);
// BIFF8
if (!empty($this->mWorksheets) && is_array($this->mWorksheets)) {
$array_temp = array();
foreach ($this->mWorksheets as $key => $value) {
$array_temp[$value] = $this->mrWorkbook->addWorksheet($value);
}
// reassign previously defined sheetname, so you can refer a worksheet
// by calling $this->mWorksheets['Sheet1'], etc. later
$this->mWorksheets = $array_temp;
}
} else {
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/WriteExcel/Worksheet.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/WriteExcel/Workbook.php';
$this->mrWorkbook =& new Workbook('-');
//$this->mrWorkbook = new Spreadsheet_Excel_Writer_Workbook('-');
if (!empty($this->mWorksheets) && is_array($this->mWorksheets)) {
$array_temp = array();
foreach ($this->mWorksheets as $key => $value) {
$array_temp[$value] =& $this->mrWorkbook->add_worksheet($value);
}
// reassign previously defined sheetname, so you can refer a worksheet
// by calling $this->mWorksheets['Sheet1'], etc. later
$this->mWorksheets = $array_temp;
}
}
}
示例11: DoLogin
function DoLogin()
{
SysLog::Instance()->log('Login(sso)::DoLogin', "login");
$ssoclient = SsoClient::Instance();
SysLog::Instance()->log('Login(sso)::DoLogin poke me!!', "login");
// echo "Is sso alive? ";
// var_dump($ssoclient->isSsoAlive());
// die();
$SsoAuth = $ssoclient->authenticateSsoUser($this->mUsername, $this->mPassword, $this->mSsoSystemId);
// echo "<pre>";
// var_dump($SsoAuth);
// echo "</pre>";
// die();
SysLog::Instance()->log("DoLogin got SsoAuth: " . print_r($SsoAuth, true), "login");
if ($SsoAuth['status'] === true) {
// save SSID
$ssoclient->saveSsIdToLocal($SsoAuth['ssid'], Configuration::Instance()->GetValue('application', 'sso_group'));
// request details on SSID
$SsoAttr = $ssoclient->requestSsIdAttributes($SsoAuth['ssid'], $this->mSsoSystemId);
SysLog::Instance()->log("DoLogin got SsoAttr: " . print_r($SsoAttr, true), "login");
$local_username = $SsoAttr['mSsoLocalUsername'];
$this->mUser->mUserName = $local_username;
$this->mUser->GetUser();
}
// echo "<pre>";
// var_dump($SsoAttr);
// echo "</pre>";
// die($local_username);
return $SsoAuth['status'];
}
示例12: __construct
function __construct($connectionNumber = 0)
{
$connection_id = Configuration::Instance()->GetValue('application', 'session_db_connection');
$this->mSqlFile = Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/gtfw/session/save_handler/database/session.sql.php';
parent::__construct($connectionNumber);
SysLog::Log('DbSaveHandler::__construct', 'Session');
}
示例13: Database
public function Database($connectionNumber = 0)
{
SysLog::Instance()->log("creating Database using connection: #{$connectionNumber}", "database");
$db_conn = Configuration::Instance()->GetValue('application', 'db_conn');
$db_conn = $db_conn[$connectionNumber];
// remind me
if (!$db_conn) {
die('Can\'t find database configuration of index ' . $connectionNumber . '. Please, configure it properly in application.conf.php.');
}
if ($this->mDbConfig != NULL) {
foreach ($this->mDbConfig as $key => $value) {
$db_conn[$key] = $value;
}
}
$this->mDbConfig = $db_conn;
// makes connection id as part of db config
$this->mDbConfig['connection_id'] = md5(serialize($this->mDbConfig));
//
$db_driv_class = str_replace(' ', '', ucwords(str_replace('_', ' ', $this->mDbConfig['db_driv'])));
if (!isset($GLOBALS['db'][$this->mDbConfig['connection_id']])) {
// not connected yet
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/gtfw/database/database_engine/' . $this->mDbConfig['db_driv'] . '/' . $db_driv_class . 'DatabaseEngine.class.php';
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
SysLog::Instance()->log('$this->mrDbEngine' . " = new {$db_driv_class}DatabaseEngine(\$this->mDbConfig);", 'database');
SysLog::Instance()->log('$this->mDbConfig):' . print_r($this->mDbConfig, true), 'database');
eval('$this->mrDbEngine' . " = new {$db_driv_class}DatabaseEngine(\$this->mDbConfig);");
} else {
SysLog::Instance()->log('$this->mrDbEngine' . " = new {$db_driv_class}DatabaseEngine(\$this->mDbConfig);", 'database');
SysLog::Instance()->log('$this->mDbConfig):' . print_r($this->mDbConfig, true), 'database');
eval('$this->mrDbEngine' . " = new {$db_driv_class}DatabaseEngine(\$this->mDbConfig);");
}
if (!$this->mrDbEngine) {
SysLog::Log('mrDbEngine is not available, how come?!', 'database');
die('mrDbEngine is not available!!!');
}
if ($this->Connect()) {
SysLog::Log('Connected using dbid #' . $this->mDbConfig['connection_id'], 'database');
$GLOBALS['db'][$this->mDbConfig['connection_id']] = $this->mrDbEngine;
if ($connectionNumber != 0) {
$this->addConn = true;
}
} else {
//die('Can\'t connect to database!');
SysLog::Instance()->log('Can\'t connect to database!', 'database');
//die($this->GetLastError());
if ($connectionNumber == 0) {
die('Can\'t connect to database number ' . $connectionNumber);
} else {
$this->addConn = false;
}
}
} else {
// connected already
SysLog::Log('Already connected using dbid #' . $this->mDbConfig['connection_id'], 'database');
$this->mrDbEngine = $GLOBALS['db'][$this->mDbConfig['connection_id']];
}
// new and old instance have to load sql file!
$this->LoadSql();
}
示例14: write
function write($log, $category)
{
if (Configuration::Instance()->GetValue('application', 'syslog_enabled')) {
$handle = fopen(Configuration::Instance()->GetValue('application', 'syslog_log_path') . "syslog.log", "a+");
$item = array("category" => $category, "content" => serialize($log));
fwrite($handle, serialize($item) . "\n");
}
}
示例15: Create
public function Create(UserSession $session)
{
$hideUsers = Configuration::Instance()->GetSectionKey(ConfigSection::PRIVACY, ConfigKeys::PRIVACY_HIDE_USER_DETAILS, new BooleanConverter());
if ($session->IsAdmin || !$hideUsers) {
return new UserRepository();
}
return new GroupAdminUserRepository(new GroupRepository(), $session);
}