]>
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_TOOLS = 'tools';
20 public static $PAGE_CHANGEPASSWORD = 'changepasswd';
22 public static $PAGE_CONFIGURE = 'configure';
24 public static $PAGE_CHANGETAG = 'changetag';
26 public static $PAGE_ADDLINK = 'addlink';
28 public static $PAGE_EDITLINK = 'edit_link';
30 public static $PAGE_EXPORT = 'export';
32 public static $PAGE_IMPORT = 'import';
34 public static $PAGE_OPENSEARCH = 'opensearch';
36 public static $PAGE_LINKLIST = 'linklist';
39 * Reproducing renderPage() if hell, to avoid regression.
41 * This highlights how bad this needs to be rewrite,
42 * but let's focus on plugins for now.
44 * @param string $query $_SERVER['QUERY_STRING'].
45 * @param array $get $_SERVER['GET'].
46 * @param bool $loggedIn true if authenticated user.
48 * @return self::page found.
50 public static function findPage($query, $get, $loggedIn)
52 $loggedIn = ($loggedIn === true) ? true : false;
54 if (empty($query) && !isset($get['edit_link']) && !isset($get['post'])) {
55 return self
::$PAGE_LINKLIST;
58 if (startswith($query, 'do='. self
::$PAGE_LOGIN) && $loggedIn === false) {
59 return self
::$PAGE_LOGIN;
62 if (startswith($query, 'do='. self
::$PAGE_PICWALL)) {
63 return self
::$PAGE_PICWALL;
66 if (startswith($query, 'do='. self
::$PAGE_TAGCLOUD)) {
67 return self
::$PAGE_TAGCLOUD;
70 if (startswith($query, 'do='. self
::$PAGE_OPENSEARCH)) {
71 return self
::$PAGE_OPENSEARCH;
74 if (startsWith($query, 'do='. self
::$PAGE_DAILY)) {
75 return self
::$PAGE_DAILY;
78 // At this point, only loggedin pages.
80 return self
::$PAGE_LINKLIST;
83 if (startswith($query, 'do='. self
::$PAGE_TOOLS)) {
84 return self
::$PAGE_TOOLS;
87 if (startswith($query, 'do='. self
::$PAGE_CHANGEPASSWORD)) {
88 return self
::$PAGE_CHANGEPASSWORD;
91 if (startswith($query, 'do='. self
::$PAGE_CONFIGURE)) {
92 return self
::$PAGE_CONFIGURE;
95 if (startswith($query, 'do='. self
::$PAGE_CHANGETAG)) {
96 return self
::$PAGE_CHANGETAG;
99 if (startswith($query, 'do='. self
::$PAGE_ADDLINK)) {
100 return self
::$PAGE_ADDLINK;
103 if (isset($get['edit_link']) || isset($get['post'])) {
104 return self
::$PAGE_EDITLINK;
107 if (startswith($query, 'do='. self
::$PAGE_EXPORT)) {
108 return self
::$PAGE_EXPORT;
111 if (startswith($query, 'do='. self
::$PAGE_IMPORT)) {
112 return self
::$PAGE_IMPORT;
115 return self
::$PAGE_LINKLIST;