]>
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_EXPORT = 'export';
36 public static $PAGE_IMPORT = 'import';
38 public static $PAGE_OPENSEARCH = 'opensearch';
40 public static $PAGE_LINKLIST = 'linklist';
42 public static $PAGE_PLUGINSADMIN = 'pluginadmin';
44 public static $PAGE_SAVE_PLUGINSADMIN = 'save_pluginadmin';
47 * Reproducing renderPage() if hell, to avoid regression.
49 * This highlights how bad this needs to be rewrite,
50 * but let's focus on plugins for now.
52 * @param string $query $_SERVER['QUERY_STRING'].
53 * @param array $get $_SERVER['GET'].
54 * @param bool $loggedIn true if authenticated user.
56 * @return string page found.
58 public static function findPage($query, $get, $loggedIn)
60 $loggedIn = ($loggedIn === true) ? true : false;
62 if (empty($query) && !isset($get['edit_link']) && !isset($get['post'])) {
63 return self
::$PAGE_LINKLIST;
66 if (startsWith($query, 'do='. self
::$PAGE_LOGIN) && $loggedIn === false) {
67 return self
::$PAGE_LOGIN;
70 if (startsWith($query, 'do='. self
::$PAGE_PICWALL)) {
71 return self
::$PAGE_PICWALL;
74 if (startsWith($query, 'do='. self
::$PAGE_TAGCLOUD)) {
75 return self
::$PAGE_TAGCLOUD;
78 if (startsWith($query, 'do='. self
::$PAGE_OPENSEARCH)) {
79 return self
::$PAGE_OPENSEARCH;
82 if (startsWith($query, 'do='. self
::$PAGE_DAILY)) {
83 return self
::$PAGE_DAILY;
86 if (startsWith($query, 'do='. self
::$PAGE_FEED_ATOM)) {
87 return self
::$PAGE_FEED_ATOM;
90 if (startsWith($query, 'do='. self
::$PAGE_FEED_RSS)) {
91 return self
::$PAGE_FEED_RSS;
94 // At this point, only loggedin pages.
96 return self
::$PAGE_LINKLIST;
99 if (startsWith($query, 'do='. self
::$PAGE_TOOLS)) {
100 return self
::$PAGE_TOOLS;
103 if (startsWith($query, 'do='. self
::$PAGE_CHANGEPASSWORD)) {
104 return self
::$PAGE_CHANGEPASSWORD;
107 if (startsWith($query, 'do='. self
::$PAGE_CONFIGURE)) {
108 return self
::$PAGE_CONFIGURE;
111 if (startsWith($query, 'do='. self
::$PAGE_CHANGETAG)) {
112 return self
::$PAGE_CHANGETAG;
115 if (startsWith($query, 'do='. self
::$PAGE_ADDLINK)) {
116 return self
::$PAGE_ADDLINK;
119 if (isset($get['edit_link']) || isset($get['post'])) {
120 return self
::$PAGE_EDITLINK;
123 if (startsWith($query, 'do='. self
::$PAGE_EXPORT)) {
124 return self
::$PAGE_EXPORT;
127 if (startsWith($query, 'do='. self
::$PAGE_IMPORT)) {
128 return self
::$PAGE_IMPORT;
131 if (startsWith($query, 'do='. self
::$PAGE_PLUGINSADMIN)) {
132 return self
::$PAGE_PLUGINSADMIN;
135 if (startsWith($query, 'do='. self
::$PAGE_SAVE_PLUGINSADMIN)) {
136 return self
::$PAGE_SAVE_PLUGINSADMIN;
139 return self
::$PAGE_LINKLIST;