From f9c295bdfc28df3cf666a3473aec9960eff6de44 Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 10 Jul 2014 14:40:32 +0200 Subject: [PATCH] isp 0.39 --- serendipity_event_imageselectorplus/ChangeLog | 16 +- .../lang_en.inc.php | 1 + .../plugin_mediainsert.tpl | 6 +- .../quickblog.tpl | 28 +- .../serendipity_event_imageselectorplus.php | 272 ++++++++---------- 5 files changed, 164 insertions(+), 159 deletions(-) diff --git a/serendipity_event_imageselectorplus/ChangeLog b/serendipity_event_imageselectorplus/ChangeLog index 383d7e5b..a81b8726 100644 --- a/serendipity_event_imageselectorplus/ChangeLog +++ b/serendipity_event_imageselectorplus/ChangeLog @@ -1,10 +1,18 @@ +0.39: +----- + * added form target to + * added non-image object uploads with link/image generation via radio field, + * which creates a real link instead of using the hidden quickblog tag + * removed some obsolet functions + * disabled allow_comments, moderate_comments to always take default values + 0.38: ---- -Changed default value of quickblog image size to default -$serendipity['thumbSize']. This prevents creation of another -image copy to the MediaLibrary, if not changed to another value. -Added a description lang constant for this. + * Changed default value of quickblog image size to default + $serendipity['thumbSize']. This prevents creation of another + image copy to the MediaLibrary, if not changed to another value. + * Added a description lang constant for this. 0.37: diff --git a/serendipity_event_imageselectorplus/lang_en.inc.php b/serendipity_event_imageselectorplus/lang_en.inc.php index 69a265ec..60c935f1 100644 --- a/serendipity_event_imageselectorplus/lang_en.inc.php +++ b/serendipity_event_imageselectorplus/lang_en.inc.php @@ -32,3 +32,4 @@ @define('PLUGIN_EVENT_IMAGESELECTORPLUS_JHEAD_DESC', 'Override the default behaviour and use external calls to jhead to obtain EXIF data. Choose this option only if jhead is installed and can be executed.'); @define('PLUGIN_EVENT_IMAGESELECTORPLUS_IMAGE_SIZE_DESC', 'Changing this default $serendipity[\'thumbSize\'] to another value, will add an additional and resized copy of that image to the MediaLibrary. This instance is then used as the preview thumbnail image in your frontend blog entry, linking to the origin image.'); +@define('PLUGIN_EVENT_IMAGESELECTORPLUS_ASOBJECT', 'Non-image object?'); diff --git a/serendipity_event_imageselectorplus/plugin_mediainsert.tpl b/serendipity_event_imageselectorplus/plugin_mediainsert.tpl index 7624e1a1..3ffcef0e 100644 --- a/serendipity_event_imageselectorplus/plugin_mediainsert.tpl +++ b/serendipity_event_imageselectorplus/plugin_mediainsert.tpl @@ -2,10 +2,10 @@ ' . $serendipity['POST']['quickblog']['body']; + $entry['title'] = htmlspecialchars($serendipity['POST']['quickblog']['title']); + if (isset($objpath) && !empty($objpath)) { + $entry['body'] = '' . $filename . ' (-'.$obj_mime.'-)

' . htmlspecialchars($serendipity['POST']['quickblog']['body']) . '

