]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - application/Router.php
6 * (only displayable pages here)
10 public static $AJAX_THUMB_UPDATE = 'ajax_thumb_update';
12 public static $PAGE_LOGIN = 'login';
14 public static $PAGE_PICWALL = 'picwall';
16 public static $PAGE_TAGCLOUD = 'tagcloud';
18 public static $PAGE_TAGLIST = 'taglist';
20 public static $PAGE_DAILY = 'daily';
22 public static $PAGE_FEED_ATOM = 'atom';
24 public static $PAGE_FEED_RSS = 'rss';
26 public static $PAGE_TOOLS = 'tools';
28 public static $PAGE_CHANGEPASSWORD = 'changepasswd';
30 public static $PAGE_CONFIGURE = 'configure';
32 public static $PAGE_CHANGETAG = 'changetag';
34 public static $PAGE_ADDLINK = 'addlink';
36 public static $PAGE_EDITLINK = 'edit_link';
38 public static $PAGE_DELETELINK = 'delete_link';
40 public static $PAGE_EXPORT = 'export';
42 public static $PAGE_IMPORT = 'import';
44 public static $PAGE_OPENSEARCH = 'opensearch';
46 public static $PAGE_LINKLIST = 'linklist';
48 public static $PAGE_PLUGINSADMIN = 'pluginadmin';
50 public static $PAGE_SAVE_PLUGINSADMIN = 'save_pluginadmin';
52 public static $PAGE_THUMBS_UPDATE = 'thumbs_update';
54 public static $GET_TOKEN = 'token';
57 * Reproducing renderPage() if hell, to avoid regression.
59 * This highlights how bad this needs to be rewrite,
60 * but let's focus on plugins for now.
62 * @param string $query $_SERVER['QUERY_STRING'].
63 * @param array $get $_SERVER['GET'].
64 * @param bool $loggedIn true if authenticated user.
66 * @return string page found.
68 public static function findPage($query, $get, $loggedIn)
70 $loggedIn = ($loggedIn === true) ? true : false;
72 if (empty($query) && !isset($get['edit_link']) && !isset($get['post'])) {
73 return self
::$PAGE_LINKLIST;
76 if (startsWith($query, 'do='. self
::$PAGE_LOGIN) && $loggedIn === false) {
77 return self
::$PAGE_LOGIN;
80 if (startsWith($query, 'do='. self
::$PAGE_PICWALL)) {
81 return self
::$PAGE_PICWALL;
84 if (startsWith($query, 'do='. self
::$PAGE_TAGCLOUD)) {
85 return self
::$PAGE_TAGCLOUD;
88 if (startsWith($query, 'do='. self
::$PAGE_TAGLIST)) {
89 return self
::$PAGE_TAGLIST;
92 if (startsWith($query, 'do='. self
::$PAGE_OPENSEARCH)) {
93 return self
::$PAGE_OPENSEARCH;
96 if (startsWith($query, 'do='. self
::$PAGE_DAILY)) {
97 return self
::$PAGE_DAILY;
100 if (startsWith($query, 'do='. self
::$PAGE_FEED_ATOM)) {
101 return self
::$PAGE_FEED_ATOM;
104 if (startsWith($query, 'do='. self
::$PAGE_FEED_RSS)) {
105 return self
::$PAGE_FEED_RSS;
108 if (startsWith($query, 'do='. self
::$PAGE_THUMBS_UPDATE)) {
109 return self
::$PAGE_THUMBS_UPDATE;
112 if (startsWith($query, 'do='. self
::$AJAX_THUMB_UPDATE)) {
113 return self
::$AJAX_THUMB_UPDATE;
116 // At this point, only loggedin pages.
118 return self
::$PAGE_LINKLIST;
121 if (startsWith($query, 'do='. self
::$PAGE_TOOLS)) {
122 return self
::$PAGE_TOOLS;
125 if (startsWith($query, 'do='. self
::$PAGE_CHANGEPASSWORD)) {
126 return self
::$PAGE_CHANGEPASSWORD;
129 if (startsWith($query, 'do='. self
::$PAGE_CONFIGURE)) {
130 return self
::$PAGE_CONFIGURE;
133 if (startsWith($query, 'do='. self
::$PAGE_CHANGETAG)) {
134 return self
::$PAGE_CHANGETAG;
137 if (startsWith($query, 'do='. self
::$PAGE_ADDLINK)) {
138 return self
::$PAGE_ADDLINK;
141 if (isset($get['edit_link']) || isset($get['post'])) {
142 return self
::$PAGE_EDITLINK;
145 if (isset($get['delete_link'])) {
146 return self
::$PAGE_DELETELINK;
149 if (startsWith($query, 'do='. self
::$PAGE_EXPORT)) {
150 return self
::$PAGE_EXPORT;
153 if (startsWith($query, 'do='. self
::$PAGE_IMPORT)) {
154 return self
::$PAGE_IMPORT;
157 if (startsWith($query, 'do='. self
::$PAGE_PLUGINSADMIN)) {
158 return self
::$PAGE_PLUGINSADMIN;
161 if (startsWith($query, 'do='. self
::$PAGE_SAVE_PLUGINSADMIN)) {
162 return self
::$PAGE_SAVE_PLUGINSADMIN;
165 if (startsWith($query, 'do='. self
::$GET_TOKEN)) {
166 return self
::$GET_TOKEN;
169 return self
::$PAGE_LINKLIST;