Changeset 552
- Timestamp:
- 11/09/08 16:31:25 (15 years ago)
- google:author:
- appears
- Location:
- plugins/dlManager
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dlManager/_define.php
r551 r552 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 4',30 /* Version */ '1.0-RC5', 31 31 /* Permissions */ 'admin' 32 32 ); -
plugins/dlManager/_prepend.php
r551 r552 31 31 '^mediaplayer/([0-9]+)$',array('dlManagerPageDocument','player')); 32 32 $core->url->register('download','download', 33 '^download/([0-9]+)$',array('dlManagerPageDocument',' wrapper'));33 '^download/([0-9]+)$',array('dlManagerPageDocument','download')); 34 34 $core->url->register('viewfile','viewfile', 35 35 '^viewfile/(.+)$',array('dlManagerPageDocument','viewfile')); -
plugins/dlManager/_public.php
r551 r552 32 32 private static function check() 33 33 { 34 34 35 global $core; 35 36 … … 70 71 $page_dir = $page_root; 71 72 72 $_ctx->dlManager_currentDir = '/'; 73 $dir = '/'; 74 $_ctx->dlManager_currentDir = __('Home'); 75 73 76 $root = true; 74 77 … … 77 80 { 78 81 $_ctx->dlManager_currentDir = substr($args,1); 79 $page_dir = $page_root.'/'.$_ctx->dlManager_currentDir; 82 $dir = substr($args,1); 83 $page_dir = $page_root.'/'.$dir; 80 84 $root = false; 81 85 } 82 86 83 87 # BreadCrumb 84 $_ctx->dlManager_BreadCrumb = dlManager::breadCrumb($ _ctx->dlManager_currentDir);88 $_ctx->dlManager_BreadCrumb = dlManager::breadCrumb($dir); 85 89 # /BreadCrumb 86 90 … … 215 219 216 220 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 { 221 222 $file = $core->media->getFile($args); 222 223 … … 227 228 228 229 # file_url for mp3 and flv players 229 $_ctx->file_url = $core->blog->url.$core->url->getBase('viewfile').'/'. 230 $file->media_id; 230 if ($core->blog->settings->dlmanager_hide_urls) 231 { 232 $_ctx->file_url = $core->blog->url.$core->url->getBase('viewfile'). 233 '/'.$file->media_id; 234 } 235 else 236 { 237 $_ctx->file_url = $file->file_url; 238 } 231 239 232 240 # define root of DL Manager … … 283 291 @param count <b>boolean</b> Count download 284 292 */ 285 public static function wrapper($args,$count=true)293 public static function download($args) 286 294 { 287 295 global $core; … … 289 297 self::check(); 290 298 291 if ( empty($args)) {self::p404();}299 if (!preg_match('/^[0-9]+$/',$args)) {self::p404();} 292 300 293 301 try … … 299 307 self::p404(); 300 308 } 301 302 $page_root = $core->blog->settings->dlmanager_root;303 309 304 310 if (!dlManager::inJail($file->relname)) {self::p404();} … … 306 312 if (is_readable($file->file)) 307 313 { 308 if ($co unt && $core->blog->settings->dlmanager_counter)314 if ($core->blog->settings->dlmanager_counter) 309 315 { 310 316 $count = unserialize($core->blog->settings->dlmanager_count_dl); … … 327 333 readfile($file->file); 328 334 exit; 329 /*header('Location:'.$file->file_url);330 exit; */335 # header('Location:'.$file->file_url); 336 exit; 331 337 } 332 338 } … … 345 351 global $core; 346 352 347 if (!$GLOBALS['core']->blog->settings->dlmanager_hide 353 if (!$GLOBALS['core']->blog->settings->dlmanager_hide_urls 348 354 || empty($args) || !$core->blog->settings->dlmanager_active) 349 355 { … … 352 358 353 359 try 354 { 355 $elements = explode('/',$args); 356 360 { 357 361 # 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]; 362 if (preg_match('/^[0-9]+$/',$args,$matches)) 363 { 364 $file = $core->media->getFile($matches[0]); 367 365 368 $file = $core->media->getFile($args); 366 if (empty($file->file) || ($file->type != 'audio/mpeg3' 367 && $file->type != 'video/x-flv' && $file->media_type != 'image')) 368 { 369 self::p404(); 370 } 371 372 $file_path = $file->file; 373 } 374 # image thumbnail 375 # \see http://fr.php.net/preg_match 376 elseif (preg_match('@^([0-9]+)/(m|s|t|sq)$@',$args,$matches)) 377 { 378 $file_id = $matches[1]; 379 $size = $matches[2]; 380 381 $file = $core->media->getFile($file_id); 369 382 370 383 # check that the file is an image and the requested size is valid … … 378 391 { 379 392 # get the directory of the file and the filename of the thumbnail 380 $ image= dirname($file->file).'/'.basename($file->media_thumb[$size]);393 $file_path = dirname($file->file).'/'.basename($file->media_thumb[$size]); 381 394 } else 382 395 { 383 $ image= $file->file;396 $file_path = $file->file; 384 397 } 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 } 398 } 399 else 400 { 401 self::p404(); 402 } 403 404 if ((!dlManager::inJail($file->relname)) || (!is_readable($file_path))) 405 { 406 self::p404(); 407 } 408 409 http::$cache_max_age = 36000; 410 http::cache(array_merge(array($file_path),get_included_files())); 411 header('Content-type: '.$file->type); 412 header('Content-Length: '.filesize($file_path)); 413 readfile($file_path); 414 exit; 393 415 } 394 416 catch (Exception $e) … … 615 637 $type = ($attr['type'] == 'dirs') ? 'dirs' : 'files'; 616 638 617 return('<?php if ( count($_ctx->{\'dlManager_'.$type.'\'}) == 0) : ?>'.639 return('<?php if ($_ctx->{\'dlManager_'.$type.'\'}->count() == 0) : ?>'. 618 640 $content. 619 641 '<?php endif; ?>'); … … 799 821 $f = $GLOBALS['core']->tpl->getFilters($attr); 800 822 801 if ($GLOBALS['core']->blog->settings->dlmanager_hide )823 if ($GLOBALS['core']->blog->settings->dlmanager_hide_urls) 802 824 { 803 825 return('<?php echo($core->blog->url.'. … … 889 911 public static function itemMTime($attr) 890 912 { 891 $f = $GLOBALS['core']->tpl->getFilters($attr); 892 893 return('<?php echo '.sprintf($f,'$_ctx->items->media_dtstr').'; ?>'); 913 global $core; 914 915 $f = $GLOBALS['core']->tpl->getFilters($attr); 916 917 $str = '$_ctx->items->media_dtstr'; 918 919 if (isset($attr['format'])) 920 { 921 if ($attr['format'] == 'date_format') 922 { 923 $format = $GLOBALS['core']->blog->settings->date_format; 924 } 925 elseif ($attr['format'] == 'time_format') 926 { 927 $format = $GLOBALS['core']->blog->settings->time_format; 928 } 929 else 930 { 931 $format = $attr['format']; 932 } 933 934 $str = 'dt::dt2str(\''.$format.'\','.$str.')'; 935 } 936 937 return('<?php echo '.sprintf($f,$str).'; ?>'); 894 938 } 895 939 … … 934 978 {$size = $attr['size'];} 935 979 936 if ($GLOBALS['core']->blog->settings->dlmanager_hide )980 if ($GLOBALS['core']->blog->settings->dlmanager_hide_urls) 937 981 { 938 982 return('<?php '. … … 1166 1210 $mediaplayer = 1167 1211 '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 1168 $item->media_id.'" title="'.__('Preview 1212 $item->media_id.'" title="'.__('Preview:').' '.$item->media_title.'">'. 1169 1213 '<img src="'.$core->blog->getQmarkURL(). 1170 1214 'pf=dlManager/images/'.$icon.'" alt="'.__('Preview').'" />'. -
plugins/dlManager/default-templates/media.html
r551 r552 177 177 </td> 178 178 <td class="size">{{tpl:DLMItemSize format="1"}}</td> 179 <!-- #<td>{{tpl:DLMItemType}}</td> 180 return "text/plain" --> 181 <!-- #<td>{{tpl:DLMItemMediaType}}</td> 182 return "text" --> 183 <!-- #<td>{{tpl:DLMItemExtension}}</td> 184 return "txt" --> 185 <td>{{tpl:DLMItemMTime}}</td> 179 <!-- #<td>{{tpl:DLMItemType}}</td> return "text/plain" --> 180 <!-- #<td>{{tpl:DLMItemMediaType}}</td> return "text" --> 181 <!-- #<td>{{tpl:DLMItemExtension}}</td> return "txt" --> 182 <!-- # date_format and time_format use blog settings, 183 see http://php.net/strftime for other syntax --> 184 <td>{{tpl:DLMItemMTime format="date_format"}} {{tpl:DLMItemMTime format="time_format"}}</td> 186 185 <tpl:DLMIfDownloadCounter> 187 186 <td class="number">{{tpl:DLMItemDlCount}}</td> -
plugins/dlManager/default-templates/media_player.html
r551 r552 109 109 <dd>{{tpl:DLMItemSize format="1"}}</dd> 110 110 <dt>{{tpl:lang Modification time}}</dt> 111 <dd>{{tpl:DLMItemMTime}}</dd> 111 <!-- # date_format and time_format use blog settings, 112 see http://php.net/strftime for other syntax --> 113 <dd>{{tpl:DLMItemMTime format="date_format"}} {{tpl:DLMItemMTime format="time_format"}}</dd> 112 114 <tpl:DLMIfDownloadCounter> 113 115 <dt>{{tpl:lang Download number}}</dt> -
plugins/dlManager/index.php
r551 r552 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']),35 $settings->put('dlmanager_hide_urls',!empty($_POST['dlmanager_hide_urls']), 36 36 'boolean','Hide files URLs'); 37 37 $settings->put('dlmanager_counter',!empty($_POST['dlmanager_counter']), … … 101 101 </p> 102 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.');103 <?php echo form::checkbox('dlmanager_hide_urls',1, 104 $core->blog->settings->dlmanager_hide_urls); ?> 105 <label class="classic" for="dlmanager_hide_urls"> 106 <?php echo __('Hide URLs of images, mp3 and flv files'); ?> 107 </label> 108 </p> 109 <p class="form-note"> 110 <?php echo __('The images, mp3 and flv files will be served without revealing their URLs.'); 111 111 echo ' '; 112 112 printf(__('The public directory (or its subdirectories) can be in a restricted area or protected by a %1$s file containing %2$s.'), -
plugins/dlManager/lib.dlManager.php
r551 r552 123 123 { 124 124 $dir = trim($dir); 125 126 # check127 if (($dir == '.') OR ($dir == '..')) {self::p404();}128 125 129 126 if (!empty($dir)) -
plugins/dlManager/locales/fr/main.po
r551 r552 3 3 "Project-Id-Version: DL Manager\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2008-11-0 8 01:42+0100\n"6 "PO-Revision-Date: 2008-11-0 8 01:42+0100\n"5 "POT-Creation-Date: 2008-11-09 04:14+0100\n" 6 "PO-Revision-Date: 2008-11-09 04:14+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:142 19 #: _public.php:74 20 #: public_l10n.php:14 21 msgid "Home" 22 msgstr "" 23 24 #: _public.php:146 20 25 msgid "parent directory" 21 26 msgstr "répertoire parent" 22 27 23 #: _public.php:16 128 #: _public.php:165 24 29 msgid "previous" 25 30 msgstr "précédente" 26 31 27 #: _public.php:16 232 #: _public.php:166 28 33 msgid "next" 29 34 msgstr "suivante" 30 35 31 #: _public.php:1 16836 #: _public.php:1213 32 37 #: public_l10n.php:22 33 msgid "Preview 34 msgstr "" 35 36 #: _public.php:1 17038 msgid "Preview:" 39 msgstr "" 40 41 #: _public.php:1215 37 42 #: public_l10n.php:23 38 43 msgid "Preview" … … 179 184 msgstr "Revenir au répertoire" 180 185 181 #: public_l10n.php:14182 msgid "Home"183 msgstr ""184 185 186 #: public_l10n.php:15 186 187 msgid "Image meta" … … 238 239 239 240 #: index.php:106 240 msgid "Hide files URLs"241 msgstr "Cacher les URLs des fichiers"241 msgid "Hide URLs of images, mp3 and flv files" 242 msgstr "Cacher les URLs des images et des fichiers mp3 et flv" 242 243 243 244 #: index.php:110 244 msgid "The files will be served without revealing their URLs."245 msgstr "Les fichiersseront servis sans révéler leurs URLs."245 msgid "The images, mp3 and flv files will be served without revealing their URLs." 246 msgstr "Les images et les fichiers mp3 et flv seront servis sans révéler leurs URLs." 246 247 247 248 #: index.php:112 … … 320 321 msgstr "Enregistrer la configuration" 321 322 323 #~ msgid "Hide files URLs" 324 #~ msgstr "Cacher les URLs des fichiers" 325 -
plugins/dlManager/public_l10n.php
r550 r552 20 20 __("No file."); 21 21 __("Page(s):"); 22 __("Preview 22 __("Preview:"); 23 23 __("Preview"); 24 24 __("Size");
Note: See TracChangeset
for help on using the changeset viewer.