Luxbum.net - Script de galerie photo

root/trunk/index.php

Revision 250, 3.5 kB (checked in by nicolas, 10 months ago)

meilleure gestion des vues

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 $GLOBALS['_PX_starttime'] = microtime(true);
3
4 if (!file_exists('conf/config.php')) {
5    exit('<a href="install.php">please install luxbum</a>');
6 }
7
8 include('common.php');
9 $_SESSION['manager'] = false;
10
11
12
13 Pluf::loadConfig('conf/config.php');
14 include (TEMPLATE_DIR.Pluf::f('template').'/conf_'.Pluf::f('template').'.php');
15
16
17 /**
18  *
19  * Classe de réponses aux actions des formulaires.
20  * L'action est lancée seulement si le formulaire est effectivement validé.
21  */
22 class lbPostAction {
23
24    /**
25     *
26     * @param Pluf_HTTP_Request $request
27     * @param Commentaire $comment
28     * @param CommonFile $file
29     * @return Commentaire
30     */
31    function comment($request, $comment, $file) {
32       if (count($request->POST) > 0 && isset($request->POST['action']) && $request->POST['action'] === 'ct') {
33          $comment->fillFromPost($request);
34
35          if ($comment->isValidForm()) {
36             $comment->fillInfos();
37             $file->saveComment($comment);
38             $comment = new Commentaire();
39          }
40       }
41       return $comment;
42    }
43
44    /**
45     *
46     * @param Pluf_HTTP_Request $request
47     * @param Commentaire $comment
48     * @param PassPost $$privatePost
49     * @return Commentaire
50     */
51    function login($request, $privatePost, $dir) {
52       if (count($request->POST) > 0 && isset($request->POST['action']) && $request->POST['action'] === 'private') {
53          $privatePost->fillFromPost();
54          $privateManager =& PrivateManager::getInstance();
55          if ($privateManager->unlockDir($dir, $privatePost)) {
56             return true;
57          }
58          return false;
59       }
60    }
61 }
62
63 // Index views
64 $dispatcher->registerController('ui_public_Index', 'index', '#^/$#i');
65 $dispatcher->registerController('ui_public_Index', 'folder', '#^/folder/(.*)/$#i');
66
67 // View files (image & flv)
68 $dispatcher->registerController('ui_public_FileDownload', 'image', '#^/image/(vignette|apercu|index|full)/(.+)/(.+)$#i');
69 $dispatcher->registerController('ui_public_FileDownload', 'flv', '#^/flvdl/(.+)/(.+\.flv)$#i');
70
71 // Selection
72 $dispatcher->registerController('ui_public_Selection', 'select', '#^/select/(.*)/(.*)$#i');
73 $dispatcher->registerController('ui_public_Selection', 'unselect', '#^/unselect/(.*)/(.*)$#i');
74 $dispatcher->registerController('ui_public_Selection', 'selectall', '#^/selectall/(.*)/$#i');
75 $dispatcher->registerController('ui_public_Selection', 'unselectall', '#^/unselectall/(.*)/$#i');
76 $dispatcher->registerController('ui_public_Selection', 'deleteSelection', '#^/deleteselection/$#i');
77 $dispatcher->registerController('ui_public_Selection', 'downloadSelection', '#^/downloadselection/$#i');
78 $dispatcher->registerController('ui_public_Gallery', 'selection', '#^/selectiong/(.*)/(.*)$#i');
79 $dispatcher->registerController('ui_public_Display', 'selection', '#^/selectiond/(.*)/(.*)$#i');
80
81 // Private views
82 $dispatcher->registerController('ui_public_Private', 'action', '#^/private/(.*)/$#i');
83
84 // Gallery views
85 $dispatcher->registerController('ui_public_Gallery', 'view', '#^/gallery/(.*)/(.*)$#i');
86
87 // File display view
88 $dispatcher->registerController('ui_public_Display', 'view', '#^/display/(.*)/(.*)$#i');
89
90 // Image meta informations views
91 $dispatcher->registerController('ui_public_InfosMeta', 'action', '#^/meta/(.*)/(.*)$#i');
92
93 // File comments
94 $dispatcher->registerController('ui_public_Commentaire', 'action', '#^/comments/(.*)/(.*)$#i');
95
96 // Image gallery slideshow
97 $dispatcher->registerController('ui_public_SlideShow', 'action', '#^/slide\-show/(.*)/(.*)$#i');
98
99
100 // Select the correct view and display it
101 $dispatcher->Launch($_SERVER['QUERY_STRING']);
102
103
104 ?>
Note: See TracBrowser for help on using the browser.