Changeset 863220d612ed27e28b1e8e1f6e4c3d95efb8d35f

Show
Ignore:
Timestamp:
01/29/12 17:55:46 (4 months ago)
Author:
Xemle <xemle@phtagr.org>
Children:
7016eb4cb4364248b02c2b3336aff5da9a22e032
Parents:
0736ab3ac681bfd827d0973122d3a48e4b39594e
git-committer:
Xemle <xemle@phtagr.org> / 2012-01-29T17:55:46Z+0100
Message:

Use request object instead of controller's params

Location:
Controller
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • Controller/AppController.php

    r1de0187 r863220d  
    124124 
    125125  function _checkKey() { 
    126     if (!isset($this->params['named']['key'])) { 
     126    if (!isset($this->request->params['named']['key'])) { 
    127127      return false; 
    128128    } 
    129129 
    130130    // fetch and delete key from passed parameters 
    131     $key = $this->params['named']['key']; 
    132     unset($this->params['named']['key']); 
     131    $key = $this->request->params['named']['key']; 
     132    unset($this->request->params['named']['key']); 
    133133 
    134134    $data = $this->User->findByKey($key, array('User.id')); 
  • Controller/BrowserController.php

    ree4c2b7f r863220d  
    105105  function _getPathFromUrl($strip = 0, $len = false) { 
    106106    $strip = max(0, $strip); 
    107     if (count($this->params['pass']) - $strip - abs($len) > 0) { 
     107    if (count($this->request->params['pass']) - $strip - abs($len) > 0) { 
    108108      if ($len) { 
    109         $dirs = array_slice($this->params['pass'], $strip, $len); 
     109        $dirs = array_slice($this->request->params['pass'], $strip, $len); 
    110110      } else { 
    111         $dirs = array_slice($this->params['pass'], $strip); 
     111        $dirs = array_slice($this->request->params['pass'], $strip); 
    112112      } 
    113113      $path = '/'.implode('/', $dirs).'/'; 
  • Controller/CommentsController.php

    r1de0187 r863220d  
    4242 
    4343    $params = array(); 
    44     foreach ($this->params['named'] as $key => $value) { 
     44    foreach ($this->request->params['named'] as $key => $value) { 
    4545      $params[] = $key.':'.$value; 
    4646    } 
  • Controller/Component/SearchComponent.php

    r0ee680a r863220d  
    8484    ); 
    8585 
     86  /** List of chars to escape on setParam() */ 
     87  var $escapeChars = '=,/'; 
     88 
    8689  function initialize(&$controller) { 
    8790    $this->controller = &$controller; 
     
    182185      unset($this->_data[$name]); 
    183186    } 
     187  } 
     188 
     189  function encode($input) { 
     190    $out = ''; 
     191    $input = (string)$input; 
     192    $len = strlen($input); 
     193    for ($i = 0; $i < $len; $i++) { 
     194      $c = substr($input, $i, 1); 
     195      if (strpos($this->escapeChars, $c) !== false) { 
     196        $c = '=' . dechex(ord($c)); 
     197      } 
     198      $out = $out . $c; 
     199    } 
     200    return $out; 
    184201  } 
    185202 
  • Controller/ExplorerController.php

    r0ee680a r863220d  
    382382        $crumbs[] = "$param:$value"; 
    383383      } 
    384       $crumbs = am($crumbs, $this->Search->urlToCrumbs($this->params['url']['url'], 5)); 
     384      $crumbs = am($crumbs, $this->Search->urlToCrumbs($this->request->url, 5)); 
    385385    } elseif ($param == 'folder') { 
    386       $folder = implode('/', array_slice($this->params['pass'], 2)); 
     386      $folder = implode('/', array_slice($this->request->params['pass'], 2)); 
    387387      $fsRoot = $this->User->getRootDir($user); 
    388       $fsFolder = implode(DS, array_slice($this->params['pass'], 2)); 
     388      $fsFolder = implode(DS, array_slice($this->request->params['pass'], 2)); 
    389389      $fsFolder = Folder::slashTerm(Folder::addPathElement($fsRoot, $fsFolder)); 
    390390      if (is_dir($fsRoot) && is_dir($fsFolder)) { 
     
    396396      } 
    397397    } else { 
    398       $crumbs = am($crumbs, $this->Search->urlToCrumbs($this->params['url']['url'], 3)); 
     398      $crumbs = am($crumbs, $this->Search->urlToCrumbs($this->request->url, 3)); 
    399399    } 
    400400    $this->crumbs = $crumbs; 
     
    403403 
    404404  function group($name) { 
    405     $this->crumbs = am(array('group:' . $name), $this->Search->urlToCrumbs($this->params['url']['url'], 3)); 
     405    $this->crumbs = am(array('group:' . $name), $this->Search->urlToCrumbs($this->request->url, 3)); 
    406406    $this->render('index'); 
    407407  } 
     
    456456      $crumbs[] = 'tag:' . $tag; 
    457457    } 
    458     $this->crumbs = am($crumbs, $this->Search->urlToCrumbs($this->params['url']['url'], 3)); 
     458    $this->crumbs = am($crumbs, $this->Search->urlToCrumbs($this->request->url, 3)); 
    459459    $this->render('index'); 
    460460  } 
     
    466466      $crumbs[] = 'category:' . $category; 
    467467    } 
    468     $this->crumbs = am($crumbs, $this->Search->urlToCrumbs($this->params['url']['url'], 3)); 
     468    $this->crumbs = am($crumbs, $this->Search->urlToCrumbs($this->request->url, 3)); 
    469469    $this->render('index'); 
    470470  } 
     
    476476      $crumbs[] = 'location:' . $location; 
    477477    } 
    478     $this->crumbs = am($crumbs, $this->Search->urlToCrumbs($this->params['url']['url'], 3)); 
     478    $this->crumbs = am($crumbs, $this->Search->urlToCrumbs($this->request->url, 3)); 
    479479    $this->render('index'); 
    480480  } 
     
    482482  
    483483  function edit() { 
    484     if (isset($this->request->data)) { 
     484    if (!empty($this->request->data)) { 
    485485      $ids = preg_split('/\s*,\s*/', $this->request->data['Media']['ids']); 
    486486      $ids = array_unique($ids); 
  • Controller/ImagesController.php

    ree4c2b7f r863220d  
    4444    } 
    4545 
    46     $encoded = array_splice(split('/', $this->params['url']['url']), 3); 
     46    $encoded = array_splice(split('/', $this->request->url), 3); 
    4747    foreach ($encoded as $crumb) { 
    4848      $this->crumbs[] = $this->Search->decode($crumb); 
     
    5353    parent::beforeRender(); 
    5454    $this->set('crumbs', $this->crumbs); 
    55     $this->params['crumbs'] = $this->crumbs; 
     55    $this->request->params['crumbs'] = $this->crumbs; 
    5656  } 
    5757 
  • Controller/SetupController.php

    ree4c2b7f r863220d  
    4747    $this->dbConfig = CONFIGS.'database.php'; 
    4848    $this->paths = array(TMP, USER_DIR); 
    49     if (isset($this->params['admin']) && $this->params['admin'] && $this->__hasSysOp()) { 
     49    if (isset($this->request->params['admin']) && $this->request->params['admin'] && $this->__hasSysOp()) { 
    5050      parent::beforeFilter(); 
    5151    } else { 
  • Controller/UsersController.php

    r0ee680a r863220d  
    337337 
    338338    $id = intval($id); 
    339     $dirs = $this->params['pass']; 
     339    $dirs = $this->request->params['pass']; 
    340340    unset($dirs[0]); 
    341341    $fsroot = implode(DS, $dirs);