Changeset 520
- Timestamp:
- 10/13/08 03:05:14 (15 years ago)
- google:author:
- appears
- Location:
- plugins/publicMedia
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/publicMedia/_admin.php
r517 r520 43 43 global $core; 44 44 45 $settings->setNameSpace('publicmedia _page');45 $settings->setNameSpace('publicmedia'); 46 46 $settings->put('publicmedia_page_active',!empty($_POST['publicmedia_page_active']), 47 47 'boolean','Activate Media Page'); … … 54 54 (!empty($_POST['publicmedia_page_root']) ? $_POST['publicmedia_page_root'] : ''), 55 55 'string', 'root directory'); 56 $settings->put('publicmedia_count_dl',56 /*$settings->put('publicmedia_count_dl', 57 57 (!empty($_POST['publicmedia_count_dl']) ? $_POST['publicmedia_count_dl'] : serialize(array())), 58 'string', 'Download counter'); 58 'string', 'Download counter');*/ 59 59 # inspirated from lightbox/admin.php 60 60 $settings->setNameSpace('system'); -
plugins/publicMedia/_define.php
r519 r520 26 26 /* Description*/ "Display media on a public page or in a widget", 27 27 /* Author */ "Moe (http://gniark.net/), Osku and Tomtom (http://blog.zenstyle.fr)", 28 /* Version */ '1.1. 1',28 /* Version */ '1.1.2', 29 29 /* Permissions */ 'admin' 30 30 ); -
plugins/publicMedia/_install.php
r515 r520 38 38 $cur = $core->con->openCursor($core->prefix.'setting'); 39 39 $cur->setting_ns = 'publicmedia'; 40 $cur->update('WHERE (setting_id LIKE \'publicmedia_ page%\') '.40 $cur->update('WHERE (setting_id LIKE \'publicmedia_%\') '. 41 41 'AND setting_ns = \'system\';'); 42 42 -
plugins/publicMedia/_public.php
r519 r520 75 75 $dirs = explode('/',$_ctx->mediaPage_currentDir); 76 76 $path = ''; 77 //die('<pre>'.print_r($dirs,true).'</pre>'); 77 78 foreach ($dirs as $dir) 78 79 { 79 $path = (($path == '') ? $dir : $path.'/'.$dir); 80 $breadCrumb[$dir] = $base_url.$path; 80 $dir = trim($dir); 81 if (!empty($dir)) 82 { 83 $path = (($path == '') ? $dir : $path.'/'.$dir); 84 $breadCrumb[$dir] = $base_url.$path; 85 } 81 86 } 82 87 } … … 130 135 $item->relname = 131 136 substr($item->relname,$page_root_len); 137 # parent directory 132 138 if ($item->file == $parent_dir_full_path) 133 139 { … … 171 177 $core->media = new dcMedia($core); 172 178 } 173 174 $core->media->chdir($core->blog->settings->publicmedia_page_root); 175 // we need to test if the file is in a subdirectory of -^ 176 $core->media->getDir(); 177 178 $items = $core->media->dir['files']; 179 180 # initialize $file 181 $file = ''; 182 183 foreach ($items as $media_item) { 184 if ($media_item->media_id == $args) { 185 $file_id = $media_item->media_id; 186 $file_ext = $media_item->extension; 187 $file_mime = $media_item->type; 188 $file_name = $media_item->media_title; 189 $file = $media_item->file; 190 break; 179 180 $file = $core->media->getFile($args); 181 182 $page_root = $core->blog->settings->publicmedia_page_root; 183 184 if (!empty($page_root)) 185 { 186 if (strpos($file->relname,$page_root) !== 0) 187 { 188 self::p404(); 191 189 } 192 } 193 unset($items); 190 } 194 191 195 if ($file && is_readable($file)) {192 if ($file->file && is_readable($file->file)) { 196 193 $count = unserialize($core->blog->settings->publicmedia_count_dl); 197 $count[$file_id] = array_key_exists($file_id,$count) ? $count[$file_id]+1 : 1; 198 // if (!is_object($core->settings)) ? 199 $settings = new dcSettings($core,$core->blog->id); 200 $settings->setNamespace('system'); 194 $count[$file->media_id] = array_key_exists($file->media_id,$count) ? $count[$file->media_id]+1 : 1; 195 if (!is_object($core->blog->settings)) 196 { 197 $settings = new dcSettings($core,$core->blog->id); 198 } 199 else 200 { 201 $settings =& $core->blog->settings; 202 } 203 $settings->setNamespace('publicmedia'); 201 204 $settings->put('publicmedia_count_dl',serialize($count),'string','Download counter'); 202 205 //$core->callBehavior('publicDownloadedFile',(integer)$args); 203 header('Content-type: '.$file _mime);204 header('Content-Disposition: attachment; filename="'.$file _name.'"');205 readfile($file );206 header('Content-type: '.$file->type); 207 header('Content-Disposition: attachment; filename="'.$file->basename.'"'); 208 readfile($file->file); 206 209 exit; 207 210 } … … 587 590 $f = $GLOBALS['core']->tpl->getFilters($attr); 588 591 589 return('<?php echo($core->blog->url. \'download/\'.'.sprintf($f,'$_ctx->media_item->media_id').'); ?>');592 return('<?php echo($core->blog->url.$core->url->getBase(\'download\').\'/\'.'.sprintf($f,'$_ctx->media_item->media_id').'); ?>'); 590 593 } 591 594 /**
Note: See TracChangeset
for help on using the changeset viewer.