From: <rob...@us...> - 2012-06-05 21:20:55
|
Revision: 41804 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=41804&view=rev Author: robertplummer Date: 2012-06-05 21:20:48 +0000 (Tue, 05 Jun 2012) Log Message: ----------- [FIX] Getting permissions right to show edit button and ensuring we get an archive id by mysql rather than through filegallery, which was failing when user had upload access only Modified Paths: -------------- branches/9.x/lib/wiki-plugins/wikiplugin_img.php branches/9.x/tiki-edit_draw.php Modified: branches/9.x/lib/wiki-plugins/wikiplugin_img.php =================================================================== --- branches/9.x/lib/wiki-plugins/wikiplugin_img.php 2012-06-05 20:36:06 UTC (rev 41803) +++ branches/9.x/lib/wiki-plugins/wikiplugin_img.php 2012-06-05 21:20:48 UTC (rev 41804) @@ -1352,8 +1352,17 @@ $repl = '{img src=' . $src . "\"}\n<p>" . $imgdata['desc'] . '</p>'; } - global $tiki_p_edit; - if ($prefs['feature_draw'] === 'y' && $tiki_p_upload_files === 'y' && $tiki_p_edit === 'y') { + global $tiki_p_edit, $fromTracker; + $globalperms = Perms::get(array( 'type' => 'file gallery', 'object' => $imgdata['galleryId'] )); + + if ( + $prefs['feature_draw'] == 'y' && + $globalperms->upload_files == 'y' && + ( + $tiki_p_edit == 'y' || + $fromTracker == true + ) + ) { if ($prefs['wiki_edit_icons_toggle'] == 'y' && !isset($_COOKIE['wiki_plugin_edit_view'])) { $iconDisplayStyle = " style='display:none;'"; } else { Modified: branches/9.x/tiki-edit_draw.php =================================================================== --- branches/9.x/tiki-edit_draw.php 2012-06-05 20:36:06 UTC (rev 41803) +++ branches/9.x/tiki-edit_draw.php 2012-06-05 21:20:48 UTC (rev 41804) @@ -89,11 +89,15 @@ if ($fileInfo['filetype'] != $mimetypes["svg"] && $prefs['fgal_keep_fileId'] == 'y') { // this is a conversion from an image other than svg $newFileInfo = $filegallib->get_file_info($fileId); - - $archives = $filegallib->get_archives($fileInfo['fileId']); - $archive = end($archives['data']); - - $newFileInfo['data'] = str_replace('?fileId=' . $fileInfo['fileId'] . '#', '?fileId=' . $archive['fileId'] . '#', $newFileInfo['data']); + + $archiveFileId = $tikilib->getOne(" + SELECT fileId + FROM tiki_files + WHERE archiveId = ? + ORDER BY lastModif DESC + ", array($fileId)); + + $newFileInfo['data'] = str_replace('?fileId=' . $fileInfo['fileId'] . '#', '?fileId=' . $archiveFileId . '#', $newFileInfo['data']); $fileId = $filegallib->save_archive($newFileInfo["fileId"], $newFileInfo['galleryId'], 0, $newFileInfo['filename'], $newFileInfo['description'], $newFileInfo['name'].".svg", $newFileInfo['data'], strlen($newFileInfo['data']), $type, $newFileInfo['user'], null, null, $user); } } else { @@ -108,7 +112,11 @@ if ($fileInfo['filetype'] == $mimetypes["svg"]) { $data = $fileInfo["data"]; } else { //we already confirmed that this is an image, here we make it compatible with svg - $data = '<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + $image = imagecreatefromstring($fileInfo["data"]); + $w = imagesx($image); + $h = imagesy($image); + + $data = '<svg width="' . $w . '" height="' . $h . '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g> <title>Layer 1</title> <image x="1" y="1" width="100%" height="100%" id="svg_1" xlink:href="' . (empty($fileInfo['fileId']) ? '' : $tikilib->tikiUrl() . 'tiki-download_file.php?fileId=' . $fileInfo['fileId'] . '#image' ) . '"/> @@ -161,6 +169,8 @@ if (isset($_REQUEST['raw'])) { $jsFunctionality = ""; } else { + $prefs['feature_draw_hide_buttons'] = addslashes(htmlentities($prefs['feature_draw_hide_buttons'])); + $jsFunctionality = "$('#drawFullscreen') .click(function() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |