本文整理汇总了PHP中security::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP security::getInstance方法的具体用法?PHP security::getInstance怎么用?PHP security::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类security
的用法示例。
在下文中一共展示了security::getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$this->spam = antispam::getInstance();
$this->security = security::getInstance();
$this->filter = array('content' => array('filters' => array()), 'suscribe' => array('filters' => array(array('trueOrFalse'))));
$this->validate = array('author' => array('required' => true, 'rules' => array(array('rule' => VALID_NOT_EMPTY, 'message' => 'Por favor introduce tu Nombre.'))), 'url' => array('rules' => array(array('rule' => VALID_URL, 'message' => 'No es una URL valida.'))), 'email' => array('required' => true, 'rules' => array(array('rule' => VALID_EMAIL, 'message' => 'El e-mail no es valido.'))), 'content' => array('required' => true, 'rules' => array(array('rule' => VALID_NOT_EMPTY, 'message' => 'Debes introducir un comentario.'), array('rule' => array('isSpam'), 'message' => 'No se aceptan comentarios en blanco o con spam.'))));
}
示例2: renderAdminMenu
protected function renderAdminMenu(array $prm = null)
{
$links = array();
if (security::getInstance()->isLogged()) {
$db = db::getInstance();
$tables = $db->getTables();
foreach ($tables as $t) {
if (!strpos($t, '_') && !strpos($t, db::getCfg('i18n'))) {
$links[$t] = request::uriDef(array('module' => $t, 'action' => '', 'param' => ''));
}
}
}
$this->setViewVar('linksTable', $links);
}
示例3:
<?php
echo '<h1>' . $error . '</h1>';
echo utils::htmlOut(session::getFlash('nyroError')) . '<br /><br />';
echo security::getInstance()->getLoginForm();
示例4: exec
/**
* Every called action must pass by this function
*
* @param null|string $prm Actopn Parameters
* @throws nException if wrong parameter or other errors
*/
final public function exec(array $prm=array()) {
$this->prmExec = array_merge(array(
'module'=>$this->getName(),
'action'=>'index',
'param'=>'',
'paramA'=>null,
'prefix'=>null),
$prm);
$this->prmExec['prefix'] = null;
if (array_key_exists(NYROENV, $this->cfg->basicPrefixExec) &&
in_array($this->prmExec['action'], $this->cfg->getInArray('basicPrefixExec', NYROENV)))
$this->prmExec['prefix'] = ucfirst(NYROENV);
else if ($this->cfg->prefixExec && !in_array($this->prmExec['action'], $this->cfg->noPrefixExec))
$this->prmExec['prefix'] = $this->cfg->prefixExec;
$this->beforeExec($prm);
if (!$this->cfg->render)
security::getInstance()->check($this->prmExec);
$fctName = ($this->cfg->render? 'render' : 'exec').$this->prmExec['prefix'].ucfirst($this->prmExec['action']);
if (!method_exists($this, $fctName))
response::getInstance()->error();
$this->setViewAction($this->prmExec['action']);
$param = is_array($this->prmExec['paramA'])? $this->prmExec['paramA'] : request::parseParam($this->prmExec['param']);
$tags = $this->cfg->cacheTags;
$search = array('/', '<', '>');
$replace = array('', '', '');
if (is_array($this->prmExec['paramA']))
foreach($this->prmExec['paramA'] as $k=>$v) {
if (is_object($v)) {
if (is_callable(array($v, '__toString')))
$tags[] = $k.'='.$v;
else
$tags[] = $k.'='.get_class($v);
} elseif (!is_numeric($k))
$tags[] = $k.'='.str_replace($search, $replace, $v);
else
$tags[] = str_replace($search, $replace, $v);
}
$paramTpl = array();
foreach($param as $k=>$v) {
if (is_object($v)) {
if (is_callable(array($v, '__toString')))
$paramTpl[] = $k.'='.$v;
else
$paramTpl[] = $k.'='.get_class($v);
} else
$paramTpl[] = $k.':'.$v;
}
$conf = array(
'layout'=>$this->cfg->layout,
'module'=>$this->getName(),
'action'=>$this->cfg->viewAction,
'param'=>implode(',', $paramTpl),
'cache'=>array_merge(array(
'enabled'=>$this->isCacheEnabled(),
'serialize'=>false,
'tags'=>$tags,
'request'=>array('uri'=>false, 'meth'=>array())
), $this->cfg->cache)
);
$this->tpl = factory::get('tpl', array_merge_recursive($conf, $this->cfg->tplPrm));
$this->tpl->getCfg()->layout = $this->cfg->layout;
$this->tpl->getCfg()->module = $this->getName();
$this->tpl->getCfg()->action = $this->cfg->viewAction;
$this->tpl->getCfg()->default = $this->cfg->viewAction;
$this->prmExec['callbackPrm'] = array(
'fctName'=>$fctName,
'fctNameParam'=>$param,
'prm'=>$prm
);
$this->middleExec($prm);
}
示例5: execAdminLogout
protected function execAdminLogout(array $prm = array())
{
security::getInstance()->logout();
response::getInstance()->redirect(request::uri('/'));
}
示例6: foreach
<?php
if (security::getInstance()->isLogged()) {
?>
<ul id="menu">
<?php
if (isset($links)) {
foreach ($links as $l => $name) {
if ($name == 'hr') {
echo '<li class="hr"><span></span></li>';
} else {
echo '<li><a href="' . $l . '">' . $name . '</a></li>';
}
}
}
if (isset($linksTable)) {
foreach ($linksTable as $name => $l) {
echo '<li><a href="' . $l . '">' . $name . '</a></li>';
}
echo '<li class="hr"><span></span></li>';
}
?>
<li><a href="<?php
echo security::getInstance()->getPage('logout', true);
?>
">Déconnexion</a></li>
</ul>
<?php
}