A quick test shows it is working. will check it more.
Thanks... missing piece to upgrading one site with a ton of external images from another related site. On Mon, Oct 19, 2009 at 6:32 PM, The Editor <[email protected]> wrote: > > Kevin, it's late here, but I think I have the attrs back in the > uploads markup for external links. I've actually significantly > rewritten the code to use some simpler techniques and hopefully be a > bit more efficient. It seems much more logical at least... Please give > it a try and let me know if you spot any problems. I just replaced the > entire last function in markups.php with this: > > Cheers, > Dan > > function BOLTMuploads($file) { > ## HERE IS THE MARKUP PROCESSOR FOR FILE UPLOADS. CREATE MARKUP FOR AN > IMAGE AND IF DOESN'T EXIST PUTS A LINK TO AN UPLOAD FORM. IF EXISTS, > DISPLAYS IMAGE OR SHOWS DOWNLOAD LINK > global $scriptURL, $fieldURL, $pageLink, $BOLTid, > $BOLTmissingUpload, > $BOLTreloadMark, $imgPath; > $args = BOLTargs($file, 'uploads'); > if (isset($args['file'])) $file = $args['file']; > else $file = $args[1]; > if (substr($file, 0, 4) == 'img:') $file = substr($file, 4); > if (strpos('jpg,gif,png', substr(strrchr($file, "."), 1)) !== false) > $type = 'img'; > else $type = 'a'; > foreach($args as $f => $v) { > if (! in_array($f, BOLTattrs($type))) continue; > $attr .= "$f='$v' "; > } > if (strpos($file, '://') !== false) { > if ($type == 'img') return BOLTescape("<img src='$file' > $attr />"); > return; > } > if (! isset($BOLTmissingUpload)) { > $BOLTmissingUpload = BOLTconfig('BOLTmissingMark'); > if ($BOLTmissingUpload == 'true') $BOLTmissingUpload = > "<span > class='marks'><sup>?</sup></span>"; > } > if (substr($file, 0, 1) == "?") { > $file = substr($file, 1); > unset($BOLTmissingUpload); > } > $BOLTfilesDir = BOLTconfig('BOLTfilesDir', 'files'); > if (BOLTconfig('BOLTuploadCase') != 'true') $file = > strtolower($file); > if (BOLTfilter($file, '/^[-_a-zA-Z0-9.]+$/') == '') return > BOLTtranslate(BOLTinfoVar('site.messages', 'invalid_file', 'Invalid > file name.')); > $dir = ''; > if (isset($args['dir'])) { > $dir = $args['dir']; > if (BOLTfilter($dir, '/^[-_a-zA-Z0-9\/]+$/') == '') return > BOLTtranslate(BOLTinfoVar('site.messages', 'invalid_dir', > 'Unauthorized upload directory.')); > $location = "$BOLTfilesDir/$dir/$file"; > } > else $location = "$BOLTfilesDir/$file"; > if (isset($args['label'])) $label = $args['label']; > else $label = $file; > if (! file_exists($location)) $location = strtolower($location); > if (! file_exists($location)) $location = "$imgPath/$file"; > if (file_exists($location)) { > if (substr($location, 0, strlen($imgPath)) != $imgPath) > $location = > $fieldURL . $location; > if (BOLTexists('site.auth.files') && > strpos(BOLTloadpage('site.auth.files'), $file) !== false && ! > BOLTauth($file, $BOLTid, 'files')) return 'File access blocked'; > if (strpos('jpg,gif,png', substr(strrchr($file, "."), 1)) > !== false) { > if (!isset($args['alt'])) $attr .= "alt='' "; > if (strpos($attr, 'height=') === false && > strpos($attr, 'width=') > === false) { > $size = getimagesize($location); > $attr .= $size[3]; > } > return BOLTescape("<img src='$location' $attr />"); > } > else { > $out = "<a href='$location' $attr>$label</a>"; > if ($args['reload'] == 'true' || $_GET['reload'] == > 'true') { > if (! isset($BOLTreloadMark)) > $BOLTreloadMark = "<span > class='marks'><sup>^</sup></span>"; > if ($dir != '') $reload = "<a > href='$scriptURL$fileLink&action=upload&file=$file&dir=$dir' > rel='nofollow'>$BOLTreloadMark</a>"; > else $reload = "<a > href='$scriptURL$fileLink&action=upload&file=$file' > rel='nofollow'>$BOLTreloadMark</a>"; > } > return BOLTescape("$out$reload"); > } > } > else { > $label = $label . $BOLTmissingUpload; > if ($dir != '') return BOLTescape("<a > > href='$scriptURL$pageLink$fileLink&action=upload&file=$file&dir=$dir'>$label</a>"); > return BOLTescape("<a > href='$scriptURL$pageLink$fileLink&action=upload&file=$file'>$label</a>"); > } > } > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "BoltWire" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/boltwire?hl=en -~----------~----~----~----~------~----~------~--~---
