示例#1
0
/**
 * @param array $tags
 * @param BaseController $controller
 *
 * @return array
 */
function clmvc_setup_default_tags($tags, $controller)
{
    $bag = $controller->getBag();
    $tags['title'] = Filter::run('title', array($bag['title']));
    $tags['stylesheets'] = implode("\n", Filter::run('stylesheets-frontend', array(array())));
    $tags['javascript_footer'] = implode("\n", Filter::run('javascripts-footer-frontend', array(array())));
    $tags['javascript_head'] = implode("\n", Filter::run('javascripts-head-frontend', array(array())));
    return $tags;
}
示例#2
0
 /**
  * Performs the security check, verify nonce and if user can perform action.
  *
  * @param BaseController $controller
  * @param $data
  * @param string         $action
  *
  * @return bool
  */
 public function perform($controller, $data, $action = '')
 {
     $s = Security::create();
     if ($this->nonce_base) {
         $nonce = array_key_exists_v('_asnonce', $controller->values);
         if ($nonce) {
             $verified_nonce = $s->verifyNonce($nonce, $this->nonce_base);
             if (!$verified_nonce) {
                 return false;
             }
         } else {
             return false;
         }
     }
     if ($s->currentUserIsLoggedIn()) {
         if (!$this->useraction || $s->currentUserCan($this->useraction)) {
             return true;
         }
     }
     $controller->getRenderer()->RenderText('You cannot perform this action');
     return false;
 }
示例#3
0
 /**
  * @return string
  */
 public function getTemplate()
 {
     return $this->controller->getTemplateType();
 }