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