'; + } else { + $entry['body'] = '' . htmlspecialchars($serendipity['POST']['quickblog']['body']); + } $entry['authorid'] = $serendipity['authorid']; $entry['exflag'] = false; - $entry['categories'][0] = $serendipity['POST']['quickblog']['category']; - $entry['allow_comments'] = 'true'; - $entry['moderate_comments'] = 'false'; + $entry['categories'][0] = htmlspecialchars($serendipity['POST']['quickblog']['category']); + #$entry['allow_comments'] = 'true'; //disabled to take default values + #$entry['moderate_comments'] = 'false'; //disabled to take default values $serendipity['POST']['properties']['fake'] = 'fake'; $id = serendipity_updertEntry($entry); @@ -590,6 +642,7 @@ class serendipity_event_imageselectorplus extends serendipity_event $entry = serendipity_fetchEntry('id', $serendipity['GET']['id']); $imageid = $serendipity['GET']['image']; $imgsrc = ''; + if (preg_match('@@imsU', $entry['body'], $imgmatch)) { $imgsrc = $imgmatch[1]; } elseif (preg_match('@@imsU', $entry['extended'], $imgmatch)) { @@ -610,7 +663,7 @@ class serendipity_event_imageselectorplus extends serendipity_event echo '
'; echo $link . '<< ' . BACK . ''; - echo ''; + echo "\n\n\n"; return true; break; @@ -623,11 +676,7 @@ class serendipity_event_imageselectorplus extends serendipity_event case 'frontend_image_selector_imagealign': case 'frontend_image_selector_imagesize': case 'frontend_image_selector_hiddenfields': - return true; - break; - case 'frontend_image_selector_imagelink': - $this->display_target_selectbox(); return true; break; @@ -647,15 +696,22 @@ class serendipity_event_imageselectorplus extends serendipity_event #uploadform .radio_field label { padding-left: .5em; } +#uploadform .quickblog_form_select { + margin-top: 0.75em; + margin-bottom: 0.75em; +} display_script(); - return true; - break; + if ($serendipity['version'][0] < '2') { + $eventData['finishJSFunction'] = 'serendipity_imageSelectorPlus_done(\'' . htmlspecialchars($serendipity['GET']['textarea']) . '\')'; + } else { + $eventData['finishJSFunction'] = 'serendipity.serendipity_imageSelector_done(\'' . htmlspecialchars($serendipity['GET']['textarea']) . '\')'; + } + return true; + break; default: return false; @@ -672,6 +728,14 @@ class serendipity_event_imageselectorplus extends serendipity_event */ function parse_quickblog_post($path, &$body) { global $serendipity; + + preg_match('@@imsU', $body, $target); + $path = str_replace($target[1], '', $path); + $body = str_replace($target[1], '', $body); + + //check for non-image object + if (!isset($target) && empty($target)) return $body; + $file = basename($path); $dir = dirname($path) . '/'; @@ -680,6 +744,9 @@ class serendipity_event_imageselectorplus extends serendipity_event $suf = $t[1]; $infile = $dir . $file; + + $s9yimgID = (int)$this->getImageIdByUrl($infile); + $outfile = $dir . $f . '.quickblog.' . $suf; // check for existing image.quickblog thumb (see change in backend_image_addHotlink) else change to default thumbnail name if (!file_exists($outfile)) $outfile = $dir . $f . '.serendipityThumb.' . $suf; @@ -712,10 +779,32 @@ class serendipity_event_imageselectorplus extends serendipity_event $http_infile = $this->httpize($infile); $http_outfile = $this->httpize($outfile); + // create link targets + $totarget = str_replace('|', '', $target[1]); + $linktarget = ''; + switch($totarget) { + case '_blank': + $linktarget = ' target="_blank"'; + break; + case 'js': + list($width, $height, $type, $attr) = getimagesize("$infile"); + $linktarget = ' onclick="F1 = window.open(\''.$http_infile.'\',\'Zoom\',\'height='.$height.',width='.$width.',top=\'+ (screen.height-'.$height.')/2 +\',left=\'+ (screen.width-'.$width.')/2 +\',toolbar=no,menubar=no,location=no,resize=1,resizable=1,scrollbars=yes\'); return false;"'; + break; + case 'plugin': + $linktarget = ' id="s9yisphref'.$s9yimgID.'" onclick="javascript:this.href = this.href + \'&serendipity[from]=\' + self.location.href;"'; + $linkto = $serendipity['serendipityHTTPPath'] . 'serendipity_admin_image_selector.php?serendipity[step]=showItem&serendipity[image]='.$s9yimgID; + $http_infile = $this->httpize($linkto); + break; + } + $quickblog = array( + 'html5' => ($serendipity['wysiwyg'] || $serendipity['version'][0] > '1') ? true : false, 'image' => $http_outfile, 'fullimage' => $http_infile, 'body' => preg_replace('@()@imsU', '', $body), + 'imageid' => $s9yimgID, + 'target' => $linktarget, + 'istarget' => $totarget, 'exif' => &$exif, 'exif_mode' => $exif_mode ); @@ -732,127 +821,10 @@ class serendipity_event_imageselectorplus extends serendipity_event } - /* - * display_target_selectbox() - * displays select box for choosing target of image in the image selector - * depreceated, in new version >0.9 already in admin_image_selector.php - */ - function display_target_selectbox() { -?> - - -
- - -