Changeset 201
- Timestamp:
- 05/20/07 19:51:29 (2 years ago)
- Files:
-
- trunk/.htaccess.rewrite (modified) (1 diff)
- trunk/api/Pluf (added)
- trunk/api/Pluf/HTTP (added)
- trunk/api/Pluf/HTTP.php (copied) (copied from trunk/api/inc/HTTP.php) (1 diff)
- trunk/api/Pluf/HTTP/Error404.php (added)
- trunk/api/Pluf/HTTP/Error500.php (added)
- trunk/api/Pluf/HTTP/Request.php (added)
- trunk/api/Pluf/HTTP/Response (added)
- trunk/api/Pluf/HTTP/Response.php (added)
- trunk/api/Pluf/HTTP/Response/Forbidden.php (added)
- trunk/api/Pluf/HTTP/Response/NotFound.php (added)
- trunk/api/Pluf/HTTP/Response/Redirect.php (added)
- trunk/api/Pluf/HTTP/Response/RedirectToLogin.php (added)
- trunk/api/Pluf/HTTP/Response/ServerError.php (added)
- trunk/api/Pluf/HTTP/Response/ServerErrorDebug.php (added)
- trunk/api/Pluf/HTTP/URL.php (added)
- trunk/api/Pluf/Middleware (added)
- trunk/api/Pluf/Middleware/Debug.php (added)
- trunk/api/Pluf/Middleware/Maintenance.php (added)
- trunk/api/Pluf/Middleware/Session.php (added)
- trunk/api/Pluf/Middleware/Tidy.php (added)
- trunk/api/Pluf/Pluf.php (added)
- trunk/api/Pluf/Template (added)
- trunk/api/Pluf/Template.php (added)
- trunk/api/Pluf/Template/Compiler.php (added)
- trunk/api/Pluf/Template/Context.php (added)
- trunk/api/Pluf/Template/ContextVars.php (added)
- trunk/api/Pluf/Template/Tag (added)
- trunk/api/Pluf/Template/Tag.php (added)
- trunk/api/Pluf/Template/Tag/Cfg.php (added)
- trunk/api/Pluf/Template/Tag/Mytag.php (added)
- trunk/api/Pluf/Template/Tag/NavigationMenu.php (added)
- trunk/api/Pluf/Template/Tag/Style.php (added)
- trunk/api/Pluf/Template/Tag/Url.php (added)
- trunk/api/inc/HTTP.php (modified) (1 diff)
- trunk/api/inc/Recordset.php (moved) (moved from trunk/api/inc/recordset.php) (7 diffs)
- trunk/api/inc/SortableRecordset.php (moved) (moved from trunk/api/inc/sortablerecordset.php) (1 diff)
- trunk/api/inc/ZipFile.php (moved) (moved from trunk/api/inc/zip.php) (1 diff)
- trunk/api/inc/dispatcher.php (modified) (5 diffs)
- trunk/api/inc/files.php (modified) (3 diffs)
- trunk/api/inc/image.meta.php (modified) (4 diffs)
- trunk/api/inc/imagetoolkit.imagemagick.php (modified) (1 diff)
- trunk/api/inc/imagetoolkit.php (modified) (1 diff)
- trunk/api/inc/l10n.php (modified) (1 diff)
- trunk/api/inc/paginator.php (modified) (6 diffs)
- trunk/api/inc/verif.php (modified) (4 diffs)
- trunk/api/process/commentaire.php (modified) (4 diffs)
- trunk/api/process/commonfile.php (modified) (7 diffs)
- trunk/api/process/commongallery.php (modified) (3 diffs)
- trunk/api/process/luxbum.php (modified) (6 diffs)
- trunk/api/process/luxbumflv.php (modified) (2 diffs)
- trunk/api/process/luxbumgallery.php (modified) (7 diffs)
- trunk/api/process/luxbumimage.php (modified) (4 diffs)
- trunk/api/process/luxbumindex.php (modified) (3 diffs)
- trunk/api/process/luxbumselectiongallery.php (modified) (3 diffs)
- trunk/api/process/private.php (modified) (14 diffs)
- trunk/api/process/processFactory.php (deleted)
- trunk/api/process/selection.php (modified) (7 diffs)
- trunk/api/ui/backend (deleted)
- trunk/api/ui/frontend (deleted)
- trunk/api/ui/lib.backend.php (deleted)
- trunk/api/ui/lib.frontend.php (deleted)
- trunk/api/ui/link.php (modified) (14 diffs)
- trunk/api/ui/public (added)
- trunk/api/ui/public/Commentaire.php (added)
- trunk/api/ui/public/Display.php (added)
- trunk/api/ui/public/FileDownload.php (added)
- trunk/api/ui/public/Gallery.php (added)
- trunk/api/ui/public/Index.php (added)
- trunk/api/ui/public/InfosMeta.php (added)
- trunk/api/ui/public/Private.php (added)
- trunk/api/ui/public/Selection.php (added)
- trunk/api/ui/public/SlideShow.php (added)
- trunk/api/ui/views (deleted)
- trunk/api/ui/views.php (deleted)
- trunk/common.php (modified) (6 diffs)
- trunk/conf/config.dist.php (modified) (1 diff)
- trunk/index.php (modified) (2 diffs)
- trunk/locales/fr/luxbum.lang (modified) (1 diff)
- trunk/templates/public/luxbum/_filefooter.php (deleted)
- trunk/templates/public/luxbum/_fileheader.php (deleted)
- trunk/templates/public/luxbum/_footer.html (added)
- trunk/templates/public/luxbum/_footer.php (deleted)
- trunk/templates/public/luxbum/_header.html (added)
- trunk/templates/public/luxbum/_header.php (deleted)
- trunk/templates/public/luxbum/commentaire.html (added)
- trunk/templates/public/luxbum/commentaire.php (deleted)
- trunk/templates/public/luxbum/conf_luxbum.php (modified) (2 diffs)
- trunk/templates/public/luxbum/flv.php (deleted)
- trunk/templates/public/luxbum/gallery.html (added)
- trunk/templates/public/luxbum/index.html (added)
- trunk/templates/public/luxbum/index.php (deleted)
- trunk/templates/public/luxbum/meta.html (added)
- trunk/templates/public/luxbum/meta.php (deleted)
- trunk/templates/public/luxbum/private.html (added)
- trunk/templates/public/luxbum/private.php (deleted)
- trunk/templates/public/luxbum/slideshow.html (added)
- trunk/templates/public/luxbum/slideshow.php (deleted)
- trunk/templates/public/luxbum/themes/dark/dark.css (modified) (4 diffs)
- trunk/templates/public/luxbum/themes/dark/images/next.png (moved) (moved from trunk/templates/public/luxbum/themes/dark/images/forward.png)
- trunk/templates/public/luxbum/themes/dark/images/previous.png (moved) (moved from trunk/templates/public/luxbum/themes/dark/images/back.png)
- trunk/templates/public/luxbum/themes/light/images/next.png (moved) (moved from trunk/templates/public/luxbum/themes/light/images/forward.png)
- trunk/templates/public/luxbum/themes/light/images/previous.png (moved) (moved from trunk/templates/public/luxbum/themes/light/images/back.png)
- trunk/templates/public/luxbum/themes/light/light.css (modified) (4 diffs)
- trunk/templates/public/luxbum/themes/light2/images/next.png (moved) (moved from trunk/templates/public/luxbum/themes/light2/images/forward.png)
- trunk/templates/public/luxbum/themes/light2/images/previous.png (moved) (moved from trunk/templates/public/luxbum/themes/light2/images/back.png)
- trunk/templates/public/luxbum/themes/light2/light2.css (modified) (2 diffs)
- trunk/templates/public/luxbum/themes/linux62/images/next.png (moved) (moved from trunk/templates/public/luxbum/themes/linux62/images/forward.png)
- trunk/templates/public/luxbum/themes/linux62/images/previous.png (moved) (moved from trunk/templates/public/luxbum/themes/linux62/images/back.png)
- trunk/templates/public/luxbum/vignette.php (deleted)
- trunk/templates/public/photoblog/_footer.html (added)
- trunk/templates/public/photoblog/_header.html (added)
- trunk/templates/public/photoblog/affichage.php (deleted)
- trunk/templates/public/photoblog/conf_photoblog.php (modified) (1 diff)
- trunk/templates/public/photoblog/display.html (added)
- trunk/templates/public/photoblog/footer.php (deleted)
- trunk/templates/public/photoblog/gallery.html (added)
- trunk/templates/public/photoblog/header.php (deleted)
- trunk/templates/public/photoblog/index.html (added)
- trunk/templates/public/photoblog/index.php (deleted)
- trunk/templates/public/photoblog/private.html (added)
- trunk/templates/public/photoblog/themes/blue/blue.css (modified) (5 diffs)
- trunk/templates/public/photoblog/vignette.php (deleted)
- trunk/tmp (added)
- trunk/tmp/.htaccess (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/.htaccess.rewrite
r189 r201 1 1 RewriteEngine on 2 2 3 RewriteRule ^( image|album|folder|meta|photo|comments|slide\-show|private|file)/(.*)$ /index.php?/$1/$23 RewriteRule ^(flv|flvdl|image|album|folder|meta|photo|comments|slide\-show|private)/(.*)$ /index.php?/$1/$2 4 4 5 RewriteRule ^(select|unselect|selectiong|deleteselection|downloadselection)/(.*)$ /index.php?/$1/$2 5 6 6 7 RewriteRule ^(.*)/_javascript/(.*)$ /_javascript/$2 [L] 7 8 RewriteRule ^(.*)/templates/(.*)$ /templates/$2 [L] 8 9 10 trunk/api/Pluf/HTTP.php
r194 r201 56 56 } 57 57 } 58 59 58 60 } 59 61 trunk/api/inc/HTTP.php
r194 r201 1 1 <?php 2 /* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */3 /*4 # ***** BEGIN LICENSE BLOCK *****5 # This file is part of Plume Framework, a simple PHP Application Framework.6 # Copyright (C) 2001-2006 Loic d'Anterroches and contributors.7 #8 # Plume Framework is free software; you can redistribute it and/or modify9 # it under the terms of the GNU Lesser General Public License as published by10 # the Free Software Foundation; either version 2.1 of the License, or11 # (at your option) any later version.12 #13 # Plume Framework is distributed in the hope that it will be useful,14 # but WITHOUT ANY WARRANTY; without even the implied warranty of15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 # GNU Lesser General Public License for more details.17 #18 # You should have received a copy of the GNU Lesser General Public License19 # along with this program; if not, write to the Free Software20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA21 #22 # ***** END LICENSE BLOCK ***** */23 2 24 3 /** 25 * Base HTTP tools.4 * 26 5 */ 27 class Pluf_HTTP 28 { 29 30 /** 31 * Break magic_quotes 32 * 33 * @credit Olivier Meunier 34 */ 35 function removeTheMagic() 36 { 37 if (get_magic_quotes_gpc()) { 38 if (!empty($_GET)) { 39 array_walk($_GET, 'Pluf_HTTP_magicStrip'); 40 } 41 if (!empty($_POST)) { 42 array_walk($_POST, 'Pluf_HTTP_magicStrip'); 43 } 44 if (!empty($_REQUEST)) { 45 array_walk($_REQUEST, 'Pluf_HTTP_magicStrip'); 46 } 47 if (!empty($_COOKIE)) { 48 array_walk($_COOKIE, 'Pluf_HTTP_magicStrip'); 49 } 50 } 51 if (function_exists('ini_set')) { 52 @ini_set('session.use_cookies', '1'); 53 @ini_set('session.use_only_cookies', '1'); 54 @ini_set('session.use_trans_sid', '0'); 55 @ini_set('url_rewriter.tags', ''); 56 } 57 } 58 } 59 60 61 /** 62 * Break magic_quotes 63 * 64 * @credit Olivier Meunier 65 */ 66 function Pluf_HTTP_magicStrip(&$k, $key) 67 { 68 $k = Pluf_HTTP_handleMagicQuotes($k); 69 } 70 71 /** 72 * Break magic_quotes 73 * 74 * @credit Olivier Meunier 75 */ 76 function Pluf_HTTP_handleMagicQuotes(&$value) 77 { 78 if (is_array($value)) { 79 $result = array(); 80 foreach ($value as $k => $v) { 81 if (is_array($v)) { 82 $result[$k] = Pluf_HTTP_handleMagicQuotes($v); 83 } else { 84 $result[$k] = stripslashes($v); 85 } 86 } 87 return $result; 88 } else { 89 return stripslashes($value); 90 } 6 abstract class HTTP { 7 /** 8 * Return a date and time string that is conformant to RFC 2616 9 * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3 10 * 11 * @param int $time the unix timestamp of the date we want to return, 12 * empty if we want the current time 13 * @return string a date-string conformant to the RFC 2616 14 */ 15 static function getHttpDate($time='') { 16 if ($time == '') { 17 $time = time(); 18 } 19 /* Use fixed list of weekdays and months, so we don't have to fiddle with locale stuff */ 20 $months = array('01' => 'Jan', '02' => 'Feb', '03' => 'Mar', 21 '04' => 'Apr', '05' => 'May', '06' => 'Jun', 22 '07' => 'Jul', '08' => 'Aug', '09' => 'Sep', 23 '10' => 'Oct', '11' => 'Nov', '12' => 'Dec'); 24 $weekdays = array('1' => 'Mon', '2' => 'Tue', '3' => 'Wed', 25 '4' => 'Thu', '5' => 'Fri', '6' => 'Sat', 26 '0' => 'Sun'); 27 $dow = $weekdays[gmstrftime('%w', $time)]; 28 $month = $months[gmstrftime('%m', $time)]; 29 $out = gmstrftime('%%s, %d %%s %Y %H:%M:%S GMT', $time); 30 return sprintf($out, $dow, $month); 31 } 91 32 } 92 33 trunk/api/inc/Recordset.php
r179 r201 12 12 # 13 13 # Contributor(s): 14 # Lo ïc d'Anterroches14 # Loïc d'Anterroches 15 15 */ 16 16 … … 18 18 * @package inc 19 19 */ 20 class Recordset220 class inc_Recordset implements Iterator 21 21 { 22 22 var $arrayField = array(); … … 24 24 var $arrayList = array(); // tableau contenant la liste 25 25 var $intIndex; //index pour parcourir les enregistrements 26 var$intRowCount=0; // nombre d'enregistrements26 private $intRowCount=0; // nombre d'enregistrements 27 27 var $endOfPage=-1; 28 28 var $startOfPage=-1; … … 30 30 31 31 32 function recordset2() {32 function inc_Recordset() { 33 33 $this->intIndex = 0; 34 34 } … … 77 77 /** 78 78 * Get the current row of data. 79 * @return CommonFile 79 80 */ 80 81 function f() { 81 if (/*!$this->EOP() && */!$this->BOF() && !$this->EOF()) {82 //if (/*!$this->EOP() && */!$this->BOF() && !$this->EOF()) { 82 83 return $this->arrayList[$this->intIndex]; 83 }84 return false;84 //} 85 //return false; 85 86 } 86 87 … … 97 98 function moveStart() { 98 99 $this->intIndex = 0; 100 return true; 101 } 102 103 function moveStartPage() { 104 if ($this->startOfPage == -1) { 105 $this->intIndex = 0; 106 } 107 else { 108 $this->intIndex = $this->startOfPage; 109 } 99 110 return true; 100 111 } … … 163 174 reset ($this->arrayList); 164 175 } 176 177 178 function current () { 179 return $this->f(); 180 } 181 function key () { 182 return $this->intIndex; 183 } 184 function next () { 185 $this->intIndex++; 186 //$this->moveNext(); 187 return $this->f(); 188 } 189 function rewind () { 190 $this->moveStartPage(); 191 } 192 function valid () { 193 return !($this->intIndex == $this->intRowCount || $this->intIndex == $this->endOfPage);//$this->EOP(); 194 } 165 195 } 166 196 trunk/api/inc/SortableRecordset.php
r191 r201 4 4 * @package inc 5 5 */ 6 class SortableRecordset extends Recordset2{6 class inc_SortableRecordset extends inc_Recordset { 7 7 8 8 var $sortList = array(); trunk/api/inc/ZipFile.php
r130 r201 25 25 * @access public 26 26 */ 27 class zipfile27 class inc_ZipFile 28 28 { 29 29 /** trunk/api/inc/dispatcher.php
r194 r201 41 41 */ 42 42 function Launch($query='') { 43 $query = rawurldecode($query); 43 44 $query = preg_replace('#^(/)+#', '/', '/'.$query);//echo $query; 44 45 $this->loadBuiltinControllers(); 45 46 $this->loadControllers(); 46 $this->match($query); 47 //$this->match($query); 48 49 $query = preg_replace('#^(/)+#', '/', '/'.$query); 50 $req = new Pluf_HTTP_Request($query); 51 $middleware = array(); 52 foreach (Pluf::f('middleware_classes', array()) as $mw) { 53 $middleware[] = new $mw(); 54 } 55 $skip = false; 56 foreach ($middleware as $mw) { 57 if (method_exists($mw, 'process_request')) { 58 $res = $mw->process_request($req); 59 if ($res !== false) { 60 // $res is a response 61 $res->render(); 62 $skip = true; 63 break; 64 } 65 } 66 } 67 if ($skip === false) { 68 $response = Dispatcher::match($req); 69 foreach ($middleware as $mw) { 70 if (method_exists($mw, 'process_response')) { 71 $response = $mw->process_response($req, $response); 72 } 73 } 74 $response->render(); 75 } 47 76 } 48 77 … … 53 82 * @param string Query string 54 83 */ 55 function match($query) { 56 $query = rawurldecode($query); 84 function match($req) { 57 85 58 86 // Order the controllers by priority … … 63 91 64 92 $res = 200; 65 foreach ($GLOBALS['_PX_control'] as $key => $control) { 66 //echo $control['regex'].'<br>'; 67 if (preg_match($control['regex'], $query, $match)) { 68 if ($res == 404 and $control['priority'] < 8) { 69 continue; 93 foreach ($GLOBALS['_PX_control'] as $key => $ctl) { 94 $match = array(); 95 if (preg_match($ctl['regex'], $req->query, $match)) { 96 try { 97 $m = new $ctl['plugin'](); 98 if (!isset($ctl['params'])) { 99 return $m->$ctl['method']($req, $match); 100 } 101 else { 102 return $m->$ctl['method']($req, $match, $ctl['params']); 103 } 70 104 } 71 72 //$res = call_user_func(array($control['plugin'], 'action'), 73 // $match); 74 $obj = new $control['plugin']; 75 $res = $obj->action($match); 76 if ($res != 301 and $res != 404) { 77 showDebugInfo(); 78 return; 105 catch (Pluf_HTTP_Error404 $e) { 106 return new Pluf_HTTP_Response_NotFound(""); 79 107 } 80 if ($res == 301 and !empty($GLOBALS['_PX_redirect'])) { 81 header('Location: '.$GLOBALS['_PX_redirect']); 82 return; 108 catch (Exception $e) { 109 if ($GLOBALS['debug'] == true) { 110 return new Pluf_HTTP_Response_ServerErrorDebug($e); 111 } 112 else { 113 return new Pluf_HTTP_Response_ServerError($e->getMessage()); 114 } 83 115 } 84 116 } 85 117 } 118 return new Pluf_HTTP_Response_NotFound("No Matching view"); 86 119 } 87 120 … … 108 141 if ($entry != '.' && $entry != '..' 109 142 && is_dir($this->pluginPath.$entry) 110 && file_exists($this->pluginPath.$entry.'/register.php')) {143 && file_exists($this->pluginPath.$entry.'/register.php')) { 111 144 include_once($this->pluginPath.$entry.'/register.php'); 112 145 } … … 133 166 * @return void 134 167 */ 135 function registerController($plugin, $ regex, $priority=5) {168 function registerController($plugin, $method, $regex, $priority=5) { 136 169 if (!isset($GLOBALS['_PX_control'])) { 137 170 $GLOBALS['_PX_control'] = array(); 138 171 } 139 172 $GLOBALS['_PX_control'][] = array('plugin' => $plugin, 140 'regex' => $regex, 141 'priority' => $priority); 173 'method' => $method, 174 'regex' => $regex, 175 'priority' => $priority); 142 176 } 143 144 177 } 145 178 trunk/api/inc/files.php
r195 r201 10 10 */ 11 11 function addTailSlash ($dir) { 12 if (strlen($dir) > 1 && $dir[strlen ($dir) - 1] != '/') { 12 $size = strlen($dir); 13 if ($size > 1 && $dir[$size - 1] != '/') { 13 14 $dir = $dir.'/'; 14 15 } … … 20 21 */ 21 22 function removeTailSlash ($dir) { 22 if (strlen ($dir) == 0) { 23 $size = strlen($dir); 24 if ($size == 0) { 23 25 return $dir; 24 26 } 25 if ($dir[ strlen ($dir)- 1] == '/') {26 $dir = substr ($dir, 0, strlen ($dir)- 1);27 if ($dir[$size - 1] == '/') { 28 $dir = substr ($dir, 0, $size - 1); 27 29 } 28 30 return $dir; … … 180 182 function getExtension($f) { 181 183 $f = explode('.',basename($f)); 182 183 if (count($f) <= 1) { 184 $c = count($f); 185 186 if ($c <= 1) { 184 187 return ''; 185 188 } 186 189 187 return strtolower($f[ count($f)-1]);190 return strtolower($f[$c - 1]); 188 191 } 189 192 trunk/api/inc/image.meta.php
r150 r201 27 27 * @package inc 28 28 */ 29 class ImageMeta extends Recordset229 class ImageMeta extends inc_Recordset 30 30 { 31 31 var $meta = array(); … … 36 36 37 37 function ImageMeta($f) { 38 parent:: Recordset2();38 parent::inc_Recordset(); 39 39 $this->loadFile($f); 40 40 } … … 176 176 } 177 177 178 $d = @exif_read_data($f, 'ANY_TAG');178 $d = @exif_read_data($f, EXIF|COMMENT); 179 179 180 180 if (!is_array($d)) { … … 368 368 $this->value = $value; 369 369 } 370 371 function getName() { 372 return $this->name; 373 } 374 375 function getValue() { 376 return $this->value; 377 } 370 378 } 371 379 trunk/api/inc/imagetoolkit.imagemagick.php
r200 r201 36 36 // Other methods 37 37 else { 38 $cmd = 'convert -quality 80-treedepth 5 -resize %dx%d -geometry %dx%d %s %s';38 $cmd = 'convert -quality 65 -treedepth 5 -resize %dx%d -geometry %dx%d %s %s'; 39 39 $cmd = sprintf($cmd, 40 40 $this->imageDestWidth, $this->imageDestHeight, trunk/api/inc/imagetoolkit.php
r189 r201 23 23 var $imageDestWidth; 24 24 var $imageDestHeight; 25 25 var $mode; 26 27 static function factory($imagePath, $imageDriver='') { 28 if ($imageDriver === '') { 29 $imageDriver = Pluf::f('image_generation_driver'); 30 } 31 switch($imageDriver) { 32 case 'gd': 33 return new ImageToolkitGD($imagePath); 34 break; 35 36 case 'imagemagick': 37 return new ImageToolkitImageMagick($imagePath); 38 break; 39 40 case 'imagick': 41 break; 42 } 43 } 44 26 45 /** 27 46 * Constructeur par dᅵfaut trunk/api/inc/l10n.php
r130 r201 36 36 return $GLOBALS['_PX_locale'][$t]; 37 37 } 38 elseif ( $GLOBALS['debug']=== true) {38 elseif (Pluf::f('debug') === true) { 39 39 $GLOBALS['_PX_debug_data']['untranslated'][$t] = $t; 40 40 } trunk/api/inc/paginator.php
r133 r201 1 1 <?php 2 3 class Page { 4 private $text; 5 private $imageName; 6 private $page; 7 8 /** 9 * @param string $text 10 * @param string $imageName 11 * @param int $page 12 */ 13 function __construct($text, $imageName, $page) { 14 $this->text = $text; 15 $this->imageName = $imageName; 16 $this->page = $page; 17 } 18 19 function getText() { 20 return $this->text; 21 } 22 23 function getImageName() { 24 return $this->imageName; 25 } 26 27 function getPage() { 28 return $this->page; 29 } 30 } 2 31 3 32 /** 4 33 * @package inc 5 34 */ 6 class Paginator extends Recordset2 { 35 class Paginator extends inc_Recordset { 36 var $res; 7 37 var $currentPage; 8 38 var $countPages; … … 10 40 var $totalPages; 11 41 12 function Paginator($currentPage, $countPages, $elementsByPage = 7, $nb_bouton_page = 3) { 13 parent::Recordset2(); 42 function Paginator($res, $currentPage, $countPages, $elementsByPage = 7, $nb_bouton_page = 3) { 43 parent::inc_Recordset(); 44 $this->res = $res; 14 45 $this->currentPage = $currentPage; 15 46 $this->countPages = $countPages; … … 53 84 if ($first_button > 0) { 54 85 $mini = true; 55 $this->addToList( array('<<', $this->getPictureNumber(0), 0));56 $this->addToList( array('<', $this->getPictureNumber($this->currentPage-2), 0));86 $this->addToList(new Page('<<', $this->getPictureNumber(0), 0)); 87 $this->addToList(new Page('<', $this->getPictureNumber($this->currentPage-2), 0)); 57 88 } 58 89 … … 60 91 for ($j=$first_button; $j < $last_button; $j++) { 61 92 $mini = true; 62 $this->addToList( array($j+1, $this->getPictureNumber($j), $j+1));93 $this->addToList(new Page($j+1, $this->getPictureNumber($j), $j+1)); 63 94 } 64 95 … … 66 97 if ( $last_button < $nb_sql ) { 67 98 $mini = true; 68 $this->addToList( array('>', $this->getPictureNumber($j), 0));69 $this->addToList( array('>>', $this->getPictureNumber($nb_sql-1), 0));99 $this->addToList(new Page('>', $this->getPictureNumber($j), 0)); 100 $this->addToList(new Page('>>', $this->getPictureNumber($nb_sql-1), 0)); 70 101 } 71 102 } … … 87 118 return ($this->currentPage * $this->elementsByPage) - (2 * $this->elementsByPage); 88 119 } 120 121 function getLinkVignette($return = false) { 122 $this->res->move($this->f()->getImageName()); 123 124 $file = $this->res->f(); 125 return link::gallery($file->getDir(), $file->getFile()); 126 } 89 127 128 129 function isFirst() { 130 return $this->getCurrentPage() == 1; 131 } 132 133 /** 134 * 135 */ 136 function isLast() { 137 return $this->getCurrentPage() == $this->getTotalPages(); 138 } 139 140 /** 141 * @return string the link url to consult the previous page in a gallery page 142 */ 143 public function getLinkPreviousPageGallery() { 144 if ($this->isFirst()) { 145 return ''; 146 } 147 $this->res->move($this->prevPage()); 148 $file = $this->res->f(); 149 return link::gallery($file->getDir(), $file->getFile()); 150 } 151 152 /** 153 * @return string the link url to consult the next page in a gallery page 154 */ 155 public function getLinkNextPageGallery() { 156 if ($this->isLast()) { 157 return ''; 158 } 159 $this->res->move($this->nextPage()); 160 $file = $this->res->f(); 161 return link::gallery($file->getDir(), $file->getFile()); 162 } 163 90 164 } 91 165 ?> trunk/api/inc/verif.php
r130 r201 7 7 8 8 /** 9 * V érifie si le format du nom du dossier est correct9 * Vᅵrifie si le format du nom du dossier est correct 10 10 * @param String dir Dossier de l'image 11 11 */ … … 18 18 19 19 /** 20 * V érifie si l'image existe20 * Vᅵrifie si l'image existe 21 21 * @param String dir Dossier de l'image 22 22 * @param String $img Nom de l'image 23 23 */ 24 24 function photo ($dir, $img) { 25 if (!is_file (luxbum::getImage($dir, $img))) {25 if (!is_file(luxbum::getImage($dir, $img))) { 26 26 return false; 27 27 } … … 30 30 31 31 /** 32 * V érifie si le dossier est correct32 * Vᅵrifie si le dossier est correct 33 33 */ 34 34 function isDir ($dir) { … … 42 42 43 43 /** 44 * V érifie si un couple dossier/image est correct.44 * Vᅵrifie si un couple dossier/image est correct. 45 45 * Exit si erreur ! 46 46 * @param String dir Dossier de l'image trunk/api/process/commentaire.php
r164 r201 25 25 /** 26 26 * 27 * @param Pluf_HTTP_Request $request 27 28 */ 28 function fillFromPost ( ) {29 function fillFromPost ($request) { 29 30 // Auteur, obligatoire 30 if (isset ($ _POST['author']) && $_POST['author'] != '') {31 $this->setAuthor (protege_input ($ _POST['author']));31 if (isset ($request->POST['author']) && $request->POST['author'] != '') { 32 $this->setAuthor (protege_input ($request->POST['author'])); 32 33 } 33 34 else { … … 36 37 37 38 // Contenu, obligatoire 38 if (isset ($ _POST['content']) && trim ($_POST['content']) != '') {39 $this->setContent (protege_input ($ _POST['content']));39 if (isset ($request->POST['content']) && trim ($request->POST['content']) != '') { 40 $this->setContent (protege_input ($request->POST['content'])); 40 41 } 41 42 else { … … 44 45 45 46 // Site 46 if (isset ($ _POST['website']) && $_POST['website'] != '') {47 $this->setWebsite (protege_input ($ _POST['website']));47 if (isset ($request->POST['website']) && $request->POST['website'] != '') { 48 $this->setWebsite (protege_input ($request->POST['website'])); 48 49
