本文整理汇总了PHP中Security::Instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Security::Instance方法的具体用法?PHP Security::Instance怎么用?PHP Security::Instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Security
的用法示例。
在下文中一共展示了Security::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: NusoapResponse
function NusoapResponse()
{
// force to set global variable $debug
// before calling parent constructor
$GLOBALS['debug'] = $this->mDebugMode;
parent::soap_server();
$this->configureWsdl(__CLASS__ . 'Service', FALSE, $this->mEndpoint);
$this->mrDispatcher = Dispatcher::Instance();
$this->mrSecurity = Security::Instance();
$this->mrSession = Session::Instance();
if (!empty($this->mRegisteredFunctions)) {
foreach ($this->mRegisteredFunctions as $func_name => $params) {
if (is_array($params) && $params != NULL) {
$this->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']);
} else {
$this->register($func_name);
}
}
}
if (!empty($this->mRegisteredTypes)) {
foreach ($this->mRegisteredTypes as $type_name => $params) {
if (is_array($params) && count($params) > 0) {
if ($params['type'] == 'complexType' && $params['phptype'] != 'scalar') {
$this->wsdl->addComplexType($type_name, $params['type'], $params['phptype'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arraytype']);
} else {
$this->wsdl->addSimpleType($type_name, $params['type'], $params['phptype'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arraytype']);
}
} else {
$this->register($func_name);
}
}
}
$this->wsdl->addComplexType('ListType', 'complexType', 'array');
$this->wsdl->addComplexType('AgmListType', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:integer[]')), 'xsd:integer');
}
示例3: __construct
function __construct()
{
SysLog::Instance()->log('Login(sso)::__construct', "login");
// make a copy of a user instance
$this->mUser = Security::Instance()->mrUser;
$this->mSsoSystemId = Configuration::Instance()->GetValue('application', 'system_id');
/* TODO: make this configurable" */
}
示例4: GetUnloadNotify
public function GetUnloadNotify()
{
#gtfwDebugSet
#$this->SetDebugOn();
$userId = Security::Instance()->mAuthentication->GetCurrentUser()->GetUserId();
$result = $this->Open($this->mSqlQueries['get_unload_notify'], array($userId));
$this->SetLoadAll();
return $result;
}
示例5: ProcessRequest
function ProcessRequest()
{
Security::Instance()->Logout(TRUE);
//$this->RedirectTo($this->mrDispatcher->GetUrl('login_default', 'session', 'destroy', 'html'));
$module = Configuration::Instance()->GetValue('application', 'default_module');
$submodule = Configuration::Instance()->GetValue('application', 'default_submodule');
$action = Configuration::Instance()->GetValue('application', 'default_action');
$type = Configuration::Instance()->GetValue('application', 'default_type');
$this->RedirectTo(Dispatcher::Instance()->GetUrl($module, $submodule, $action, $type));
}
示例6: ProcessRequest
function ProcessRequest()
{
Security::Instance()->Logout(TRUE);
//$this->RedirectTo($this->mrDispatcher->GetUrl('login_default', 'session', 'destroy', 'html'));
$module = Configuration::Instance()->GetValue('application', 'default_module');
$submodule = Configuration::Instance()->GetValue('application', 'default_submodule');
$action = Configuration::Instance()->GetValue('application', 'default_action');
$type = Configuration::Instance()->GetValue('application', 'default_type');
$urlRedirect = Dispatcher::Instance()->GetUrl($module, $submodule, $action, $type);
return array('exec' => 'GtfwAjax.replaceContentWithUrl("body-application","' . $urlRedirect . '&ascomponent=1")');
}
示例7: SendLog
public function SendLog($log)
{
if (class_exists('Security')) {
$user = Security::Instance()->mAuthentication->GetCurrentUser()->GetUserName();
}
if (empty($user)) {
$user = GTFWConfiguration::GetValue('application', 'default_user');
}
$ip = $_SERVER['REMOTE_ADDR'];
$result = $this->SendLogDb($user, $ip, $log);
return $result;
}
示例8: ProcessRequest
function ProcessRequest()
{
if (Security::Instance()->IsLoggedIn()) {
// redirect to proper place
$module = 'home';
$submodule = 'home';
$action = 'view';
$type = 'html';
$this->RedirectTo(Dispatcher::Instance()->GetUrl($module, $submodule, $action, $type));
return NULL;
}
echo '<pre>';
print_r(Security::Instance()->IsLoggedIn());
echo '</pre>';
return Security::Instance()->RequestSalt();
}
示例9: ProcessRequest
function ProcessRequest()
{
if (Security::Instance()->Login($_REQUEST['username'] . '', $_REQUEST['password'] . '', $_REQUEST['hashed'] . '' == 1)) {
// redirect to proper place
$module = 'home';
$submodule = 'home';
$action = 'view';
$type = 'html';
Log::Instance()->SendLog('Proses Login Sukses');
$this->RedirectTo(Dispatcher::Instance()->GetUrl($module, $submodule, $action, $type));
return;
} else {
Log::Instance()->SendLog('Proses Login Gagal');
$this->RedirectTo(Dispatcher::Instance()->GetUrl('login_default', 'login', 'view', 'html') . '&fail=1');
return;
}
return NULL;
}
示例10: IsLoggedIn
function IsLoggedIn()
{
return Security::Instance()->IsLoggedIn();
}
示例11: Logout
function Logout()
{
// make a copy of a user instance
$this->mrUser = Security::Instance()->mrUser;
}
示例12: ModuleDenied
function ModuleDenied($module)
{
#gtfwDbOpen
$groupId = Security::Instance()->mAuthentication->GetCurrentUser()->GetDefaultUserGroupId();
#gtfwDbOpen
if ($this->labelAksi == "notset") {
if (!isset($_SESSION['describe_gtfw_module'])) {
$result = $this->open($this->mSqlQueries['describe_gtfw_module'], array());
$_SESSION['describe_gtfw_module'] = json_encode($result);
} else {
$result = json_decode($_SESSION['describe_gtfw_module'], true);
}
for ($i = 0; $i < count($result); $i++) {
if (strtoupper($result[$i]['Field']) == 'LABELAKSI') {
$this->labelAksi = true;
break;
} else {
$this->labelAksi = false;
}
}
}
if (isset($module->mrVariable)) {
if (empty($this->moduleDelete)) {
if (!isset($this->moduleDelete[$module->mrVariable])) {
if ($this->labelAksi === true) {
$result = $this->open($this->mSqlQueries['module_denied'], array($groupId, $module));
} else {
$result = $this->open($this->mSqlQueries['module_denied_2'], array($groupId, $module));
}
$this->moduleDelete[$module->mrVariable] = $result;
} else {
$result = $this->moduleDelete[$module->mrVariable];
}
return $result;
} else {
return $this->moduleDelete[$module->mrVariable];
}
} else {
return false;
}
}
示例13: call
function call($params, $content)
{
//print_r($params);
$name = 'name';
// koreksi code tanpa mengubah code aslinya
$content_repo =& $GLOBALS['content_repo'];
$component_name =& $GLOBALS['component_name'];
if (!isset($content_repo)) {
$content_repo = array();
}
if (!isset($component_name)) {
$component_name = array();
}
if (!isset($params['type'])) {
$params['type'] = null;
}
// checking component's name
if ($params[$name] != '' && isset($component_name[$params[$name]]) && $component_name[$params[$name]] != "{$params['module']} {$params['submodule']} {$params['action']} {$params['type']}") {
return 'Redeclared component name: ' . $params['name'] . " for module {$params['module']}, submodule {$params['submodule']}, action {$params['action']}, and type {$params['type']}";
}
if (!isset($params['type'])) {
$params['type'] = '';
}
$component_name[$params[$name]] = "{$params['module']} {$params['submodule']} {$params['action']} {$params['type']}";
// this caching mechanism isn't suitable for module that needs to be rendered
// everytime, such as paging navigation
if (isset($content_repo[$params['name']][$params['module']][$params['submodule']][$params['action']][$params['type']])) {
$this_content = $content_repo[$params['name']][$params['module']][$params['submodule']][$params['action']][$params['type']];
} else {
// catching component's paramaters
$parameters = array();
// pattemplate content style
// warning: value is always trimmed!!
if (trim($content) != '') {
$temp = explode("\n", $content);
foreach ($temp as $k => $v) {
if (trim($v) != '') {
list($var, $val) = explode(':=', $v);
$parameters[$var] = trim($val);
}
}
}
// http get style (via 'params' attribute)
if (isset($params['params'])) {
if (trim($params['params']) != '') {
parse_str($params['params'], $temp);
foreach ($temp as $k => $v) {
$parameters[$k] = $v;
}
}
}
// html tag attribute style
// ie. not name, module, submodule, action, params
foreach ($params as $k => $v) {
if ($k != 'name' && $k != 'module' && $k != 'submodule' && $k != 'action' && $k != 'params') {
$parameters[$k] = $v;
}
}
// WARNING: this soon will be obsolete
// modified by Ageng (is it correct??)
// catch the parameters that was setted for component
if (isset($GLOBALS['parameters_set'])) {
foreach ($GLOBALS['parameters_set'] as $key => $value) {
foreach ($parameters as $keyparameters => $valueparameters) {
if ($keyparameters == $key) {
$parameters[$keyparameters] = $value;
}
}
}
}
ob_start();
if (Security::Instance()->AllowedToAccess($params['module'], $params['submodule'], $params['action'], 'html')) {
list($file_path, $class_name) = Dispatcher::Instance()->GetModule($params['module'], $params['submodule'], $params['action'], 'html');
if (FALSE === $file_path) {
Dispatcher::Instance()->ModuleNotFound();
} else {
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/pat_template/pat_template.php';
require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/gtfw/response/html/HtmlResponse.class.php';
require_once $file_path;
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
eval('$module = new ' . $class_name . '();');
} else {
eval('$module = new ' . $class_name . '();');
}
// give component a name
$module->mComponentName = $params['name'];
// display as module
// modified by Ageng
// assign component parameters to their property
$module->mComponentParameters = $parameters;
$module->Display(TRUE);
}
} else {
Security::Instance()->ModuleAccessDenied();
}
$this_content = ob_get_contents();
// ===== added by roby =====
// this code created to make "prepared variable" to prevent patTemplate parsing it in included module that call with gtfwrendermodule function
// because prepared variable will be parsed in main modul as a normal variable
// to apply, you can put a param in gtfwrendermodule function like example below:
//.........这里部分代码省略.........
示例14: GetDhtmlxMenu
public function GetDhtmlxMenu()
{
$username = Security::Instance()->mAuthentication->GetCurrentUser()->GetUserName();
$result = $this->Open($this->mSqlQueries['dhtmlx_menu'], array($username));
return $result;
}
示例15: Dispatch
function Dispatch()
{
// send header first
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
if (isset($_SERVER['HTTP_X_GTFWMODULETYPE'])) {
$type = $_SERVER['HTTP_X_GTFWMODULETYPE'];
} else {
$type = null;
}
//SysLog::Log("HEADER: " .$_SERVER['X-GtfwModuleType'], 'dispatcher');
SysLog::Log("HEADER: " . $type, 'dispatcher');
$module = '';
$submodule = '';
$action = '';
$type = '';
if (Configuration::Instance()->GetValue('application', 'url_type') == 'Long') {
if (isset($_REQUEST['mod']) && isset($_REQUEST['sub']) && isset($_REQUEST['act']) && isset($_REQUEST['typ']) || $_REQUEST['typ'] == "rest") {
// hack for requests/responses that don't need obfuscation
if (in_array($_REQUEST['typ'], Configuration::Instance()->GetValue('application', 'url_obfuscator_exception'))) {
Configuration::Instance()->RegisterHook($this);
}
//
$module = $this->Decrypt($_REQUEST['mod']);
$submodule = $this->Decrypt($_REQUEST['sub']);
$action = $this->Decrypt($_REQUEST['act']);
$type = $this->Decrypt($_REQUEST['typ']);
SysLog::Log("Long URL \$_REQUEST", 'dispatcher');
} else {
SysLog::Log("No \$_REQUEST set for Long URL {$_REQUEST['mod']}", 'dispatcher');
}
} elseif (Configuration::Instance()->GetValue('application', 'url_type') == 'Short') {
if (isset($_REQUEST['mid'])) {
$module_id = $this->Decrypt($_REQUEST['mid']);
$request_translated = $this->TranslateRequestToLong($module_id);
if (is_array($request_translated)) {
$module = $request_translated[0];
$submodule = $request_translated[1];
$action = $request_translated[2];
$type = $request_translated[3];
}
}
} elseif (Configuration::Instance()->GetValue('application', 'url_type') == 'Path') {
list(, , $module, , $submodule, , $action, , $type, ) = explode('/', $_SERVER['PATH_INFO']);
$module = $this->Decrypt($module);
$submodule = $this->Decrypt($submodule);
$action = $this->Decrypt($action);
$type = $this->Decrypt($type);
}
SysLog::Log("Translated request: {$module}/{$submodule}/{$action}/{$type} from " . print_r($_REQUEST, true), 'dispatcher');
// default
if ($module == '' && $submodule == '' && $action == '' && $type == '') {
$module = Configuration::Instance()->GetValue('application', 'default_module');
$submodule = Configuration::Instance()->GetValue('application', 'default_submodule');
$action = Configuration::Instance()->GetValue('application', 'default_action');
$type = Configuration::Instance()->GetValue('application', 'default_type');
}
// hack to overide any typ specified before.
if (isset($_COOKIE['GtfwModuleType'])) {
$type = $_COOKIE['GtfwModuleType']->Raw();
// delete the cookie
setcookie('GtfwModuleType', '', mktime(5, 0, 0, 7, 26, 1997));
}
if (isset($_SERVER['HTTP_X_GTFWMODULETYPE'])) {
$type = $_SERVER['HTTP_X_GTFWMODULETYPE'];
}
SysLog::Log("Final request: {$module}/{$submodule}/{$action}/{$type}", 'dispatcher');
$this->mModule = $module;
$this->mSubModule = $submodule;
$this->mAction = $action;
$this->mType = $type;
if (class_exists('ServiceSecurity')) {
if (ServiceSecurity::Instance()->AllowedToAccess($module, $submodule, $action, $type)) {
list($file_path, $class_name) = $this->GetModule($module, $submodule, $action, $type);
if (FALSE === $file_path) {
$dbMsg = SysLog::Instance()->getAllError();
if (!empty($dbMsg)) {
echo "<pre>";
for ($i = 0; $i < count($dbMsg); $i++) {
echo $dbMsg[$i];
}
echo "</pre>";
}
die('Service Not Found');
} else {
$this->DispacherSend($type, $file_path, $class_name);
}
}
} else {
SysLog::Instance()->log("Security::Instance()->AllowedToAccess({$module}, {$submodule}, {$action}, {$type})", 'sanitizer');
if (Security::Instance()->AllowedToAccess($module, $submodule, $action, $type)) {
list($file_path, $class_name) = $this->GetModule($module, $submodule, $action, $type);
if (FALSE === $file_path) {
$this->ModuleNotFound();
} else {
if (!Security::Instance()->IsProtocolCheckPassed($module, $submodule, $action, $type)) {
// redirect to https or http
$url = Configuration::Instance()->GetValue('application', 'baseaddress');
if (!isset($_SERVER['HTTPS'])) {
$url = preg_replace('/^http:/', 'https:', $url);
//.........这里部分代码省略.........