diff options
Diffstat (limited to 'index.php')
| -rw-r--r-- | index.php | 72 |
1 files changed, 53 insertions, 19 deletions
| @@ -40,7 +40,7 @@ if(isset($_SESSION['admin']) && $_SESSION['admin'] == 1 | |||
| 40 | require('controller/Security.php'); // sécurité des chaines | 40 | require('controller/Security.php'); // sécurité des chaines |
| 41 | require('model/Article.php'); | 41 | require('model/Article.php'); |
| 42 | 42 | ||
| 43 | if($_GET['page'] == 'discographie') | 43 | if($_GET['page'] === 'discographie' || $_GET['page'] === 'album') |
| 44 | { | 44 | { |
| 45 | require('model/Album.php'); | 45 | require('model/Album.php'); |
| 46 | } | 46 | } |
| @@ -174,31 +174,28 @@ if(isset($_GET['page'])) | |||
| 174 | $fonctionVisitor(); | 174 | $fonctionVisitor(); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | if($_GET['page'] == 'melaine') | 177 | //if($_GET['page'] === 'melaine'){} |
| 178 | {} | ||
| 179 | } | 178 | } |
| 180 | // page discographie (avec albums et articles) | 179 | // page discographie (avec albums et articles) |
| 181 | elseif($_GET['page'] == 'discographie') | 180 | elseif($_GET['page'] === 'discographie') |
| 182 | { | 181 | { |
| 183 | // rédaction | 182 | // nouvel album |
| 184 | if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'edition') | 183 | if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'edition') |
| 185 | { | 184 | { |
| 186 | // modification | 185 | if(!isset($_GET['file_code']) || empty($_GET['file_code'])) |
| 187 | if(isset($_GET['file_code']) || !empty($_GET['file_code'])) | ||
| 188 | { | ||
| 189 | discoEdit($_GET['file_code'], 0); | ||
| 190 | } | ||
| 191 | // nouvel article | ||
| 192 | else | ||
| 193 | { | 186 | { |
| 194 | // par sécurité | 187 | // par sécurité |
| 195 | unset($_GET['file_code']); | 188 | unset($_GET['file_code']); |
| 196 | 189 | ||
| 197 | discoEdit('', 0); | 190 | albumEdit('', 0); |
| 191 | } | ||
| 192 | else | ||
| 193 | { | ||
| 194 | discoVisitor(); | ||
| 198 | } | 195 | } |
| 199 | } | 196 | } |
| 200 | // modification d'un positions.json (version sans JS) | 197 | // modification d'un positions.json (version sans JS) |
| 201 | else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'monter') | 198 | elseif($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] === 'monter') |
| 202 | { | 199 | { |
| 203 | if(isset($_GET['file_code']) && !empty($_GET['file_code'])) | 200 | if(isset($_GET['file_code']) && !empty($_GET['file_code'])) |
| 204 | { | 201 | { |
| @@ -211,11 +208,11 @@ if(isset($_GET['page'])) | |||
| 211 | discoVisitor(); | 208 | discoVisitor(); |
| 212 | } | 209 | } |
| 213 | } | 210 | } |
| 214 | else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'descendre') | 211 | elseif($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] === 'descendre') |
| 215 | { | 212 | { |
| 216 | if(isset($_GET['file_code']) && !empty($_GET['file_code'])) | 213 | if(isset($_GET['file_code']) && !empty($_GET['file_code'])) |
| 217 | { | 214 | { |
| 218 | // 0 pour descendre | 215 | // -1 pour descendre |
| 219 | inversionPositions($_GET['page'], $_GET['file_code'], 'Album', -1); | 216 | inversionPositions($_GET['page'], $_GET['file_code'], 'Album', -1); |
| 220 | discoVisitor(); | 217 | discoVisitor(); |
| 221 | } | 218 | } |
| @@ -227,7 +224,14 @@ if(isset($_GET['page'])) | |||
| 227 | // suppression | 224 | // suppression |
| 228 | else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'suppression') | 225 | else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'suppression') |
| 229 | { | 226 | { |
| 230 | discoEdit($_GET['file_code'], 1); | 227 | if(isset($_GET['file_code']) && !empty($_GET['file_code'])) |
| 228 | { | ||
| 229 | albumEdit($_GET['file_code'], 1); | ||
| 230 | } | ||
| 231 | else | ||
| 232 | { | ||
| 233 | discoVisitor(); | ||
| 234 | } | ||
| 231 | } | 235 | } |
| 232 | else | 236 | else |
| 233 | { | 237 | { |
| @@ -235,10 +239,40 @@ if(isset($_GET['page'])) | |||
| 235 | } | 239 | } |
| 236 | } | 240 | } |
| 237 | // page d'un album de la discographie | 241 | // page d'un album de la discographie |
| 238 | // page visiteur uniquement | ||
| 239 | elseif($_GET['page'] == 'album') | 242 | elseif($_GET['page'] == 'album') |
| 240 | { | 243 | { |
| 241 | album($_GET['file_code']); | 244 | // page d'aucun album |
| 245 | if(!isset($_GET['file_code']) || $_GET['file_code'] == '') | ||
| 246 | { | ||
| 247 | header('Location: index.php?page=discographie'); | ||
| 248 | } | ||
| 249 | |||
| 250 | if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'edition') | ||
| 251 | { | ||
| 252 | // modification | ||
| 253 | if(isset($_GET['file_code']) || !empty($_GET['file_code'])) | ||
| 254 | { | ||
| 255 | albumEdit($_GET['file_code'], 0); | ||
| 256 | } | ||
| 257 | // suppression | ||
| 258 | else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'suppression') | ||
| 259 | { | ||
| 260 | albumEdit($_GET['file_code'], 1); | ||
| 261 | } | ||
| 262 | // on fait rien | ||
| 263 | else | ||
| 264 | { | ||
| 265 | // par sécurité | ||
| 266 | unset($_GET['file_code']); | ||
| 267 | |||
| 268 | //albumEdit('', 0); | ||
| 269 | discoVisitor(); | ||
| 270 | } | ||
| 271 | } | ||
| 272 | else | ||
| 273 | { | ||
| 274 | albumVisitor($_GET['file_code']); | ||
| 275 | } | ||
| 242 | } | 276 | } |
| 243 | // page connexion | 277 | // page connexion |
| 244 | elseif($_GET['page'] == 'connexion') | 278 | elseif($_GET['page'] == 'connexion') |
