From: <xa...@us...> - 2011-09-01 22:56:47
|
Revision: 36792 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=36792&view=rev Author: xavidp Date: 2011-09-01 22:56:41 +0000 (Thu, 01 Sep 2011) Log Message: ----------- [FIX]Couple of minor fixes for anonymous users: fixed display below the chart, and avoid buttons and svg/pdf generation by anonymous and robots to prevent server impact of robots Modified Paths: -------------- mods/trunk/wiki-plugins/r/lib/wiki-plugins/wikiplugin_rr.php Modified: mods/trunk/wiki-plugins/r/lib/wiki-plugins/wikiplugin_rr.php =================================================================== --- mods/trunk/wiki-plugins/r/lib/wiki-plugins/wikiplugin_rr.php 2011-09-01 22:34:19 UTC (rev 36791) +++ mods/trunk/wiki-plugins/r/lib/wiki-plugins/wikiplugin_rr.php 2011-09-01 22:56:41 UTC (rev 36792) @@ -165,7 +165,7 @@ function wikiplugin_rr($data, $params) { - global $smarty, $trklib, $tikilib, $prefs, $dbversion_tiki ; + global $smarty, $trklib, $tikilib, $prefs, $dbversion_tiki, $user ; include_once('db/tiki-db.php'); // to set up multitiki etc if there ($tikidomain) @@ -303,7 +303,7 @@ } // execute R program - $fn = runR ($output, convert, $sha1, $data, '', $ws, $params); + $fn = runR ($output, convert, $sha1, $data, '', $ws, $params, $user); $ret = file_get_contents ($fn); // Check for Tiki version, to apply parsing of content or not (behavior changed in Tiki7, it seems) @@ -327,7 +327,7 @@ } -function runR ($output, $convert, $sha1, $input, $echo, $ws, $params) { +function runR ($output, $convert, $sha1, $input, $echo, $ws, $params, $user) { static $r_count = 0; // Generate a graphics @@ -494,10 +494,13 @@ if (file_exists($rgo . '.png')) { fwrite ($fd, $prg . '<img src="' . $rgo_rel . '.png' . '" class="fixedSize"' . ' alt="' . $rgo_rel . '.png' . '">'); } - if (isset($params["svg"]) && $params["svg"]=="1") { + if ( !empty($user) && isset($params["svg"]) && $params["svg"]=="1" || ( isset($params["pdf"]) && $params["pdf"]=="1" ) ){ + fwrite ($fd, $prg . '</br>'); + } + if ( !empty($user) && isset($params["svg"]) && $params["svg"]=="1") { fwrite ($fd, $prg . ' <span class="button"><a href="' . curPageURL() . '>ype=svg' . '" alt="' . $rgo_rel . '.svg' . '" target="_blank">' . tr("Save Image as SVG") . '</a></span>'); } - if (isset($params["pdf"]) && $params["pdf"]=="1") { + if ( !empty($user) && isset($params["pdf"]) && $params["pdf"]=="1") { fwrite ($fd, $prg . ' <span class="button"><a href="' . curPageURL() . '>ype=pdf' . '" alt="' . $rgo_rel . '.pdf' . '" target="_blank">' . tr("Save Image as PDF") . '</a></span>'); } } else { @@ -509,7 +512,7 @@ $r_count++; // Check if the user requested an svg file to be generated instead of the standard png in the wiki page - if (isset($_REQUEST['gtype']) && $_REQUEST['gtype']=="svg") { + if ( !empty($user) && isset($_REQUEST['gtype']) && $_REQUEST['gtype']=="svg") { // return an svg file to be downloaded if (isset($_REQUEST["filename"])) { $filename = $_REQUEST['filename']; @@ -525,7 +528,7 @@ header('Content-Length: '.filesize($rgo . '.svg')); header("Content-Disposition: attachment; filename=\"$filename\""); readfile($rgo . '.svg'); - } elseif (isset($_REQUEST['gtype']) && $_REQUEST['gtype']=="pdf") { // Check if the user requested a pdf file to be generated instead of the standard png in the wiki page + } elseif ( !empty($user) && isset($_REQUEST['gtype']) && $_REQUEST['gtype']=="pdf") { // Check if the user requested a pdf file to be generated instead of the standard png in the wiki page // return a pdf file to be downloaded if (isset($_REQUEST["filename"])) { $filename = $_REQUEST['filename']; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |