From: <var...@us...> - 2010-06-17 11:37:36
|
Revision: 7542 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7542&view=rev Author: vargenau Date: 2010-06-17 11:37:30 +0000 (Thu, 17 Jun 2010) Log Message: ----------- Remove unused functions: oldFilterThroughCmd_File and oldFilterThroughCmd Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2010-06-17 11:34:55 UTC (rev 7541) +++ trunk/lib/WikiPluginCached.php 2010-06-17 11:37:30 UTC (rev 7542) @@ -1072,51 +1072,6 @@ } } - function oldFilterThroughCmd_File($input, $commandLine) { - $ext = ".txt"; - $tmpfile = tempnam(getUploadFilePath(), $ext); - $fp = fopen($tmpfile,'wb'); - fwrite($fp, $input); - fclose($fp); - $cat = isWindows() ? 'cat' : 'type'; - $pipe = popen("$cat \"$tmpfile\" | $commandLine", 'r'); - if (!$pipe) { - print "pipe failed."; - return ""; - } - $output = ''; - while (!feof($pipe)) { - $output .= fread($pipe, 1024); - } - pclose($pipe); - unlink($tmpfile); - return $output; - } - - /* PHP versions < 4.3 - * TODO: via temp file looks more promising - */ - function oldFilterThroughCmd($input, $commandLine) { - $input = str_replace ("\\", "\\\\", $input); - $input = str_replace ("\"", "\\\"", $input); - $input = str_replace ("\$", "\\\$", $input); - $input = str_replace ("`", "\`", $input); - $input = str_replace ("'", "\'", $input); - //$input = str_replace (";", "\;", $input); - - $pipe = popen("echo \"$input\" | $commandLine", 'r'); - if (!$pipe) { - print "pipe failed."; - return ""; - } - $output = ''; - while (!feof($pipe)) { - $output .= fread($pipe, 1024); - } - pclose($pipe); - return $output; - } - // run "echo $source | $commandLine" and return result function filterThroughCmd($source, $commandLine) { return $this->newFilterThroughCmd($source, $commandLine); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-17 15:16:30
|
Revision: 8976 http://sourceforge.net/p/phpwiki/code/8976 Author: vargenau Date: 2014-07-17 15:16:21 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Use public when needed Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-07-17 14:32:09 UTC (rev 8975) +++ trunk/lib/WikiPluginCached.php 2014-07-17 15:16:21 UTC (rev 8976) @@ -134,7 +134,7 @@ * @see #getImage * @see #getMap */ - protected function run($dbi, $argstr, &$request, $basepage) + public function run($dbi, $argstr, &$request, $basepage) { $cache = $this->newCache(); //$cacheparams = $GLOBALS['CacheParams']; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-17 15:18:27
|
Revision: 8977 http://sourceforge.net/p/phpwiki/code/8977 Author: vargenau Date: 2014-07-17 15:18:20 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Use public when needed Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-07-17 15:16:21 UTC (rev 8976) +++ trunk/lib/WikiPluginCached.php 2014-07-17 15:18:20 UTC (rev 8977) @@ -479,7 +479,7 @@ * * @return Cache copy of the cache object */ - static protected function newCache() + static public function newCache() { static $staticcache; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-18 12:23:26
|
Revision: 8988 http://sourceforge.net/p/phpwiki/code/8988 Author: vargenau Date: 2014-07-18 12:23:23 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Use protected when needed Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-07-18 10:11:37 UTC (rev 8987) +++ trunk/lib/WikiPluginCached.php 2014-07-18 12:23:23 UTC (rev 8988) @@ -878,7 +878,7 @@ * * @return void */ - private function resetError() + protected function resetError() { $this->_errortext = ''; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-27 15:49:24
|
Revision: 9009 http://sourceforge.net/p/phpwiki/code/9009 Author: vargenau Date: 2014-07-27 15:49:16 +0000 (Sun, 27 Jul 2014) Log Message: ----------- Remove static Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-07-25 16:03:00 UTC (rev 9008) +++ trunk/lib/WikiPluginCached.php 2014-07-27 15:49:16 UTC (rev 9009) @@ -701,7 +701,7 @@ * @param $errorformat string outputs errors in 'png', 'gif', 'jpg' or 'html' * @return bool error status; true=ok; false=error */ - static private function produceImage(&$content, $plugin, $dbi, $argarray, $request, $errorformat) + private function produceImage(&$content, $plugin, $dbi, $argarray, $request, $errorformat) { $plugin->resetError(); $content['html'] = $imagehandle = false; @@ -915,7 +915,7 @@ * @param string $errortext guess what? * @return void */ - static protected function printError($imgtype, $errortext) + protected function printError($imgtype, $errortext) { $imgtype = $this->decideImgType($imgtype); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-27 15:53:08
|
Revision: 9010 http://sourceforge.net/p/phpwiki/code/9010 Author: vargenau Date: 2014-07-27 15:53:00 +0000 (Sun, 27 Jul 2014) Log Message: ----------- Remove static Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-07-27 15:49:16 UTC (rev 9009) +++ trunk/lib/WikiPluginCached.php 2014-07-27 15:53:00 UTC (rev 9010) @@ -807,7 +807,7 @@ * @param string $errorformat outputs errors in 'png', 'gif', 'jpeg' or 'html' * @return bool */ - static public function fetchImageFromCache($dbi, $request, $errorformat = 'png') + public function fetchImageFromCache($dbi, $request, $errorformat = 'png') { $cache = $this->newCache(); $errorformat = $this->decideImgType($errorformat); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-09-29 16:35:15
|
Revision: 9137 http://sourceforge.net/p/phpwiki/code/9137 Author: vargenau Date: 2014-09-29 16:35:13 +0000 (Mon, 29 Sep 2014) Log Message: ----------- checkCall1 and checkCall2 are not static Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-09-29 16:34:31 UTC (rev 9136) +++ trunk/lib/WikiPluginCached.php 2014-09-29 16:35:13 UTC (rev 9137) @@ -643,7 +643,7 @@ * Param id and param plugincall are * also return values. */ - private static function checkCall1(&$id, &$plugincall, $cache, $request, $errorformat) + private function checkCall1(&$id, &$plugincall, $cache, $request, $errorformat) { $id = $request->getArg('id'); $plugincall = rawurldecode($request->getArg('args')); @@ -671,7 +671,7 @@ * @return bool false if an error occurs, true otherwise. * */ - static private function checkCall2(&$plugincall, $request) + private function checkCall2(&$plugincall, $request) { // if plugincall wasn't sent by URL, it must have been // stored in a session var instead and we can retreive it from there @@ -915,7 +915,7 @@ * @param string $errortext guess what? * @return void */ - protected function printError($imgtype, $errortext) + public function printError($imgtype, $errortext) { $imgtype = $this->decideImgType($imgtype); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-10-03 14:57:28
|
Revision: 9180 http://sourceforge.net/p/phpwiki/code/9180 Author: vargenau Date: 2014-10-03 14:57:26 +0000 (Fri, 03 Oct 2014) Log Message: ----------- function ImageFontWidth exists Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-10-03 14:54:29 UTC (rev 9179) +++ trunk/lib/WikiPluginCached.php 2014-10-03 14:57:26 UTC (rev 9180) @@ -977,13 +977,8 @@ 'width' => 600, 'height' => 350); - if (function_exists('ImageFontWidth')) { - $charx = ImageFontWidth($fontnr); - $chary = ImageFontHeight($fontnr); - } else { - $charx = 10; - $chary = 10; - } + $charx = ImageFontWidth($fontnr); + $chary = ImageFontHeight($fontnr); $marginx = $charx; $marginy = floor($chary / 2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-10-06 12:21:34
|
Revision: 9196 http://sourceforge.net/p/phpwiki/code/9196 Author: vargenau Date: 2014-10-06 12:21:30 +0000 (Mon, 06 Oct 2014) Log Message: ----------- Wikicreole syntax Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-10-06 10:19:30 UTC (rev 9195) +++ trunk/lib/WikiPluginCached.php 2014-10-06 12:21:30 UTC (rev 9196) @@ -27,7 +27,6 @@ */ require_once 'lib/WikiPlugin.php'; -// require_once "lib/plugincache-config.php"; // replaced by config.ini settings! // types: define('PLUGIN_CACHED_HTML', 0); // cached html (extensive calculation) @@ -76,7 +75,6 @@ private function genUrl($cache, $argarray) { global $request; - //$cacheparams = $GLOBALS['CacheParams']; $plugincall = serialize(array( 'pluginname' => $this->getName(), @@ -137,7 +135,6 @@ public function run($dbi, $argstr, &$request, $basepage) { $cache = $this->newCache(); - //$cacheparams = $GLOBALS['CacheParams']; $sortedargs = $this->getArgs($argstr, $request); if (is_array($sortedargs)) @@ -400,15 +397,15 @@ * Creates an HTML map hyperlinked to the image specified * by url and containing the hotspots given by map. * - * @param $id string unique id for the plugin call - * @param $url string url pointing to the image part of the map - * @param $map string <area> tags defining active + * @param string $id unique id for the plugin call + * @param string $url url pointing to the image part of the map + * @param string $map <area> tags defining active * regions in the map - * @param $dbi WikiDB database abstraction class - * @param $argarray array complete (!) arguments to produce + * @param WikiDB $dbi database abstraction class + * @param array $argarray complete (!) arguments to produce * image. It is not necessary to call * WikiPlugin->getArgs anymore. - * @param $request Request + * @param Request $request * @return string html output */ protected function embedMap($id, $url, $map, &$dbi, $argarray, &$request) @@ -659,9 +656,9 @@ * Extracts the parameters necessary to reconstruct the plugin * call needed to produce the requested image. * - * @param $plugincall string reference to serialized array containing both + * @param string $plugincall reference to serialized array containing both * name and parameters of the plugin call - * @param $request Request ??? + * @param Request $request ??? * @return bool false if an error occurs, true otherwise. * */ @@ -686,13 +683,13 @@ /** * Creates an image or image map depending on the plugin type. - * @param $content array reference to created array which overwrite the keys + * @param array $content reference to created array which overwrite the keys * 'image', 'imagetype' and possibly 'html' - * @param $plugin WikiPluginCached plugin which is called to create image or map - * @param $dbi WikiDB handle to database - * @param $argarray array Contains all arguments needed by plugin - * @param $request Request ???? - * @param $errorformat string outputs errors in 'png', 'gif', 'jpg' or 'html' + * @param WikiPluginCached $plugin plugin which is called to create image or map + * @param WikiDB $dbi WikiDB handle to database + * @param array $argarray array Contains all arguments needed by plugin + * @param Request $request Request ???? + * @param string $errorformat outputs errors in 'png', 'gif', 'jpg' or 'html' * @return bool error status; true=ok; false=error */ private function produceImage(&$content, $plugin, $dbi, $argarray, $request, $errorformat) @@ -711,8 +708,8 @@ if (!$imagehandle || $errortext) { if (!$errortext) { - $errortext = "'<?plugin " . $plugin->getName() . ' ' - . $this->glueArgs($argarray) . " ?>' returned no image, " + $errortext = "'<<" . $plugin->getName() . ' ' + . $this->glueArgs($argarray) . " >>' returned no image, " . " although no error was reported."; } $this->printError($errorformat, $errortext); @@ -858,7 +855,7 @@ return true; } - $errortext = "Could not create image file from imagehandle."; + $errortext = _("Could not create image file from imagehandle."); $this->printError($errorformat, $errortext); return false; } // FetchImageFromCache @@ -941,11 +938,11 @@ * values may be smaller if the chosen font is to big for there * is further restriction to 600 pixel in width and 350 in height. * - * @param $txt string multi line text to be converted - * @param $fontnr integer number (1-5) telling gd which internal font to use; + * @param string $txt multi line text to be converted + * @param int $fontnr number (1-5) telling gd which internal font to use; * I recommend font 2 for errors and 4 for help texts. - * @param $textcol array text color as a list of the rgb components; array(red,green,blue) - * @param $bgcol array background color; array(red,green,blue) + * @param array $textcol text color as a list of the rgb components; array(red,green,blue) + * @param array $bgcol background color; array(red,green,blue) * @return string image handle for gd routines */ static public function text2img($txt, $fontnr, $textcol, $bgcol) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-10-06 12:49:23
|
Revision: 9198 http://sourceforge.net/p/phpwiki/code/9198 Author: vargenau Date: 2014-10-06 12:49:21 +0000 (Mon, 06 Oct 2014) Log Message: ----------- Check file size Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2014-10-06 12:25:59 UTC (rev 9197) +++ trunk/lib/WikiPluginCached.php 2014-10-06 12:49:21 UTC (rev 9198) @@ -747,7 +747,11 @@ } if (file_exists($tmpfile)) { $fp = fopen($tmpfile, 'rb'); - $content['image'] = fread($fp, filesize($tmpfile)); + if (filesize($tmpfile)) { + $content['image'] = fread($fp, filesize($tmpfile)); + } else { + $content['image'] = ''; + } fclose($fp); if (!empty($this->_static)) { // on static it is in "uploads/" but in wikicached also @@ -756,8 +760,9 @@ return true; } unlink($tmpfile); - if ($content['image']) + if ($content['image']) { return true; + } } return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-10-14 08:33:14
|
Revision: 9965 http://sourceforge.net/p/phpwiki/code/9965 Author: vargenau Date: 2016-10-14 08:33:12 +0000 (Fri, 14 Oct 2016) Log Message: ----------- Fix getImageType prototype Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2016-10-14 08:24:17 UTC (rev 9964) +++ trunk/lib/WikiPluginCached.php 2016-10-14 08:33:12 UTC (rev 9965) @@ -320,7 +320,7 @@ * @param Request $request * @return string 'png', 'jpeg' or 'gif' */ - protected function getImageType(&$dbi, $argarray, &$request) + protected function getImageType($dbi, $argarray, &$request) { if (in_array($argarray['imgtype'], preg_split('/\s*:\s*/', PLUGIN_CACHED_IMGTYPES))) return $argarray['imgtype']; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-10-16 15:20:18
|
Revision: 9972 http://sourceforge.net/p/phpwiki/code/9972 Author: vargenau Date: 2016-10-16 15:20:15 +0000 (Sun, 16 Oct 2016) Log Message: ----------- Fix getImageType prototype Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2016-10-14 15:39:20 UTC (rev 9971) +++ trunk/lib/WikiPluginCached.php 2016-10-16 15:20:15 UTC (rev 9972) @@ -320,7 +320,7 @@ * @param Request $request * @return string 'png', 'jpeg' or 'gif' */ - protected function getImageType($dbi, $argarray, &$request) + protected function getImageType($dbi, $argarray, $request) { if (in_array($argarray['imgtype'], preg_split('/\s*:\s*/', PLUGIN_CACHED_IMGTYPES))) return $argarray['imgtype']; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-16 18:47:32
|
Revision: 10289 http://sourceforge.net/p/phpwiki/code/10289 Author: vargenau Date: 2021-06-16 18:47:30 +0000 (Wed, 16 Jun 2021) Log Message: ----------- class WikiPluginCached is a "fake" abstract class so that it can be instantiated Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2021-06-16 17:21:22 UTC (rev 10288) +++ trunk/lib/WikiPluginCached.php 2021-06-16 18:47:30 UTC (rev 10289) @@ -57,7 +57,7 @@ * * @author Johannes Große, Reini Urban */ -abstract class WikiPluginCached extends WikiPlugin +class WikiPluginCached extends WikiPlugin { public $_static; @@ -255,6 +255,11 @@ /* --------------------- abstract functions ----------- */ + protected function getDescription() + { + trigger_error('pure virtual', E_USER_ERROR); + } + /** * Sets the type of the plugin to html, image or map * production @@ -269,8 +274,12 @@ * <li>PLUGIN_CACHED_MAP</li> * </ul> */ - abstract protected function getPluginType(); + protected function getPluginType() + { + trigger_error('pure virtual', E_USER_ERROR); + } + /** * Creates an image handle from the given user arguments. * This method is only called if the return value of @@ -285,7 +294,10 @@ * @return mixed imagehandle image handle if successful * false if an error occured */ - abstract protected function getImage($dbi, $argarray, $request); + protected function getImage($dbi, $argarray, $request) + { + trigger_error('pure virtual', E_USER_ERROR); + } /** * Sets the life time of a cache entry in seconds. @@ -357,7 +369,10 @@ * @return string html to be printed in place of the plugin command * false if an error occured */ - abstract protected function getHtml($dbi, $argarray, $request, $basepage); + protected function getHtml($dbi, $argarray, $request, $basepage) + { + trigger_error('pure virtual', E_USER_ERROR); + } /** * Creates HTML output to be cached. @@ -375,7 +390,10 @@ * image. * array(false,false) if an error occured */ - abstract protected function getMap($dbi, $argarray, $request); + protected function getMap($dbi, $argarray, $request) + { + trigger_error('pure virtual', E_USER_ERROR); + } /* --------------------- produce Html ----------------------------- */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-06 07:55:46
|
Revision: 10443 http://sourceforge.net/p/phpwiki/code/10443 Author: vargenau Date: 2021-08-06 07:55:40 +0000 (Fri, 06 Aug 2021) Log Message: ----------- Always use local pear/Cache.php Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2021-08-06 07:54:22 UTC (rev 10442) +++ trunk/lib/WikiPluginCached.php 2021-08-06 07:55:40 UTC (rev 10443) @@ -24,12 +24,11 @@ */ /** - * You should set up the options in config/config.ini at Part seven: - * $ pear install http://pear.php.net/get/Cache - * This file belongs to WikiPluginCached. + * You should set up the options in config/config.ini at Part seven. */ require_once 'lib/WikiPlugin.php'; +require_once 'lib/pear/Cache.php'; // types: define('PLUGIN_CACHED_HTML', 0); // cached html (extensive calculation) @@ -499,15 +498,6 @@ static $staticcache; if (!is_object($staticcache)) { - if (!class_exists('Cache')) { - // uuh, pear not in include_path! should print a warning. - // search some possible pear paths. - $pearFinder = new PearFileFinder(); - if ($lib = $pearFinder->findFile('Cache.php', 'missing_ok')) - require_once($lib); - else // fall back to our own copy - require_once 'lib/pear/Cache.php'; - } $cacheparams = array(); foreach (explode(':', 'database:cache_dir:filename_prefix:highwater:lowwater' . ':maxlifetime:maxarglen:usecache:force_syncmap') as $key) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-10-06 10:59:51
|
Revision: 10618 http://sourceforge.net/p/phpwiki/code/10618 Author: vargenau Date: 2021-10-06 10:59:50 +0000 (Wed, 06 Oct 2021) Log Message: ----------- lib/WikiPluginCached.php: check plugin exists Modified Paths: -------------- trunk/lib/WikiPluginCached.php Modified: trunk/lib/WikiPluginCached.php =================================================================== --- trunk/lib/WikiPluginCached.php 2021-10-06 09:17:41 UTC (rev 10617) +++ trunk/lib/WikiPluginCached.php 2021-10-06 10:59:50 UTC (rev 10618) @@ -846,6 +846,9 @@ $loader = new WikiPluginLoader(); $plugin = $loader->getPlugin($pluginname); + if (!$plugin) { + return false; + } // cache empty, but image maps have to be created _inline_ // so ask user to reload wiki page instead @@ -854,10 +857,9 @@ $this->printError($errorformat, $errortext); } - if (!$this->produceImage($content, $plugin, $dbi, $argarray, - $request, $errorformat) - ) + if (!$this->produceImage($content, $plugin, $dbi, $argarray, $request, $errorformat)) { return false; + } $expire = $plugin->getExpire($dbi, $argarray, $request); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |