Changeset 542
- Timestamp:
- 11/03/08 00:33:01 (15 years ago)
- google:author:
- appears
- Location:
- plugins/dlManager
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dlManager/_admin.php
r533 r542 110 110 # filemanager->$exclude_list is protected 111 111 '<p>'. 112 sprintf(__('Files can be excluded from %1$s by editing <strong>%2$s</strong> in <strong>%3$s</strong>.'), 112 sprintf( 113 __('Files can be excluded from %1$s by editing <strong>%2$s</strong> in <strong>%3$s</strong>.'), 113 114 __('Download manager'),'media_exclusion',__('about:config')).' '. 114 115 sprintf(__('For example, to exclude %1$s and %2$s files : <code>%3$s</code>'), … … 136 137 $tz = $core->blog->settings->blog_timezone; 137 138 138 $w->create('dlManager',__('Download manager'),array('dlManagerWidget','show')); 139 $w->create('dlManager',__('Download manager'), 140 array('dlManagerWidget','show')); 139 141 140 $w->dlManager->setting('title',__('Title:').' ('.__('optional').')',__('Download manager'),'text'); 142 $w->dlManager->setting('title',__('Title:').' ('.__('optional').')', 143 __('Download manager'),'text'); 141 144 142 145 $w->dlManager->setting('file_sort',__('Sort files:'),'','combo', … … 145 148 $w->dlManager->setting('root',__('root directory:'),'','combo', 146 149 dlManager::listDirs()); 150 151 $w->dlManager->setting('display_dirs',__('Display subdirectories'), 152 true,'check'); 153 154 $w->dlManager->setting('dirs_title',__('Subdirectories title:'). 155 ' ('.__('optional').')',__('Directories'),'text'); 156 157 $w->dlManager->setting('display_files',__('Display files'), 158 true,'check'); 159 160 $w->dlManager->setting('files_title',__('Files title:'). 161 ' ('.__('optional').')',__('Files'),'text'); 147 162 148 163 $w->dlManager->setting('block',__('Block display:'),'<ul>%s</ul>','text'); -
plugins/dlManager/_define.php
r537 r542 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-beta1 0',30 /* Version */ '1.0-beta11', 31 31 /* Permissions */ 'admin' 32 32 ); -
plugins/dlManager/_public.php
r537 r542 67 67 68 68 $_ctx->dlManager_currentDir = '/'; 69 70 # BreadCrumb 71 $breadCrumb = array(); 72 69 73 70 # if visitor asked a directory 74 71 if ((!empty($args)) && (substr($args,0,1) == '/')) … … 76 73 $_ctx->dlManager_currentDir = substr($args,1); 77 74 $page_dir = $page_root.'/'.$_ctx->dlManager_currentDir; 78 79 # BreadCrumb80 $base_url = dlManager::pageURL().'/';81 $dirs = explode('/',$_ctx->dlManager_currentDir);82 $path = '';83 75 84 foreach ($dirs as $dir) 85 { 86 $dir = trim($dir); 87 88 # check 89 if (($dir == '.') OR ($dir == '..')) {self::p404();} 90 91 if (!empty($dir)) 92 { 93 $path = (($path == '') ? $dir : $path.'/'.$dir); 94 $breadCrumb[$dir] = $base_url.$path; 95 } 96 } 97 } 98 99 $_ctx->dlManager_BreadCrumb = $breadCrumb; 100 unset($breadCrumb); 76 unset($breadCrumb); 77 } 78 79 # BreadCrumb 80 $_ctx->dlManager_BreadCrumb = dlManager::breadCrumb($_ctx->dlManager_currentDir); 101 81 # /BreadCrumb 102 82 … … 138 118 $item->media_type = 'folder'; 139 119 140 if (($item->file == $ core->media->root)120 if (($item->file == $parent_dir_full_path) 141 121 && ($_ctx->dlManager_currentDir == '/')) 142 122 { … … 211 191 if ($page_root_len > 0) {$page_root_len += 1;} 212 192 213 if (!empty($page_root)) 214 { 215 if (strpos($file->relname,$page_root) !== 0) 216 { 217 self::p404(); 218 } 219 } 193 if (!dlManager::inJail($file->relname)) {self::p404();} 220 194 221 195 $_ctx->dlManager_item->relname = … … 225 199 $_ctx->dlManager_item->relname = ''; 226 200 } 227 228 # BreadCrumb 229 $breadCrumb = array(); 230 201 231 202 # if visitor asked a directory 232 233 203 $_ctx->dlManager_currentDir = $_ctx->dlManager_item->relname; 234 204 $page_dir = $page_root.'/'.$_ctx->dlManager_currentDir; 235 205 236 206 # 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); 207 $_ctx->dlManager_BreadCrumb = dlManager::breadCrumb($_ctx->dlManager_currentDir); 257 208 # /BreadCrumb 258 209 259 # compatibility with Dotclear revisions < 2445260 global $attach_f;261 $attach_f = new ArrayObject();262 $attach_f->file_url = $file->file_url;263 264 210 $core->tpl->setPath($core->tpl->getPath(), 265 211 dirname(__FILE__).'/default-templates/'); … … 289 235 $page_root = $core->blog->settings->dlmanager_root; 290 236 291 if (!empty($page_root)) 292 { 293 if (strpos($file->relname,$page_root) !== 0) 294 { 295 self::p404(); 296 } 297 } 237 if (!dlManager::inJail($file->relname)) {self::p404();} 298 238 299 239 if (is_readable($file->file)) … … 418 358 $core->tpl->addValue('DLMItemImageMetaValue',array('dlManagerPageTpl', 419 359 'itemImageMetaValue')); 360 361 # zip content 362 $core->tpl->addBlock('DLMItemZipContent',array('dlManagerPageTpl', 363 'itemZipContent')); 364 $core->tpl->addValue('DLMItemZipContentFile',array('dlManagerPageTpl', 365 'itemZipContentFile')); 420 366 421 367 /** … … 940 886 return('<?php echo '.sprintf($f,'$value').'; ?>'); 941 887 } 888 889 /** 890 Loop on zip content 891 @param attr <b>array</b> Attribute 892 @return <b>string</b> PHP block 893 */ 894 public static function itemZipContent($attr,$content) 895 { 896 $f = $GLOBALS['core']->tpl->getFilters($attr); 897 898 return 899 '<?php '. 900 '$_ctx->dlManager_index = 0;'. 901 '$content = $core->media->getZipContent($_ctx->dlManager_item); '. 902 'foreach ($content as $file => $v) { '. 903 '?>'."\n". 904 $content. 905 '<?php $_ctx->dlManager_index += 1; '. 906 '}'. 907 'unset($content,$_ctx->dlManager_index,$file); ?>'; 908 } 909 910 /** 911 Zip content file 912 @param attr <b>array</b> Attribute 913 @return <b>string</b> PHP block 914 */ 915 public static function itemZipContentFile($attr) 916 { 917 $f = $GLOBALS['core']->tpl->getFilters($attr); 918 919 return('<?php echo '.sprintf($f,'$file').'; ?>'); 920 } 942 921 } 943 922 … … 970 949 $core->media->getDir(); 971 950 972 $items = $core->media->dir['files'];973 974 951 $items_str = $str = ''; 975 952 976 foreach ($items as $item) { 977 $mediaplayer = ''; 978 if ($item->media_type == 'image') 953 if ($w->display_dirs) 954 { 955 $items = $core->media->dir['dirs']; 956 957 # define root of DL Manager 958 $page_root = $core->blog->settings->dlmanager_root; 959 960 # used to remove root from path 961 $page_root_len = strlen($page_root); 962 963 # remove slash at the beginning of the string 964 if ($page_root_len > 0) {$page_root_len += 1;} 965 966 foreach ($items as $item) { 967 if (!empty($item->relname)) 968 { 969 $item->relname = 970 substr($item->relname,$page_root_len); 971 972 $items_str .= sprintf($w->item,$core->blog->url. 973 $core->url->getBase('media').'/'.$item->relname, 974 $item->basename,$item->basename,''); 975 } 976 } 977 978 if (!empty($items_str)) 979 979 { 980 $mediaplayer = 981 '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 982 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'. 980 if ($w->dirs_title) 981 { 982 $str .= '<h3>'.html::escapeHTML($w->dirs_title).'</h3>'; 983 } 984 $str .= sprintf($w->block,$items_str); 985 } 986 } 987 988 if ($w->display_files) 989 { 990 $items_str = ''; 991 $items = $core->media->dir['files']; 992 993 foreach ($items as $item) { 994 $mediaplayer = ''; 995 if ($item->media_type == 'image') 996 { 997 $mediaplayer = 998 '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 999 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'. 1000 '<img src="'.$core->blog->getQmarkURL(). 1001 'pf=dlManager/images/image.png" alt="'.__('Preview').'" />'. 1002 '</a>'; 1003 } elseif ($item->type == 'audio/mpeg3' || $item->type == 'video/x-flv') 1004 { 1005 $mediaplayer = '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 1006 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'. 983 1007 '<img src="'.$core->blog->getQmarkURL(). 984 'pf=dlManager/images/ image.png" alt="'.__('Preview').'" />'.1008 'pf=dlManager/images/control_play.png" alt="'.__('Preview').'" />'. 985 1009 '</a>'; 986 } elseif ($item->type == 'audio/mpeg3' || $item->type == 'video/x-flv') 1010 } elseif ($item->type == 'application/zip') 1011 { 1012 $mediaplayer = '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 1013 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'. 1014 '<img src="'.$core->blog->getQmarkURL(). 1015 'pf=dlManager/images/briefcase.png" alt="'.__('Preview').'" />'. 1016 '</a>'; 1017 } 1018 1019 $items_str .= sprintf($w->item,$core->blog->url. 1020 $core->url->getBase('download').'/'.$item->media_id, 1021 $item->media_title,$item->basename,$mediaplayer); 1022 } 1023 1024 if (!empty($items_str)) 987 1025 { 988 $mediaplayer = '<a href="'.$core->blog->url.$core->url->getBase('mediaplayer').'/'. 989 $item->media_id.'" title="'.__('Preview :').' '.$item->media_title.'">'. 990 '<img src="'.$core->blog->getQmarkURL(). 991 'pf=dlManager/images/control_play.png" alt="'.__('Preview').'" />'. 992 '</a>'; 993 } 994 995 $items_str .= sprintf($w->item,$core->blog->url. 996 $core->url->getBase('download').'/'.$item->media_id, 997 $item->media_title,$item->basename,$mediaplayer); 1026 if ($w->files_title) 1027 { 1028 $str .= '<h3>'.html::escapeHTML($w->files_title).'</h3>'; 1029 } 1030 $str .= sprintf($w->block,$items_str); 1031 } 998 1032 } 999 1033 unset($items); … … 1003 1037 ? '<h2>'.html::escapeHTML($w->title).'</h2>' : null; 1004 1038 1005 if (!empty($items_str))1006 {1007 $str = sprintf($w->block,$items_str);1008 }1009 1010 1039 $link = (strlen($w->link) > 0) ? '<p class="text"><a href="'. 1011 1040 dlManager::pageURL().'">'.html::escapeHTML($w->link).'</a></p>' : null; -
plugins/dlManager/default-templates/media.html
r537 r542 20 20 21 21 <style type="text/css"> 22 .center {text-align:center;} 22 23 .size {white-space:pre;} 23 24 .number {text-align:right;} … … 103 104 {{tpl:lang File}} 104 105 </th> 106 <th>{{tpl:lang Preview}}</th> 105 107 <th>{{tpl:lang Size}}</th> 106 108 <!-- #<th>{{tpl:lang Type}}</th>--> … … 119 121 {{tpl:DLMItemTitle}} 120 122 </a> 123 </td> 124 <td class="center"> 121 125 <!-- # image files --> 122 126 <tpl:DLMItemIf media_type="image"> … … 131 135 </a> 132 136 </tpl:DLMItemIf> 137 <!-- # zip files --> 138 <tpl:DLMItemIf type="application/zip"> 139 <a href="{{tpl:DLMItemPlayerURL}}" class="preview" title="{{tpl:lang Preview :}} {{tpl:DLMItemBasename}}"> 140 <img src="{{tpl:BlogQmarkURL}}pf=dlManager/images/briefcase.png" alt="{{tpl:lang Preview}}" /> 141 </a> 142 </tpl:DLMItemIf> 143 133 144 </td> 134 145 <td class="size">{{tpl:DLMItemSize format="1"}}</td> -
plugins/dlManager/default-templates/media_player.html
r537 r542 63 63 <p><a href="{{tpl:DLMItemDirPath}}">{{tpl:lang Get back to the directory}}</a></p> 64 64 65 < p>65 <h3> 66 66 <a href="{{tpl:DLMItemDlURL}}" title="{{tpl:DLMItemBasename}}"> 67 67 {{tpl:lang Download this file}} 68 68 </a> 69 </ p>69 </h3> 70 70 71 71 <div id="player"> … … 82 82 <tpl:DLMItemIf type="video/x-flv"> 83 83 {{tpl:include src="_flv_player.html"}} 84 </tpl:DLMItemIf> 85 86 <tpl:DLMItemIf type="application/zip"> 87 <h3>{{tpl:lang Zip file content}}</h3> 88 <tpl:DLMItemZipContent> 89 <tpl:DLMHeader> 90 <ul> 91 </tpl:DLMHeader> 92 <li>{{tpl:DLMItemZipContentFile}}</li> 93 <tpl:DLMFooter> 94 </ul> 95 </tpl:DLMFooter> 96 </tpl:DLMItemZipContent> 84 97 </tpl:DLMItemIf> 85 98 </div> -
plugins/dlManager/lib.dlManager.php
r537 r542 61 61 /** 62 62 get sort values 63 @param empty_value <b>boolean</b> Add an empty value in the array 63 @param empty_value <b>boolean</b> Add an empty value in the array 64 64 @return <b>array</b> sort values 65 65 */ … … 87 87 return ($core->blog->url.$core->url->getBase('media')); 88 88 } 89 90 /** 91 make BreadCrumb 92 @param dir <b>string</b> path directory 93 @return <b>array</b> BreadCrumb 94 */ 95 public static function breadCrumb($dir) 96 { 97 # BreadCrumb 98 $base_url = self::pageURL().'/'; 99 $dirs = explode('/',$dir); 100 $path = ''; 101 102 foreach ($dirs as $dir) 103 { 104 $dir = trim($dir); 105 106 # check 107 if (($dir == '.') OR ($dir == '..')) {self::p404();} 108 109 if (!empty($dir)) 110 { 111 $path = (($path == '') ? $dir : $path.'/'.$dir); 112 $breadCrumb[$dir] = $base_url.$path; 113 } 114 } 115 116 if (empty($breadCrumb)) {$breadCrumb = array();} 117 118 return($breadCrumb); 119 } 120 121 /** 122 test if a file or a directory is in "jail" 123 @param path <b>string</b> path 124 @return <b>boolean</b> BreadCrumb 125 */ 126 public static function inJail($path) 127 { 128 global $core; 129 130 $root = $core->blog->settings->dlmanager_root; 131 132 if (!empty($root)) 133 { 134 if (strpos($path,$root) !== 0) 135 { 136 return false; 137 } 138 } 139 140 return true; 141 } 89 142 } 90 143 -
plugins/dlManager/locales/fr/main.po
r537 r542 3 3 "Project-Id-Version: DL Manager\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2008-1 0-27 17:29+0100\n"6 "PO-Revision-Date: 2008-1 0-27 17:29+0100\n"5 "POT-Creation-Date: 2008-11-03 00:24+0100\n" 6 "PO-Revision-Date: 2008-11-03 00:24+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 5419 #: _public.php:134 20 20 #: public_l10n.php:7 21 21 msgid "parent directory" 22 22 msgstr "répertoire parent" 23 23 24 #: _public.php:982 25 #: _public.php:989 24 #: _public.php:999 25 #: _public.php:1006 26 #: _public.php:1013 26 27 msgid "Preview :" 27 28 msgstr "" 28 29 29 #: _public.php:984 30 #: _public.php:991 30 #: _public.php:1001 31 #: _public.php:1008 32 #: _public.php:1015 31 33 msgid "Preview" 32 34 msgstr "" … … 51 53 #: _admin.php:75 52 54 #: _admin.php:80 53 #: _admin.php:11 354 #: _admin.php:11 855 #: _admin.php:12 356 #: _admin.php:13 857 #: _admin.php:14 058 #: _admin.php:1 5459 #: _admin.php:1 5555 #: _admin.php:114 56 #: _admin.php:119 57 #: _admin.php:124 58 #: _admin.php:139 59 #: _admin.php:143 60 #: _admin.php:169 61 #: _admin.php:170 60 62 #: public_l10n.php:3 61 63 msgid "Download manager" … … 77 79 78 80 #: _admin.php:91 79 #: _admin.php:14 281 #: _admin.php:145 80 82 #: public_l10n.php:5 81 83 msgid "Sort files:" … … 95 97 msgstr "Le répertoire public sera affiché." 96 98 97 #: _admin.php:11 299 #: _admin.php:113 98 100 #, php-format 99 101 msgid "Files can be excluded from %1$s by editing <strong>%2$s</strong> in <strong>%3$s</strong>." 100 102 msgstr "Les fichiers peuvent être exclus de %1$s en éditant <strong>%2$s</strong> dans <strong>%3$s</strong>." 101 103 102 #: _admin.php:11 3104 #: _admin.php:114 103 105 msgid "about:config" 104 106 msgstr "" 105 107 106 #: _admin.php:11 4108 #: _admin.php:115 107 109 #, php-format 108 110 msgid "For example, to exclude %1$s and %2$s files : <code>%3$s</code>" 109 111 msgstr "Par exemple, pour exclure les fichiers %1$s et %2$s : <code>%3$s</code>" 110 112 111 #: _admin.php:11 5113 #: _admin.php:116 112 114 msgid "PNG" 113 115 msgstr "" 114 116 115 #: _admin.php:11 5117 #: _admin.php:116 116 118 msgid "JPG" 117 119 msgstr "" 118 120 119 #: _admin.php:11 8121 #: _admin.php:119 120 122 #, php-format 121 123 msgid "URL of the %s page :" 122 124 msgstr "URL de la page %s :" 123 125 124 #: _admin.php:12 2126 #: _admin.php:123 125 127 #, php-format 126 128 msgid "View the %s page" 127 129 msgstr "Voir la page %s" 128 130 129 #: _admin.php:14 0131 #: _admin.php:142 130 132 msgid "Title:" 131 133 msgstr "Titre :" 132 134 133 #: _admin.php:14 0135 #: _admin.php:142 134 136 #: _admin.php:155 137 #: _admin.php:161 138 #: _admin.php:170 135 139 msgid "optional" 136 140 msgstr "facultatif" 137 141 138 #: _admin.php:14 5142 #: _admin.php:148 139 143 msgid "root directory:" 140 144 msgstr "répertoire de base :" 141 145 142 #: _admin.php:148 143 msgid "Block display:" 144 msgstr "Affichage du bloc :" 145 146 #: _admin.php:150 147 msgid "Item display:" 148 msgstr "Affichage d'un élément :" 146 #: _admin.php:151 147 msgid "Display subdirectories" 148 msgstr "Afficher les sous-répertoires :" 149 149 150 150 #: _admin.php:154 151 #, php-format 152 msgid "Add a link to %s in the widget:" 153 msgstr "Ajouter un lien vers %s dans le widget :" 154 155 #: _admin.php:157 156 msgid "Home page only" 157 msgstr "" 158 151 msgid "Subdirectories title:" 152 msgstr "Titre des sous-répertoires :" 153 154 #: _admin.php:155 159 155 #: public_l10n.php:6 160 156 msgid "Directories" 161 157 msgstr "Répertoires" 162 158 159 #: _admin.php:157 160 msgid "Display files" 161 msgstr "Afficher les fichiers" 162 163 #: _admin.php:160 164 msgid "Files title:" 165 msgstr "Titre des fichiers :" 166 167 #: _admin.php:161 168 #: public_l10n.php:12 169 msgid "Files" 170 msgstr "Fichiers" 171 172 #: _admin.php:163 173 msgid "Block display:" 174 msgstr "Affichage du bloc :" 175 176 #: _admin.php:165 177 msgid "Item display:" 178 msgstr "Affichage d'un élément :" 179 180 #: _admin.php:169 181 #, php-format 182 msgid "Add a link to %s in the widget:" 183 msgstr "Ajouter un lien vers %s dans le widget :" 184 185 #: _admin.php:172 186 msgid "Home page only" 187 msgstr "" 188 163 189 #: public_l10n.php:9 164 190 msgid "No directory." … … 169 195 msgstr "Aucun fichier." 170 196 171 #: public_l10n.php:12172 msgid "Files"173 msgstr "Fichiers"174 175 197 #: public_l10n.php:13 176 198 msgid "Basename" … … 225 247 msgstr "Méta données" 226 248 249 #: public_l10n.php:28 250 msgid "Zip file content" 251 msgstr "Contenu du fichier zip" 252 -
plugins/dlManager/public_l10n.php
r537 r542 26 26 __('Download this file'); 27 27 __('Image meta'); 28 __('Zip file content'); 28 29 ?>
Note: See TracChangeset
for help on using the changeset viewer.