当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller\Csrf类代码示例

本文整理汇总了PHP中Cx\Core\Csrf\Controller\Csrf的典型用法代码示例。如果您正苦于以下问题:PHP Csrf类的具体用法?PHP Csrf怎么用?PHP Csrf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Csrf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 private function __construct()
 {
     global $objInit;
     $backOrFrontend = $objInit->mode;
     // TODO: Unused
     //        global $objFWUser;
     //        $langId;
     if ($backOrFrontend == "frontend") {
         $langId = $objInit->getFrontendLangId();
     } else {
         //backend
         $langId = $objInit->getBackendLangId();
     }
     $langCode = FWLanguage::getLanguageCodeById($langId);
     $this->setVariable(array('path' => ASCMS_PATH_OFFSET . '/' . $langCode . '/', 'basePath' => ASCMS_PATH_OFFSET . '/', 'cadminPath' => \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteBackendPath() . '/', 'mode' => $objInit->mode, 'language' => $langCode, 'csrf' => \Cx\Core\Csrf\Controller\Csrf::code()), 'contrexx');
     //let i18n set it's variables
     $i18n = new ContrexxJavascriptI18n($langCode);
     $i18n->variablesTo($this);
     //determine the correct jquery ui css' path.
     //the user might have overridden the default css in the theme, so look out for this too.
     $jQUiCssPath = 'themes/' . $objInit->getCurrentThemesPath() . '/jquery-ui.css';
     //customized css would be here
     if ($objInit->mode != 'frontend' || !file_exists(ASCMS_DOCUMENT_ROOT . '/' . $jQUiCssPath)) {
         //use standard css
         $jQUiCssPath = 'lib/javascript/jquery/ui/css/jquery-ui.css';
     }
     $this->setVariable(array('jQueryUiCss' => $jQUiCssPath), 'contrexx-ui');
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:28,代码来源:ContrexxJavascript.class.php

示例2: __construct

 /**
  * Constructor   -> Create the module-menu and an internal template-object
  * @global   InitCMS
  * @global   \Cx\Core\Html\Sigma
  * @global   array
  */
 function __construct()
 {
     global $objInit, $objTemplate, $_CORELANG;
     parent::__construct();
     $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . '/Blog/View/Template/Backend');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $this->_intLanguageId = FRONTEND_LANG_ID;
     $objFWUser = \FWUser::getFWUserObject();
     $this->_intCurrentUserId = $objFWUser->objUser->getId();
     $strNavigation = '';
     $isAdmin = $objFWUser->objUser->getAdminStatus();
     //if(in_array(120, $objFWUser->objUser->getStaticPermissionIds()) || $isAdmin) {
     $strNavigation .= '<a href="index.php?cmd=Blog" 
                 class="' . ($_GET['act'] == '' ? 'active' : '') . '">' . $_CORELANG['TXT_BLOG_ENTRY_MANAGE_TITLE'] . '</a>';
     //}
     if (in_array(121, $objFWUser->objUser->getStaticPermissionIds()) || $isAdmin) {
         $strNavigation .= '<a href="index.php?cmd=Blog&amp;act=addEntry" 
                 class="' . (in_array($_GET['act'], array('addEntry', 'editEntry')) ? 'active' : '') . '">' . $_CORELANG['TXT_BLOG_ENTRY_ADD_TITLE'] . '</a>';
     }
     if (in_array(122, $objFWUser->objUser->getStaticPermissionIds()) || $isAdmin) {
         $strNavigation .= '<a href="index.php?cmd=Blog&amp;act=manageCategory" 
                 class="' . (in_array($_GET['act'], array('manageCategory', 'manageCategory')) ? 'active' : '') . '">' . $_CORELANG['TXT_BLOG_CATEGORY_MANAGE_TITLE'] . '</a>';
     }
     if (in_array(125, $objFWUser->objUser->getStaticPermissionIds()) || $isAdmin) {
         $strNavigation .= '<a href="index.php?cmd=Blog&amp;act=networks" 
                 class="' . (in_array($_GET['act'], array('networks', 'editNetwork')) ? 'active' : '') . '">' . $_CORELANG['TXT_BLOG_NETWORKS_TITLE'] . '</a>';
     }
     if (in_array(124, $objFWUser->objUser->getStaticPermissionIds()) || $isAdmin) {
         $strNavigation .= '<a href="index.php?cmd=Blog&amp;act=settings" 
                 class="' . (in_array($_GET['act'], array('settings')) ? 'active' : '') . '">' . $_CORELANG['TXT_BLOG_SETTINGS_TITLE'] . '</a>';
     }
     $objTemplate->setVariable('CONTENT_NAVIGATION', $strNavigation);
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:40,代码来源:BlogManager.class.php

示例3: preResolve

 public function preResolve(\Cx\Core\Routing\Url $url)
 {
     if ($this->cx->getMode() != \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) {
         return;
     }
     $em = $this->cx->getDb()->getEntityManager();
     $rewriteRuleRepo = $em->getRepository($this->getNamespace() . '\\Model\\Entity\\RewriteRule');
     $rewriteRules = $rewriteRuleRepo->findAll(array(), array('order' => 'asc'));
     $last = false;
     $originalUrl = clone $url;
     foreach ($rewriteRules as $rewriteRule) {
         try {
             $url = $rewriteRule->resolve($url, $last);
         } catch (\Exception $e) {
             // This is thrown if the regex of the rule is not valid
         }
         if ($last) {
             break;
         }
     }
     if ($originalUrl->toString() != $url->toString()) {
         \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . $url->toString(), true, $rewriteRule->getRewriteStatusCode());
         die;
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:25,代码来源:ComponentController.class.php

示例4: login

 /**
  * Login to facebook and get the associated cloudrexx user.
  */
 public function login()
 {
     $client = new \Google_Client();
     $client->setApplicationName('Contrexx Login');
     $client->setClientId($this->applicationData[0]);
     $client->setClientSecret($this->applicationData[1]);
     $client->setRedirectUri(\Cx\Lib\SocialLogin::getLoginUrl(self::OAUTH_PROVIDER));
     $client->setDeveloperKey($this->applicationData[2]);
     $client->setUseObjects(true);
     $client->setApprovalPrompt('auto');
     $client->setScopes(self::$scopes);
     self::$google = new \Google_Oauth2Service($client);
     self::$googleplus = new \Google_PlusService($client);
     if (isset($_GET['code'])) {
         try {
             $client->authenticate();
         } catch (\Google_AuthException $e) {
         }
     }
     if (!$client->getAccessToken()) {
         \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . $client->createAuthUrl());
         exit;
     }
     self::$userdata = $this->getUserData();
     $this->getContrexxUser(self::$userdata['oauth_id']);
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:29,代码来源:Google.class.php

示例5: noAccess

 /**
  * Redirects the browser to the noaccess webpage.
  *
  * @return void
  */
 public static function noAccess($redirect = null)
 {
     global $objInit;
     $objFWUser = FWUser::getFWUserObject();
     \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . CONTREXX_DIRECTORY_INDEX . '?' . ($objInit->mode == 'backend' ? '' : 'section=Login&' . (!empty($redirect) ? 'redirect=' . $redirect . '&' : '')) . ($objFWUser->objUser->login() ? 'cmd=noaccess' : ''));
     exit;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:12,代码来源:permission.class.php

示例6: __construct

 /**
  * PHP5 constructor
  *
  * @global \Cx\Core\Html\Sigma
  * @global array
  */
 function __construct()
 {
     parent::__construct();
     $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Alias/View/Template/Backend');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:13,代码来源:AliasManager.class.php

示例7: load

 /**
  * Load your component.
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $objTemplate, $sessionObj;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             if (!isset($sessionObj) || !is_object($sessionObj)) {
                 $sessionObj = \cmsSession::getInstance();
             }
             $objLogin = new \Cx\Core_Modules\Login\Controller\Login(\Env::get('cx')->getPage()->getContent());
             $pageTitle = \Env::get('cx')->getPage()->getTitle();
             $pageMetaTitle = \Env::get('cx')->getPage()->getMetatitle();
             \Env::get('cx')->getPage()->setContent($objLogin->getContent($pageMetaTitle, $pageTitle));
             break;
         case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
             if (\FWUser::getFWUserObject()->objUser->login(true)) {
                 \Cx\Core\Csrf\Controller\Csrf::header('location: index.php');
             }
             $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
             $objTemplate = $this->cx->getTemplate();
             $objLoginManager = new \Cx\Core_Modules\Login\Controller\LoginManager();
             $objLoginManager->getPage();
             break;
         default:
             break;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:31,代码来源:ComponentController.class.php

示例8: __construct

 /**
  * Headlines constructor
  * 
  * @param string $pageContent Template content
  */
 function __construct($pageContent)
 {
     parent::__construct('.');
     $this->getSettings();
     $this->pageContent = $pageContent;
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:12,代码来源:CalendarHeadlines.class.php

示例9: __construct

 /**
  * constructor
  *
  * global    object    $objTemplate
  * global    array    $_ARRAYLANG
  */
 function __construct()
 {
     global $objTemplate, $_ARRAYLANG;
     $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/NetTools/View/Template/Backend');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:13,代码来源:NetToolsManager.class.php

示例10: login

 /**
  * Login to facebook and get the associated contrexx user.
  */
 public function login()
 {
     // fixing timestamp issue with twitter
     // it is necessary that the twitter server has the same time as our system
     date_default_timezone_set('UTC');
     $tmhOAuth = new \tmhOAuth(array('consumer_key' => $this->applicationData[0], 'consumer_secret' => $this->applicationData[1]));
     // set the timestamp
     $tmhOAuth->config['force_timestamp'] = true;
     $tmhOAuth->config['timestamp'] = time();
     if (isset($_GET['oauth_verifier'])) {
         $tmhOAuth->config['user_token'] = $_SESSION['oauth']['oauth_token'];
         $tmhOAuth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];
         $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array('oauth_verifier' => $_GET['oauth_verifier'], 'x_auth_access_type' => 'read'));
         $access_token = $tmhOAuth->extract_params($tmhOAuth->response['response']);
         $tmhOAuth->config['user_token'] = $access_token['oauth_token'];
         $tmhOAuth->config['user_secret'] = $access_token['oauth_token_secret'];
         $tmhOAuth->request('GET', $tmhOAuth->url('1.1/account/verify_credentials'));
         $resp = json_decode($tmhOAuth->response['response']);
         unset($_SESSION['oauth']);
         $name = explode(' ', $resp->name);
         self::$userdata = array('first_name' => $name[0], 'last_name' => $name[1], 'email' => $resp->screen_name . '@twitter.com');
         $this->getContrexxUser($resp->id);
     } else {
         $tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ""), array('oauth_callback' => \Cx\Lib\SocialLogin::getLoginUrl(self::OAUTH_PROVIDER)));
         $_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
         $url = 'https://api.twitter.com/oauth/authenticate?oauth_token=' . $_SESSION['oauth']['oauth_token'];
         \Cx\Core\Csrf\Controller\Csrf::header("Location: " . $url);
         exit;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:33,代码来源:Twitter.class.php

示例11: __construct

 /**
  * Constructor
  * @global object $objTemplate
  * @global array $_ARRAYLANG
  */
 function __construct($pageContent)
 {
     $this->pageContent = $pageContent;
     $this->_objTpl = new \Cx\Core\Html\Sigma('.');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:12,代码来源:Ecard.class.php

示例12: getPage

 public function getPage($pos, $page_content)
 {
     global $_CONFIG, $_ARRAYLANG;
     $objTpl = new \Cx\Core\Html\Sigma('.');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTpl);
     $objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $objTpl->setTemplate($page_content);
     $objTpl->setGlobalVariable($_ARRAYLANG);
     $term = isset($_REQUEST['term']) ? trim(contrexx_input2raw($_REQUEST['term'])) : '';
     if (strlen($term) >= 3) {
         $term = trim(contrexx_input2raw($_REQUEST['term']));
         $this->setTerm($term);
         $eventHandlerInstance = \Env::get('cx')->getEvents();
         $eventHandlerInstance->triggerEvent('SearchFindContent', array($this));
         if ($this->result->size() == 1) {
             $arraySearchResults[] = $this->result->toArray();
         } else {
             $arraySearchResults = $this->result->toArray();
         }
         usort($arraySearchResults, function ($a, $b) {
             if ($a['Score'] == $b['Score']) {
                 if (isset($a['Date'])) {
                     if ($a['Date'] == $b['Date']) {
                         return 0;
                     }
                     if ($a['Date'] > $b['Date']) {
                         return -1;
                     }
                     return 1;
                 }
                 return 0;
             }
             if ($a['Score'] > $b['Score']) {
                 return -1;
             }
             return 1;
         });
         $countResults = sizeof($arraySearchResults);
         if (!is_numeric($pos)) {
             $pos = 0;
         }
         $paging = getPaging($countResults, $pos, '&amp;section=Search&amp;term=' . contrexx_raw2encodedUrl($term), '<b>' . $_ARRAYLANG['TXT_SEARCH_RESULTS'] . '</b>', true);
         $objTpl->setVariable('SEARCH_PAGING', $paging);
         $objTpl->setVariable('SEARCH_TERM', contrexx_raw2xhtml($term));
         if ($countResults > 0) {
             $searchComment = sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_ORDER_BY_RELEVANCE'], contrexx_raw2xhtml($term), $countResults);
             $objTpl->setVariable('SEARCH_TITLE', $searchComment);
             $arraySearchOut = array_slice($arraySearchResults, $pos, $_CONFIG['corePagingLimit']);
             foreach ($arraySearchOut as $details) {
                 $objTpl->setVariable(array('COUNT_MATCH' => $_ARRAYLANG['TXT_RELEVANCE'] . ' ' . $details['Score'] . '%', 'LINK' => '<b><a href="' . $details['Link'] . '" title="' . contrexx_raw2xhtml($details['Title']) . '">' . contrexx_raw2xhtml($details['Title']) . '</a></b>', 'SHORT_CONTENT' => contrexx_raw2xhtml($details['Content'])));
                 $objTpl->parse('search_result');
             }
             return $objTpl->get();
         }
     }
     $noresult = $term != '' ? sprintf($_ARRAYLANG['TXT_NO_SEARCH_RESULTS'], $term) : $_ARRAYLANG['TXT_PLEASE_ENTER_SEARCHTERM'];
     $objTpl->setVariable('SEARCH_TITLE', $noresult);
     return $objTpl->get();
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:59,代码来源:Search.class.php

示例13: __construct

 /**
  * PHP 5 Constructor
  */
 function __construct()
 {
     $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/member/View/Template/Backend');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $this->act = isset($_REQUEST['act']) ? $_REQUEST['act'] : '';
     $this->setNavigation();
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:11,代码来源:admin.class.php

示例14: __construct

 /**
  * Constructor
  */
 function __construct($tplPath, $name)
 {
     $this->_objTpl = new \Cx\Core\Html\Sigma($tplPath);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $this->moduleName = $name;
     $this->moduleNameLC = strtolower($this->moduleName);
     $this->_objTpl->setGlobalVariable(array('MODULE_NAME' => $this->moduleName, 'MODULE_NAME_LC' => $this->moduleNameLC, 'CSRF' => 'csrf=' . \Cx\Core\Csrf\Controller\Csrf::code()));
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:11,代码来源:MediaDirectoryLibrary.class.php

示例15: __construct

 function __construct($pageContent)
 {
     parent::__construct();
     $this->getSettings();
     $this->_pageContent = $pageContent;
     $this->_objTemplate = new \Cx\Core\Html\Sigma('.');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTemplate);
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:8,代码来源:NewsHeadlines.class.php


注:本文中的Cx\Core\Csrf\Controller\Csrf类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。