Changeset 863220d612ed27e28b1e8e1f6e4c3d95efb8d35f
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1de0187
|
r863220d
|
|
| 124 | 124 | |
| 125 | 125 | function _checkKey() { |
| 126 | | if (!isset($this->params['named']['key'])) { |
| | 126 | if (!isset($this->request->params['named']['key'])) { |
| 127 | 127 | return false; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // 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']); |
| 133 | 133 | |
| 134 | 134 | $data = $this->User->findByKey($key, array('User.id')); |
-
|
ree4c2b7f
|
r863220d
|
|
| 105 | 105 | function _getPathFromUrl($strip = 0, $len = false) { |
| 106 | 106 | $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) { |
| 108 | 108 | if ($len) { |
| 109 | | $dirs = array_slice($this->params['pass'], $strip, $len); |
| | 109 | $dirs = array_slice($this->request->params['pass'], $strip, $len); |
| 110 | 110 | } else { |
| 111 | | $dirs = array_slice($this->params['pass'], $strip); |
| | 111 | $dirs = array_slice($this->request->params['pass'], $strip); |
| 112 | 112 | } |
| 113 | 113 | $path = '/'.implode('/', $dirs).'/'; |
-
|
r1de0187
|
r863220d
|
|
| 42 | 42 | |
| 43 | 43 | $params = array(); |
| 44 | | foreach ($this->params['named'] as $key => $value) { |
| | 44 | foreach ($this->request->params['named'] as $key => $value) { |
| 45 | 45 | $params[] = $key.':'.$value; |
| 46 | 46 | } |
-
|
r0ee680a
|
r863220d
|
|
| 84 | 84 | ); |
| 85 | 85 | |
| | 86 | /** List of chars to escape on setParam() */ |
| | 87 | var $escapeChars = '=,/'; |
| | 88 | |
| 86 | 89 | function initialize(&$controller) { |
| 87 | 90 | $this->controller = &$controller; |
| … |
… |
|
| 182 | 185 | unset($this->_data[$name]); |
| 183 | 186 | } |
| | 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; |
| 184 | 201 | } |
| 185 | 202 | |
-
|
r0ee680a
|
r863220d
|
|
| 382 | 382 | $crumbs[] = "$param:$value"; |
| 383 | 383 | } |
| 384 | | $crumbs = am($crumbs, $this->Search->urlToCrumbs($this->params['url']['url'], 5)); |
| | 384 | $crumbs = am($crumbs, $this->Search->urlToCrumbs($this->request->url, 5)); |
| 385 | 385 | } elseif ($param == 'folder') { |
| 386 | | $folder = implode('/', array_slice($this->params['pass'], 2)); |
| | 386 | $folder = implode('/', array_slice($this->request->params['pass'], 2)); |
| 387 | 387 | $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)); |
| 389 | 389 | $fsFolder = Folder::slashTerm(Folder::addPathElement($fsRoot, $fsFolder)); |
| 390 | 390 | if (is_dir($fsRoot) && is_dir($fsFolder)) { |
| … |
… |
|
| 396 | 396 | } |
| 397 | 397 | } else { |
| 398 | | $crumbs = am($crumbs, $this->Search->urlToCrumbs($this->params['url']['url'], 3)); |
| | 398 | $crumbs = am($crumbs, $this->Search->urlToCrumbs($this->request->url, 3)); |
| 399 | 399 | } |
| 400 | 400 | $this->crumbs = $crumbs; |
| … |
… |
|
| 403 | 403 | |
| 404 | 404 | 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)); |
| 406 | 406 | $this->render('index'); |
| 407 | 407 | } |
| … |
… |
|
| 456 | 456 | $crumbs[] = 'tag:' . $tag; |
| 457 | 457 | } |
| 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)); |
| 459 | 459 | $this->render('index'); |
| 460 | 460 | } |
| … |
… |
|
| 466 | 466 | $crumbs[] = 'category:' . $category; |
| 467 | 467 | } |
| 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)); |
| 469 | 469 | $this->render('index'); |
| 470 | 470 | } |
| … |
… |
|
| 476 | 476 | $crumbs[] = 'location:' . $location; |
| 477 | 477 | } |
| 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)); |
| 479 | 479 | $this->render('index'); |
| 480 | 480 | } |
| … |
… |
|
| 482 | 482 | |
| 483 | 483 | function edit() { |
| 484 | | if (isset($this->request->data)) { |
| | 484 | if (!empty($this->request->data)) { |
| 485 | 485 | $ids = preg_split('/\s*,\s*/', $this->request->data['Media']['ids']); |
| 486 | 486 | $ids = array_unique($ids); |
-
|
ree4c2b7f
|
r863220d
|
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | | $encoded = array_splice(split('/', $this->params['url']['url']), 3); |
| | 46 | $encoded = array_splice(split('/', $this->request->url), 3); |
| 47 | 47 | foreach ($encoded as $crumb) { |
| 48 | 48 | $this->crumbs[] = $this->Search->decode($crumb); |
| … |
… |
|
| 53 | 53 | parent::beforeRender(); |
| 54 | 54 | $this->set('crumbs', $this->crumbs); |
| 55 | | $this->params['crumbs'] = $this->crumbs; |
| | 55 | $this->request->params['crumbs'] = $this->crumbs; |
| 56 | 56 | } |
| 57 | 57 | |
-
|
ree4c2b7f
|
r863220d
|
|
| 47 | 47 | $this->dbConfig = CONFIGS.'database.php'; |
| 48 | 48 | $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()) { |
| 50 | 50 | parent::beforeFilter(); |
| 51 | 51 | } else { |
-
|
r0ee680a
|
r863220d
|
|
| 337 | 337 | |
| 338 | 338 | $id = intval($id); |
| 339 | | $dirs = $this->params['pass']; |
| | 339 | $dirs = $this->request->params['pass']; |
| 340 | 340 | unset($dirs[0]); |
| 341 | 341 | $fsroot = implode(DS, $dirs); |