Changeset 253
- Timestamp:
- 10/31/08 10:50:18 (15 years ago)
- Location:
- plugins/gallery
- Files:
-
- 25 added
- 1 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/gallery/CHANGELOG
r240 r253 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 * Fixed bugs in redirection URLs 6 * updated settings to make them global by default, they can still be specialized for each blog. 7 * It is now possible to include subcategories in filters (dc 2.1 feature) 8 1 9 2 10 Gallery 0.2.16 -
plugins/gallery/_define.php
r240 r253 15 15 /* Description*/ "Image Gallery for Dotclear2", 16 16 /* Author */ "Bruno Hondelatte", 17 /* Version */ '0. 2.16',17 /* Version */ '0.3beta', 18 18 /* Permissions */ 'usage,contentadmin' 19 19 ); -
plugins/gallery/_install.php
r217 r253 11 11 # -- END LICENSE BLOCK ------------------------------------ 12 12 if (!defined('DC_CONTEXT_ADMIN')) exit; 13 global $core; 13 14 14 15 $this_version = $core->plugins->moduleInfo('gallery','version'); 15 16 $installed_version = $core->getVersion('gallery'); 16 17 18 function putGlobalSetting($id,$value,$type=null,$label=null,$value_change=true) { 19 global $core; 20 $old_value = $core->blog->settings->get($id); 21 if ($old_value === null) 22 $core->blog->settings->put($id,$value,$type,$label,$value_change,true); 23 else 24 $core->blog->settings->put($id,$old_value,$type,$label,$value_change,true); 25 } 17 26 if (version_compare($installed_version,$this_version,'>=')) { 27 $core->blog->settings->setNamespace('gallery'); 28 putGlobalSetting('gallery_galleries_url_prefix','galleries','string','Gallery lists URL prefix'); 29 putGlobalSetting('gallery_gallery_url_prefix','gallery','string','Galleries URL prefix'); 30 putGlobalSetting('gallery_image_url_prefix','image','string','Images URL prefix'); 31 putGlobalSetting('gallery_default_theme','default','string','Default theme to use'); 32 putGlobalSetting('gallery_nb_images_per_page',24,'integer','Number of images per page'); 33 putGlobalSetting('gallery_nb_galleries_per_page',10,'integer','Number of galleries per page'); 34 putGlobalSetting('gallery_new_items_default','YYYYN','string','Default options for new items management'); 35 putGlobalSetting('gallery_galleries_sort','date','string','Galleries list sort criteria'); 36 putGlobalSetting('gallery_galleries_order','DESC','string','Galleries list sort order criteria'); 37 putGlobalSetting('gallery_galleries_orderbycat',true,'boolean','Galleries list group by category'); 38 putGlobalSetting('gallery_enabled',false,'boolean','Gallery plugin enabled'); 18 39 return; 19 40 } -
plugins/gallery/_prepend.php
r240 r253 20 20 21 21 /* URL Handlers for galleries lists, galleries and images */ 22 if ( !is_null($core->blog->settings->gallery_gallery_url_prefix)) {22 if ($core->blog->settings->gallery_enabled) { 23 23 $core->url->register('gal',$core->blog->settings->gallery_gallery_url_prefix,'^' 24 24 .$core->blog->settings->gallery_gallery_url_prefix.'/(.+)$',array('urlGallery','gallery')); … … 27 27 $core->url->register('galitem',$core->blog->settings->gallery_image_url_prefix,'^' 28 28 .$core->blog->settings->gallery_image_url_prefix.'/(.+)$',array('urlGallery','image')); 29 $core->url->register('galtheme','gallerytheme','^gallerytheme/(.+/.+)$',array('urlGalleryProxy','galtheme')); 29 30 /* RNot yes implemented 30 31 $core->url->register('images','images','^images/(.+)$',array('urlGallery','images')); -
plugins/gallery/_public.php
r240 r253 36 36 $core->tpl->addBlock('GalleryItemGallery',array('tplGallery','GalleryItemGallery')); 37 37 $core->tpl->addValue('GalleryItemFeedURL',array('tplGallery','GalleryItemFeedURL')); 38 38 $core->tpl->addValue('GalleryItemMeta',array('tplGallery','GalleryItemMeta')); 39 40 $core->tpl->addValue('GalleryInclude',array('tplGallery','GalleryInclude')); 39 41 40 42 /* StyleSheets URL */ … … 42 44 $core->tpl->addValue('GalleryStylePath',array('tplGallery','GalleryStylePath')); 43 45 $core->tpl->addValue('GalleryJSPath',array('tplGallery','GalleryJSPath')); 46 $core->tpl->addValue('GalleryTemplateURL',array('tplGallery','GalleryTemplateURL')); 44 47 45 48 /* Templates dir */ 46 49 $core->addBehavior('publicBeforeDocument',array('behaviorsGallery','addTplPath')); 47 50 51 52 48 53 // Later on, some rest features :) 49 54 if (!empty($core->pubrest)) 55 require dirname(__FILE__).'/_pubrest.php'; 56 50 57 $core->pubrest->register('gallery','restGallery'); 51 58 … … 54 61 public static function addTplPath(&$core) 55 62 { 56 $core->tpl->setPath($core->tpl->getPath(),dirname(__FILE__).'/default-templates'); 63 if ($core->blog->settings->gallery_themes_path != null) 64 $core->tpl->setPath($core->tpl->getPath(),path::fullFromRoot($core->blog->settings->gallery_themes_path,DC_ROOT)); 65 else 66 $core->tpl->setPath($core->tpl->getPath(),path::fullFromRoot($core->blog->settings->gallery_themes_path,DC_ROOT)); 57 67 } 58 68 … … 66 76 global $core; 67 77 $f = $GLOBALS['core']->tpl->getFilters($attr); 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'; 78 $css_relname = $core->blog->settings->gallery_default_theme.'/gallery.css'; 79 if (file_exists(path::real($core->blog->settings->themes_path.'/'.$core->blog->settings->theme).'/tpl/'.$css_relname)) 80 $css = $core->blog->settings->themes_url.'/'.$core->blog->settings->theme.'/tpl/'.$css_relname; 81 else 82 $css = $core->blog->url.(($core->blog->settings->url_scan == 'path_info')?'?':'').'pf=gallery/default-templates/' 83 .$css_relname; 70 84 $res = "\n<?php echo '<style type=\"text/css\" media=\"screen\">@import url(".$css.");</style>';\n?>"; 71 85 return $res; … … 93 107 return $res; 94 108 109 } 110 public static function GalleryTemplateURL($attr,$content) 111 { 112 $f = $this->getFilters($attr); 113 return '<?php echo '.sprintf($f,'$core->blog->url').'."gallerytemplate/"; ?>'; 114 95 115 } 96 116 /* Gallery lists templates */ … … 253 273 $type = !empty($attr['type']) ? $attr['type'] : 'rss2'; 254 274 255 if (!preg_match('#^(rss2|atom|mediarss )$#',$type)) {275 if (!preg_match('#^(rss2|atom|mediarss|custom)$#',$type)) { 256 276 $type = 'rss2'; 257 277 } … … 261 281 } 262 282 263 /*public static function GalEntryPrevious($attr,$content) 264 { 283 public static function GalleryItemMeta($attr) 284 { 285 if (empty($attr['name'])) 286 return ''; 287 $value = addslashes($attr['name']); 288 289 290 $p = '<?php if ($_ctx->media->type == "image/jpeg") {'."\n". 291 'if (isset($_ctx->media->media_meta))'."\n". 292 'echo $_ctx->media->media_meta->{\''.$value."'};\n". 293 "}\n". 294 '?>'; 295 return $p; 296 } 297 298 public static function GalleryInclude($attr) { 299 if (!isset($attr['src'])) { return; } 300 $rel_src = path::clean($attr['src']); 301 $theme = $GLOBALS['_ctx']->gallery_theme; 302 if ($theme == '') { 303 $src = $rel_src; 304 } else { 305 $src = $theme."/".$rel_src; 306 } 307 265 308 return 266 '<?php $current_cat = (issetif ($if (!empty($_ctx->current_cat)) $isnewcat=true;'."\n".267 ' else268 $content.269 '<?php endif;?> 270 } */309 '<?php try { '. 310 "echo \$core->tpl->getData('".str_replace("'","\'",$src)."'); ". 311 '} catch (Exception $e) {} ?>'; 312 313 } 271 314 272 315 /* Entries -------------------------------------------- */ … … 277 320 $lastn = 0; 278 321 if (isset($attr['lastn'])) { 279 $lastn = abs((integer) $attr['lastn'])+0;322 $lastn = (integer) $attr['lastn']; 280 323 } 281 324 … … 285 328 if ($lastn > 0) { 286 329 $p .= "\$params['limit'] = ".$lastn.";\n"; 287 } else {330 } else if ($lastn == 0) { 288 331 $p .= "\$params['limit'] = \$core->blog->settings->gallery_nb_images_per_page;\n"; 289 332 } 290 333 if ($lastn >= 0) 291 334 $p .= "\$params['limit'] = array(((\$_page_number-1)*\$params['limit']),\$params['limit']);\n"; 292 335 … … 601 644 } 602 645 603 604 class restGallery {605 public static function getImages(&$core,$get,$post)606 {607 $core->meta = new dcMeta($core);608 $core->gallery = new dcGallery($core);609 610 $maxrequest=100;611 if (!empty($get['tag'])) {612 $params['tag']=$get['tag'];613 }614 if (!empty($get['galId'])) {615 $params['gal_id']=$get['galId'];616 }617 if (!empty($get['start'])) {618 $start=(integer)$get['start'];619 } else {620 $start=0;621 }622 if (!empty($get['limit']) && ($get['limit'] <= $maxrequest)) {623 $limit = (integer)$get['limit'];624 } else {625 $limit = $maxrequest;626 }627 $params['limit']=array($start,$limit);628 $rs = $core->gallery->getGalImageMedia($params);629 630 $rsp = new xmlTag();631 while ($rs->fetch()) {632 $media = $core->gallery->readmedia($rs);633 $imgTag = new xmlTag('image');634 $imgTag->id=$rs->post_id;635 $imgTag->thumb=$media->media_thumb["sq"];636 $imgTag->url=$media->file_url;637 $imgTag->post_url=$rs->getURL();638 $imgTag->title=$rs->post_title;639 640 $rsp->insertNode($imgTag);641 }642 643 return $rsp;644 }645 646 public static function getAllImageTags(&$core,$get,$post)647 {648 $core->meta = new dcMeta($core);649 $core->gallery = new dcGallery($core);650 $params['limit']=100;651 $rs = $core->meta->getMeta('tag',null,null,null,'galitem');652 653 $rsp = new xmlTag();654 while ($rs->fetch()) {655 $metaTag = new xmlTag('tag');656 $metaTag->id = $rs->meta_id;657 $metaTag->count = $rs->count;658 $rsp->insertNode($metaTag);659 }660 return $rsp;661 }662 public static function getCategories(&$core,$get,$post)663 {664 $params['post_type']='galitem';665 $rs = $core->blog->getCategories($params);666 $rsp = new xmlTag();667 while ($rs->fetch()) {668 $catTag = new xmlTag('cat');669 $catTag->id = $rs->cat_id;670 $catTag->title = $rs->cat_title;671 $rsp->insertNode($catTag);672 }673 return $rsp;674 }675 public static function getDates(&$core,$get,$post)676 {677 $params['post_type']='galitem';678 $params['type']='month';679 $rs = $core->blog->getDates($params);680 $rsp = new xmlTag();681 while ($rs->fetch()) {682 $dateTag = new xmlTag('date');683 $dateTag->dt = $rs->dt;684 $dateTag->count = $rs->nb_post;685 $rsp->insertNode($dateTag);686 }687 return $rsp;688 }689 }690 691 646 class urlGallery extends dcUrlHandlers 692 647 { 648 public static function serveThemeDocument($theme,$page,$content_type='text/html',$http_cache=true,$http_etag=true) { 649 global $core; 650 if ($theme == '') 651 self::serveDocument($page,$content_type,$http_cache,$http_etag); 652 elseif ($GLOBALS['core']->tpl->getFilePath($theme.'/'.$page) !== false) 653 self::serveDocument($theme.'/'.$page,$content_type,$http_cache,$http_etag); 654 else 655 self::serveDocument($core->blog->settings->gallery_default_theme.'/'.$page,$content_type,$http_cache,$http_etag); 656 657 } 693 658 public static function gallery($args) 694 659 { 695 660 $n = self::getPageNumber($args); 696 if (preg_match('%(^|/)feed/(mediarss|rss2|atom)/([0-9]+)$%',$args,$m)){ 697 $args = preg_replace('#(^|/)feed/(mediarss|rss2|atom)/([0-9]+)$#','',$args); 661 $theme=''; 662 $type=''; 663 if (preg_match('%(^|/)feed/(mediarss|rss2|atom|custom)/([0-9]+)$%',$args,$m)){ 664 $args = preg_replace('#(^|/)feed/(mediarss|rss2|atom|custom)/([0-9]+)$#','',$args); 698 665 $type = $m[2]; 699 $page = "feed/img-".$type.".xml"; 666 if ($type == 'custom') { 667 $theme=$GLOBALS['core']->blog->settings->gallery_default_theme; 668 $page = "image_feed.xml"; 669 } else { 670 $page = "feed/img-".$type.".xml"; 671 } 700 672 $mime = 'application/xml'; 701 673 $params['post_id'] = $m[3]; … … 707 679 $params['post_id'] = $m[3]; 708 680 } elseif ($args != '') { 709 $page=$GLOBALS['core']->blog->settings->gallery_default_theme.'/gallery.html'; 710 $params['post_url'] = $args; 681 //$page=$GLOBALS['core']->blog->settings->gallery_default_theme.'/gallery.html'; 682 $page='gallery.html'; 683 $params['post_url'] = $args; 711 684 $mime='text/html'; 685 $theme=$GLOBALS['core']->blog->settings->gallery_default_theme; 712 686 } else { 713 687 self::p404(); … … 727 701 $GLOBALS['_ctx']->gal_params = $gal_params; 728 702 $GLOBALS['_ctx']->gallery_url = $GLOBALS['_ctx']->posts->post_url; 703 $GLOBALS['_ctx']->gallery_theme = $theme; 729 704 $GLOBALS['_ctx']->comment_preview = new ArrayObject(); 730 705 $GLOBALS['_ctx']->comment_preview['content'] = ''; … … 751 726 $post_id = $GLOBALS['_ctx']->posts->post_id; 752 727 $post_password = $GLOBALS['_ctx']->posts->post_password; 728 $meta = $GLOBALS['core']->meta->getMetaArray($GLOBALS['_ctx']->posts->post_meta); 729 if ($theme != '' && isset($meta['galtheme'])) { 730 $theme = $meta['galtheme'][0]; 731 $GLOBALS['_ctx']->gallery_theme = $theme; 732 } 753 733 754 734 … … 862 842 863 843 # The entry 864 self::serve Document($page,$mime);844 self::serveThemeDocument($theme,$page,$mime); 865 845 exit; 866 846 } … … 882 862 $GLOBALS['core']->meta = new dcMeta($GLOBALS['core']);; 883 863 $GLOBALS['core']->gallery = new dcGallery($GLOBALS['core']); 884 self::serve Document($GLOBALS['core']->blog->settings->gallery_default_theme.'/galleries.html');864 self::serveThemeDocument($GLOBALS['core']->blog->settings->gallery_default_theme,'/galleries.html'); 885 865 exit; 886 866 } … … 895 875 $params['post_id'] = $m[3]; 896 876 } elseif ($args != '') { 897 $page= $GLOBALS['core']->blog->settings->gallery_default_theme.'/image.html';877 $page='image.html'; 898 878 $params['post_url'] = $args; 899 879 $mime='text/html'; … … 942 922 $post_password = $GLOBALS['_ctx']->posts->post_password; 943 923 924 if ($GLOBALS['_ctx']->gallery_url != null) { 925 $galtemp = $GLOBALS['core']->gallery->getGalleries(array('post_url'=>$GLOBALS['_ctx']->gallery_url)); 926 $meta = $GLOBALS['core']->meta->getMetaArray($galtemp->post_meta); 927 if (isset($meta['galtheme'])) { 928 $theme = $meta['galtheme'][0]; 929 } else { 930 $theme=$GLOBALS['core']->blog->settings->gallery_default_theme; 931 } 932 } else { 933 $theme=$GLOBALS['core']->blog->settings->gallery_default_theme; 934 } 935 $GLOBALS['_ctx']->gallery_theme=$theme; 936 944 937 # Password protected entry 945 938 if ($post_password != '') … … 1050 1043 } 1051 1044 //self::serveDocument('image.html'); 1052 self::serve Document($page,$mime);1045 self::serveThemeDocument($theme,$page,$mime); 1053 1046 exit; 1054 1047 } … … 1107 1100 } 1108 1101 1102 class urlGalleryProxy extends dcUrlHandlers 1103 { 1104 public static function galtheme($args) { 1105 if (preg_match('#([^/]+)/(.+)$#',$args,$m)) { 1106 $theme = $m[1]; 1107 $res = $m[2]; 1108 $full_path = path::real($GLOBALS['core']->blog->settings->gallery_themes_path.'/'.$theme.'/'.$res); 1109 if ($full_path == null) 1110 $full_path = path::real($GLOBALS['core']->blog->settings->gallery_themes_path.'/default/'.$res); 1111 1112 $allowed_types = array('png','jpg','jpeg','gif','css','js','swf'); 1113 if (!in_array(files::getExtension($full_path),$allowed_types)) { 1114 self::p404(); 1115 exit; 1116 } 1117 http::cache(array_merge(array($full_path),get_included_files())); 1118 header('Content-Type: '.files::getMimeType($full_path)); 1119 header('Content-Length: '.filesize($full_path)); 1120 readfile($full_path); 1121 exit; 1122 1123 } else { 1124 self::p404(); 1125 } 1126 1127 } 1128 } 1109 1129 1110 1130 ?> -
plugins/gallery/class.dc.gallery.php
r240 r253 26 26 class dcGallery extends dcMedia 27 27 { 28 /*private $core;29 private $con;30 private $table;*/31 28 public $orderby; 32 29 public $sortby; 33 30 34 31 public function __construct(&$core) 35 32 { … … 71 68 $filtered=false; 72 69 if (isset($meta['galrecursedir'])) { 73 $filters['recurse_dir']=$meta['galrecursedir']; 70 $filters['recurse_dir']=$meta['galrecursedir'][0]; 71 $filtered=true; 72 } 73 if (isset($meta['galsubcat'])) { 74 $filters['sub_cat']=$meta['galsubcat'][0]; 74 75 $filtered=true; 75 76 } … … 258 259 } 259 260 } 261 262 /* Categories filters */ 263 $cat_subcond = ''; 264 $cat_cond = ''; 265 $cat_not = false; 260 266 if (!empty($params['cat_id'])) 261 267 { 262 if (!is_array($params['cat_id'])) { 263 $params['cat_id'] = array($params['cat_id']); 264 } 265 array_walk($params['cat_id'],create_function('&$v,$k','if($v!==null){$v=(integer)$v;}')); 266 267 if (empty($params['cat_id_not'])) { 268 $strReq .= 'AND P.cat_id '.$this->con->in($params['cat_id']); 269 } else { 270 $strReq .= 'AND (P.cat_id IS NULL OR P.cat_id NOT '.$this->con->in($params['cat_id']).') '; 271 } 272 } 273 if (!empty($params['cat_url'])) 274 { 275 if (!is_array($params['cat_url'])) { 276 $params['cat_url'] = array($params['cat_url']); 277 } 278 array_walk($params['cat_url'],create_function('&$v,$k','$v=(string)$v;')); 279 280 if (empty($params['cat_url_not'])) { 281 $strReq .= 'AND C.cat_url '.$this->con->in($params['cat_url']); 282 } else { 283 $strReq .= 'AND (C.cat_url IS NULL OR C.cat_url NOT '.$this->con->in($params['cat_url']).') '; 284 } 285 } 268 $cat_not = !empty($params['cat_id_not']); 269 270 if (is_array($params['cat_id'])) { 271 array_walk($params['cat_id'],create_function('&$v,$k','if($v!==null){$v=(integer)$v;}')); 272 } else { 273 $params['cat_id'] = array((integer) $params['cat_id']); 274 } 275 276 if (empty($params['sub_cat'])) { 277 $cat_cond = 'P.cat_id '.$this->con->in($params['cat_id']); 278 } else { 279 $cat_subcond = 'cat_id '.$this->con->in($params['cat_id']); 280 } 281 } 282 elseif (!empty($params['cat_url'])) 283 { 284 $cat_not = !empty($params['cat_url_not']); 285 286 if (is_array($params['cat_url'])) { 287 array_walk($params['cat_url'],create_function('&$v,$k','$v=(string)$v;')); 288 } else { 289 $params['cat_url'] = array((string) $params['cat_url']); 290 } 291 292 if (empty($params['sub_cat'])) { 293 $cat_cond = 'C.cat_url '.$this->con->in($params['cat_url']); 294 } else { 295 $cat_subcond = 'cat_url '.$this->con->in($params['cat_url']); 296 } 297 } 298 299 if ($cat_subcond) # we want posts from given categories and their children 300 { 301 $rs = $this->con->select( 302 'SELECT cat_lft, cat_rgt FROM '.$this->core->prefix.'category '. 303 "WHERE blog_id = '".$this->con->escape($this->core->blog->id)."' ". 304 'AND '.$cat_subcond 305 ); 306 $cat_borders = array(); 307 while ($rs->fetch()) { 308 $cat_borders[] = '(C.cat_lft BETWEEN '.$rs->cat_lft.' AND '.$rs->cat_rgt.')'; 309 } 310 if (count($cat_borders) > 0) { 311 $strReq .= ' AND '.($cat_not ? ' NOT' : '').'(P.cat_id IS NOT NULL AND('.implode(' OR ',$cat_borders).')) '; 312 } 313 } elseif ($cat_cond) { # without children 314 $strReq .= ' AND '.($cat_not ? ' NOT' : '').'(P.cat_id IS NOT NULL AND '.$cat_cond.') '; 315 } 316 286 317 if (isset($params['post_status'])) { 287 318 $strReq .= 'AND post_status = '.(integer) $params['post_status'].' '; … … 333 364 $strReq .= $this->con->limit($params['limit']); 334 365 } 335 #echo '<p>'.$strReq.'</p>';336 366 $rs = $this->con->select($strReq); 337 367 $rs->core = $this->core; … … 807 837 } 808 838 839 840 /* Themes functions */ 841 public function getThemes() { 842 $themes = array(); 843 $themes['default']='default'; 844 if ($dh = opendir(path::fullFromRoot($this->core->blog->settings->gallery_themes_path,DC_ROOT))) { 845 while (($file = readdir($dh)) !== false) { 846 if((substr($file,0,1) != '.' ) && ($file !== 'feed')) { 847 $themes[$file]=$file; 848 } 849 } 850 } 851 return $themes; 852 } 853 809 854 } 810 855 ?> -
plugins/gallery/default-templates/default/galleries.html
r240 r253 50 50 <tpl:GalleryEntries> 51 51 <tpl:EntryIfNewCat> 52 <p class=" day-date">{{tpl:EntryCategoryWithNull}}</p>52 <p class="gallery-cat">{{tpl:EntryCategoryWithNull}}</p> 53 53 </tpl:EntryIfNewCat> 54 54 <div class="post {{tpl:EntryIfOdd}} {{tpl:EntryIfFirst}}"> … … 89 89 </tpl:EntryIf> 90 90 <tpl:EntryIf show_pings="1"> 91 <a href="{{tpl:EntryURL}}#pings" class="ping_count">{{tpl:Entry TrackbackCount}}</a></tpl:EntryIf>91 <a href="{{tpl:EntryURL}}#pings" class="ping_count">{{tpl:EntryPingCount}}</a></tpl:EntryIf> 92 92 </p> 93 93 </div> -
plugins/gallery/default-templates/default/gallery.css
r162 r253 63 63 } 64 64 65 p.gallery-cat { 66 font-size: 1em; 67 margin: 0 0 0.5em; 68 text-align: right; 69 color: #279ac4; 70 } -
plugins/gallery/default-templates/default/gallery.html
r193 r253 80 80 </div> 81 81 82 <div class="gallery-thumbnails"> 83 <tpl:GalleryItemEntries> 84 <tpl:EntriesHeader> 85 <tpl:GalleryPagination> 86 <p class="pagination"> 87 <tpl:PaginationIf start="0"><a href="{{tpl:PaginationURL offset="-1"}}" class="next">« {{tpl:lang previous images}} 88 </a> - </tpl:PaginationIf> 89 {{tpl:lang page}} {{tpl:PaginationCurrent}} {{tpl:lang of}} {{tpl:PaginationCounter}} 90 <tpl:PaginationIf end="0"> - <a href="{{tpl:PaginationURL offset="+1"}}" class="prev"> 91 {{tpl:lang next images}} »</a></tpl:PaginationIf> 92 93 </p> 94 </tpl:GalleryPagination> 95 </tpl:EntriesHeader> 96 97 <div class="gallery-thumbnail"> 98 <!--<div class="gallery-thumbnail-img">--> 99 <div class="gallery-thumbnail-img"> 100 <a href="{{tpl:GalleryItemURL}}"> 101 <img src="{{tpl:GalleryItemThumbURL size="t"}}" alt="{{tpl:EntryTitle}}"/> 102 </a> 103 </div> 104 <div class="gallery-thumbnail-desc"> 105 <span class="gallery-nb-comment">{{tpl:EntryCommentCount none="Pas de réaction" one="1 réaction" more="%s réactions"}}</span> 106 </div> 107 </div> 108 109 </tpl:GalleryItemEntries> 110 <div style="clear:both;"></div> 111 </div> 82 {{tpl:GalleryInclude src="gallery_item.html"}} 83 112 84 <!-- # Comments --> 113 85 <tpl:EntryIf show_comments="1"> -
plugins/gallery/default-templates/default/image.html
r240 r253 85 85 </tpl:EntryIf> 86 86 87 <div class="post-content">{{tpl:EntryContent}}</div> 87 <div class="post-content"> 88 <p>Exposure : {{tpl:GalleryItemMeta name="Exposure"}}</p> 89 <p>Aperture : f/{{tpl:GalleryItemMeta name="FNumber"}}</p> 90 {{tpl:EntryContent}}</div> 88 91 </div> 89 92 -
plugins/gallery/gal.php
r240 r253 1 1 <?php 2 # -- BEGIN LICENSE BLOCK ---------------------------------- 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. 3 7 # 4 # This file is part of Dotclear 2 Gallery plugin. 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 5 21 # 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 ------------------------------------ 22 # ***** END LICENSE BLOCK ***** 12 23 if (!defined('DC_CONTEXT_ADMIN')) { exit; } 13 24 … … 46 57 $core->gallery = new dcGallery($core); 47 58 59 $themes = $core->gallery->getThemes(); 48 60 /* 49 61 $post_headlink = '<link rel="%s" title="%s" href="post.php?id=%s" />'; … … 69 81 $categories = $core->blog->getCategories(); 70 82 while ($categories->fetch()) { 71 $categories_combo[html::escapeHTML($categories->cat_title)] = $categories->cat_id; 83 $categories_combo[str_repeat(' ',$categories->level-1).'• '. 84 html::escapeHTML($categories->cat_title)] = $categories->cat_id; 72 85 $reverse_cat[$categories->cat_id] = html::escapeHTML($categories->cat_title); 73 86 } … … 87 100 $c_media_dir = $c_tag = $c_user = $c_cat = 0; 88 101 $f_recurse_dir = 0; 102 $f_sub_cat = 0; 89 103 $f_media_dir = $f_tag = $f_user = $f_cat = null; 90 104 $f_orderby = $f_sortby = null; 105 $f_theme = "default"; 91 106 92 107 … … 130 145 $f_recurse_dir = 1; 131 146 } 147 if (isset($gal_filters['sub_cat'])) { 148 $f_sub_cat = 1; 149 } 132 150 if (isset($gal_filters['tag'])) { 133 151 $c_tag=true; … … 157 175 $gal_thumb = $gal_thumb[0]; 158 176 } 159 $image_ids = $core->meta->getMetaArray($post->post_meta); 160 $gal_nb_img = isset($image_ids['galitem'])?sizeof($image_ids['galitem']):0; 177 $meta_list = $core->meta->getMetaArray($post->post_meta); 178 $gal_nb_img = isset($meta_list['galitem'])?sizeof($meta_list['galitem']):0; 179 $f_theme = isset($meta_list['galtheme'])?$meta_list['galtheme'][0]:'default'; 161 180 162 181 /*$gal_meta=$core->meta->getMetaArray($post->post_meta); … … 177 196 $prev_rs = $core->gallery->getNextGallery($post_id,strtotime($post_dt),-1); 178 197 if ($next_rs !== null) { 179 echo '<p>Next:'.$next_rs->post_id.'</p>';180 198 $next_link = sprintf($gal_link,$next_rs->post_id, 181 199 html::escapeHTML($next_rs->post_title),__('next gallery').' »'); … … 185 203 186 204 if ($prev_rs !== null) { 187 echo '<p>Prev:'.$next_rs->post_id.'</p>';188 205 $prev_link = sprintf($gal_link,$prev_rs->post_id, 189 206 html::escapeHTML($prev_rs->post_title),'« '.__('previous gallery')); … … 235 252 $f_media_dir = !empty($_POST['f_media_dir']) ? $_POST['f_media_dir'] : null; 236 253 $f_recurse_dir = !empty($_POST['f_recurse_dir']); 254 $f_sub_cat = !empty($_POST['f_sub_cat']); 237 255 $f_tag = !empty($_POST['f_tag']) ? $_POST['f_tag'] : null; 238 256 $f_cat = !empty($_POST['f_cat']) ? $_POST['f_cat'] : null; … … 240 258 $f_orderby = !empty($_POST['f_orderby']) ? $_POST['f_orderby'] : null; 241 259 $f_sortby = !empty($_POST['f_sortby']) ? $_POST['f_sortby'] : null; 260 $f_theme = !empty($_POST['f_theme']) ? $_POST['f_theme'] : 'default'; 242 261 243 262 … … 289 308 290 309 /*metaBehaviors::setTags('adminAfterPostUpdate',$cur,$post_id);*/ 291 $core->meta->delPostMeta($post_id,"galmediadir");292 $core->meta->delPostMeta($post_id,"galrecursedir");293 $core->meta->delPostMeta($post_id,"galtag");294 $core->meta->delPostMeta($post_id,"galcat");295 $core->meta->delPostMeta($post_id,"galuser");296 $core->meta->delPostMeta($post_id,"galorderby");297 $core->meta->delPostMeta($post_id,"galsortby");298 if ($c_media_dir) {299 $core->meta->setPostMeta($post_id,"galmediadir",$f_media_dir);300 $core->meta->setPostMeta($post_id,"galrecursedir",(integer)$f_recurse_dir);301 }302 if ($c_tag) {303 $core->meta->setPostMeta($post_id,"galtag",$f_tag);304 }305 if ($c_cat) {306 $core->meta->setPostMeta($post_id,"galcat",$f_cat);307 }308 if ($c_user) {309 $core->meta->setPostMeta($post_id,"galuser",$f_user);310 }311 if (isset ($f_orderby)) {312 $core->meta->setPostMeta($post_id,"galorderby",$f_orderby);313 }314 if (isset ($f_sortby)) {315 $core->meta->setPostMeta($post_id,"galsortby",$f_sortby);316 }317 $core->gallery->refreshGallery($post_id);318 319 http::redirect('plugin.php?p=gallery&m=gal&id='.$post_id.'&upd=1');320 310 } 321 311 catch (Exception $e) … … 331 321 { 332 322 333 $return_id = $core->blog->addPost($cur); 334 if ($c_media_dir) { 335 $core->meta->setPostMeta($return_id,"galmediadir",$f_media_dir); 336 } 337 if ($c_tag) { 338 $core->meta->setPostMeta($return_id,"galtag",$f_tag); 339 } 340 if ($c_cat) { 341 $core->meta->setPostMeta($return_id,"galcat",$f_cat); 342 } 343 if ($c_user) { 344 $core->meta->setPostMeta($return_id,"galuser",$f_user); 345 } 346 if (isset ($f_orderby)) { 347 $core->meta->setPostMeta($return_id,"galorderby",$f_orderby); 348 } 349 if (isset ($f_sortby)) { 350 $core->meta->setPostMeta($return_id,"galsortby",$f_sortby); 351 } 352 $core->gallery->refreshGallery($return_id); 353 354 http::redirect('plugin.php?p=gallery&m=gal&id='.$return_id.'&crea=1'); 323 $post_id = $core->blog->addPost($cur); 355 324 } 356 325 catch (Exception $e) … … 359 328 } 360 329 } 330 $core->meta->delPostMeta($post_id,"galmediadir"); 331 $core->meta->delPostMeta($post_id,"galrecursedir"); 332 $core->meta->delPostMeta($post_id,"galsubcat"); 333 $core->meta->delPostMeta($post_id,"galtag"); 334 $core->meta->delPostMeta($post_id,"galcat"); 335 $core->meta->delPostMeta($post_id,"galuser"); 336 $core->meta->delPostMeta($post_id,"galorderby"); 337 $core->meta->delPostMeta($post_id,"galsortby"); 338 $core->meta->delPostMeta($post_id,"galtheme"); 339 $core->meta->delPostMeta($post_id,"subcat"); 340 if ($c_media_dir) { 341 $core->meta->setPostMeta($post_id,"galmediadir",$f_media_dir); 342 $core->meta->setPostMeta($post_id,"galrecursedir",(integer)$f_recurse_dir); 343 } 344 if ($c_tag) { 345 $core->meta->setPostMeta($post_id,"galtag",$f_tag); 346 } 347 if ($c_cat) { 348 $core->meta->setPostMeta($post_id,"galcat",$f_cat); 349 $core->meta->setPostMeta($post_id,"galsubcat",(integer)$f_sub_cat); 350 } 351 if ($c_user) { 352 $core->meta->setPostMeta($post_id,"galuser",$f_user); 353 } 354 if (isset ($f_orderby)) { 355 $core->meta->setPostMeta($post_id,"galorderby",$f_orderby); 356 } 357 if (isset ($f_sortby)) { 358 $core->meta->setPostMeta($post_id,"galsortby",$f_sortby); 359 } 360 if (isset ($f_theme) && $f_theme != 'default') { 361 $core->meta->setPostMeta($post_id,"galtheme",$f_theme); 362 } 363 $core->gallery->refreshGallery($post_id); 364 365 http::redirect('plugin.php?p=gallery&m=gal&id='.$post_id.'&upd=1'); 361 366 } 362 367 ?> … … 372 377 373 378 <?php echo metaBehaviors::postHeaders();?> 374 <link rel="stylesheet" type="text/css" href="index.php?pf=gallery/ style.css" />379 <link rel="stylesheet" type="text/css" href="index.php?pf=gallery/admin_css/style.css" /> 375 380 376 381 </script> … … 472 477 '</div>'. 473 478 '</div>'; 474 echo "</fieldset> </div>";479 echo "</fieldset>"; 475 480 } 476 481 … … 544 549 __('Tag')." : ".form::field('f_tag',20,100,$f_tag,'',2).'</label></p>'. 545 550 '<p><label class="classic">'.form::checkbox('c_cat',1,$c_cat,"disablenext").'</label><label class="classic">'. 546 __('Category')." : ".form::combo('f_cat',$categories_combo,$f_cat).'</label></p>'. 551 __('Category')." : ".form::combo('f_cat',$categories_combo,$f_cat).'</label>'. 552 '<br /><label class="classic" style="margin-left: 20px;">'.form::checkbox('f_sub_cat',1,$f_sub_cat).__('Include sub-categories').'</label></p>'. 547 553 '<p><label class="classic">'.form::checkbox('c_user',1,$c_user,"disablenext").'</label><label class="classic">'. 548 554 __('User')." : ".form::field('f_user',20,20,$f_user,'',2).'</label></p>'. … … 552 558 '<p><label class="classic">'.__('Order')." : ".form::combo('f_orderby',$orderby_combo,$f_orderby).'</label></p>'. 553 559 '<p><label class="classic">'.__('Sort')." : ".form::combo('f_sortby',$sortby_combo,$f_sortby).'</label></p>'. 560 "<h3>".__('Theme')."</h3>". 561 '<p><label class="classic">'.__('Gallery theme')." : ".form::combo('f_theme',$themes,$f_theme).'</label></p>'. 554 562 '</div>'. 555 563 '</div>'. … … 583 591 echo '</fieldset></div>'; // End #entry-content 584 592 echo '</form>'; 585 //echo '</div>';586 593 587 594 /*if ($post_id && $post->post_status == 1) { … … 600 607 } 601 608 } // if canedit post 609 echo '</div>'; 602 610 echo '<p><a href="plugin.php?p=gallery&m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; 603 611 echo '<p><a href="plugin.php?p=gallery&m=options" class="multi-part">'.__('Options').'</a></p>'; -
plugins/gallery/gals.php
r232 r253 62 62 63 63 while ($categories->fetch()) { 64 $categories_combo[html::escapeHTML($categories->cat_title)] = $categories->cat_id; 64 $categories_combo[str_repeat(' ',$categories->level-1).'• '. 65 html::escapeHTML($categories->cat_title). 66 ' ('.$categories->nb_post.')'] = $categories->cat_id; 65 67 } 66 68 -
plugins/gallery/gals_actions.php
r232 r253 32 32 { 33 33 $redir = 'plugin.php?p=gallery'. 34 '& amp;page='.$_POST['page'];34 '&page='.$_POST['page']; 35 35 } 36 36 … … 181 181 $categories = $core->blog->getCategories(); 182 182 while ($categories->fetch()) { 183 $categories_combo[$categories->cat_title] = $categories->cat_id; 183 $categories_combo[str_repeat(' ',$categories->level-1).'• '. 184 html::escapeHTML($categories->cat_title)] = $categories->cat_id; 184 185 } 185 186 } catch (Exception $e) { } -
plugins/gallery/galthumbnail.php
r232 r253 20 20 $media_id = !empty($_REQUEST['media_id']) ? (integer) $_REQUEST['media_id'] : null; 21 21 $display_page=true; 22 $redir = "plugin.php?p=gallery& amp;m=gal&id=".$core->con->escape($gal_id);22 $redir = "plugin.php?p=gallery&m=gal&id=".$core->con->escape($gal_id); 23 23 if ($gal_id) { 24 24 $gal = $core->gallery->getGalleries(array('post_id'=>$gal_id)); -
plugins/gallery/index.php
r217 r253 12 12 if (!defined('DC_CONTEXT_ADMIN')) { exit; } 13 13 14 if (is_null($core->blog->settings->gallery_ gallery_url_prefix)) {14 if (is_null($core->blog->settings->gallery_enabled) || !$core->blog->settings->gallery_enabled) { 15 15 require dirname(__FILE__).'/options.php'; 16 16 }elseif (!empty($_REQUEST['m'])) { -
plugins/gallery/item.php
r232 r253 123 123 $prev_rs = $core->gallery->getNextGalleryItem($post,-1); 124 124 if ($next_rs !== null) { 125 echo '<p>Next:'.$next_rs->post_id.'</p>';126 125 $next_link = sprintf($item_link,$next_rs->post_id, 127 126 html::escapeHTML($next_rs->post_title),__('next item').' »'); … … 131 130 132 131 if ($prev_rs !== null) { 133 echo '<p>Prev:'.$next_rs->post_id.'</p>';134 132 $prev_link = sprintf($item_link,$prev_rs->post_id, 135 133 html::escapeHTML($prev_rs->post_title),'« '.__('previous item')); … … 220 218 /*$core->meta->delPostMeta($post_id,"galmediadir"); 221 219 $core->meta->setPostMeta($post_id,"galmediadir",$gal_directory);*/ 222 http::redirect('plugin.php?p=gallery& amp;m=item&id='.$post_id.'&upd=1');220 http::redirect('plugin.php?p=gallery&m=item&id='.$post_id.'&upd=1'); 223 221 } 224 222 catch (Exception $e) … … 238 236 $core->meta->setPostMeta($return_id,"galmediadir",$gal_directory); 239 237 240 http::redirect('plugin.php?p=gallery& amp;m=gal&id='.$return_id.'&crea=1');238 http::redirect('plugin.php?p=gallery&m=gal&id='.$return_id.'&crea=1'); 241 239 } 242 240 catch (Exception $e) … … 258 256 <?php echo metaBehaviors::postHeaders(); ?> 259 257 260 <link rel="stylesheet" type="text/css" href="index.php?pf=gallery/ style.css" />258 <link rel="stylesheet" type="text/css" href="index.php?pf=gallery/admin_css/style.css" /> 261 259 262 260 -
plugins/gallery/items.php
r232 r253 45 45 # Getting categories 46 46 try { 47 $categories = $core->blog->getCategories( );47 $categories = $core->blog->getCategories(array('post_type' => 'galitem')); 48 48 } catch (Exception $e) { 49 49 $core->error->add($e->getMessage()); … … 89 89 90 90 while ($categories->fetch()) { 91 $categories_combo[html::escapeHTML($categories->cat_title)] = $categories->cat_id; 91 $categories_combo[str_repeat(' ',$categories->level-1).'• '. 92 html::escapeHTML($categories->cat_title). 93 ' ('.$categories->nb_post.')'] = $categories->cat_id; 92 94 } 93 95 -
plugins/gallery/items_actions.php
r232 r253 28 28 { 29 29 $redir = 30 'plugin.php?p=gallery& amp;m=items&user_id='.$_POST['user_id'].31 '& amp;cat_id='.$_POST['cat_id'].32 '& amp;status='.$_POST['status'].33 '& amp;selected='.$_POST['selected'].34 '& amp;month='.$_POST['month'].35 '& amp;lang='.$_POST['lang'].36 '& amp;sortby='.$_POST['sortby'].37 '& amp;order='.$_POST['order'].38 '& amp;gal_id='.$_POST['gal_id'].39 '& amp;media_dir='.$_POST['media_dir'].40 '& amp;tag='.$_POST['tag'].41 '& amp;page='.$_POST['page'].42 '& amp;nb='.$_POST['nb'];30 'plugin.php?p=gallery&m=items&user_id='.$_POST['user_id']. 31 '&cat_id='.$_POST['cat_id']. 32 '&status='.$_POST['status']. 33 '&selected='.$_POST['selected']. 34 '&month='.$_POST['month']. 35 '&lang='.$_POST['lang']. 36 '&sortby='.$_POST['sortby']. 37 '&order='.$_POST['order']. 38 '&gal_id='.$_POST['gal_id']. 39 '&media_dir='.$_POST['media_dir']. 40 '&tag='.$_POST['tag']. 41 '&page='.$_POST['page']. 42 '&nb='.$_POST['nb']; 43 43 } 44 44 … … 220 220 $categories = $core->blog->getCategories(); 221 221 while ($categories->fetch()) { 222 $categories_combo[ $categories->cat_title] = $categories->cat_id;222 $categories_combo[str_repeat(' ',$categories->level-1).'•'.html::escapeHTML($categories->cat_title)] = $categories->cat_id; 223 223 } 224 224 } catch (Exception $e) { } -
plugins/gallery/locales/fr/main.po
r195 r253 195 195 msgstr "Gestion des nouvelles images" 196 196 197 #: gal.php:561 198 msgid "Gallery theme" 199 msgstr "Thème de la galerie" 200 201 #: gal.php:552 202 msgid "Include sub-categories" 203 msgstr "Inclure les sous-catégories" 204 197 205 #: gals.php:141 198 206 msgid "update" … … 422 430 msgstr "Activer le plugin" 423 431 432 #: options.php:171 433 msgid "Disable plugin for this blog" 434 msgstr "Désactiver le plugin pour ce blog" 435 424 436 #: options.php:176 425 437 msgid "General options" -
plugins/gallery/options.php
r240 r253 12 12 if (!defined('DC_CONTEXT_ADMIN')) { exit; } 13 13 14 function defaultIfNotSet($value,$default) {15 if ($value === null)16 return $default;17 else18 return $value;19 }20 14 21 15 22 16 function setSettings() { 23 17 global $core; 24 $galleries_url_prefix = defaultIfNotSet($core->blog->settings->gallery_galleries_url_prefix,'galleries'); 25 $gallery_url_prefix = defaultIfNotSet($core->blog->settings->gallery_gallery_url_prefix,'gallery'); 26 $image_url_prefix = defaultIfNotSet($core->blog->settings->gallery_image_url_prefix,'image'); 27 //$images_url_prefix = defaultIfNotSet($core->blog->settings->gallery_images_url_prefix,'images'); 28 //$browser_url_prefix = defaultIfNotSet($core->blog->settings->gallery_browser_url_prefix,'browser'); 29 $default_theme = defaultIfNotSet($core->blog->settings->gallery_default_theme,'default'); 30 $nb_images_per_page = defaultIfNotSet($core->blog->settings->gallery_nb_images_per_page,24); 31 $nb_galleries_per_page = defaultIfNotSet($core->blog->settings->gallery_nb_images_per_page,10); 32 $gallery_new_items_default = defaultIfNotSet($core->blog->settings->gallery_new_items_default,'YYYYN'); 33 $gallery_galleries_sort = defaultIfNotSet($core->blog->settings->gallery_galleries_sort,'date'); 34 $gallery_galleries_order = defaultIfNotSet($core->blog->settings->gallery_galleries_order,'DESC'); 35 $gallery_galleries_orderbycat = defaultIfNotSet($core->blog->settings->gallery_galleries_orderbycat,true); 36 37 $core->blog->settings->setNamespace('gallery'); 38 $core->blog->settings->put('gallery_galleries_url_prefix',$galleries_url_prefix,'string','Gallery lists URL prefix'); 39 $core->blog->settings->put('gallery_gallery_url_prefix',$gallery_url_prefix,'string','Galleries URL prefix'); 40 $core->blog->settings->put('gallery_image_url_prefix',$image_url_prefix,'string','Images URL prefix'); 18 $galleries_url_prefix = $core->blog->settings->gallery_galleries_url_prefix; 19 $gallery_url_prefix = $core->blog->settings->gallery_gallery_url_prefix; 20 $image_url_prefix = $core->blog->settings->gallery_image_url_prefix; 21 //$images_url_prefix = $core->blog->settings->gallery_images_url_prefix; 22 //$browser_url_prefix = $core->blog->settings->gallery_browser_url_prefix; 23 $default_theme = $core->blog->settings->gallery_default_theme; 24 $nb_images_per_page = $core->blog->settings->gallery_nb_images_per_page; 25 $nb_galleries_per_page = $core->blog->settings->gallery_nb_images_per_page; 26 $gallery_new_items_default = $core->blog->settings->gallery_new_items_default; 27 $gallery_galleries_sort = $core->blog->settings->gallery_galleries_sort; 28 $gallery_galleries_order = $core->blog->settings->gallery_galleries_order; 29 $gallery_galleries_orderbycat = $core->blog->settings->gallery_galleries_orderbycat; 30 $gallery_enabled = $core->blog->settings->gallery_enabled; 31 32 $core->blog->settings->setNamespace('gallery'); 33 $core->blog->settings->put('gallery_galleries_url_prefix',$galleries_url_prefix); 34 $core->blog->settings->put('gallery_gallery_url_prefix',$gallery_url_prefix); 35 $core->blog->settings->put('gallery_image_url_prefix',$image_url_prefix); 41 36 //$core->blog->settings->put('gallery_images_url_prefix',$images_url_prefix,'string','Filtered Images URL prefix'); 42 37 //$core->blog->settings->put('gallery_browser_url_prefix',$browser_url_prefix,'string','Browser URL prefix'); 43 $core->blog->settings->put('gallery_default_theme',$default_theme,'string','Default theme to use'); 44 $core->blog->settings->put('gallery_nb_images_per_page',$nb_images_per_page,'integer','Number of images per page'); 45 $core->blog->settings->put('gallery_nb_galleries_per_page',$nb_galleries_per_page,'integer','Number of galleries per page'); 46 $core->blog->settings->put('gallery_new_items_default',$gallery_new_items_default,'string','Default options for new items management'); 47 $core->blog->settings->put('gallery_galleries_sort',$gallery_galleries_sort,'string','Galleries list sort criteria'); 48 $core->blog->settings->put('gallery_galleries_order',$gallery_galleries_order,'string','Galleries list sort order criteria'); 49 $core->blog->settings->put('gallery_galleries_orderbycat',$gallery_galleries_orderbycat,'boolean','Galleries list group by category'); 50 http::redirect('plugin.php?p=gallery&m=options&upd=1'); 51 } 52 53 $defaults=defaultIfNotSet($core->blog->settings->gallery_new_items_default,"YYYYN"); 54 $c_nb_img=defaultIfNotSet($core->blog->settings->gallery_nb_images_per_page,24); 55 $c_nb_gal=defaultIfNotSet($core->blog->settings->gallery_nb_galleries_per_page,24); 56 $c_sort=defaultIfNotSet($core->blog->settings->gallery_galleries_sort,"date"); 57 $c_order=defaultIfNotSet($core->blog->settings->gallery_galleries_order,"DESC"); 58 $c_orderbycat=defaultIfNotSet($core->blog->settings->gallery_galleries_orderbycat,0); 59 $c_gals_prefix=defaultIfNotSet($core->blog->settings->gallery_galleries_url_prefix,'galleries'); 60 $c_gal_prefix=defaultIfNotSet($core->blog->settings->gallery_gallery_url_prefix,'gallery'); 61 $c_img_prefix=defaultIfNotSet($core->blog->settings->gallery_image_url_prefix,'image'); 38 $core->blog->settings->put('gallery_default_theme',$default_theme); 39 $core->blog->settings->put('gallery_nb_images_per_page',$nb_images_per_page); 40 $core->blog->settings->put('gallery_nb_galleries_per_page',$nb_galleries_per_page); 41 $core->blog->settings->put('gallery_new_items_default',$gallery_new_items_default); 42 $core->blog->settings->put('gallery_galleries_sort',$gallery_galleries_sort); 43 $core->blog->settings->put('gallery_galleries_order',$gallery_galleries_order); 44 $core->blog->settings->put('gallery_galleries_orderbycat',$gallery_galleries_orderbycat); 45 $core->blog->settings->put('gallery_enabled',$gallery_enabled); 46 http::redirect('plugin.php?p=gallery&m=options&upd=1'); 47 } 48 49 $defaults=$core->blog->settings->gallery_new_items_default; 50 $c_nb_img=$core->blog->settings->gallery_nb_images_per_page; 51 $c_nb_gal=$core->blog->settings->gallery_nb_galleries_per_page; 52 $c_sort=$core->blog->settings->gallery_galleries_sort; 53 $c_order=$core->blog->settings->gallery_galleries_order; 54 $c_orderbycat=$core->blog->settings->gallery_galleries_orderbycat; 55 $c_gals_prefix=$core->blog->settings->gallery_galleries_url_prefix; 56 $c_gal_prefix=$core->blog->settings->gallery_gallery_url_prefix; 57 $c_img_prefix=$core->blog->settings->gallery_image_url_prefix; 58 $c_gal_themes_path=$core->blog->settings->gallery_themes_path; 62 59 63 60 if (!empty($_POST['enable_plugin'])) { 61 $core->blog->settings->setNamespace('gallery'); 62 $core->blog->settings->put('gallery_enabled',true,'boolean'); 64 63 setSettings(); 65 header('Location: plugin.php?p=gallery'); 64 http::redirect('plugin.php?p=gallery'); 65 } elseif (!empty($_POST['disable_plugin'])) { 66 $core->blog->settings->setNamespace('gallery'); 67 $core->blog->settings->put('gallery_enabled',false,'boolean'); 68 setSettings(); 69 http::redirect('plugin.php?p=gallery'); 66 70 } elseif (!empty($_POST['save_item_defaults'])) { 67 71 $items_default=array(); … … 77 81 $core->blog->settings->put('gallery_new_items_default',$gallery_new_items_default,'string','Default options for new items management'); 78 82 $defaults=$gallery_new_items_default; 79 http::redirect('plugin.php?p=gallery& amp;m=options&upd=1');83 http::redirect('plugin.php?p=gallery&m=options&upd=1'); 80 84 } elseif (!empty($_POST['save_general'])) { 81 85 $c_sort = !empty($_POST['galleries_sort'])?$_POST['galleries_sort']:$c_sort; … … 91 95 $core->blog->settings->put('gallery_galleries_orderbycat',$c_orderbycat,'boolean','Galleries list group by category'); 92 96 $core->blog->triggerBlog(); 93 http::redirect('plugin.php?p=gallery& amp;m=options&upd=1');97 http::redirect('plugin.php?p=gallery&m=options&upd=1'); 94 98 } elseif (!empty($_POST['save_advanced'])) { 95 99 $c_gals_prefix = !empty($_POST['galleries_prefix'])?$_POST['galleries_prefix']:$c_gals_prefix; 96 100 $c_gal_prefix = !empty($_POST['gallery_prefix'])?$_POST['gallery_prefix']:$c_gal_prefix; 97 101 $c_img_prefix = !empty($_POST['images_prefix'])?$_POST['images_prefix']:$c_img_prefix; 102 $c_gal_themes_path = !empty($_POST['themes_path'])?$_POST['themes_path']:$c_img_prefix; 98 103 $core->blog->settings->setNamespace('gallery'); 99 104 $core->blog->settings->put('gallery_galleries_url_prefix',$c_gals_prefix,'string','Gallery lists URL prefix'); 100 105 $core->blog->settings->put('gallery_gallery_url_prefix',$c_gal_prefix,'string','Galleries URL prefix'); 101 106 $core->blog->settings->put('gallery_image_url_prefix',$c_img_prefix,'string','Images URL prefix'); 107 $core->blog->settings->put('gallery_themes_path',$c_gal_themes_path,'string','Gallery Themes path'); 102 108 $core->blog->triggerBlog(); 103 http::redirect('plugin.php?p=gallery& amp;m=options&upd=1');109 http::redirect('plugin.php?p=gallery&m=options&upd=1'); 104 110 } 105 111 … … 145 151 $order_combo = array(__('Ascending') => 'asc', 146 152 __('Descending') => 'desc' ); 147 if (is_null($core->blog->settings->gallery_ gallery_url_prefix)) {153 if (is_null($core->blog->settings->gallery_enabled) || !$core->blog->settings->gallery_enabled) { 148 154 $public_ok = is_dir($core->blog->public_path); 149 155 … … 155 161 } else { 156 162 echo '<p>'.__('The plugin is not enabled for this blog yet. Click below to enable it').'</p>'. 157 '< input type="submit" name="enable_plugin" value="'.__('Enable plugin').'" />'.163 '<p><input type="submit" name="enable_plugin" value="'.__('Enable plugin').'" />'. 158 164 form::hidden('p','gallery'). 159 form::hidden('m','options').$core->formNonce() ;165 form::hidden('m','options').$core->formNonce()."</p>"; 160 166 } 161 167 echo '</fieldset></form>'; 162 168 } else { 169 echo '<form action="plugin.php" method="post" id="disable_form">'. 170 '<fieldset><legend>'.__('Plugin Activation').'</legend>'; 171 echo '<p><input type="submit" name="disable_plugin" value="'.__('Disable plugin for this blog').'" />'. 172 form::hidden('p','gallery'). 173 form::hidden('m','options').$core->formNonce().'</p>'; 174 echo '</fieldset></form>'; 163 175 164 176 echo '<form action="plugin.php" method="post" id="actions_form">'. … … 215 227 form::field('images_prefix', 60, 255, $c_img_prefix). 216 228 '</label></p>'. 229 '<p><label class=" classic">'. __('Gallery themes path').' : '. 230 form::field('themes_path', 60, 255, $c_gal_themes_path). 231 '</label></p>'. 217 232 form::hidden('p','gallery'). 218 233 form::hidden('m','options').$core->formNonce().
Note: See TracChangeset
for help on using the changeset viewer.