Development

Changeset 1586

You must first sign up to be able to contribute.

Changeset 1586

Show
Ignore:
Timestamp:
07/06/06 14:55:19 (2 years ago)
Author:
rovert
Message:

RoVeRT: updating to trunk 1585

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/rovert-0.6/lib/action/sfAction.class.php

    r1581 r1586  
    55 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 
    66 * (c) 2004-2006 Sean Kerr. 
    7  *  
     7 * 
    88 * For the full copyright and license information, please view the LICENSE 
    99 * file that was distributed with this source code. 
     
    6262  } 
    6363 
     64  /** 
     65   * Execute an application defined process prior to execution of this Action. 
     66   * 
     67   * By Default, this method is empty. 
     68   */ 
    6469  public function preExecute () 
    6570  { 
    6671  } 
    6772 
     73  /** 
     74   * Execute an application defined process immediately after execution of this Action. 
     75   * 
     76   * By Default, this method is empty. 
     77   */ 
    6878  public function postExecute () 
    6979  { 
     
    91101    } 
    92102 
    93     // ignore cache? (only in debug mode) 
    94     if (sfConfig::get('sf_debug') && $this->request->getParameter('ignore_cache', false, 'symfony/request/sfWebRequest') == true) 
    95     { 
    96       return 1; 
    97     } 
    98  
    99103    $cache = $this->getContext()->getViewCacheManager(); 
    100104 
     
    111115  } 
    112116 
     117  /** 
     118   * Forwards current action to the default 404 error action 
     119   * unless the specified condition is true. 
     120   * 
     121   * @param bool A condition that evaluates to true or false. 
     122   */ 
    113123  public function forward404Unless ($condition) 
    114124  { 
     
    119129  } 
    120130 
     131  /** 
     132   * Forwards current action to the default 404 error action 
     133   * if the specified condition is true. 
     134   * 
     135   * @param bool A condition that evaluates to true or false. 
     136   */ 
    121137  public function forward404If ($condition) 
    122138  { 
     
    156172  } 
    157173 
     174  /** 
     175   * If the condition is true, forwards current action to a new one (without browser redirection). 
     176   * 
     177   * This method must be called as with a return: 
     178   * 
     179   * <code> 
     180   *  $condition = true 
     181   *  return $this->forwardIf($condition, 'module', 'action') 
     182   * </code> 
     183   * 
     184   * @param  bool   A condition that evaluates to true or false. 
     185   * @param  string module name 
     186   * @param  string action name 
     187   * @return sfView::NONE 
     188   */ 
    158189  public function forwardIf ($condition, $module, $action) 
    159190  { 
     
    164195  } 
    165196 
     197  /** 
     198   * Unless the condition is true, forwards current action to a new one (without browser redirection). 
     199   * 
     200   * This method must be called as with a return: 
     201   * 
     202   * <code> 
     203   *  $condition = false 
     204   *  return $this->forwardUnless($condition, 'module', 'action') 
     205   * </code> 
     206   * 
     207   * @param  bool   A condition that evaluates to true or false. 
     208   * @param  string module name 
     209   * @param  string action name 
     210   * @return sfView::NONE 
     211   */ 
    166212  public function forwardUnless ($condition, $module, $action) 
    167213  { 
     
    174220  public function sendEmail($module, $action) 
    175221  { 
    176     $presentation = $this->getPresentationFor($module, $action, 'sfMail'); 
    177  
    178     // error? (like a security forwarding) 
    179     if (!$presentation) 
    180     { 
    181       throw new sfException('There was an error when trying to send this email.'); 
    182     } 
    183  
    184     return $presentation; 
     222    return $this->getPresentationFor($module, $action, 'sfMail'); 
    185223  } 
    186224 
     
    222260 
    223261    // remove the action entry 
    224     for ($i = $index; $i < $actionStack->getSize(); $i++) 
    225     { 
    226       $actionEntry = $actionStack->removeEntry($i); 
     262    $nb = $actionStack->getSize() - $index; 
     263    while ($nb-- > 0) 
     264    { 
     265      $actionEntry = $actionStack->popEntry(); 
     266 
     267      if ($actionEntry->getModuleName() == sfConfig::get('sf_login_module') && $actionEntry->getActionName() == sfConfig::get('sf_login_action')) 
     268      { 
     269        $error = 'Your mail action is secured but the user is not authenticated.'; 
     270 
     271        throw new sfException($error); 
     272      } 
     273      else if ($actionEntry->getModuleName() == sfConfig::get('sf_secure_module') && $actionEntry->getActionName() == sfConfig::get('sf_secure_action')) 
     274      { 
     275        $error = 'Your mail action is secured but the user does not have access.'; 
     276 
     277        throw new sfException($error); 
     278      } 
    227279    } 
    228280 
     
    230282    if ($viewName) 
    231283    { 
    232       $this->getRequest()->setAttribute($module.'_'.$action.'_view_name', '', 'symfony/action/view'); 
     284      $this->getRequest()->getAttributeHolder()->remove($module.'_'.$action.'_view_name', 'symfony/action/view'); 
    233285    } 
    234286 
     
    261313  } 
    262314 
     315  /** 
     316   * Redirects current request to a new URL, only if specified condition is true. 
     317   * 
     318   * @see redirect 
     319   * 
     320   * This method must be called as with a return: 
     321   * 
     322   * <code>return $this->redirectIf($condition, '/ModuleName/ActionName')</code> 
     323   * 
     324   * @param  bool   A condition that evaluates to true or false. 
     325   * @param  string url 
     326   * @return sfView::NONE 
     327   */ 
    263328  public function redirectIf ($condition, $url) 
    264329  { 
     
    269334  } 
    270335 
     336  /** 
     337   * Redirects current request to a new URL, unless specified condition is true. 
     338   * 
     339   * @see redirect 
     340   * 
     341   * This method must be called as with a return: 
     342   * 
     343   * <code>return $this->redirectUnless($condition, '/ModuleName/ActionName')</code> 
     344   * 
     345   * @param  bool   A condition that evaluates to true or false. 
     346   * @param  string url 
     347   * @return sfView::NONE 
     348   */ 
    271349  public function redirectUnless ($condition, $url) 
    272350  { 
     
    406484  } 
    407485 
     486  /** 
     487   * Sets an alternate template for this Action. 
     488   * 
     489   * See 'Naming Conventions' in the 'Symfony View' documentation. 
     490   * 
     491   * @param string template name 
     492   */ 
    408493  public function setTemplate($name) 
    409494  { 
     
    413498  } 
    414499 
     500  /** 
     501   * Gets the name of the alternate template for this Action. 
     502   * 
     503   * See 'Naming Conventions' in the 'Symfony View' documentation. 
     504   * 
     505   * @return string 
     506   */ 
    415507  public function getTemplate() 
    416508  { 
     
    463555  } 
    464556} 
    465  
    466 ?> 
  • branches/rovert-0.6/lib/action/sfActionStack.class.php

    r1581 r1586  
    55 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 
    66 * (c) 2004-2006 Sean Kerr. 
    7  *  
     7 * 
    88 * For the full copyright and license information, please view the LICENSE 
    99 * file that was distributed with this source code. 
     
    3333   * @param sfAction An sfAction implementation instance. 
    3434   * 
    35    * @return sfActionEntry sfActionEntry instance 
     35   * @return sfActionStackEntry sfActionStackEntry instance 
    3636   */ 
    3737  public function addEntry ($moduleName, $actionName, $actionInstance, $isSlot = false) 
     
    4141 
    4242    $this->stack[] = $actionEntry; 
    43      
     43 
    4444    return $actionEntry; 
    4545  } 
     
    5050   * @param int An entry index. 
    5151   * 
    52    * @return ActionStackEntry An action stack entry implementation. 
     52   * @return sfActionStackEntry An action stack entry implementation. 
    5353   */ 
    5454  public function getEntry ($index) 
     
    6969