Dotclear

Changeset 240


Ignore:
Timestamp:
09/26/08 08:50:55 (15 years ago)
Author:
bruno
Message:

Reverted back to 0.2.16, for stability purpose (and also for daInstaller...) ;)

Location:
plugins/gallery
Files:
5 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • plugins/gallery/CHANGELOG

    r237 r240  
    1 Gallery 0.3 
    2 * Added new gallery themes (imported from DS Gallery) 
    3 * New urlhandlers for static gallery files 
    4 * Gallery themes can be externalized through gallery_themes_path option 
    5  
    61 
    72Gallery 0.2.16 
  • plugins/gallery/_define.php

    r237 r240  
    1515     /* Description*/         "Image Gallery for Dotclear2", 
    1616     /* Author */             "Bruno Hondelatte", 
    17      /* Version */            'SVN', 
     17     /* Version */            '0.2.16', 
    1818     /* Permissions */        'usage,contentadmin' 
    1919); 
  • plugins/gallery/_prepend.php

    r237 r240  
    2727     $core->url->register('galitem',$core->blog->settings->gallery_image_url_prefix,'^' 
    2828          .$core->blog->settings->gallery_image_url_prefix.'/(.+)$',array('urlGallery','image')); 
    29      $core->url->register('galtheme','gallerytheme','^gallerytheme/(.+/.+)$',array('urlGalleryProxy','galtheme')); 
    3029     /* RNot yes implemented 
    3130     $core->url->register('images','images','^images/(.+)$',array('urlGallery','images')); 
  • plugins/gallery/_public.php

    r237 r240  
    3636$core->tpl->addBlock('GalleryItemGallery',array('tplGallery','GalleryItemGallery')); 
    3737$core->tpl->addValue('GalleryItemFeedURL',array('tplGallery','GalleryItemFeedURL')); 
    38 $core->tpl->addValue('GalleryItemMeta',array('tplGallery','GalleryItemMeta')); 
    3938 
    4039 
     
    4746$core->addBehavior('publicBeforeDocument',array('behaviorsGallery','addTplPath')); 
    4847 
    49  
    50  
    5148// Later on, some rest features :) 
    5249if (!empty($core->pubrest)) 
     
    5754  public static function addTplPath(&$core) 
    5855  { 
    59     $core->tpl->setPath($core->tpl->getPath(),path::fullFromRoot($core->blog->settings->gallery_themes_path,DC_ROOT)); 
     56    $core->tpl->setPath($core->tpl->getPath(),dirname(__FILE__).'/default-templates'); 
    6057  } 
    6158 
     
    6966          global $core; 
    7067          $f = $GLOBALS['core']->tpl->getFilters($attr); 
    71           $css_relname = $core->blog->settings->gallery_default_theme.'/gallery.css'; 
    72           if (file_exists(path::real($core->blog->settings->themes_path.'/'.$core->blog->settings->theme).'/tpl/'.$css_relname)) 
    73                $css = $core->blog->settings->themes_url.'/'.$core->blog->settings->theme.'/tpl/'.$css_relname; 
    74           else 
    75                $css = $core->blog->url.(($core->blog->settings->url_scan == 'path_info')?'?':'').'pf=gallery/default-templates/' 
    76                .$css_relname; 
     68          $css = $core->blog->url.(($core->blog->settings->url_scan == 'path_info')?'?':'').'pf=gallery/default-templates/' 
     69               .$core->blog->settings->gallery_default_theme.'/gallery.css'; 
    7770          $res = "\n<?php echo '<style type=\"text/css\" media=\"screen\">@import url(".$css.");</style>';\n?>"; 
    7871          return $res; 
     
    260253          $type = !empty($attr['type']) ? $attr['type'] : 'rss2'; 
    261254           
    262           if (!preg_match('#^(rss2|atom|mediarss|custom)$#',$type)) { 
     255          if (!preg_match('#^(rss2|atom|mediarss)$#',$type)) { 
    263256               $type = 'rss2'; 
    264257          } 
     
    266259          return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("gal")."/feed/'.$type.'"').'; ?>'; 
    267260           /*return '<?php echo '.sprintf($f,'$_ctx->posts->getURL()."/feed/'.$type.'"').'; ?>';*/ 
    268      } 
    269  
    270      public static function GalleryItemMeta($attr) 
    271      { 
    272           if (empty($attr['name'])) 
    273                return ''; 
    274           $value = addslashes($attr['name']); 
    275            
    276  
    277           $p = '<?php if ($_ctx->media->type == "image/jpeg") {'."\n". 
    278                'if (isset($_ctx->media->media_meta))'."\n". 
    279                'echo $_ctx->media->media_meta->{\''.$value."'};\n". 
    280                "}\n". 
    281                '?>'; 
    282           return $p; 
    283261     } 
    284262 
     
    299277          $lastn = 0; 
    300278          if (isset($attr['lastn'])) { 
    301                $lastn = (integer) $attr['lastn']; 
     279               $lastn = abs((integer) $attr['lastn'])+0; 
    302280          } 
    303281           
     
    307285          if ($lastn > 0) { 
    308286               $p .= "\$params['limit'] = ".$lastn.";\n"; 
    309           } else if ($lastn == 0) { 
     287          } else { 
    310288               $p .= "\$params['limit'] = \$core->blog->settings->gallery_nb_images_per_page;\n"; 
    311289          } 
    312           if ($lastn >= 0)     
     290           
    313291          $p .= "\$params['limit'] = array(((\$_page_number-1)*\$params['limit']),\$params['limit']);\n"; 
    314292           
     
    713691class urlGallery extends dcUrlHandlers 
    714692{ 
    715      public static function serveThemeDocument($theme,$page,$content_type='text/html',$http_cache=true,$http_etag=true) { 
    716           global $core; 
    717           if ($theme == '') 
    718                self::serveDocument($page,$content_type,$http_cache,$http_etag); 
    719           elseif ($GLOBALS['core']->tpl->getFilePath($theme.'/'.$page) !== false) 
    720                self::serveDocument($theme.'/'.$page,$content_type,$http_cache,$http_etag); 
    721           else 
    722                self::serveDocument($core->blog->settings->gallery_default_theme.'/'.$page,$content_type,$http_cache,$http_etag); 
    723  
    724      } 
    725693     public static function gallery($args) 
    726694     { 
    727695          $n = self::getPageNumber($args); 
    728           $theme=''; 
    729           $type=''; 
    730           if (preg_match('%(^|/)feed/(mediarss|rss2|atom|custom)/([0-9]+)$%',$args,$m)){ 
    731                $args = preg_replace('#(^|/)feed/(mediarss|rss2|atom|custom)/([0-9]+)$#','',$args); 
     696          if (preg_match('%(^|/)feed/(mediarss|rss2|atom)/([0-9]+)$%',$args,$m)){ 
     697               $args = preg_replace('#(^|/)feed/(mediarss|rss2|atom)/([0-9]+)$#','',$args); 
    732698               $type = $m[2]; 
    733                if ($type == 'custom') { 
    734                     $theme=$GLOBALS['core']->blog->settings->gallery_default_theme; 
    735                     $page = "image_feed.xml"; 
    736                } else { 
    737                     $page = "feed/img-".$type.".xml"; 
    738                } 
     699               $page = "feed/img-".$type.".xml"; 
    739700               $mime = 'application/xml'; 
    740701               $params['post_id'] = $m[3]; 
     
    746707               $params['post_id'] = $m[3]; 
    747708          } elseif ($args != '') { 
    748                //$page=$GLOBALS['core']->blog->settings->gallery_default_theme.'/gallery.html'; 
    749                $page='gallery.html'; 
    750                $params['post_url'] = $args; 
     709               $page=$GLOBALS['core']->blog->settings->gallery_default_theme.'/gallery.html'; 
     710          $params['post_url'] = $args; 
    751711               $mime='text/html'; 
    752                $theme=$GLOBALS['core']->blog->settings->gallery_default_theme; 
    753712          } else { 
    754713               self::p404(); 
     
    792751          $post_id = $GLOBALS['_ctx']->posts->post_id; 
    793752          $post_password = $GLOBALS['_ctx']->posts->post_password; 
    794           $meta = $GLOBALS['core']->meta->getMetaArray($GLOBALS['_ctx']->posts->post_meta); 
    795           if ($theme != '' && isset($meta['galtheme'])) { 
    796                $theme = $meta['galtheme'][0]; 
    797           }  
    798753           
    799754           
     
    907862           
    908863          # The entry 
    909           self::serveThemeDocument($theme,$page,$mime); 
     864          self::serveDocument($page,$mime); 
    910865          exit; 
    911866     } 
     
    927882          $GLOBALS['core']->meta = new dcMeta($GLOBALS['core']);; 
    928883          $GLOBALS['core']->gallery = new dcGallery($GLOBALS['core']); 
    929           self::serveThemeDocument($GLOBALS['core']->blog->settings->gallery_default_theme,'/galleries.html'); 
     884          self::serveDocument($GLOBALS['core']->blog->settings->gallery_default_theme.'/galleries.html'); 
    930885          exit; 
    931886     } 
     
    940895               $params['post_id'] = $m[3]; 
    941896          } elseif ($args != '') { 
    942                $page='image.html'; 
     897               $page=$GLOBALS['core']->blog->settings->gallery_default_theme.'/image.html'; 
    943898               $params['post_url'] = $args; 
    944899               $mime='text/html'; 
     
    987942          $post_password = $GLOBALS['_ctx']->posts->post_password; 
    988943           
    989           if ($GLOBALS['_ctx']->gallery_url != null) { 
    990                $galtemp = $GLOBALS['core']->gallery->getGalleries(array('post_url'=>$GLOBALS['_ctx']->gallery_url)); 
    991                $meta = $GLOBALS['core']->meta->getMetaArray($galtemp->post_meta); 
    992                if (isset($meta['galtheme'])) { 
    993                     $theme = $meta['galtheme'][0]; 
    994                } else { 
    995                     $theme=$GLOBALS['core']->blog->settings->gallery_default_theme; 
    996                } 
    997           } else { 
    998                $theme=$GLOBALS['core']->blog->settings->gallery_default_theme; 
    999           } 
    1000  
    1001944          # Password protected entry 
    1002945          if ($post_password != '') 
     
    11071050          } 
    11081051          //self::serveDocument('image.html'); 
    1109           self::serveThemeDocument($theme,$page,$mime); 
     1052          self::serveDocument($page,$mime); 
    11101053          exit; 
    11111054     } 
     
    11641107} 
    11651108 
    1166 class urlGalleryProxy extends dcUrlHandlers 
    1167 { 
    1168      public static function galtheme($args) { 
    1169           if (preg_match('#([^/]+)/(.+)$#',$args,$m)) { 
    1170                $theme = $m[1]; 
    1171                $res = $m[2]; 
    1172                $full_path = path::real($GLOBALS['core']->blog->settings->gallery_themes_path.'/'.$theme.'/'.$res); 
    1173                if ($full_path == null) 
    1174                     $full_path = path::real($GLOBALS['core']->blog->settings->gallery_themes_path.'/default/'.$res); 
    1175  
    1176                $allowed_types = array('png','jpg','jpeg','gif','css','js','swf'); 
    1177                if (!in_array(files::getExtension($full_path),$allowed_types)) { 
    1178                     self::p404(); 
    1179                     exit; 
    1180                } 
    1181                http::cache(array_merge(array($full_path),get_included_files())); 
    1182                header('Content-Type: '.files::getMimeType($full_path)); 
    1183                header('Content-Length: '.filesize($full_path)); 
    1184                readfile($full_path); 
    1185                exit; 
    1186  
    1187           } else { 
    1188                self::p404(); 
    1189           } 
    1190  
    1191      } 
    1192 } 
    11931109 
    11941110?> 
  • plugins/gallery/class.dc.gallery.php

    r237 r240  
    807807     } 
    808808 
    809  
    810      /* Themes functions */ 
    811      public function getThemes() { 
    812           $themes = array(); 
    813           $themes['default']='default'; 
    814           if ($dh = opendir(path::fullFromRoot($this->core->blog->settings->gallery_themes_path,DC_ROOT))) { 
    815                while (($file = readdir($dh)) !== false) { 
    816                     if((substr($file,0,1) != '.' ) && ($file !== 'feed')) { 
    817                          $themes[$file]=$file; 
    818                     } 
    819                } 
    820           } 
    821           return $themes; 
    822      } 
    823  
    824809} 
    825810?> 
  • plugins/gallery/default-templates/default/galleries.html

    r237 r240  
    8989    </tpl:EntryIf> 
    9090    <tpl:EntryIf show_pings="1"> 
    91     <a href="{{tpl:EntryURL}}#pings" class="ping_count">{{tpl:EntryPingCount}}</a></tpl:EntryIf> 
     91    <a href="{{tpl:EntryURL}}#pings" class="ping_count">{{tpl:EntryTrackbackCount}}</a></tpl:EntryIf> 
    9292    </p> 
    9393    </div> 
  • plugins/gallery/default-templates/default/image.html

    r237 r240  
    8585    </tpl:EntryIf> 
    8686     
    87     <div class="post-content"> 
    88     <p>EXIF :</p> 
    89     <ul> 
    90      <li>Make : {{tpl:GalleryItemMeta name="Make"}}</li> 
    91      <li>Exposure : {{tpl:GalleryItemMeta name="Exposure"}}</li> 
    92     </ul> 
    93      
    94     {{tpl:EntryContent}}</div> 
     87    <div class="post-content">{{tpl:EntryContent}}</div> 
    9588  </div> 
    9689   
  • plugins/gallery/gal.php

    r239 r240  
    11<?php 
    2 # ***** BEGIN LICENSE BLOCK ***** 
    3 # This file is part of DotClear Gallery plugin. 
    4 # Copyright (c) 2007 Bruno Hondelatte,  and contributors.  
    5 # Many, many thanks to Olivier Meunier and the Dotclear Team. 
    6 # All rights reserved. 
     2# -- BEGIN LICENSE BLOCK ---------------------------------- 
    73# 
    8 # Gallery plugin for DC2 is free sofwtare; you can redistribute it and/or modify 
    9 # it under the terms of the GNU General Public License as published by 
    10 # the Free Software Foundation; either version 2 of the License, or 
    11 # (at your option) any later version. 
    12 #  
    13 # DotClear is distributed in the hope that it will be useful, 
    14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 
    15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    16 # GNU General Public License for more details. 
    17 #  
    18 # You should have received a copy of the GNU General Public License 
    19 # along with DotClear; if not, write to the Free Software 
    20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
     4# This file is part of Dotclear 2 Gallery plugin. 
    215# 
    22 # ***** END LICENSE BLOCK ***** 
     6# Copyright (c) 2003-2008 Olivier Meunier and contributors 
     7# Licensed under the GPL version 2.0 license. 
     8# See LICENSE file or 
     9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     10# 
     11# -- END LICENSE BLOCK ------------------------------------ 
    2312if (!defined('DC_CONTEXT_ADMIN')) { exit; } 
    2413 
     
    5746$core->gallery = new dcGallery($core); 
    5847 
    59 $themes = $core->gallery->getThemes(); 
    6048/* 
    6149$post_headlink = '<link rel="%s" title="%s" href="post.php?id=%s" />'; 
     
    10189$f_media_dir = $f_tag = $f_user = $f_cat = null; 
    10290$f_orderby = $f_sortby = null; 
    103 $f_theme = "default"; 
    10491 
    10592 
     
    170157               $gal_thumb = $gal_thumb[0]; 
    171158          } 
    172           $meta_list = $core->meta->getMetaArray($post->post_meta); 
    173           $gal_nb_img = isset($meta_list['galitem'])?sizeof($meta_list['galitem']):0; 
    174           $f_theme = isset($meta_list['galtheme'])?$meta_list['galtheme'][0]:'default'; 
     159          $image_ids = $core->meta->getMetaArray($post->post_meta); 
     160          $gal_nb_img = isset($image_ids['galitem'])?sizeof($image_ids['galitem']):0; 
    175161 
    176162          /*$gal_meta=$core->meta->getMetaArray($post->post_meta); 
     
    254240     $f_orderby = !empty($_POST['f_orderby']) ? $_POST['f_orderby'] : null; 
    255241     $f_sortby = !empty($_POST['f_sortby']) ? $_POST['f_sortby'] : null; 
    256      $f_theme = !empty($_POST['f_theme']) ? $_POST['f_theme'] : 'default'; 
    257242 
    258243 
     
    311296               $core->meta->delPostMeta($post_id,"galorderby"); 
    312297               $core->meta->delPostMeta($post_id,"galsortby"); 
    313                $core->meta->delPostMeta($post_id,"galtheme"); 
    314298               if ($c_media_dir) { 
    315299                    $core->meta->setPostMeta($post_id,"galmediadir",$f_media_dir); 
     
    331315                    $core->meta->setPostMeta($post_id,"galsortby",$f_sortby); 
    332316               } 
    333                if (isset ($f_theme) && $f_theme != 'default') { 
    334                     $core->meta->setPostMeta($post_id,"galtheme",$f_theme); 
    335                } 
    336317               $core->gallery->refreshGallery($post_id); 
    337318 
    338                http::redirect('plugin.php?p=gallery&amp;m=gal&id='.$post_id.'&amp;upd=1'); 
     319               http::redirect('plugin.php?p=gallery&amp;m=gal&amp;id='.$post_id.'&upd=1'); 
    339320          } 
    340321          catch (Exception $e) 
     
    571552     '<p><label class="classic">'.__('Order')." : ".form::combo('f_orderby',$orderby_combo,$f_orderby).'</label></p>'. 
    572553     '<p><label class="classic">'.__('Sort')." : ".form::combo('f_sortby',$sortby_combo,$f_sortby).'</label></p>'. 
    573      "<h3>".__('Theme')."</h3>". 
    574      '<p><label class="classic">'.__('Gallery theme')." : ".form::combo('f_theme',$themes,$f_theme).'</label></p>'. 
    575554     '</div>'. 
    576555     '</div>'. 
     
    604583     echo '</fieldset></div>';          // End #entry-content 
    605584     echo '</form>'; 
     585     //echo '</div>'; 
    606586      
    607587     /*if ($post_id && $post->post_status == 1) { 
  • plugins/gallery/options.php

    r237 r240  
    6060$c_gal_prefix=defaultIfNotSet($core->blog->settings->gallery_gallery_url_prefix,'gallery'); 
    6161$c_img_prefix=defaultIfNotSet($core->blog->settings->gallery_image_url_prefix,'image'); 
    62 $c_gal_themes_path=defaultIfNotSet($core->blog->settings->gallery_themes_path,'plugins/gallery/default-templates'); 
    6362 
    6463if (!empty($_POST['enable_plugin'])) { 
     
    9796     $c_gal_prefix = !empty($_POST['gallery_prefix'])?$_POST['gallery_prefix']:$c_gal_prefix; 
    9897     $c_img_prefix = !empty($_POST['images_prefix'])?$_POST['images_prefix']:$c_img_prefix; 
    99      $c_gal_themes_path = !empty($_POST['themes_path'])?$_POST['themes_path']:$c_img_prefix; 
    10098     $core->blog->settings->setNamespace('gallery'); 
    10199     $core->blog->settings->put('gallery_galleries_url_prefix',$c_gals_prefix,'string','Gallery lists URL prefix'); 
    102100     $core->blog->settings->put('gallery_gallery_url_prefix',$c_gal_prefix,'string','Galleries URL prefix'); 
    103101     $core->blog->settings->put('gallery_image_url_prefix',$c_img_prefix,'string','Images URL prefix'); 
    104      $core->blog->settings->put('gallery_themes_path',$c_gal_themes_path,'string','Gallery Themes path'); 
    105102     $core->blog->triggerBlog(); 
    106103     http::redirect('plugin.php?p=gallery&amp;m=options&amp;upd=1'); 
     
    218215          form::field('images_prefix', 60, 255, $c_img_prefix). 
    219216          '</label></p>'. 
    220           '<p><label class=" classic">'. __('Gallery themes path').' : '. 
    221           form::field('themes_path', 60, 255, $c_gal_themes_path). 
    222           '</label></p>'. 
    223217          form::hidden('p','gallery'). 
    224218          form::hidden('m','options').$core->formNonce(). 
Note: See TracChangeset for help on using the changeset viewer.

Sites map