Changeset 551
- Timestamp:
- 11/08/08 02:35:29 (15 years ago)
- google:author:
- appears
- Location:
- plugins/dlManager
- Files:
-
- 11 added
- 5 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dlManager/_admin.php
r548 r551 58 58 59 59 $w->dlManager->setting('root',__('root directory:'),'','combo', 60 dlManager::listDirs(true ));60 dlManager::listDirs(true,false)); 61 61 62 62 $w->dlManager->setting('display_dirs',__('Display subdirectories'), -
plugins/dlManager/_define.php
r550 r551 28 28 /* Description*/ "Download manager with a public page and a widget", 29 29 /* Author */ "Moe (http://gniark.net/), Osku and Tomtom (http://blog.zenstyle.fr)", 30 /* Version */ '1.0-RC 3.2',30 /* Version */ '1.0-RC4', 31 31 /* Permissions */ 'admin' 32 32 ); -
plugins/dlManager/_prepend.php
r548 r551 29 29 '^media(/.+)?$',array('dlManagerPageDocument','page')); 30 30 $core->url->register('mediaplayer','mediaplayer', 31 '^mediaplayer/([0-9]+ (/js)?)?$',array('dlManagerPageDocument','player'));31 '^mediaplayer/([0-9]+)$',array('dlManagerPageDocument','player')); 32 32 $core->url->register('download','download', 33 33 '^download/([0-9]+)$',array('dlManagerPageDocument','wrapper')); 34 $core->url->register('viewfile','viewfile', 35 '^viewfile/(.+)$',array('dlManagerPageDocument','viewfile')); 34 36 $core->url->register('icon','icon', 35 '^icon/(.+) ?$',array('dlManagerPageDocument','icon'));37 '^icon/(.+)$',array('dlManagerPageDocument','icon')); 36 38 37 39 ?> -
plugins/dlManager/_public.php
r548 r551 30 30 class dlManagerPageDocument extends dcUrlHandlers 31 31 { 32 private static function check() 33 { 34 global $core; 35 36 # if the plugin is disabled 37 if (!$core->blog->settings->dlmanager_active) {self::p404();} 38 39 # exit if the public_path (and Media root) doesn't exist 40 if (!is_dir($core->blog->public_path)) {self::p404();} 41 } 42 32 43 /** 33 44 serve the document … … 38 49 global $core; 39 50 40 if (!$core->blog->settings->dlmanager_active) {self::p404();}41 51 self::check(); 52 42 53 # start session 43 54 $session_id = session_id(); … … 48 59 try 49 60 { 50 # exit if the public_path (and Media root) doesn't exist51 if (!is_dir($core->blog->public_path)) {self::p404();}52 53 61 # define root of DL Manager 54 62 $page_root = $core->blog->settings->dlmanager_root; … … 63 71 64 72 $_ctx->dlManager_currentDir = '/'; 65 66 # if visitor asked a directory 73 $root = true; 74 75 # if the visitor request a directory 67 76 if ((!empty($args)) && (substr($args,0,1) == '/')) 68 77 { 69 78 $_ctx->dlManager_currentDir = substr($args,1); 70 79 $page_dir = $page_root.'/'.$_ctx->dlManager_currentDir; 71 72 unset($breadCrumb); 80 $root = false; 73 81 } 74 82 … … 78 86 79 87 # file sort 80 # default value81 $_ctx->dlManager_fileSort = $core->blog->settings->dlmanager_file_sort;82 83 88 # if visitor can choose how to sort files 84 89 if ($core->blog->settings->dlmanager_enable_sort === true) … … 97 102 # /from /dotclear/admin/media.php 98 103 } 104 else 105 { 106 # default value 107 $_ctx->dlManager_fileSort = $core->blog->settings->dlmanager_file_sort; 108 } 99 109 100 110 # exit if the directory doesn't exist 101 111 $dir_full_path = $core->media->root.'/'.$page_dir; 112 if (!is_dir($dir_full_path)) {self::p404();} 113 114 # used to remove link to root directory 102 115 $parent_dir_full_path = path::real(dirname($dir_full_path)); 103 if (!is_dir($dir_full_path)) {self::p404();}104 116 117 # get the content of the directory 105 118 $core->media->setFileSort($_ctx->dlManager_fileSort); 106 119 107 120 $core->media->chdir($page_dir); 108 121 $core->media->getDir(); … … 114 127 $item->media_type = 'folder'; 115 128 116 if (($item->file == $parent_dir_full_path)117 && ($_ctx->dlManager_currentDir == '/'))129 # if the current page is the root 130 if ($root && ($item->file == $parent_dir_full_path)) 118 131 { 119 132 # remove link to root directory … … 122 135 else 123 136 { 124 $item->relname = 125 substr($item->relname,$page_root_len); 137 $item->relname = substr($item->relname,$page_root_len); 126 138 127 # parent directory139 # rename link to parent directory 128 140 if ($item->file == $parent_dir_full_path) 129 141 { … … 133 145 } 134 146 135 $_ctx->dlManager_dirs = $core->media->dir['dirs']; 136 137 $files_array = $core->media->dir['files']; 147 $_ctx->dlManager_dirs = dlManager::getItems($core->media->dir['dirs']); 148 unset($core->media->dir['dirs']); 149 150 # pager 151 $files =& $core->media->dir['files']; 152 153 $_ctx->dlManager_multiple_pages = (boolean) (count($files) > 154 $core->blog->settings->dlmanager_nb_per_page); 138 155 139 156 $_ctx->dlManager_pager = new pager( 140 # page141 ((isset($_GET['page'])) ? $_GET['page'] : 1),count($files _array),157 # current page 158 ((isset($_GET['page'])) ? $_GET['page'] : 1),count($files), 142 159 $core->blog->settings->dlmanager_nb_per_page,10); 143 160 144 $_ctx->dlManager_pager->html_prev = '« '.__('previous page'); 145 $_ctx->dlManager_pager->html_next = __('next page').' »'; 146 147 $core->media->dir['files'] = array(); 161 $_ctx->dlManager_pager->html_prev = '← '.__('previous'); 162 $_ctx->dlManager_pager->html_next = __('next').' →'; 163 $_ctx->dlManager_pager->var_page = 'page'; 164 $_ctx->dlManager_pager->html_link_sep = ' '; 165 $_ctx->dlManager_pager->html_prev_grp = '…'; 166 $_ctx->dlManager_pager->html_next_grp = '…'; 167 168 $files_array = array(); 148 169 149 170 for ($i=$_ctx->dlManager_pager->index_start, $j=0; 150 171 $i<=$_ctx->dlManager_pager->index_end; $i++, $j++) 151 172 { 152 $item =& $files _array[$i];173 $item =& $files[$i]; 153 174 154 175 $item->relname = substr($item->relname,$page_root_len); 155 176 156 $core->media->dir['files'][] = $files_array[$i]; 157 } 158 $_ctx->dlManager_files = $core->media->dir['files']; 177 $files_array[] = $item; 178 } 179 $_ctx->dlManager_files = dlManager::getItems($files_array); 180 unset($core->media->dir['files'],$files_array); 181 # /pager 159 182 160 183 # download counter … … 187 210 global $core; 188 211 189 if (!$core->blog->settings->dlmanager_active) {self::p404();}212 self::check(); 190 213 191 214 $_ctx =& $GLOBALS['_ctx']; 192 193 # exit if the public_path (and Media root) doesn't exist 194 if (!is_dir($core->blog->public_path)) {self::p404();} 195 196 $file = $core->media->getFile(str_replace('/js','',$args)); 197 198 if ((empty($file->file)) || (!is_readable($file->file))) 199 { 200 self::p404(); 201 } 202 203 $_ctx->items = $file; 204 $_ctx->file_url = $file->file_url; 205 206 # define root of DL Manager 207 $page_root = $core->blog->settings->dlmanager_root; 208 209 # used to remove root from path 210 $page_root_len = strlen($page_root); 211 212 # remove slash at the beginning of the string 213 if ($page_root_len > 0) {$page_root_len += 1;} 214 215 if (!dlManager::inJail($file->relname)) {self::p404();} 216 217 $_ctx->items->relname = 218 dirname(substr($_ctx->items->relname,$page_root_len)); 219 if ($_ctx->items->relname == '.') 220 { 221 $_ctx->items->relname = ''; 222 } 223 224 # if visitor asked a directory 225 $_ctx->dlManager_currentDir = $_ctx->items->relname; 226 $page_dir = $page_root.'/'.$_ctx->dlManager_currentDir; 227 228 # BreadCrumb 229 $_ctx->dlManager_BreadCrumb = dlManager::breadCrumb($_ctx->dlManager_currentDir); 230 # /BreadCrumb 231 232 # download counter 233 $_ctx->dlManager_count_dl = 234 unserialize($core->blog->settings->dlmanager_count_dl); 235 if (!is_array($_ctx->dlManager_count_dl)) 236 { 237 $_ctx->dlManager_count_dl = array(); 238 } 239 240 $core->tpl->setPath($core->tpl->getPath(), 241 dirname(__FILE__).'/default-templates/'); 242 243 if (preg_match('#^.*\/js$#',$args)) { 244 self::serveDocument('_media_player_content.html','text/html'); 245 } 246 else { 215 216 try 217 { 218 # exit if the public_path (and Media root) doesn't exist 219 if (!is_dir($core->blog->public_path)) {self::p404();} 220 221 $file = $core->media->getFile($args); 222 223 if ((empty($file->file)) || (!is_readable($file->file))) 224 { 225 self::p404(); 226 } 227 228 # file_url for mp3 and flv players 229 $_ctx->file_url = $core->blog->url.$core->url->getBase('viewfile').'/'. 230 $file->media_id; 231 232 # define root of DL Manager 233 $page_root = $core->blog->settings->dlmanager_root; 234 235 # used to remove root from path 236 $page_root_len = strlen($page_root); 237 238 # remove slash at the beginning of the string 239 if ($page_root_len > 0) {$page_root_len += 1;} 240 241 if (!dlManager::inJail($file->relname)) {self::p404();} 242 243 $file->relname = 244 dirname(substr($file->relname,$page_root_len)); 245 if ($file->relname == '.') 246 { 247 $file->relname = ''; 248 } 249 250 # BreadCrumb 251 $_ctx->dlManager_BreadCrumb = dlManager::breadCrumb($file->relname); 252 # /BreadCrumb 253 254 # download counter 255 $_ctx->dlManager_count_dl = 256 unserialize($core->blog->settings->dlmanager_count_dl); 257 if (!is_array($_ctx->dlManager_count_dl)) 258 { 259 $_ctx->dlManager_count_dl = array(); 260 } 261 262 # get static record 263 $files = array(); 264 $files[] = $file; 265 $_ctx->items = dlManager::getItems($files); 266 unset($files); 267 # /get static record 268 269 $core->tpl->setPath($core->tpl->getPath(), 270 dirname(__FILE__).'/default-templates/'); 271 247 272 self::serveDocument('media_player.html','text/html'); 273 } 274 catch (Exception $e) 275 { 276 $_ctx->form_error = $e->getMessage(); 248 277 } 249 278 } … … 252 281 serve file 253 282 @param args <b>string</b> Argument 254 */ 255 public static function wrapper($args) 283 @param count <b>boolean</b> Count download 284 */ 285 public static function wrapper($args,$count=true) 256 286 { 257 287 global $core; 258 259 if (empty($args) || !$core->blog->settings->dlmanager_active) { 288 289 self::check(); 290 291 if (empty($args)) {self::p404();} 292 293 try 294 { 295 $file = $core->media->getFile($args); 296 297 if (empty($file->file)) 298 { 299 self::p404(); 300 } 301 302 $page_root = $core->blog->settings->dlmanager_root; 303 304 if (!dlManager::inJail($file->relname)) {self::p404();} 305 306 if (is_readable($file->file)) 307 { 308 if ($count && $core->blog->settings->dlmanager_counter) 309 { 310 $count = unserialize($core->blog->settings->dlmanager_count_dl); 311 if (!is_array($count)) {$count = array();} 312 $count[$file->media_id] = array_key_exists($file->media_id,$count) 313 ? $count[$file->media_id]+1 : 1; 314 315 $settings =& $core->blog->settings; 316 317 $settings->setNamespace('dlmanager'); 318 $settings->put('dlmanager_count_dl',serialize($count),'string', 319 'Download counter'); 320 //$core->callBehavior('publicDownloadedFile',(integer)$args); 321 } 322 http::$cache_max_age = 36000; 323 http::cache(array_merge(array($file->file),get_included_files())); 324 header('Content-type: '.$file->type); 325 header('Content-Length: '.filesize($file->file)); 326 header('Content-Disposition: attachment; filename="'.$file->basename.'"'); 327 readfile($file->file); 328 exit; 329 /*header('Location:'.$file->file_url); 330 exit;*/ 331 } 332 } 333 catch (Exception $e) 334 { 335 $_ctx->form_error = $e->getMessage(); 336 } 337 } 338 339 /** 340 serve a file without incrementing the download counter 341 @param args <b>string</b> Argument 342 */ 343 public static function viewfile($args) 344 { 345 global $core; 346 347 if (!$GLOBALS['core']->blog->settings->dlmanager_hide 348 || empty($args) || !$core->blog->settings->dlmanager_active) 349 { 260 350 self::p404(); 261 351 } 262 263 $file = $core->media->getFile($args); 264 265 if (empty($file->file)) 266 { 267 self::p404(); 268 } 269 270 $page_root = $core->blog->settings->dlmanager_root; 271 272 if (!dlManager::inJail($file->relname)) {self::p404();} 273 274 if (is_readable($file->file)) 275 { 276 if ($core->blog->settings->dlmanager_counter) 277 { 278 $count = unserialize($core->blog->settings->dlmanager_count_dl); 279 if (!is_array($count)) {$count = array();} 280 $count[$file->media_id] = array_key_exists($file->media_id,$count) 281 ? $count[$file->media_id]+1 : 1; 352 353 try 354 { 355 $elements = explode('/',$args); 356 357 # standard file 358 if (count($elements) == 1) 359 { 360 self::wrapper($elements[0],false); 361 } 362 # image file 363 elseif (count($elements) == 2) 364 { 365 $file_id = $elements[0]; 366 $size = $elements[1]; 282 367 283 $ settings =& $core->blog->settings;368 $file = $core->media->getFile($args); 284 369 285 $settings->setNamespace('dlmanager'); 286 $settings->put('dlmanager_count_dl',serialize($count),'string', 287 'Download counter'); 288 } 289 //$core->callBehavior('publicDownloadedFile',(integer)$args); 290 header('Content-type: '.$file->type); 291 header('Content-Disposition: attachment; filename="'.$file->basename.'"'); 292 readfile($file->file); 293 exit; 294 } 295 296 self::p404(); 297 } 298 299 /** 300 serve files icons 370 # check that the file is an image and the requested size is valid 371 if ((empty($file->file)) || ($file->media_type != 'image') 372 || !array_key_exists($size,$core->media->thumb_sizes)) 373 { 374 self::p404(); 375 } 376 377 if (isset($file->media_thumb[$size])) 378 { 379 # get the directory of the file and the filename of the thumbnail 380 $image = dirname($file->file).'/'.basename($file->media_thumb[$size]); 381 } else 382 { 383 $image = $file->file; 384 } 385 386 http::$cache_max_age = 36000; 387 http::cache(array_merge(array($image),get_included_files())); 388 header('Content-type: '.$file->type); 389 header('Content-Length: '.filesize($image)); 390 readfile($image); 391 exit; 392 } 393 } 394 catch (Exception $e) 395 { 396 $_ctx->form_error = $e->getMessage(); 397 } 398 } 399 400 /** 401 serve icon files 301 402 @param args <b>string</b> Argument 302 403 */ … … 311 412 } 312 413 313 $icon_path = path::real(DC_ROOT.'/admin/images/media/'.$args.'.png');314 315 414 try 316 415 { 416 $icon_path = path::real(DC_ROOT.'/admin/images/media/'.$args.'.png'); 417 317 418 if (is_readable($icon_path)) 318 419 { 319 420 # from /dotclear/inc/load_plugin_file.php 421 http::$cache_max_age = 36000; 320 422 http::cache(array_merge(array($icon_path),get_included_files())); 321 423 header('Content-type: '.files::getMimeType($icon_path)); … … 355 457 356 458 $core->tpl->addBlock('DLMIfNoItem',array('dlManagerPageTpl','ifNoItem')); 459 460 $core->tpl->addBlock('DLMIfPages',array('dlManagerPageTpl','ifPages')); 357 461 358 462 # item … … 396 500 'itemZipContentFile')); 397 501 502 # text file content 503 $core->tpl->addValue('DLMItemFileContent',array('dlManagerPageTpl', 504 'itemFileContent')); 505 398 506 # find entries containing a media 399 507 $core->tpl->addBlock('DLMItemEntries',array('dlManagerPageTpl', … … 513 621 514 622 /** 623 If there is more than one page 624 @param attr <b>array</b> Attribute 625 @param content <b>string</b> Content 626 @return <b>string</b> PHP block 627 */ 628 public static function ifPages($attr,$content) 629 { 630 return('<?php if ($_ctx->dlManager_multiple_pages) : ?>'. 631 $content. 632 '<?php endif; ?>'); 633 } 634 635 /** 515 636 loop on items 516 637 @param attr <b>array</b> Attribute … … 520 641 public static function items($attr,$content) 521 642 { 522 $type = ( $attr['type'] == 'dirs') ? 'dirs' : 'files';643 $type = (($attr['type'] == 'dirs') ? 'dirs' : 'files'); 523 644 524 645 return 525 646 '<?php '. 526 '$_ctx->items = dlManager::getItems($_ctx->{\'dlManager_'.$type.'\'}); '.647 '$_ctx->items = $_ctx->{\'dlManager_'.$type.'\'}; '. 527 648 'while ($_ctx->items->fetch()) : ?>'."\n". 528 649 $content. … … 678 799 $f = $GLOBALS['core']->tpl->getFilters($attr); 679 800 801 if ($GLOBALS['core']->blog->settings->dlmanager_hide) 802 { 803 return('<?php echo($core->blog->url.'. 804 '$core->url->getBase(\'viewfile\').\'/\'.'. 805 sprintf($f,'$_ctx->items->media_id').'); ?>'); 806 } 680 807 return('<?php echo '.sprintf($f,'$_ctx->items->file_url').'; ?>'); 681 808 } … … 806 933 && array_key_exists($attr['size'],$core->media->thumb_sizes)) 807 934 {$size = $attr['size'];} 808 809 return('<?php if (isset($_ctx->items->media_thumb[\''. 810 $size.'\'])) :'. 935 936 if ($GLOBALS['core']->blog->settings->dlmanager_hide) 937 { 938 return('<?php '. 939 'echo($core->blog->url.$core->url->getBase(\'viewfile\').\'/\'.'. 940 '$_ctx->items->media_id.\'/'.$size.'\'); ?>'); 941 } 942 return('<?php if (isset($_ctx->items->media_thumb[\''.$size.'\'])) :'. 811 943 'echo($_ctx->items->media_thumb[\''.$size.'\']);'. 812 944 'else :'. … … 885 1017 886 1018 /** 1019 Text file content 1020 @return <b>string</b> PHP block 1021 */ 1022 public static function itemFileContent($attr) 1023 { 1024 return('<?php if (is_readable($_ctx->items->file)) : '. 1025 'echo html::escapeHTML(file_get_contents($_ctx->items->file));'. 1026 'endif; ?>'); 1027 } 1028 1029 /** 887 1030 loop on posts which contain this item 888 1031 @param attr <b>array</b> Attribute … … 967 1110 if ($page_root_len > 0) {$page_root_len += 1;} 968 1111 1112 $parent_dir_full_path = path::real( 1113 dirname($core->media->root.'/'.$w->root)); 1114 969 1115 foreach ($items as $item) { 970 1116 if (!empty($item->relname)) 971 1117 { 972 $item->relname = 973 substr($item->relname,$page_root_len); 1118 $item->relname = substr($item->relname,$page_root_len); 974 1119 975 $items_str .= sprintf($w->item,$core->blog->url. 976 $core->url->getBase('media').'/'.$item->relname, 977 $item->basename,$item->basename,''); 1120 # display only subdirectories 1121 if ($item->file != $parent_dir_full_path) 1122 { 1123 $items_str .= sprintf($w->item,$core->blog->url. 1124 $core->url->getBase('media').'/'.$item->relname, 1125 $item->basename,$item->basename,''); 1126 } 978 1127 } 979 1128 } … … 995 1144 996 1145 foreach ($items as $item) { 997 $mediaplayer = '';998 1146 if ($item->media_type == 'image') 999 1147 { 1000 $mediaplayer = 1001 '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 1002 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'. 1003 '<img src="'.$core->blog->getQmarkURL(). 1004 'pf=dlManager/images/image.png" alt="'.__('Preview').'" />'. 1005 '</a>'; 1148 $icon = 'image.png'; 1006 1149 } elseif ($item->type == 'audio/mpeg3' ) 1007 1150 { 1008 $mediaplayer = '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 1009 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'. 1151 $icon = 'music.png'; 1152 } elseif ($item->type == 'video/x-flv') 1153 { 1154 $icon = 'film.png'; 1155 } elseif ($item->type == 'application/zip') 1156 { 1157 $icon = 'briefcase.png'; 1158 } elseif ($item->media_type == 'text') 1159 { 1160 $icon = 'page_white_text.png'; 1161 } else 1162 { 1163 $icon = 'information.png'; 1164 } 1165 1166 $mediaplayer = 1167 '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 1168 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'. 1010 1169 '<img src="'.$core->blog->getQmarkURL(). 1011 'pf=dlManager/images/ music.png" alt="'.__('Preview').'" />'.1170 'pf=dlManager/images/'.$icon.'" alt="'.__('Preview').'" />'. 1012 1171 '</a>'; 1013 } elseif ($item->type == 'video/x-flv')1014 {1015 $mediaplayer = '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'.1016 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'.1017 '<img src="'.$core->blog->getQmarkURL().1018 'pf=dlManager/images/film.png" alt="'.__('Preview').'" />'.1019 '</a>';1020 } elseif ($item->type == 'application/zip')1021 {1022 $mediaplayer = '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'.1023 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'.1024 '<img src="'.$core->blog->getQmarkURL().1025 'pf=dlManager/images/briefcase.png" alt="'.__('Preview').'" />'.1026 '</a>';1027 }1028 1172 1029 1173 $items_str .= sprintf($w->item,$core->blog->url. -
plugins/dlManager/default-templates/media.html
r550 r551 23 23 .size {white-space:pre;} 24 24 .number {text-align:right;} 25 .TB_overlayMacFFBGHack {background: url({{tpl:BlogQmarkURL}}pf=dlManager/images/macFFBgHack.png) repeat;}25 dt {font-weight:bold;} 26 26 </style> 27 27 28 <link rel="stylesheet" href="{{tpl:BlogQmarkURL}}pf=dlManager/default-templates/ thickbox.css" type="text/css" media="screen" />28 <link rel="stylesheet" href="{{tpl:BlogQmarkURL}}pf=dlManager/default-templates/facebox.css" type="text/css" media="screen" /> 29 29 30 30 {{tpl:include src="_head.html"}} 31 31 32 <script type="text/javascript" src="{{tpl:BlogQmarkURL}}pf=dlManager/js/ thickbox.js"></script>32 <script type="text/javascript" src="{{tpl:BlogQmarkURL}}pf=dlManager/js/facebox.pack.js"></script> 33 33 34 34 <script type="text/javascript"> 35 35 //<![CDATA[ 36 /* define this before $(document).ready() to avoid an error */ 37 var tb_pathToImage = "{{tpl:BlogQmarkURL}}pf=dlManager/images/loadingAnimation.gif"; 38 $(document).ready(function () { 39 $("a.thickbox").each(function() { 40 $(this).attr("href",this.href+"/js"); 36 $(document).ready(function () { 37 $.facebox.settings.opacity = 0.3; 38 $.facebox.settings.loadingImage = '{{tpl:BlogQmarkURL}}pf=dlManager/images/facebox/loading.gif'; 39 $.facebox.settings.closeImage = '{{tpl:BlogQmarkURL}}pf=dlManager/images/facebox/closelabel.gif'; 40 $('a.preview').click(function () { 41 $.get($(this).attr('href'), function(data) { 42 data = $(data).find('#file'); 43 var imagemeta = $(data).children('#imagemeta'); 44 imagemeta.children('dl').hide(); 45 imagemeta.children('h3').css({cursor:"pointer",textDecoration:"underline"}) 46 imagemeta.children('h3').click( function() { 47 $(this).siblings('dl').toggle(); 48 }); 49 $.facebox(data); 50 }); 51 return(false); 41 52 }); 42 53 }); … … 138 149 </td> 139 150 <td class="center"> 140 < !-- # image files -->141 <tpl:DLMItemIf media_type="image">142 < a href="{{tpl:DLMItemPlayerURL}}" class="preview thickbox" title="{{tpl:lang Preview:}} {{tpl:DLMItemBasename}}">151 <a href="{{tpl:DLMItemPlayerURL}}" class="preview" title="{{tpl:lang Preview:}} {{tpl:DLMItemBasename}}"> 152 <!-- # image files --> 153 <tpl:DLMItemIf media_type="image"> 143 154 <img src="{{tpl:BlogQmarkURL}}pf=dlManager/images/image.png" alt="{{tpl:lang Preview}}" /> 144 </a> 145 </tpl:DLMItemIf> 146 <!-- # mp3 files --> 147 <tpl:DLMItemIf type="audio/mpeg3"> 148 <a href="{{tpl:DLMItemPlayerURL}}" class="preview thickbox" title="{{tpl:lang Preview:}} {{tpl:DLMItemBasename}}"> 155 </tpl:DLMItemIf> 156 <!-- # mp3 files --> 157 <tpl:DLMItemIf type="audio/mpeg3"> 149 158 <img src="{{tpl:BlogQmarkURL}}pf=dlManager/images/music.png" alt="{{tpl:lang Preview}}" /> 150 </a> 151 </tpl:DLMItemIf> 152 <!-- # flv files --> 153 <tpl:DLMItemIf type="video/x-flv"> 154 <a href="{{tpl:DLMItemPlayerURL}}" class="preview thickbox" title="{{tpl:lang Preview:}} {{tpl:DLMItemBasename}}"> 159 </tpl:DLMItemIf> 160 <!-- # flv files --> 161 <tpl:DLMItemIf type="video/x-flv"> 155 162 <img src="{{tpl:BlogQmarkURL}}pf=dlManager/images/film.png" alt="{{tpl:lang Preview}}" /> 156 </a> 157 </tpl:DLMItemIf> 158 <!-- # zip files --> 159 <tpl:DLMItemIf type="application/zip"> 160 <a href="{{tpl:DLMItemPlayerURL}}" class="preview thickbox" title="{{tpl:lang Preview:}} {{tpl:DLMItemBasename}}"> 163 </tpl:DLMItemIf> 164 <!-- # zip files --> 165 <tpl:DLMItemIf type="application/zip"> 161 166 <img src="{{tpl:BlogQmarkURL}}pf=dlManager/images/briefcase.png" alt="{{tpl:lang Preview}}" /> 162 </a> 163 </tpl:DLMItemIf> 164 <!-- # other files --> 165 <tpl:DLMItemIf operator="&&" media_type="!image" type="!audio/mpeg3,video/x-flv,application/zip"> 166 <a href="{{tpl:DLMItemPlayerURL}}" class="preview thickbox" title="{{tpl:lang Informations:}} {{tpl:DLMItemBasename}}"> 167 </tpl:DLMItemIf> 168 <!-- # text files --> 169 <tpl:DLMItemIf media_type="text"> 170 <img src="{{tpl:BlogQmarkURL}}pf=dlManager/images/page_white_text.png" alt="{{tpl:lang Preview}}" /> 171 </tpl:DLMItemIf> 172 <!-- # other files --> 173 <tpl:DLMItemIf operator="&&" media_type="!image,text" type="!audio/mpeg3,video/x-flv,application/zip"> 167 174 <img src="{{tpl:BlogQmarkURL}}pf=dlManager/images/information.png" alt="{{tpl:lang Informations}}" /> 168 </ a>169 </ tpl:DLMItemIf>175 </tpl:DLMItemIf> 176 </a> 170 177 </td> 171 178 <td class="size">{{tpl:DLMItemSize format="1"}}</td> … … 184 191 </tbody> 185 192 </table> 186 <p>{{tpl:lang Page(s):}} {{tpl:DLMPageLinks}}</p> 193 <tpl:DLMIfPages> 194 <p>{{tpl:lang Page(s):}} {{tpl:DLMPageLinks}}</p> 195 </tpl:DLMIfPages> 187 196 </tpl:LoopPosition> 188 197 </tpl:DLMItems> -
plugins/dlManager/default-templates/media_player.html
r548 r551 20 20 21 21 <style type="text/css"> 22 textarea {width:100%;} 22 23 dt {font-weight:bold;} 23 24 </style> … … 35 36 <div id="content"> 36 37 37 {{tpl:include src="_media_player_content.html"}} 38 <div class="content-inner"> 39 <div id="content-info"> 40 <h2> 41 {{tpl:lang Download manager}} - {{tpl:lang Preview}} 42 </h2> 43 </div> 44 45 <tpl:SysIfFormError> 46 <div class="error">{{tpl:SysFormError}}</div> 47 </tpl:SysIfFormError> 48 49 <div id="dlmanager"> 50 <p> 51 <a href="{{tpl:DLMBaseURL}}">{{tpl:lang Home}}</a> / 52 <!-- # loop on directory path, display dir / subdir --> 53 <tpl:DLMBreadCrumb> 54 <a href="{{tpl:DLMBreadCrumbDirURL}}"> 55 {{tpl:DLMBreadCrumbDirName}}</a> / 56 </tpl:DLMBreadCrumb> 57 {{tpl:DLMItemBasename}} 58 </p> 59 60 <p><a href="{{tpl:DLMItemDirPath}}">{{tpl:lang Get back to the directory}}</a></p> 61 62 <div id="file"> 63 <div id="player"> 64 <tpl:DLMItemIf media_type="image"> 65 <!--<a href="{{tpl:DLMItemDlURL}}" title="{{tpl:DLMItemBasename}}">--> 66 <img src="{{tpl:DLMItemImageThumbPath size="m"}}" alt="{{tpl:DLMItemTitle}}" /> 67 <!--</a>--> 68 </tpl:DLMItemIf> 69 70 <tpl:DLMItemIf type="audio/mpeg3"> 71 {{tpl:include src="_mp3_player.html"}} 72 </tpl:DLMItemIf> 73 74 <tpl:DLMItemIf type="video/x-flv"> 75 {{tpl:include src="_flv_player.html"}} 76 </tpl:DLMItemIf> 77 78 <tpl:DLMItemIf type="application/zip"> 79 <h3>{{tpl:lang Zip file content}}</h3> 80 <tpl:DLMItemZipContent> 81 <tpl:LoopPosition start="1" length="1"> 82 <ul> 83 </tpl:LoopPosition> 84 <li>{{tpl:DLMItemZipContentFile}}</li> 85 <tpl:LoopPosition start="-1"> 86 </ul> 87 </tpl:LoopPosition> 88 </tpl:DLMItemZipContent> 89 </tpl:DLMItemIf> 90 91 <tpl:DLMItemIf media_type="text"> 92 <textarea cols="80" rows="20">{{tpl:DLMItemFileContent}}</textarea> 93 </tpl:DLMItemIf> 94 </div><!-- End #player --> 95 96 <h3> 97 <a href="{{tpl:DLMItemDlURL}}" title="{{tpl:DLMItemBasename}}"> 98 {{tpl:lang Download this file}} 99 </a> 100 </h3> 101 102 <h3>{{tpl:lang Informations}}</h3> 103 <dl> 104 <dt>{{tpl:lang Basename}}</dt> 105 <dd>{{tpl:DLMItemBasename}}</dd> 106 <dt>{{tpl:lang Type}}</dt> 107 <dd>{{tpl:DLMItemType}}</dd> 108 <dt>{{tpl:lang Size}}</dt> 109 <dd>{{tpl:DLMItemSize format="1"}}</dd> 110 <dt>{{tpl:lang Modification time}}</dt> 111 <dd>{{tpl:DLMItemMTime}}</dd> 112 <tpl:DLMIfDownloadCounter> 113 <dt>{{tpl:lang Download number}}</dt> 114 <dd>{{tpl:DLMItemDlCount}}</dd> 115 </tpl:DLMIfDownloadCounter> 116 </dl> 117 118 <tpl:DLMItemIf media_type="image"> 119 <div id="imagemeta"> 120 <tpl:DLMItemImageMeta> 121 <tpl:LoopPosition start="1" length="1"> 122 <h3>{{tpl:lang Image meta}}</h3> 123 <dl> 124 </tpl:LoopPosition> 125 <dt>{{tpl:DLMItemImageMetaName}}</dt> 126 <dd>{{tpl:DLMItemImageMetaValue}}</dd> 127 <tpl:LoopPosition start="-1"> 128 </dl> 129 </tpl:LoopPosition> 130 </tpl:DLMItemImageMeta> 131 </div><!-- End #imagemeta --> 132 </tpl:DLMItemIf> 133 134 <tpl:DLMItemEntries> 135 <tpl:LoopPosition start="1" length="1"> 136 <h3>{{tpl:lang Entries containing this media}}</h3> 137 <ul> 138 </tpl:LoopPosition> 139 <li> 140 <a href="{{tpl:EntryURL}}">{{tpl:EntryTitle encode_html="1"}} 141 ({{tpl:EntryDate format="%d/%m/%Y"}})</a> 142 </li> 143 <tpl:LoopPosition start="-1"> 144 </ul> 145 </tpl:LoopPosition> 146 </tpl:DLMItemEntries> 147 </div><!-- End #dlmanager --> 148 </div><!-- End #file --> 149 150 </div><!-- End #content-inner --> 38 151 39 152 </div><!-- End #content --> -
plugins/dlManager/index.php
r548 r551 33 33 $settings->put('dlmanager_active',!empty($_POST['dlmanager_active']), 34 34 'boolean','Enable DL Manager'); 35 $settings->put('dlmanager_hide',!empty($_POST['dlmanager_hide']), 36 'boolean','Hide files URLs'); 35 37 $settings->put('dlmanager_counter',!empty($_POST['dlmanager_counter']), 36 38 'boolean','Enable download counter'); … … 99 101 </p> 100 102 <p> 103 <?php echo form::checkbox('dlmanager_hide',1, 104 $core->blog->settings->dlmanager_hide); ?> 105 <label class="classic" for="dlmanager_hide"> 106 <?php echo __('Hide files URLs'); ?> 107 </label> 108 </p> 109 <p class="form-note"> 110 <?php echo __('The files will be served without revealing their URLs.'); 111 echo ' '; 112 printf(__('The public directory (or its subdirectories) can be in a restricted area or protected by a %1$s file containing %2$s.'), 113 '<strong>.htaccess</strong>','<strong>Deny from all</strong>'); ?> 114 </p> 115 <p> 101 116 <?php echo form::checkbox('dlmanager_counter',1, 102 117 $core->blog->settings->dlmanager_counter); ?> … … 145 160 <p> 146 161 <label for="dlmanager_root"> 147 <?php printf(__(' Change root of %s:'),__('Download manager'));148 echo form::combo('dlmanager_root',dlManager::listDirs( ),162 <?php printf(__('Define root of %s:'),__('Download manager')); 163 echo form::combo('dlmanager_root',dlManager::listDirs(false,true), 149 164 $core->blog->settings->dlmanager_root); ?> 150 165 </label> … … 154 169 printf(__('This will change the root of the %s page and of the widget.'), 155 170 __('Download manager')); 171 echo ' '; 156 172 printf(__('If you change this setting, reconfigure the %s widget.'), 157 173 __('Download manager')); ?> … … 170 186 <br /> 171 187 <code><?php echo dlManager::pageURL(); ?></code> 172 <br /> 188 </p> 189 <p> 173 190 <a href="<?php echo dlManager::pageURL(); ?>"> 174 191 <?php printf(__('View the %s page'),__('Download manager')); ?></a> -
plugins/dlManager/lib.dlManager.php
r549 r551 34 34 @return <b>array</b> Subdirectories 35 35 */ 36 public static function listDirs($in_jail=false) 37 { 38 global $core; 39 36 public static function listDirs($in_jail=false,$empty_value=false) 37 { 38 global $core; 39 40 $dirs = array(); 41 40 42 # empty default value 41 $dirs = array(''=> ''); 43 if ($empty_value) 44 { 45 $dirs = array(''=> ''); 46 } 42 47 43 48 try … … 51 56 { 52 57 $path = $v->relname; 53 if ($in_jail && self::inJail($path))58 if ($in_jail) 54 59 { 55 $dirs[$path] = $path; 60 if (self::inJail($path)) 61 { 62 $dirs[$path] = $path; 63 } 56 64 } 57 65 else … … 170 178 'media_title' => (isset($v->media_title) ? $v->media_title : ''), 171 179 'size' => (isset($v->size) ? $v->size : ''), 180 'file' => (isset($v->file) ? $v->file : ''), 172 181 'file_url' => (isset($v->file_url) ? $v->file_url : ''), 173 'media_id' => (isset($v->media_id) ? $v->media_id : ''),174 182 'media_id' => (isset($v->media_id) ? $v->media_id : ''), 175 183 'basename' => (isset($v->basename) ? $v->basename : ''), … … 178 186 'media_type' => (isset($v->media_type) ? $v->media_type : ''), 179 187 'media_dtstr' => (isset($v->media_dtstr) ? $v->media_dtstr : ''), 180 'media_thumb' => (isset($v->media_thumb) ? $v->media_thumb : '') 188 'media_thumb' => (isset($v->media_thumb) ? $v->media_thumb : ''), 189 'media_meta' => (isset($v->media_meta) ? $v->media_meta : '') 181 190 ); 182 191 } -
plugins/dlManager/locales/fr/main.po
r550 r551 3 3 "Project-Id-Version: DL Manager\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2008-11-0 7 00:06+0100\n"6 "PO-Revision-Date: 2008-11-0 7 00:06+0100\n"5 "POT-Creation-Date: 2008-11-08 01:42+0100\n" 6 "PO-Revision-Date: 2008-11-08 01:42+0100\n" 7 7 "Last-Translator: Moe <poedit@gniark.net>\n" 8 8 "Language-Team: Moe <poedit@gniark.net>\n" … … 17 17 "X-Poedit-SearchPath-0: .\n" 18 18 19 #: _public.php:1 3019 #: _public.php:142 20 20 msgid "parent directory" 21 21 msgstr "répertoire parent" 22 22 23 #: _public.php:144 24 msgid "previous page" 25 msgstr "page précédente" 26 27 #: _public.php:145 28 msgid "next page" 29 msgstr "page suivante" 30 31 #: _public.php:1002 32 #: _public.php:1009 33 #: _public.php:1016 34 #: _public.php:1023 23 #: _public.php:161 24 msgid "previous" 25 msgstr "précédente" 26 27 #: _public.php:162 28 msgid "next" 29 msgstr "suivante" 30 31 #: _public.php:1168 35 32 #: public_l10n.php:22 36 33 msgid "Preview :" 37 34 msgstr "" 38 35 39 #: _public.php:1004 40 #: _public.php:1011 41 #: _public.php:1018 42 #: _public.php:1025 36 #: _public.php:1170 43 37 #: public_l10n.php:23 44 38 msgid "Preview" 45 39 msgstr "" 46 40 47 #: lib.dlManager.php: 8241 #: lib.dlManager.php:90 48 42 msgid "By names, ascendant" 49 43 msgstr "Par noms, croissants" 50 44 51 #: lib.dlManager.php: 8345 #: lib.dlManager.php:91 52 46 msgid "By names, descendant" 53 47 msgstr "Par noms, décroissants" 54 48 55 #: lib.dlManager.php: 8449 #: lib.dlManager.php:92 56 50 msgid "By dates, ascendant" 57 51 msgstr "Par dates, croissantes" 58 52 59 #: lib.dlManager.php: 8553 #: lib.dlManager.php:93 60 54 msgid "By dates, descendant" 61 55 msgstr "Par dates, décroissantes" 62 56 63 57 #: _admin.php:26 64 #: index.php:7 665 #: index.php:8 058 #: index.php:78 59 #: index.php:82 66 60 msgid "Download Manager" 67 61 msgstr "Gestionnaire de téléchargements" … … 72 66 #: _admin.php:81 73 67 #: public_l10n.php:5 74 #: index.php: 8875 #: index.php:9 376 #: index.php: 9877 #: index.php:1 1278 #: index.php:1 4779 #: index.php:1 5580 #: index.php:1 5781 #: index.php:1 6382 #: index.php:1 6983 #: index.php:1 7468 #: index.php:90 69 #: index.php:95 70 #: index.php:100 71 #: index.php:127 72 #: index.php:162 73 #: index.php:170 74 #: index.php:173 75 #: index.php:179 76 #: index.php:185 77 #: index.php:191 84 78 msgid "Download manager" 85 79 msgstr "Gestionnaire de téléchargements" … … 98 92 #: _admin.php:56 99 93 #: public_l10n.php:25 100 #: index.php:1 3794 #: index.php:152 101 95 msgid "Sort files:" 102 96 msgstr "Trier les fichiers :" … … 108 102 #: _admin.php:62 109 103 msgid "Display subdirectories" 110 msgstr "Afficher les sous-répertoires :"104 msgstr "Afficher les sous-répertoires" 111 105 112 106 #: _admin.php:65 … … 229 223 msgstr "Contenu du fichier zip" 230 224 231 #: index.php:7 0225 #: index.php:72 232 226 msgid "Configuration successfully updated." 233 227 msgstr "Configuration mise à jour avec succès." 234 228 235 #: index.php:9 3229 #: index.php:95 236 230 #, php-format 237 231 msgid "Enable the %s" 238 msgstr "Activer %s"239 240 #: index.php:9 7232 msgstr "Activer le %s" 233 234 #: index.php:99 241 235 #, php-format 242 236 msgid "The %s display media on a public page." 243 237 msgstr "Le %s affiche les médias sur une page publique." 244 238 245 #: index.php:104 239 #: index.php:106 240 msgid "Hide files URLs" 241 msgstr "Cacher les URLs des fichiers" 242 243 #: index.php:110 244 msgid "The files will be served without revealing their URLs." 245 msgstr "Les fichiers seront servis sans révéler leurs URLs." 246 247 #: index.php:112 248 #, php-format 249 msgid "The public directory (or its subdirectories) can be in a restricted area or protected by a %1$s file containing %2$s." 250 msgstr "Le répertoire public (ou ses sous-répertoires) peut être dans une zone protégée ou protégé par un fichier %1$s contenant %2$s." 251 252 #: index.php:119 246 253 msgid "Enable the download counter" 247 254 msgstr "Activer le compteur de téléchargements" 248 255 249 #: index.php:1 11256 #: index.php:126 250 257 #, php-format 251 258 msgid "Redirect attachments links to %s" 252 259 msgstr "Rediriger les liens des pièces jointes vers %s" 253 260 254 #: index.php:1 16261 #: index.php:131 255 262 msgid "When downloading an attachment, the download counter will be increased." 256 263 msgstr "Lors du téléchargement d'une pièce jointe, le compteur de téléchargements sera augmenté." 257 264 258 #: index.php:1 17265 #: index.php:132 259 266 #, php-format 260 267 msgid "This will redefine the %s tag." 261 268 msgstr "Ceci redéfinira la balise %s." 262 269 263 #: index.php:1 22270 #: index.php:137 264 271 msgid "Files per page:" 265 272 msgstr "Fichiers par page :" 266 273 267 #: index.php:1 32274 #: index.php:147 268 275 msgid "Allow visitors to choose how to sort files" 269 276 msgstr "Autoriser les visiteurs à choisir l'ordre des fichiers" 270 277 271 #: index.php:1 43272 #: index.php:1 53278 #: index.php:158 279 #: index.php:168 273 280 msgid "Leave empty to cancel this feature." 274 281 msgstr "" 275 282 276 #: index.php:1 47277 #, php-format 278 msgid " Change root of %s:"279 msgstr " Changer la racine de %s :"280 281 #: index.php:1 54283 #: index.php:162 284 #, php-format 285 msgid "Define root of %s:" 286 msgstr "Définir la racine de %s :" 287 288 #: index.php:169 282 289 #, php-format 283 290 msgid "This will change the root of the %s page and of the widget." 284 291 msgstr "Ceci changera la racine de la page %s et du widget." 285 292 286 #: index.php:1 56293 #: index.php:172 287 294 #, php-format 288 295 msgid "If you change this setting, reconfigure the %s widget." 289 296 msgstr "Si vous changez ce paramètre, reconfigurez le widget %s." 290 297 291 #: index.php:1 62298 #: index.php:178 292 299 #, php-format 293 300 msgid "Files can be excluded from %1$s by editing %2$s in %3$s." 294 301 msgstr "Les fichiers peuvent être exclus de %1$s en éditant %2$s< dans %3$s." 295 302 296 #: index.php:1 65303 #: index.php:181 297 304 #, php-format 298 305 msgid "For example, to exclude %1$s and %2$s files : <code>%3$s</code>" 299 306 msgstr "Par exemple, pour exclure les fichiers %1$s et %2$s : <code>%3$s</code>" 300 307 301 #: index.php:1 69308 #: index.php:185 302 309 #, php-format 303 310 msgid "URL of the %s page :" 304 311 msgstr "URL de la page %s :" 305 312 306 #: index.php:1 74313 #: index.php:191 307 314 #, php-format 308 315 msgid "View the %s page" 309 316 msgstr "Voir la page %s" 310 317 311 #: index.php:1 79318 #: index.php:196 312 319 msgid "Save configuration" 313 320 msgstr "Enregistrer la configuration"
Note: See TracChangeset
for help on using the changeset viewer.