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