aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Router.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/Router.php')
-rw-r--r--application/Router.php55
1 files changed, 37 insertions, 18 deletions
diff --git a/application/Router.php b/application/Router.php
index 4df0387c..05877acd 100644
--- a/application/Router.php
+++ b/application/Router.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2namespace Shaarli;
2 3
3/** 4/**
4 * Class Router 5 * Class Router
@@ -7,6 +8,8 @@
7 */ 8 */
8class Router 9class Router
9{ 10{
11 public static $AJAX_THUMB_UPDATE = 'ajax_thumb_update';
12
10 public static $PAGE_LOGIN = 'login'; 13 public static $PAGE_LOGIN = 'login';
11 14
12 public static $PAGE_PICWALL = 'picwall'; 15 public static $PAGE_PICWALL = 'picwall';
@@ -35,6 +38,8 @@ class Router
35 38
36 public static $PAGE_DELETELINK = 'delete_link'; 39 public static $PAGE_DELETELINK = 'delete_link';
37 40
41 public static $PAGE_PINLINK = 'pin';
42
38 public static $PAGE_EXPORT = 'export'; 43 public static $PAGE_EXPORT = 'export';
39 44
40 public static $PAGE_IMPORT = 'import'; 45 public static $PAGE_IMPORT = 'import';
@@ -47,6 +52,8 @@ class Router
47 52
48 public static $PAGE_SAVE_PLUGINSADMIN = 'save_pluginadmin'; 53 public static $PAGE_SAVE_PLUGINSADMIN = 'save_pluginadmin';
49 54
55 public static $PAGE_THUMBS_UPDATE = 'thumbs_update';
56
50 public static $GET_TOKEN = 'token'; 57 public static $GET_TOKEN = 'token';
51 58
52 /** 59 /**
@@ -69,60 +76,68 @@ class Router
69 return self::$PAGE_LINKLIST; 76 return self::$PAGE_LINKLIST;
70 } 77 }
71 78
72 if (startsWith($query, 'do='. self::$PAGE_LOGIN) && $loggedIn === false) { 79 if (startsWith($query, 'do=' . self::$PAGE_LOGIN) && $loggedIn === false) {
73 return self::$PAGE_LOGIN; 80 return self::$PAGE_LOGIN;
74 } 81 }
75 82
76 if (startsWith($query, 'do='. self::$PAGE_PICWALL)) { 83 if (startsWith($query, 'do=' . self::$PAGE_PICWALL)) {
77 return self::$PAGE_PICWALL; 84 return self::$PAGE_PICWALL;
78 } 85 }
79 86
80 if (startsWith($query, 'do='. self::$PAGE_TAGCLOUD)) { 87 if (startsWith($query, 'do=' . self::$PAGE_TAGCLOUD)) {
81 return self::$PAGE_TAGCLOUD; 88 return self::$PAGE_TAGCLOUD;
82 } 89 }
83 90
84 if (startsWith($query, 'do='. self::$PAGE_TAGLIST)) { 91 if (startsWith($query, 'do=' . self::$PAGE_TAGLIST)) {
85 return self::$PAGE_TAGLIST; 92 return self::$PAGE_TAGLIST;
86 } 93 }
87 94
88 if (startsWith($query, 'do='. self::$PAGE_OPENSEARCH)) { 95 if (startsWith($query, 'do=' . self::$PAGE_OPENSEARCH)) {
89 return self::$PAGE_OPENSEARCH; 96 return self::$PAGE_OPENSEARCH;
90 } 97 }
91 98
92 if (startsWith($query, 'do='. self::$PAGE_DAILY)) { 99 if (startsWith($query, 'do=' . self::$PAGE_DAILY)) {
93 return self::$PAGE_DAILY; 100 return self::$PAGE_DAILY;
94 } 101 }
95 102
96 if (startsWith($query, 'do='. self::$PAGE_FEED_ATOM)) { 103 if (startsWith($query, 'do=' . self::$PAGE_FEED_ATOM)) {
97 return self::$PAGE_FEED_ATOM; 104 return self::$PAGE_FEED_ATOM;
98 } 105 }
99 106
100 if (startsWith($query, 'do='. self::$PAGE_FEED_RSS)) { 107 if (startsWith($query, 'do=' . self::$PAGE_FEED_RSS)) {
101 return self::$PAGE_FEED_RSS; 108 return self::$PAGE_FEED_RSS;
102 } 109 }
103 110
111 if (startsWith($query, 'do=' . self::$PAGE_THUMBS_UPDATE)) {
112 return self::$PAGE_THUMBS_UPDATE;
113 }
114
115 if (startsWith($query, 'do=' . self::$AJAX_THUMB_UPDATE)) {
116 return self::$AJAX_THUMB_UPDATE;
117 }
118
104 // At this point, only loggedin pages. 119 // At this point, only loggedin pages.
105 if (!$loggedIn) { 120 if (!$loggedIn) {
106 return self::$PAGE_LINKLIST; 121 return self::$PAGE_LINKLIST;
107 } 122 }
108 123
109 if (startsWith($query, 'do='. self::$PAGE_TOOLS)) { 124 if (startsWith($query, 'do=' . self::$PAGE_TOOLS)) {
110 return self::$PAGE_TOOLS; 125 return self::$PAGE_TOOLS;
111 } 126 }
112 127
113 if (startsWith($query, 'do='. self::$PAGE_CHANGEPASSWORD)) { 128 if (startsWith($query, 'do=' . self::$PAGE_CHANGEPASSWORD)) {
114 return self::$PAGE_CHANGEPASSWORD; 129 return self::$PAGE_CHANGEPASSWORD;
115 } 130 }
116 131
117 if (startsWith($query, 'do='. self::$PAGE_CONFIGURE)) { 132 if (startsWith($query, 'do=' . self::$PAGE_CONFIGURE)) {
118 return self::$PAGE_CONFIGURE; 133 return self::$PAGE_CONFIGURE;
119 } 134 }
120 135
121 if (startsWith($query, 'do='. self::$PAGE_CHANGETAG)) { 136 if (startsWith($query, 'do=' . self::$PAGE_CHANGETAG)) {
122 return self::$PAGE_CHANGETAG; 137 return self::$PAGE_CHANGETAG;
123 } 138 }
124 139
125 if (startsWith($query, 'do='. self::$PAGE_ADDLINK)) { 140 if (startsWith($query, 'do=' . self::$PAGE_ADDLINK)) {
126 return self::$PAGE_ADDLINK; 141 return self::$PAGE_ADDLINK;
127 } 142 }
128 143
@@ -134,23 +149,27 @@ class Router
134 return self::$PAGE_DELETELINK; 149 return self::$PAGE_DELETELINK;
135 } 150 }
136 151
137 if (startsWith($query, 'do='. self::$PAGE_EXPORT)) { 152 if (startsWith($query, 'do=' . self::$PAGE_PINLINK)) {
153 return self::$PAGE_PINLINK;
154 }
155
156 if (startsWith($query, 'do=' . self::$PAGE_EXPORT)) {
138 return self::$PAGE_EXPORT; 157 return self::$PAGE_EXPORT;
139 } 158 }
140 159
141 if (startsWith($query, 'do='. self::$PAGE_IMPORT)) { 160 if (startsWith($query, 'do=' . self::$PAGE_IMPORT)) {
142 return self::$PAGE_IMPORT; 161 return self::$PAGE_IMPORT;
143 } 162 }
144 163
145 if (startsWith($query, 'do='. self::$PAGE_PLUGINSADMIN)) { 164 if (startsWith($query, 'do=' . self::$PAGE_PLUGINSADMIN)) {
146 return self::$PAGE_PLUGINSADMIN; 165 return self::$PAGE_PLUGINSADMIN;
147 } 166 }
148 167
149 if (startsWith($query, 'do='. self::$PAGE_SAVE_PLUGINSADMIN)) { 168 if (startsWith($query, 'do=' . self::$PAGE_SAVE_PLUGINSADMIN)) {
150 return self::$PAGE_SAVE_PLUGINSADMIN; 169 return self::$PAGE_SAVE_PLUGINSADMIN;
151 } 170 }
152 171
153 if (startsWith($query, 'do='. self::$GET_TOKEN)) { 172 if (startsWith($query, 'do=' . self::$GET_TOKEN)) {
154 return self::$GET_TOKEN; 173 return self::$GET_TOKEN;
155 } 174 }
156 175