Dotclear

Changeset 2243:86b0bd224843


Ignore:
Timestamp:
10/04/13 11:06:08 (10 years ago)
Author:
Dsls
Branch:
default
Message:

Compatibility for actionspage : handle redir if set, avoid plugins bugs when specifying "%" in URLs by disbling entry selection persistence.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/comments_actions.php

    r2066 r2243  
    1616require dirname(__FILE__).'/../inc/admin/prepend.php'; 
    1717 
     18if (isset($_REQUEST['redir'])) { 
     19     $u = explode('?',$_REQUEST['redir']); 
     20     $uri = $u[0]; 
     21     if (isset($u[1])) { 
     22          parse_str($u[1],$args); 
     23     } 
     24     $args['redir'] = $_REQUEST['redir']; 
     25} else { 
     26     $uri = 'posts.php'; 
     27     $args=array(); 
     28} 
     29 
    1830dcPage::check('usage,contentadmin'); 
    1931 
    2032$comments_actions_page = new dcCommentsActionsPage($core,'comments.php'); 
     33$comments_actions_page->setEnableRedirSelection(false); 
    2134 
    2235$comments_actions_page->process(); 
  • admin/posts_actions.php

    r1999 r2243  
    1818dcPage::check('usage,contentadmin'); 
    1919 
    20 $posts_actions_page = new dcPostsActionsPage($core,'posts.php'); 
     20if (isset($_REQUEST['redir'])) { 
     21     $u = explode('?',$_REQUEST['redir']); 
     22     $uri = $u[0]; 
     23     if (isset($u[1])) { 
     24          parse_str($u[1],$args); 
     25     } 
     26     $args['redir'] = $_REQUEST['redir']; 
     27} else { 
     28     $uri = 'posts.php'; 
     29     $args=array(); 
     30} 
    2131 
     32$posts_actions_page = new dcPostsActionsPage($core,$uri,$args); 
     33$posts_actions_page->setEnableRedirSelection(false); 
    2234$posts_actions_page->process(); 
    2335 
  • inc/admin/actions/class.dcaction.php

    r2169 r2243  
    5252     /** @var boolean true if we are acting inside a plugin (different handling of begin/endpage) */ 
    5353     protected $in_plugin;     
     54      
     55     /** @var boolean true if we enable to keep selection when redirecting */ 
     56     protected $enable_redir_selection;  
    5457 
    5558    /** 
     
    8487          $u=explode('?',$_SERVER['REQUEST_URI']); 
    8588          $this->in_plugin = (strpos($u[0],'plugin.php') !== false); 
     89          $this->enable_redir_selection = true; 
     90     } 
     91      
     92    /** 
     93     * setEnableRedirSelection - define whether to keep selection when redirecting 
     94      *                                 Can be usefull to be disabled to preserve some compatibility. 
     95     * 
     96     * @param boolean $enable true to enable, false otherwise 
     97      * 
     98     * @access public 
     99     */ 
     100     public function setEnableRedirSelection($enable) { 
     101          $this->enable_redir_selection = $enable; 
    86102     } 
    87103      
     
    227243     public function getRedirection($with_selected_entries=false,$params=array()) { 
    228244          $redir_args = array_merge($params,$this->redir_args); 
    229           if ($with_selected_entries) { 
     245          if (isset($redir_args['redir'])) { 
     246               unset($redir_args['redir']); 
     247          } 
     248           
     249          if ($with_selected_entries && $this->enable_redir_selection) { 
    230250               $redir_args[$this->field_entries] = array_keys($this->entries); 
    231251          } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map