本文整理汇总了PHP中sfFilterChain类的典型用法代码示例。如果您正苦于以下问题:PHP sfFilterChain类的具体用法?PHP sfFilterChain怎么用?PHP sfFilterChain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfFilterChain类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filter_chain The filter chain
*/
public function execute(sfFilterChain $filter_chain)
{
$action_instance = $this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();
// Keep track only of trackable actions
if ($this->isTrackable($action_instance))
{
try
{
$entry = ncTrackerEntryPeer::createFromAction($action_instance);
$this->log('Created a new ncTrackerEntry.');
}
catch (PropelException $exception)
{
$this->log(
sprintf('Unable to create a new ncTrackerEntry. Error message: %s.', $exception->getMessage())
);
}
}
else
{
$this->log(
sprintf('Ignored non-trackable action: %s/%s.', $action_instance->getModuleName(), $action_instance->getActionName())
);
}
$filter_chain->execute($filter_chain);
}
开发者ID:ncuesta,项目名称:ncTrackerPlugin,代码行数:34,代码来源:ncTrackerFilter.class.php
示例2: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
// disable security on login and secure actions
if (sfConfig::get('sf_login_module') == $this->context->getModuleName() && sfConfig::get('sf_login_action') == $this->context->getActionName() || sfConfig::get('sf_secure_module') == $this->context->getModuleName() && sfConfig::get('sf_secure_action') == $this->context->getActionName()) {
$filterChain->execute();
return;
}
// NOTE: the nice thing about the Action class is that getCredential()
// is vague enough to describe any level of security and can be
// used to retrieve such data and should never have to be altered
if (!$this->context->getUser()->isAuthenticated()) {
if (sfConfig::get('sf_logging_enabled')) {
$this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Action "%s/%s" requires authentication, forwarding to "%s/%s"', $this->context->getModuleName(), $this->context->getActionName(), sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action')))));
}
// the user is not authenticated
$this->forwardToLoginAction();
}
// the user is authenticated
$credential = $this->getUserCredential();
if (null !== $credential && !$this->context->getUser()->hasCredential($credential)) {
if (sfConfig::get('sf_logging_enabled')) {
$this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Action "%s/%s" requires credentials "%s", forwarding to "%s/%s"', $this->context->getModuleName(), $this->context->getActionName(), sfYaml::dump($credential, 0), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')))));
}
// the user doesn't have access
$this->forwardToSecureAction();
}
// the user has access, continue
$filterChain->execute();
}
开发者ID:Phennim,项目名称:symfony1,代码行数:34,代码来源:sfBasicSecurityFilter.class.php
示例3: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
// execute next filter
$filterChain->execute();
// execute this filter only once
$response = $this->context->getResponse();
// include javascripts and stylesheets
$content = $response->getContent();
if (false !== ($pos = strpos($content, '</head>')))
{
$this->context->getConfiguration()->loadHelpers(array('Tag', 'Asset'));
$html = '';
if (!sfConfig::get('symfony.asset.javascripts_included', false))
{
$html .= get_javascripts($response);
}
if (!sfConfig::get('symfony.asset.stylesheets_included', false))
{
$html .= get_stylesheets($response);
}
if ($html)
{
$response->setContent(substr($content, 0, $pos).$html.substr($content, $pos));
}
}
sfConfig::set('symfony.asset.javascripts_included', false);
sfConfig::set('symfony.asset.stylesheets_included', false);
}
开发者ID:nationalfield,项目名称:symfony,代码行数:37,代码来源:sfCommonFilter.class.php
示例4: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
// disable stateful security checking on signin and secure actions
if (sfConfig::get('sf_login_module') == $this->context->getModuleName() && sfConfig::get('sf_login_action') == $this->context->getActionName() || sfConfig::get('sf_secure_module') == $this->context->getModuleName() && sfConfig::get('sf_secure_action') == $this->context->getActionName()) {
$filterChain->execute();
return;
}
$sf_user = $this->context->getUser();
// retrieve the current action
$action = $this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();
// get the current module and action names
$module_name = sfInflector::camelize($action->getModuleName());
$action_name = sfInflector::camelize($action->getActionName());
// get the object for the current route
$object = $this->getObjectForRoute($action->getRoute());
// i.e.: canIndexDefault
$method = "can{$action_name}{$module_name}";
// if the method exist
if (method_exists($sf_user, $method)) {
// execute it
if (!$sf_user->{$method}($object)) {
$this->forwardToSecureAction();
}
} else {
// get the default policy
$default_policy = $this->getParameter('default_policy', 'allow');
// if the default policy is not 'allow'
if ($default_policy != 'allow') {
$this->forwardToSecureAction();
}
}
$filterChain->execute();
return;
}
开发者ID:nvidela,项目名称:kimkelen,代码行数:39,代码来源:dcStatefulSecurityFilter.class.php
示例5: execute
/**
* Insert appropriate experiment code.
*
* @throws sfConfigurationException If the configured experiment type cannot be found
*
* @param sfFilterChain $filterChain
*/
public function execute($filterChain)
{
$filterChain->execute();
// connect to each active experiment
$prefix = 'app_sf_google_website_optimizer_plugin_';
if (sfConfig::get($prefix . 'enabled', false)) {
$request = $this->context->getRequest();
$response = $this->context->getResponse();
foreach (sfConfig::get($prefix . 'experiments', array()) as $name => $param) {
// merge default with configured parameters
$param = array_merge(array('enabled' => true, 'type' => null, 'key' => null, 'uacct' => sfConfig::get($prefix . 'uacct'), 'pages' => array()), $param);
if ($param['enabled']) {
// determine experiment class
$classes = sfConfig::get($prefix . 'classes', array());
$classes = array_merge(array('ab' => 'sfGWOExperimentAB', 'multivariate' => 'sfGWOExperimentMultivariate'), $classes);
if (isset($classes[$param['type']])) {
$class = $classes[$param['type']];
$experiment = new $class($name, $param);
if ($experiment->connect($request)) {
$experiment->insertContent($response);
}
} else {
throw new sfConfigurationException(sprintf('The experiment type "%s" was not found.', $param['type']));
}
}
}
}
}
开发者ID:JoshuaEstes,项目名称:sfGoogleWebsiteOptimizerPlugin,代码行数:35,代码来源:sfGWOFilter.class.php
示例6: execute
/**
*
* @param sfFilterChain $filterChain
*/
public function execute($filterChain)
{
// check to make sure the plugin is enabled, plugin is disabled by default
if (!sfConfig::get('app_sf_guard_extra_plugin_enabled', false)) {
$filterChain->execute();
return;
}
// no point in check if user is logged in =\ or if the are going to the locked out module/action
if (!$this->getContext()->getUser()->isAuthenticated() || sfConfig::get('app_sf_guard_extra_plugin_locked_out_module') == $this->getContext()->getModuleName() && sfConfig::get('app_sf_guard_extra_plugin_locked_out_action') == $this->getContext()->getActionName()) {
$this->checkIfLockedOut();
}
// check to see if user is trying to login
if (!$this->getContext()->getUser()->isAuthenticated() && sfConfig::get('sf_login_module') == $this->getContext()->getModuleName() && sfConfig::get('sf_login_action') == $this->getContext()->getActionName() && 'POST' == $this->getContext()->getRequest()->getMethod()) {
/**
* NOTE: in the future it may be possible to use the form, bind the values,
* and check to see if it is valid here. This is worth looking into
* so the plugin doesn't need to modify any other files.
*/
if (sfConfig::get('sf_logging_enabled')) {
$this->getContext()->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('"%s" ("%s") failed trying to login', $this->getUserIP(), $this->getUserHost()))));
}
}
// check to see if the user is logged in if their password will expire soon
if ($this->getContext()->getUser()->isAuthenticated()) {
$this->checkIfPassExpired();
}
// user has access to continue
$filterChain->execute();
}
开发者ID:JoshuaEstes,项目名称:sfDoctrineGuardExtraPlugin,代码行数:33,代码来源:sfGuardSecurityExtraFilter.class.php
示例7: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
if ($this->request->getParameter('dm_embed')) {
sfConfig::set('dm_admin_embedded', true);
sfConfig::set('dm_toolBar_enabled', false);
}
$this->saveApplicationUrl();
$this->loadAssetConfig();
if (sfConfig::get('dm_admin_embedded')) {
$this->response->addStylesheet('admin.embed', 'last');
$this->getContext()->getEventDispatcher()->connect('admin.save_object', array($this, 'listenToAdminSaveObjectWhenEmbedded'));
}
$this->updateLock();
$filterChain->execute();
if (sfConfig::get('dm_admin_embedded')) {
$this->response->addStylesheet('admin.embed');
} else {
// If response has no title, generate one with the H1
if ($this->response->isHtmlForHuman() && !$this->response->getTitle()) {
preg_match('|<h1[^>]*>(.*)</h1>|iuUx', $this->response->getContent(), $matches);
if (isset($matches[1])) {
$title = 'Admin : ' . strip_tags($matches[1]) . ' - ' . dmConfig::get('site_name');
$this->response->setContent(str_replace('<title></title>', '<title>' . $title . '</title>', $this->response->getContent()));
}
}
}
}
开发者ID:theolymp,项目名称:diem,代码行数:32,代码来源:dmAdminInitFilter.php
示例8: execute
/**
* Executes filter chain
*
* @param sfFilterChain $filterChain
*/
public function execute($filterChain)
{
if ($this->isFirstCall()) {
$context = $this->getContext();
$request = $context->getRequest();
$response = $context->getResponse();
$user = $context->getUser();
$cookieName = sfConfig::get('app_translation_cookie', 'myCulture');
//get the user's preferred browser language
$culture = $request->getPreferredCulture(sfConfig::get('sf_translations_available', array()));
$this->log(sprintf('Browser language is %s', $culture));
//override with a user cookie language if it exists
if ($request->getCookie($cookieName)) {
$culture = $request->getCookie($cookieName);
$this->log(sprintf('Overriding culture %s from culture cookie', $culture));
}
//has the user overridden the language manually?
if ($request->getParameter('sf_culture') && in_array(strtolower($request->getParameter('sf_culture')), array_map('strtolower', sfConfig::get('sf_translations_available', array())))) {
//set the language for this request, so you don't have to refresh
$culture = $request->getParameter('sf_culture');
//update the cookie with the new language for future requests
$response->setCookie($cookieName, $culture, time() + 60 * 60 * 24 * 30 * 12 * 30, '/');
$this->log(sprintf('Culture manually overridden to %s', $culture));
}
$this->log(sprintf('Applying culture: %s for this session', $culture));
$user->setCulture($culture);
sfConfig::set('sf_current_culture', $culture);
$context->getResponse()->addMeta('language', $culture, true);
}
$filterChain->execute();
}
开发者ID:Alenpiera,项目名称:streeme,代码行数:36,代码来源:i18nAutodetectFilter.class.php
示例9: execute
/**
*
* @param sfFilterChain $filterChain
*/
public function execute($filterChain)
{
//Ha be van kapcsolva a Schacc login és
//Ha nem is akar bejeletkezni, akkor nincs semmi dolgunk, mehet tovább a lánc
if (!sfConfig::get('sf_Schacc_enable') || !$this->isSignin()) {
$filterChain->execute();
return;
}
$post = $this->getPostParameter('signin');
$user = Doctrine::getTable('SchaccUser')->findOneBy('username', $post['username']);
//Ha van lokális user, ami nem schacc-al került be
//Ezt nem a mi dolgunk kezelni, továbbküldjük
if ($user && !$user->is_schacc) {
$filterChain->execute();
//ha ide eljutunk azt jelenti, hogy nem sikerült autentikálni lokális adatbázisból
//ezt később figyelembe kell vennünk
$has_local_non_schacc_acc = true;
}
//Schacc autentikáció
$this->form = new sfGuardFormSignin();
$this->form->getValidatorSchema()->setPostValidator(new sfSchaccValidatorUser());
$this->form->bind($post);
if ($this->form->isValid()) {
//sikerült autentikálni a Schacc-t
if ($has_local_non_schacc_acc) {
//ha ide jutunk az nagy baj
//azt jelenti, hogy valaki egy Schacc-al próbált bejelentkezni
//de már van egy ugyan olyan felhasználó nevű, de más jelszavú user,
//aki korábban nem Schaccal lépett be,
//hanem regisztrált
//erről nem tudhatjuk biztosan, hogy Ő-e, így figyelmeztetjük
throw new Exception(<<<EOF
Schaccal próbáltál bejelentkezni,
de már van egy ilyen nevű user az adatbázisban,
aki korábban regisztrált.
Ha Te vagy ez a meglévő felhasználó,
lépj be a regisztrációnál megadott jelszavaddal.
Ha nem Te vagy, akkor sajnos más olyan felhasználónevet választott,
ami a Te Schaccod. Kérlek regisztrálj egy másik névvel.
EOF
);
}
$values = $this->form->getValues();
//Ha nem volt eddig ilyen user
if (!$user) {
$user = new SchaccUser();
$user->username = $values['username'];
}
$this->updateProfile($user, $post);
$this->getUser()->signin($user, array_key_exists('remember', $values) ? $values['remember'] : false);
// always redirect to a URL set in app.yml
// or to the referer
// or to the homepage
$signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user->getReferer(''));
$this->getContext()->getController()->redirect('' != $signinUrl ? $signinUrl : '@homepage');
}
$filterChain->execute();
}
开发者ID:szelpe,项目名称:cukorka,代码行数:62,代码来源:sfSchaccFilter.class.php
示例10: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
if ($this->isFirstCall() && !$this->context->getUser()->isAuthenticated()) {
if ($memberId = $this->context->getUser()->getRememberedMemberId()) {
$this->context->getUser()->login($memberId);
}
}
$filterChain->execute();
}
开发者ID:balibali,项目名称:OpenPNE3,代码行数:14,代码来源:opRememberLoginFilter.class.php
示例11: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain The filter chain.
*/
public function execute($filterChain)
{
if (!\Altumo\Http\IncomingHttpRequest::isSecure()) {
if (\sfConfig::get('app_require_ssl') === true) {
header('Location: https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
exit;
}
}
$filterChain->execute();
}
开发者ID:homer6,项目名称:sfAltumoPlugin,代码行数:15,代码来源:Https.php
示例12: execute
public function execute(sfFilterChain $filterChain)
{
$module = $this->getContext()->getModuleName();
$action = $this->getContext()->getActionName();
$actionsStack = PluginExecutionManager::instance()->getPreExecuteMethodStack($module, $action);
$this->performServiceOpteration($actionsStack, self::PRE_EXEC);
$filterChain->execute();
$actionsStack = PluginExecutionManager::instance()->getPostExecuteMethodStack($module, $action);
$this->performServiceOpteration($actionsStack, self::POST_EXEC);
}
开发者ID:THM068,项目名称:orangehrm,代码行数:10,代码来源:orangehrmPostExecutionFilter.php
示例13: execute
/**
* Executes the filter chain, returning the response content with an additional admin toolbar.
*
* @param sfFilterChain $filterChain
*/
public function execute(sfFilterChain $filterChain)
{
$filterChain->execute();
$context = sfContext::getInstance();
$user = $context->getUser();
$ph = $context->getRequest()->getParameterHolder();
if ($ph->get('module') === 'rtShopCategory' && $ph->get('action') === 'show') {
$user->setAttribute('rt_shop_category_id', $ph->get('id'));
}
}
开发者ID:pierswarmers,项目名称:rtShopPlugin,代码行数:15,代码来源:rtShopFilter.class.php
示例14: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
$request = $this->context->getRequest();
if (!$request->isMobile()) {
if (!$this->isErrorAction()) {
$this->forwardToErrorAction();
}
}
$filterChain->execute();
}
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:15,代码来源:sfDenyFromNonMobileFilter.class.php
示例15: execute
/**
* Executes the filter chain.
*
* @param sfFilterChain $filterChain
*/
public function execute($filterChain)
{
$cookieName = sfConfig::get('dm_security_remember_cookie_name', 'dm_remember_' . dmProject::getHash());
if ($this->isFirstCall() && $this->user->isAnonymous() && ($cookie = $this->request->getCookie($cookieName))) {
$q = Doctrine_Core::getTable('DmRememberKey')->createQuery('r')->innerJoin('r.User u')->where('r.remember_key = ?', $cookie);
if ($q->count()) {
$this->user->signIn($q->fetchOne()->get('User'));
}
}
$filterChain->execute();
}
开发者ID:theolymp,项目名称:diem,代码行数:16,代码来源:dmRememberMeFilter.class.php
示例16: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain The filter chain
*/
public function execute($filterChain)
{
$routing = $this->context->getRouting();
$routes = $routing->getRoutes();
$routeName = $routing->getCurrentRouteName();
$variables = $routes[$routeName]->getDefaults();
if (isset($variables['noindex']) && $variables['noindex']) {
$this->context->getResponse()->addMeta('robots', 'noindex,nofollow');
}
$filterChain->execute();
}
开发者ID:auphau,项目名称:joyreactor,代码行数:16,代码来源:kokaMetaRoutingFilter.class.php
示例17: execute
/**
* Executes the filter chain.
*
* @param sfFilterChain $filterChain
*/
public function execute($filterChain)
{
$cookieName = sfConfig::get('app_sf_com_guard_plugin_remember_cookie_name', 'sfRemember');
if ($this->isFirstCall() && $this->context->getUser()->isAnonymous() && ($cookie = $this->context->getRequest()->getCookie($cookieName))) {
$q = Doctrine_Query::create()->from('sfObjectGuardRememberKey r')->innerJoin('r.User u')->where('r.remember_key = ?', $cookie);
if ($q->count()) {
$this->context->getUser()->signIn($q->fetchOne()->User);
}
}
$filterChain->execute();
}
开发者ID:everzet,项目名称:sfDoctrineObjectGuardPlugin,代码行数:16,代码来源:sfObjectGuardRememberMeFilter.class.php
示例18: execute
/**
* Executes the filter chain.
*
* @param sfFilterChain $filterChain
*/
public function execute($filterChain)
{
$cookieName = sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember');
if ($this->isFirstCall() && $this->context->getUser()->isAnonymous() && ($cookie = $this->context->getRequest()->getCookie($cookieName))) {
$q = Doctrine_Core::getTable('sfGuardUser')->createQuery('u')->select('u.*')->innerJoin('u.RememberKeys r')->where('u.is_active = ?', true)->addWhere('r.remember_key = ?', $cookie);
if ($q->count()) {
$this->context->getUser()->signIn($q->fetchOne());
}
}
$filterChain->execute();
}
开发者ID:jmiridis,项目名称:atcsf1,代码行数:16,代码来源:sfGuardRememberMeFilter.class.php
示例19: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
$current = $this->context->getRouting()->getCurrentRouteName();
$configName = 'enable_' . $this->getParameter('app', 'pc');
if (!opConfig::get($configName)) {
if ($current !== 'error') {
$this->context->getController()->redirect('@error');
throw new sfStopException();
}
}
$filterChain->execute();
}
开发者ID:te-koyama,项目名称:openpne,代码行数:17,代码来源:opCheckEnabledApplicationFilter.class.php
示例20: execute
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
// execute this filter only once, if cache is set and no GET or POST parameters
if (!sfConfig::get('sf_cache')) {
$filterChain->execute();
return;
}
if ($this->executeBeforeExecution()) {
$filterChain->execute();
}
$this->executeBeforeRendering();
}
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:17,代码来源:sfCacheFilter.class.php
注:本文中的sfFilterChain类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论