Changeset 537
- Timestamp:
- 10/27/08 17:36:04 (15 years ago)
- google:author:
- appears
- Location:
- plugins/dlManager
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dlManager/_define.php
r536 r537 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-beta 9',30 /* Version */ '1.0-beta10', 31 31 /* Permissions */ 'admin' 32 32 ); -
plugins/dlManager/_public.php
r536 r537 54 54 # exit if the public_path (and Media root) doesn't exist 55 55 if (!is_dir($core->blog->public_path)) {self::p404();} 56 57 if (!is_object($core->media)) 58 { 59 $core->media = new dcMedia($core); 60 } 61 56 62 57 # define root of DL Manager 63 58 $page_root = $core->blog->settings->dlmanager_root; … … 90 85 { 91 86 $dir = trim($dir); 87 88 # check 89 if (($dir == '.') OR ($dir == '..')) {self::p404();} 90 92 91 if (!empty($dir)) 93 92 { … … 192 191 # exit if the public_path (and Media root) doesn't exist 193 192 if (!is_dir($core->blog->public_path)) {self::p404();} 194 195 if (!is_object($core->media)) 196 { 197 $core->media = new dcMedia($core); 198 } 199 193 200 194 $file = $core->media->getFile($args); 201 195 202 if ( empty($file->file))196 if ((empty($file->file)) || (!is_readable($file->file))) 203 197 { 204 198 self::p404(); 205 199 } 206 200 201 $_ctx->dlManager_item = $file; 202 $_ctx->file_url = $file->file_url; 203 204 # define root of DL Manager 207 205 $page_root = $core->blog->settings->dlmanager_root; 208 206 207 # used to remove root from path 208 $page_root_len = strlen($page_root); 209 210 # remove slash at the beginning of the string 211 if ($page_root_len > 0) {$page_root_len += 1;} 212 209 213 if (!empty($page_root)) 210 214 { … … 214 218 } 215 219 } 216 217 if (is_readable($file->file)) 218 { 219 $_ctx->dlManager_item = $file; 220 $_ctx->file_url = $file->file_url; 221 222 # compatibility with Dotclear revisions < 2445 223 global $attach_f; 224 $attach_f = new ArrayObject(); 225 $attach_f->file_url = $file->file_url; 226 227 $core->tpl->setPath($core->tpl->getPath(), 228 dirname(__FILE__).'/default-templates/'); 229 230 self::serveDocument('media_player.html','text/html'); 231 } 220 221 $_ctx->dlManager_item->relname = 222 dirname(substr($_ctx->dlManager_item->relname,$page_root_len)); 223 if ($_ctx->dlManager_item->relname == '.') 224 { 225 $_ctx->dlManager_item->relname = ''; 226 } 227 228 # BreadCrumb 229 $breadCrumb = array(); 230 231 # if visitor asked a directory 232 233 $_ctx->dlManager_currentDir = $_ctx->dlManager_item->relname; 234 $page_dir = $page_root.'/'.$_ctx->dlManager_currentDir; 235 236 # BreadCrumb 237 $base_url = dlManager::pageURL().'/'; 238 $dirs = explode('/',$_ctx->dlManager_currentDir); 239 $path = ''; 240 241 foreach ($dirs as $dir) 242 { 243 $dir = trim($dir); 244 245 # check 246 if (($dir == '.') OR ($dir == '..')) {self::p404();} 247 248 if (!empty($dir)) 249 { 250 $path = (($path == '') ? $dir : $path.'/'.$dir); 251 $breadCrumb[$dir] = $base_url.$path; 252 } 253 } 254 255 $_ctx->dlManager_BreadCrumb = $breadCrumb; 256 unset($breadCrumb); 257 # /BreadCrumb 258 259 # compatibility with Dotclear revisions < 2445 260 global $attach_f; 261 $attach_f = new ArrayObject(); 262 $attach_f->file_url = $file->file_url; 263 264 $core->tpl->setPath($core->tpl->getPath(), 265 dirname(__FILE__).'/default-templates/'); 266 267 self::serveDocument('media_player.html','text/html'); 232 268 } 233 269 … … 243 279 self::p404(); 244 280 } 245 246 if (!is_object($core->media)) 247 { 248 $core->media = new dcMedia($core); 249 } 250 281 251 282 $file = $core->media->getFile($args); 252 283 … … 272 303 $count[$file->media_id] = array_key_exists($file->media_id,$count) 273 304 ? $count[$file->media_id]+1 : 1; 274 if (!is_object($core->blog->settings)) 275 { 276 $settings = new dcSettings($core,$core->blog->id); 277 } 278 else 279 { 280 $settings =& $core->blog->settings; 281 } 305 306 $settings =& $core->blog->settings; 307 282 308 $settings->setNamespace('dlmanager'); 283 309 $settings->put('dlmanager_count_dl',serialize($count),'string', … … 934 960 return; 935 961 } 936 937 if (!is_object($core->media)) 938 { 939 $core->media = new dcMedia($core); 940 } 941 962 942 963 # from /dotclear/admin/media.php 943 964 if ($w->file_sort) { -
plugins/dlManager/default-templates/media.html
r536 r537 50 50 51 51 <div id="dlmanager"> 52 <h3>{{tpl:lang Directories}}</h3>53 54 52 <p> 55 53 <a href="{{tpl:DLMBaseURL}}">{{tpl:lang Home}}</a> / 56 <!-- # loop on directory path, display full / 3 / 2 / 1-->54 <!-- # loop on directory path, display dir / subdir --> 57 55 <tpl:DLMBreadCrumb> 58 56 <a href="{{tpl:DLMBreadCrumbDirURL}}"> … … 62 60 </tpl:DLMBreadCrumb> 63 61 </p> 64 62 63 <h3>{{tpl:lang Directories}}</h3> 64 65 65 <tpl:DLMIfNoItem type="dirs"> 66 66 <p>{{tpl:lang No directory.}}</p> -
plugins/dlManager/default-templates/media_player.html
r536 r537 7 7 <meta name="MSSmartTagsPreventParsing" content="TRUE" /> 8 8 <meta name="robots" content="noindex, nofollow" /> 9 <title>{{tpl:lang Download manager}} - {{tpl:DLMItemTitle}} - {{tpl:BlogName encode_html="1"}}</title>9 <title>{{tpl:lang Preview}} - {{tpl:DLMItemTitle}} - {{tpl:BlogName encode_html="1"}}</title> 10 10 11 11 <link rel="top" href="{{tpl:BlogURL}}" title="{{tpl:lang Home}}" /> … … 38 38 <div id="content-info"> 39 39 <h2> 40 {{tpl:lang Download manager}}40 {{tpl:lang Preview}} 41 41 </h2> 42 42 </div> 43 44 <p><a href="{{tpl:DLMBaseURL}}">{{tpl:lang Home}}</a></p> 45 43 46 44 <tpl:DLMIfError> 47 45 <div class="error"> … … 51 49 52 50 <div id="dlmanager"> 53 <h3>{{tpl:lang Preview :}} {{tpl:DLMItemTitle}}</h3> 51 <p> 52 <a href="{{tpl:DLMBaseURL}}">{{tpl:lang Home}}</a> / 53 <!-- # loop on directory path, display dir / subdir --> 54 <tpl:DLMBreadCrumb> 55 <a href="{{tpl:DLMBreadCrumbDirURL}}"> 56 {{tpl:DLMBreadCrumbDirName}}</a> 57 <tpl:DLMBreadCrumbSeparator last="1"> / 58 </tpl:DLMBreadCrumbSeparator> 59 </tpl:DLMBreadCrumb> 60 {{tpl:DLMItemBasename}} 61 </p> 62 63 <p><a href="{{tpl:DLMItemDirPath}}">{{tpl:lang Get back to the directory}}</a></p> 64 54 65 <p> 55 66 <a href="{{tpl:DLMItemDlURL}}" title="{{tpl:DLMItemBasename}}"> … … 58 69 </p> 59 70 71 <div id="player"> 60 72 <tpl:DLMItemIf media_type="image"> 61 <img src="{{tpl:DLMItemImageThumbPath size="m"}}" alt="{{tpl:DLMItemTitle}}" /> 73 <a href="{{tpl:DLMItemDlURL}}" title="{{tpl:DLMItemBasename}}"> 74 <img src="{{tpl:DLMItemImageThumbPath size="m"}}" alt="{{tpl:DLMItemTitle}}" /> 75 </a> 62 76 </tpl:DLMItemIf> 63 64 <div id="player"> 77 65 78 <tpl:DLMItemIf type="audio/mpeg3"> 66 79 {{tpl:include src="_mp3_player.html"}} -
plugins/dlManager/lib.dlManager.php
r533 r537 36 36 global $core; 37 37 38 # empty default value 38 39 $dirs = array(''=> ''); 39 40 $public_path = path::real($core->blog->public_path); 41 if (!is_dir($public_path)) {return(array());} 42 43 # +1 : remove slash at the beginning of the path when using substr() 44 $len_public_path = strlen($public_path)+1; 45 46 $dirList = files::getDirList($public_path); 47 48 foreach ($dirList['dirs'] as $dir) 40 41 try 49 42 { 50 if ( $dir != $public_path)43 if (!is_object($core->media)) 51 44 { 52 $dir = substr($dir,$len_public_path); 53 $dirs[$dir] = $dir; 45 $core->media = new dcMedia($core); 46 } 47 # from gallery/gal.php 48 foreach ($core->media->getRootDirs() as $v) 49 { 50 $dirs[$v->relname] = $v->relname; 54 51 } 55 52 } 56 53 catch (Exception $e) 54 { 55 $core->error->add($e->getMessage()); 56 } 57 57 58 return($dirs); 58 59 } -
plugins/dlManager/locales/fr/main.po
r536 r537 3 3 "Project-Id-Version: DL Manager\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2008-10-2 6 23:28+0100\n"6 "PO-Revision-Date: 2008-10-2 6 23:28+0100\n"5 "POT-Creation-Date: 2008-10-27 17:29+0100\n" 6 "PO-Revision-Date: 2008-10-27 17:29+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:15 519 #: _public.php:154 20 20 #: public_l10n.php:7 21 21 msgid "parent directory" 22 22 msgstr "répertoire parent" 23 23 24 #: _public.php:9 4825 #: _public.php:9 5424 #: _public.php:982 25 #: _public.php:989 26 26 msgid "Preview :" 27 27 msgstr "" 28 28 29 #: _public.php:9 4930 #: _public.php:9 5529 #: _public.php:984 30 #: _public.php:991 31 31 msgid "Preview" 32 32 msgstr "" 33 33 34 #: lib.dlManager.php:7 134 #: lib.dlManager.php:72 35 35 msgid "By names, ascendant" 36 36 msgstr "Par noms, croissants" 37 37 38 #: lib.dlManager.php:7 238 #: lib.dlManager.php:73 39 39 msgid "By names, descendant" 40 40 msgstr "Par noms, décroissants" 41 41 42 #: lib.dlManager.php:7 342 #: lib.dlManager.php:74 43 43 msgid "By dates, ascendant" 44 44 msgstr "Par dates, croissantes" 45 45 46 #: lib.dlManager.php:7 446 #: lib.dlManager.php:75 47 47 msgid "By dates, descendant" 48 48 msgstr "Par dates, décroissantes" … … 214 214 215 215 #: public_l10n.php:25 216 msgid "Get back to the directory" 217 msgstr "Revenir au répertoire" 218 219 #: public_l10n.php:26 216 220 msgid "Download this file" 217 221 msgstr "Télécharger ce fichier" 218 222 223 #: public_l10n.php:27 224 msgid "Image meta" 225 msgstr "Méta données" 226 -
plugins/dlManager/public_l10n.php
r536 r537 23 23 24 24 # media_item.html 25 __('Get back to the directory'); 25 26 __('Download this file'); 27 __('Image meta'); 26 28 ?>
Note: See TracChangeset
for help on using the changeset viewer.