1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
<?php
/* SVN FILE: $Id: routes.php,v 1.1.1.1 2006/08/14 23:54:56 sancus%off.net Exp $ */
/**
* Short description for file.
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different urls to chosen controllers and their actions (functions).
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 0.2.9
* @version $Revision: 1.1.1.1 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/08/14 23:54:56 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/views/pages/home.thtml)...
*/
$Route->connect('/', array('controller' => 'addons', 'action' => 'home'));
/**
* ...and connect the rest of 'Pages' controller's urls.
*/
$Route->connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
* Then we connect url '/test' to our test controller. This is helpful in
* developement.
*/
$Route->connect('/tests', array('controller' => 'tests', 'action' => 'index'));
// Connect the routes for app and lang. The order of these are important!
// The first one that matches is what it will use. If LANG and APP_SHORTNAME
// aren't defined, bootstrap will be redirecting the person. We're all pretty
// sure these routes don't need to be added every time...
if (defined('LANG') && defined('SITE_LAYOUT')) {
global $other_layouts;
if (array_key_exists(SITE_LAYOUT, $other_layouts)) {
$prefix = LANG;
}
else {
$prefix = LANG . '/' . SITE_LAYOUT;
}
// If they just go to /$lang/$app/
$Route->connect("/{$prefix}", array('controller' => 'addons', 'action' => 'home'));
// connect localized, static pages
$Route->connect("/{$prefix}/pages/*", array('controller' => 'pages', 'action' => 'display'));
// Setup old URL handlers. These all are in the $lang's section because they
// get redirected here in bootstrap.php. Original redirects can be seen at:
// http://lxr.mozilla.org/mozilla/source/webtools/addons/public/htaccess.dist
// v2: section prefixes (eg. /extensions/)
$Route->connect("/{$prefix}/extensions/", array('controller' => 'legacy_url', 'action' => 'oldSection', 'extensions'));
$Route->connect("/{$prefix}/themes/", array('controller' => 'legacy_url', 'action' => 'oldSection', 'themes'));
$Route->connect("/{$prefix}/plugins/", array('controller' => 'legacy_url', 'action' => 'oldSection', 'plugins'));
$Route->connect("/{$prefix}/search-engines/", array('controller' => 'legacy_url', 'action' => 'oldSection', 'search-engines'));
$Route->connect("/{$prefix}/dictionaries/", array('controller' => 'legacy_url', 'action' => 'oldSection', 'dictionaries'));
$Route->connect("/{$prefix}/bookmarks/", array('controller' => 'legacy_url', 'action' => 'oldSection', 'bookmarks'));
// Redirect for firefox 1.5
$Route->connect("/{$prefix}/search-engines.php", array('controller' => 'addons', 'action' => 'browse', 'type:4'));
// Some pleasant short forms
$Route->connect("/{$prefix}/browse/*", array('controller' => 'addons', 'action' => 'browse'));
$Route->connect("/{$prefix}/recommended/*", array('controller' => 'addons', 'action' => 'recommended'));
$Route->connect("/{$prefix}/user/*", array('controller' => 'users', 'action' => 'info'));
$Route->connect("/{$prefix}/addon/*", array('controller' => 'addons', 'action' => 'display'));
$Route->connect("/{$prefix}/blog/*", array('controller' => 'blog', 'action' => 'view'));
$Route->connect("/{$prefix}/collection/*", array('controller' => 'collections', 'action' => 'display'));
// API hookup
$Route->connect("/{$prefix}/api/addon/*", array('controller' => 'api', 'action'=>'addon'));
$Route->connect("/{$prefix}/api/list/*", array('controller' => 'api', 'action'=>'list_addons'));
$Route->connect("/{$prefix}/api/[\d\.]*/feed/*", array('controller' => 'api', 'action'=>'collections_feed'));
// Add API versioning support
$Route->connect("/{$prefix}/api/[\d\.]*/addon/*", array('controller' => 'api', 'action'=>'addon'));
$Route->connect("/{$prefix}/api/[\d\.]*/list/*", array('controller' => 'api', 'action'=>'list_addons'));
$Route->connect("/{$prefix}/api/[\d\.]*/search/*", array('controller' => 'api', 'action'=>'search'));
$Route->connect("/{$prefix}/api/[\d\.]*/get_language_packs/*", array('controller' => 'api', 'action'=>'get_language_packs'));
// Bandwagon/collections
$Route->connect("/{$prefix}/fashionyourfirefox/", array('controller' => 'collections', 'action' => 'interactive'));
// Magical undocumented routing syntax - if nothing has matched up till now, it'll hit this
$Route->connect("/{$prefix}/:controller/:action/*", array('controller' => 'pages', 'action' => 'index'));
}
//}}
?>
|