From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- plugins/dokuwiki/lib/exe/fetch.php | 433 +++++++++++++++++++++ plugins/dokuwiki/lib/images/fileicons/bz2.png | Bin 0 -> 720 bytes plugins/dokuwiki/lib/images/fileicons/conf.png | Bin 0 -> 717 bytes plugins/dokuwiki/lib/images/fileicons/deb.png | Bin 0 -> 716 bytes plugins/dokuwiki/lib/images/fileicons/doc.png | Bin 0 -> 659 bytes plugins/dokuwiki/lib/images/fileicons/file.gif | Bin 0 -> 942 bytes plugins/dokuwiki/lib/images/fileicons/file.png | Bin 0 -> 720 bytes plugins/dokuwiki/lib/images/fileicons/gif.png | Bin 0 -> 1001 bytes plugins/dokuwiki/lib/images/fileicons/gz.png | Bin 0 -> 716 bytes plugins/dokuwiki/lib/images/fileicons/htm.png | Bin 0 -> 748 bytes plugins/dokuwiki/lib/images/fileicons/html.png | Bin 0 -> 748 bytes plugins/dokuwiki/lib/images/fileicons/index.php | 49 +++ plugins/dokuwiki/lib/images/fileicons/jpeg.png | Bin 0 -> 1001 bytes plugins/dokuwiki/lib/images/fileicons/jpg.png | Bin 0 -> 1001 bytes plugins/dokuwiki/lib/images/fileicons/odc.png | Bin 0 -> 749 bytes plugins/dokuwiki/lib/images/fileicons/odf.png | Bin 0 -> 807 bytes plugins/dokuwiki/lib/images/fileicons/odg.png | Bin 0 -> 788 bytes plugins/dokuwiki/lib/images/fileicons/odi.png | Bin 0 -> 788 bytes plugins/dokuwiki/lib/images/fileicons/odp.png | Bin 0 -> 744 bytes plugins/dokuwiki/lib/images/fileicons/ods.png | Bin 0 -> 749 bytes plugins/dokuwiki/lib/images/fileicons/odt.png | Bin 0 -> 577 bytes plugins/dokuwiki/lib/images/fileicons/pdf.png | Bin 0 -> 663 bytes plugins/dokuwiki/lib/images/fileicons/png.png | Bin 0 -> 1001 bytes plugins/dokuwiki/lib/images/fileicons/ppt.png | Bin 0 -> 762 bytes plugins/dokuwiki/lib/images/fileicons/ps.png | Bin 0 -> 534 bytes plugins/dokuwiki/lib/images/fileicons/rpm.png | Bin 0 -> 638 bytes plugins/dokuwiki/lib/images/fileicons/rtf.png | Bin 0 -> 474 bytes plugins/dokuwiki/lib/images/fileicons/swf.png | Bin 0 -> 843 bytes plugins/dokuwiki/lib/images/fileicons/sxc.png | Bin 0 -> 749 bytes plugins/dokuwiki/lib/images/fileicons/sxd.png | Bin 0 -> 788 bytes plugins/dokuwiki/lib/images/fileicons/sxi.png | Bin 0 -> 744 bytes plugins/dokuwiki/lib/images/fileicons/sxw.png | Bin 0 -> 577 bytes plugins/dokuwiki/lib/images/fileicons/tar.png | Bin 0 -> 747 bytes plugins/dokuwiki/lib/images/fileicons/tgz.png | Bin 0 -> 716 bytes plugins/dokuwiki/lib/images/fileicons/txt.png | Bin 0 -> 542 bytes plugins/dokuwiki/lib/images/fileicons/xls.png | Bin 0 -> 731 bytes plugins/dokuwiki/lib/images/fileicons/xml.png | Bin 0 -> 475 bytes plugins/dokuwiki/lib/images/fileicons/zip.png | Bin 0 -> 874 bytes .../dokuwiki/lib/images/interwiki/amazon.de.gif | Bin 0 -> 882 bytes plugins/dokuwiki/lib/images/interwiki/amazon.gif | Bin 0 -> 882 bytes .../dokuwiki/lib/images/interwiki/amazon.uk.gif | Bin 0 -> 882 bytes plugins/dokuwiki/lib/images/interwiki/bug.gif | Bin 0 -> 166 bytes plugins/dokuwiki/lib/images/interwiki/coral.gif | Bin 0 -> 85 bytes plugins/dokuwiki/lib/images/interwiki/doku.gif | Bin 0 -> 257 bytes plugins/dokuwiki/lib/images/interwiki/google.gif | Bin 0 -> 980 bytes plugins/dokuwiki/lib/images/interwiki/meatball.gif | Bin 0 -> 1100 bytes plugins/dokuwiki/lib/images/interwiki/phpfn.gif | Bin 0 -> 330 bytes plugins/dokuwiki/lib/images/interwiki/sb.gif | Bin 0 -> 886 bytes plugins/dokuwiki/lib/images/interwiki/wiki.gif | Bin 0 -> 909 bytes plugins/dokuwiki/lib/images/interwiki/wp.gif | Bin 0 -> 680 bytes plugins/dokuwiki/lib/images/interwiki/wpde.gif | Bin 0 -> 680 bytes plugins/dokuwiki/lib/images/interwiki/wpmeta.gif | Bin 0 -> 680 bytes plugins/dokuwiki/lib/images/smileys/delete.gif | Bin 0 -> 1421 bytes plugins/dokuwiki/lib/images/smileys/fixme.gif | Bin 0 -> 1435 bytes plugins/dokuwiki/lib/images/smileys/icon_arrow.gif | Bin 0 -> 170 bytes .../dokuwiki/lib/images/smileys/icon_biggrin.gif | Bin 0 -> 172 bytes .../dokuwiki/lib/images/smileys/icon_confused.gif | Bin 0 -> 171 bytes plugins/dokuwiki/lib/images/smileys/icon_cool.gif | Bin 0 -> 172 bytes plugins/dokuwiki/lib/images/smileys/icon_cry.gif | Bin 0 -> 498 bytes plugins/dokuwiki/lib/images/smileys/icon_doubt.gif | Bin 0 -> 990 bytes .../dokuwiki/lib/images/smileys/icon_doubt2.gif | Bin 0 -> 992 bytes plugins/dokuwiki/lib/images/smileys/icon_eek.gif | Bin 0 -> 170 bytes plugins/dokuwiki/lib/images/smileys/icon_evil.gif | Bin 0 -> 236 bytes .../dokuwiki/lib/images/smileys/icon_exclaim.gif | Bin 0 -> 236 bytes plugins/dokuwiki/lib/images/smileys/icon_frown.gif | Bin 0 -> 171 bytes plugins/dokuwiki/lib/images/smileys/icon_fun.gif | Bin 0 -> 590 bytes plugins/dokuwiki/lib/images/smileys/icon_idea.gif | Bin 0 -> 176 bytes plugins/dokuwiki/lib/images/smileys/icon_kaddi.gif | Bin 0 -> 991 bytes plugins/dokuwiki/lib/images/smileys/icon_lol.gif | Bin 0 -> 336 bytes .../dokuwiki/lib/images/smileys/icon_mrgreen.gif | Bin 0 -> 349 bytes .../dokuwiki/lib/images/smileys/icon_neutral.gif | Bin 0 -> 171 bytes .../dokuwiki/lib/images/smileys/icon_question.gif | Bin 0 -> 248 bytes plugins/dokuwiki/lib/images/smileys/icon_razz.gif | Bin 0 -> 176 bytes .../dokuwiki/lib/images/smileys/icon_redface.gif | Bin 0 -> 650 bytes .../dokuwiki/lib/images/smileys/icon_rolleyes.gif | Bin 0 -> 485 bytes plugins/dokuwiki/lib/images/smileys/icon_sad.gif | Bin 0 -> 171 bytes .../dokuwiki/lib/images/smileys/icon_silenced.gif | Bin 0 -> 231 bytes plugins/dokuwiki/lib/images/smileys/icon_smile.gif | Bin 0 -> 174 bytes .../dokuwiki/lib/images/smileys/icon_smile2.gif | Bin 0 -> 174 bytes .../dokuwiki/lib/images/smileys/icon_surprised.gif | Bin 0 -> 174 bytes .../dokuwiki/lib/images/smileys/icon_twisted.gif | Bin 0 -> 238 bytes plugins/dokuwiki/lib/images/smileys/icon_wink.gif | Bin 0 -> 170 bytes .../dokuwiki/lib/plugins/changelinks/syntax.php | 157 ++++++++ plugins/dokuwiki/lib/plugins/fslink/syntax.php | 81 ++++ plugins/dokuwiki/lib/plugins/newline/syntax.php | 77 ++++ plugins/dokuwiki/lib/plugins/syntax.php | 270 +++++++++++++ 86 files changed, 1067 insertions(+) create mode 100644 plugins/dokuwiki/lib/exe/fetch.php create mode 100644 plugins/dokuwiki/lib/images/fileicons/bz2.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/conf.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/deb.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/doc.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/file.gif create mode 100644 plugins/dokuwiki/lib/images/fileicons/file.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/gif.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/gz.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/htm.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/html.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/index.php create mode 100644 plugins/dokuwiki/lib/images/fileicons/jpeg.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/jpg.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/odc.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/odf.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/odg.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/odi.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/odp.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/ods.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/odt.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/pdf.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/png.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/ppt.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/ps.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/rpm.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/rtf.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/swf.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/sxc.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/sxd.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/sxi.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/sxw.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/tar.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/tgz.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/txt.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/xls.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/xml.png create mode 100644 plugins/dokuwiki/lib/images/fileicons/zip.png create mode 100644 plugins/dokuwiki/lib/images/interwiki/amazon.de.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/amazon.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/amazon.uk.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/bug.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/coral.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/doku.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/google.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/meatball.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/phpfn.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/sb.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/wiki.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/wp.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/wpde.gif create mode 100644 plugins/dokuwiki/lib/images/interwiki/wpmeta.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/delete.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/fixme.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_arrow.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_biggrin.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_confused.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_cool.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_cry.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_doubt.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_doubt2.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_eek.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_evil.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_exclaim.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_frown.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_fun.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_idea.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_kaddi.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_lol.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_mrgreen.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_neutral.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_question.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_razz.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_redface.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_rolleyes.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_sad.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_silenced.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_smile.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_smile2.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_surprised.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_twisted.gif create mode 100644 plugins/dokuwiki/lib/images/smileys/icon_wink.gif create mode 100644 plugins/dokuwiki/lib/plugins/changelinks/syntax.php create mode 100644 plugins/dokuwiki/lib/plugins/fslink/syntax.php create mode 100644 plugins/dokuwiki/lib/plugins/newline/syntax.php create mode 100644 plugins/dokuwiki/lib/plugins/syntax.php (limited to 'plugins/dokuwiki/lib') diff --git a/plugins/dokuwiki/lib/exe/fetch.php b/plugins/dokuwiki/lib/exe/fetch.php new file mode 100644 index 0000000..59e59ca --- /dev/null +++ b/plugins/dokuwiki/lib/exe/fetch.php @@ -0,0 +1,433 @@ + + */ + +# security hotfix +die(); + + if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); + define('DOKU_DISABLE_GZIP_OUTPUT', 1); + require_once(DOKU_INC.'inc/init.php'); + require_once(DOKU_INC.'inc/common.php'); + require_once(DOKU_INC.'inc/pageutils.php'); + require_once(DOKU_INC.'inc/confutils.php'); + //close sesseion + session_write_close(); + if(!defined('CHUNK_SIZE')) define('CHUNK_SIZE',16*1024); + + $mimetypes = getMimeTypes(); + + //get input + $MEDIA = stripctl(getID('media',false)); // no cleaning except control chars - maybe external + $CACHE = calc_cache($_REQUEST['cache']); + $WIDTH = (int) $_REQUEST['w']; + $HEIGHT = (int) $_REQUEST['h']; + list($EXT,$MIME) = mimetype($MEDIA); + if($EXT === false){ + $EXT = 'unknown'; + $MIME = 'application/octet-stream'; + } + + //media to local file + if(preg_match('#^(https?)://#i',$MEDIA)){ + //handle external images + if(strncmp($MIME,'image/',6) == 0) $FILE = get_from_URL($MEDIA,$EXT,$CACHE); + if(!$FILE){ + //download failed - redirect to original URL + header('Location: '.$MEDIA); + exit; + } + }else{ + $MEDIA = cleanID($MEDIA); + if(empty($MEDIA)){ + header("HTTP/1.0 400 Bad Request"); + print 'Bad request'; + exit; + } + + $FILE = mediaFN($MEDIA); + } + + //check file existance + if(!@file_exists($FILE)){ + header("HTTP/1.0 404 Not Found"); + //FIXME add some default broken image + print 'Not Found'; + exit; + } + + //handle image resizing + if((substr($MIME,0,5) == 'image') && $WIDTH){ + $FILE = get_resized($FILE,$EXT,$WIDTH,$HEIGHT); + } + + // finally send the file to the client + sendFile($FILE,$MIME,$CACHE); + +/* ------------------------------------------------------------------------ */ + +/** + * Set headers and send the file to the client + * + * @author Andreas Gohr + * @author Ben Coburn + */ +function sendFile($file,$mime,$cache){ + global $conf; + $fmtime = filemtime($file); + // send headers + header("Content-Type: $mime"); + // smart http caching headers + if ($cache==-1) { + // cache + // cachetime or one hour + header('Expires: '.gmdate("D, d M Y H:i:s", time()+max($conf['cachetime'], 3600)).' GMT'); + header('Cache-Control: public, proxy-revalidate, no-transform, max-age='.max($conf['cachetime'], 3600)); + header('Pragma: public'); + } else if ($cache>0) { + // recache + // remaining cachetime + 10 seconds so the newly recached media is used + header('Expires: '.gmdate("D, d M Y H:i:s", $fmtime+$conf['cachetime']+10).' GMT'); + header('Cache-Control: public, proxy-revalidate, no-transform, max-age='.max($fmtime-time()+$conf['cachetime']+10, 0)); + header('Pragma: public'); + } else if ($cache==0) { + // nocache + header('Cache-Control: must-revalidate, no-transform, post-check=0, pre-check=0'); + header('Pragma: public'); + } + header('Accept-Ranges: bytes'); + //send important headers first, script stops here if '304 Not Modified' response + http_conditionalRequest($fmtime); + list($start,$len) = http_rangeRequest(filesize($file)); + + //application mime type is downloadable + if(substr($mime,0,11) == 'application'){ + header('Content-Disposition: attachment; filename="'.basename($file).'";'); + } + + // send file contents + $fp = @fopen($file,"rb"); + if($fp){ + fseek($fp,$start); //seek to start of range + + $chunk = ($len > CHUNK_SIZE) ? CHUNK_SIZE : $len; + while (!feof($fp) && $chunk > 0) { + @set_time_limit(); // large files can take a lot of time + print fread($fp, $chunk); + flush(); + $len -= $chunk; + $chunk = ($len > CHUNK_SIZE) ? CHUNK_SIZE : $len; + } + fclose($fp); + }else{ + header("HTTP/1.0 500 Internal Server Error"); + print "Could not read $file - bad permissions?"; + } +} + +/** + * Checks and sets headers to handle range requets + * + * @author Andreas Gohr + * @returns array The start byte and the amount of bytes to send + */ +function http_rangeRequest($size){ + if(!isset($_SERVER['HTTP_RANGE'])){ + // no range requested - send the whole file + header("Content-Length: $size"); + return array(0,$size); + } + + $t = explode('=', $_SERVER['HTTP_RANGE']); + if (!$t[0]=='bytes') { + // we only understand byte ranges - send the whole file + header("Content-Length: $size"); + return array(0,$size); + } + + $r = explode('-', $t[1]); + $start = (int)$r[0]; + $end = (int)$r[1]; + if (!$end) $end = $size - 1; + if ($start > $end || $start > $size || $end > $size){ + header('HTTP/1.1 416 Requested Range Not Satisfiable'); + print 'Bad Range Request!'; + exit; + } + + $tot = $end - $start + 1; + header('HTTP/1.1 206 Partial Content'); + header("Content-Range: bytes {$start}-{$end}/{$size}"); + header("Content-Length: $tot"); + + return array($start,$tot); +} + +/** + * Resizes the given image to the given size + * + * @author Andreas Gohr + */ +function get_resized($file, $ext, $w, $h=0){ + global $conf; + + $info = getimagesize($file); + if(!$h) $h = round(($w * $info[1]) / $info[0]); + + // we wont scale up to infinity + if($w > 2000 || $h > 2000) return $file; + + //cache + $local = getCacheName($file,'.media.'.$w.'x'.$h.'.'.$ext); + $mtime = @filemtime($local); // 0 if not exists + + if( $mtime > filemtime($file) || + resize_imageIM($ext,$file,$info[0],$info[1],$local,$w,$h) || + resize_imageGD($ext,$file,$info[0],$info[1],$local,$w,$h) ){ + return $local; + } + //still here? resizing failed + return $file; +} + +/** + * Returns the wanted cachetime in seconds + * + * Resolves named constants + * + * @author Andreas Gohr + */ +function calc_cache($cache){ + global $conf; + + if(strtolower($cache) == 'nocache') return 0; //never cache + if(strtolower($cache) == 'recache') return $conf['cachetime']; //use standard cache + return -1; //cache endless +} + +/** + * Download a remote file and return local filename + * + * returns false if download fails. Uses cached file if available and + * wanted + * + * @author Andreas Gohr + * @author Pavel Vitis + */ +function get_from_URL($url,$ext,$cache){ + global $conf; + + // if no cache or fetchsize just redirect + if ($cache==0) return false; + if (!$conf['fetchsize']) return false; + + $local = getCacheName(strtolower($url),".media.$ext"); + $mtime = @filemtime($local); // 0 if not exists + + //decide if download needed: + if( ($mtime == 0) || // cache does not exist + ($cache != -1 && $mtime < time()-$cache) // 'recache' and cache has expired + ){ + if(image_download($url,$local)){ + return $local; + }else{ + return false; + } + } + + //if cache exists use it else + if($mtime) return $local; + + //else return false + return false; +} + +/** + * Download image files + * + * @author Andreas Gohr + */ +function image_download($url,$file){ + global $conf; + $http = new DokuHTTPClient(); + $http->max_bodysize = $conf['fetchsize']; + $http->timeout = 25; //max. 25 sec + $http->header_regexp = '!\r\nContent-Type: image/(jpe?g|gif|png)!i'; + + $data = $http->get($url); + if(!$data) return false; + + $fileexists = @file_exists($file); + $fp = @fopen($file,"w"); + if(!$fp) return false; + fwrite($fp,$data); + fclose($fp); + if(!$fileexists and $conf['fperm']) chmod($file, $conf['fperm']); + + // check if it is really an image + $info = @getimagesize($file); + if(!$info){ + @unlink($file); + return false; + } + + return true; +} + +/** + * resize images using external ImageMagick convert program + * + * @author Pavel Vitis + * @author Andreas Gohr + */ +function resize_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ + global $conf; + + // check if convert is configured + if(!$conf['im_convert']) return false; + + // prepare command + $cmd = $conf['im_convert']; + $cmd .= ' -resize '.$to_w.'x'.$to_h.'!'; + if ($ext == 'jpg' || $ext == 'jpeg') { + $cmd .= ' -quality '.$conf['jpg_quality']; + } + $cmd .= " $from $to"; + + @exec($cmd,$out,$retval); + if ($retval == 0) return true; + return false; +} + +/** + * resize images using PHP's libGD support + * + * @author Andreas Gohr + */ +function resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ + global $conf; + + if($conf['gdlib'] < 1) return false; //no GDlib available or wanted + + // check available memory + if(!is_mem_available(($from_w * $from_h * 4) + ($to_w * $to_h * 4))){ + return false; + } + + // create an image of the given filetype + if ($ext == 'jpg' || $ext == 'jpeg'){ + if(!function_exists("imagecreatefromjpeg")) return false; + $image = @imagecreatefromjpeg($from); + }elseif($ext == 'png') { + if(!function_exists("imagecreatefrompng")) return false; + $image = @imagecreatefrompng($from); + + }elseif($ext == 'gif') { + if(!function_exists("imagecreatefromgif")) return false; + $image = @imagecreatefromgif($from); + } + if(!$image) return false; + + if(($conf['gdlib']>1) && function_exists("imagecreatetruecolor")){ + $newimg = @imagecreatetruecolor ($to_w, $to_h); + } + if(!$newimg) $newimg = @imagecreate($to_w, $to_h); + if(!$newimg){ + imagedestroy($image); + return false; + } + + //keep png alpha channel if possible + if($ext == 'png' && $conf['gdlib']>1 && function_exists('imagesavealpha')){ + imagealphablending($newimg, false); + imagesavealpha($newimg,true); + } + + //try resampling first + if(function_exists("imagecopyresampled")){ + if(!@imagecopyresampled($newimg, $image, 0, 0, 0, 0, $to_w, $to_h, $from_w, $from_h)) { + imagecopyresized($newimg, $image, 0, 0, 0, 0, $to_w, $to_h, $from_w, $from_h); + } + }else{ + imagecopyresized($newimg, $image, 0, 0, 0, 0, $to_w, $to_h, $from_w, $from_h); + } + + $okay = false; + if ($ext == 'jpg' || $ext == 'jpeg'){ + if(!function_exists('imagejpeg')){ + $okay = false; + }else{ + $okay = imagejpeg($newimg, $to, $conf['jpg_quality']); + } + }elseif($ext == 'png') { + if(!function_exists('imagepng')){ + $okay = false; + }else{ + $okay = imagepng($newimg, $to); + } + }elseif($ext == 'gif') { + if(!function_exists('imagegif')){ + $okay = false; + }else{ + $okay = imagegif($newimg, $to); + } + } + + // destroy GD image ressources + if($image) imagedestroy($image); + if($newimg) imagedestroy($newimg); + + return $okay; +} + +/** + * Checks if the given amount of memory is available + * + * If the memory_get_usage() function is not available the + * function just assumes $used bytes of already allocated memory + * + * @param int $mem Size of memory you want to allocate in bytes + * @param int $used already allocated memory (see above) + * @author Filip Oscadal + * @author Andreas Gohr + */ +function is_mem_available($mem,$bytes=1048576){ + $limit = trim(ini_get('memory_limit')); + if(empty($limit)) return true; // no limit set! + + // parse limit to bytes + $unit = strtolower(substr($limit,-1)); + switch($unit){ + case 'g': + $limit = substr($limit,0,-1); + $limit *= 1024*1024*1024; + break; + case 'm': + $limit = substr($limit,0,-1); + $limit *= 1024*1024; + break; + case 'k': + $limit = substr($limit,0,-1); + $limit *= 1024; + break; + } + + // get used memory if possible + if(function_exists('memory_get_usage')){ + $used = memory_get_usage(); + } + + + if($used+$mem > $limit){ + return false; + } + + return true; +} + +//Setup VIM: ex: et ts=2 enc=utf-8 : +?> diff --git a/plugins/dokuwiki/lib/images/fileicons/bz2.png b/plugins/dokuwiki/lib/images/fileicons/bz2.png new file mode 100644 index 0000000..d48cae0 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/bz2.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/conf.png b/plugins/dokuwiki/lib/images/fileicons/conf.png new file mode 100644 index 0000000..ddffe6f Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/conf.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/deb.png b/plugins/dokuwiki/lib/images/fileicons/deb.png new file mode 100644 index 0000000..9229d87 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/deb.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/doc.png b/plugins/dokuwiki/lib/images/fileicons/doc.png new file mode 100644 index 0000000..932567f Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/doc.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/file.gif b/plugins/dokuwiki/lib/images/fileicons/file.gif new file mode 100644 index 0000000..815ccb1 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/file.gif differ diff --git a/plugins/dokuwiki/lib/images/fileicons/file.png b/plugins/dokuwiki/lib/images/fileicons/file.png new file mode 100644 index 0000000..817014f Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/file.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/gif.png b/plugins/dokuwiki/lib/images/fileicons/gif.png new file mode 100644 index 0000000..b4c07a9 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/gif.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/gz.png b/plugins/dokuwiki/lib/images/fileicons/gz.png new file mode 100644 index 0000000..2426bd1 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/gz.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/htm.png b/plugins/dokuwiki/lib/images/fileicons/htm.png new file mode 100644 index 0000000..1a68121 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/htm.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/html.png b/plugins/dokuwiki/lib/images/fileicons/html.png new file mode 100644 index 0000000..672cbce Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/html.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/index.php b/plugins/dokuwiki/lib/images/fileicons/index.php new file mode 100644 index 0000000..805b36d --- /dev/null +++ b/plugins/dokuwiki/lib/images/fileicons/index.php @@ -0,0 +1,49 @@ + + + filetype icons + + + + + + +
+ '; +} +?> +
+ +
+ '; +} +?> +
+ + + diff --git a/plugins/dokuwiki/lib/images/fileicons/jpeg.png b/plugins/dokuwiki/lib/images/fileicons/jpeg.png new file mode 100644 index 0000000..aa4cc23 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/jpeg.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/jpg.png b/plugins/dokuwiki/lib/images/fileicons/jpg.png new file mode 100644 index 0000000..1fb6cc1 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/jpg.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/odc.png b/plugins/dokuwiki/lib/images/fileicons/odc.png new file mode 100644 index 0000000..47f65c8 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/odc.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/odf.png b/plugins/dokuwiki/lib/images/fileicons/odf.png new file mode 100644 index 0000000..a2fbc51 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/odf.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/odg.png b/plugins/dokuwiki/lib/images/fileicons/odg.png new file mode 100644 index 0000000..434f182 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/odg.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/odi.png b/plugins/dokuwiki/lib/images/fileicons/odi.png new file mode 100644 index 0000000..74f6303 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/odi.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/odp.png b/plugins/dokuwiki/lib/images/fileicons/odp.png new file mode 100644 index 0000000..a5c77f8 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/odp.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/ods.png b/plugins/dokuwiki/lib/images/fileicons/ods.png new file mode 100644 index 0000000..2ab1273 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/ods.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/odt.png b/plugins/dokuwiki/lib/images/fileicons/odt.png new file mode 100644 index 0000000..b0c21fc Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/odt.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/pdf.png b/plugins/dokuwiki/lib/images/fileicons/pdf.png new file mode 100644 index 0000000..638066d Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/pdf.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/png.png b/plugins/dokuwiki/lib/images/fileicons/png.png new file mode 100644 index 0000000..f0b5b00 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/png.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/ppt.png b/plugins/dokuwiki/lib/images/fileicons/ppt.png new file mode 100644 index 0000000..adaefc6 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/ppt.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/ps.png b/plugins/dokuwiki/lib/images/fileicons/ps.png new file mode 100644 index 0000000..c51c763 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/ps.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/rpm.png b/plugins/dokuwiki/lib/images/fileicons/rpm.png new file mode 100644 index 0000000..22212ea Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/rpm.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/rtf.png b/plugins/dokuwiki/lib/images/fileicons/rtf.png new file mode 100644 index 0000000..d8bada5 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/rtf.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/swf.png b/plugins/dokuwiki/lib/images/fileicons/swf.png new file mode 100644 index 0000000..0729ed0 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/swf.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/sxc.png b/plugins/dokuwiki/lib/images/fileicons/sxc.png new file mode 100644 index 0000000..419c183 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/sxc.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/sxd.png b/plugins/dokuwiki/lib/images/fileicons/sxd.png new file mode 100644 index 0000000..5801bb2 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/sxd.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/sxi.png b/plugins/dokuwiki/lib/images/fileicons/sxi.png new file mode 100644 index 0000000..2a94290 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/sxi.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/sxw.png b/plugins/dokuwiki/lib/images/fileicons/sxw.png new file mode 100644 index 0000000..6da97be Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/sxw.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/tar.png b/plugins/dokuwiki/lib/images/fileicons/tar.png new file mode 100644 index 0000000..5a2f717 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/tar.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/tgz.png b/plugins/dokuwiki/lib/images/fileicons/tgz.png new file mode 100644 index 0000000..141acf5 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/tgz.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/txt.png b/plugins/dokuwiki/lib/images/fileicons/txt.png new file mode 100644 index 0000000..da20009 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/txt.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/xls.png b/plugins/dokuwiki/lib/images/fileicons/xls.png new file mode 100644 index 0000000..e8cd58d Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/xls.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/xml.png b/plugins/dokuwiki/lib/images/fileicons/xml.png new file mode 100644 index 0000000..eb46323 Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/xml.png differ diff --git a/plugins/dokuwiki/lib/images/fileicons/zip.png b/plugins/dokuwiki/lib/images/fileicons/zip.png new file mode 100644 index 0000000..999ffbe Binary files /dev/null and b/plugins/dokuwiki/lib/images/fileicons/zip.png differ diff --git a/plugins/dokuwiki/lib/images/interwiki/amazon.de.gif b/plugins/dokuwiki/lib/images/interwiki/amazon.de.gif new file mode 100644 index 0000000..f52c1c5 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/amazon.de.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/amazon.gif b/plugins/dokuwiki/lib/images/interwiki/amazon.gif new file mode 100644 index 0000000..f52c1c5 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/amazon.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/amazon.uk.gif b/plugins/dokuwiki/lib/images/interwiki/amazon.uk.gif new file mode 100644 index 0000000..f52c1c5 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/amazon.uk.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/bug.gif b/plugins/dokuwiki/lib/images/interwiki/bug.gif new file mode 100644 index 0000000..3432b8d Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/bug.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/coral.gif b/plugins/dokuwiki/lib/images/interwiki/coral.gif new file mode 100644 index 0000000..0f9f675 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/coral.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/doku.gif b/plugins/dokuwiki/lib/images/interwiki/doku.gif new file mode 100644 index 0000000..7dc4248 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/doku.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/google.gif b/plugins/dokuwiki/lib/images/interwiki/google.gif new file mode 100644 index 0000000..fb39f61 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/google.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/meatball.gif b/plugins/dokuwiki/lib/images/interwiki/meatball.gif new file mode 100644 index 0000000..7ac5454 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/meatball.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/phpfn.gif b/plugins/dokuwiki/lib/images/interwiki/phpfn.gif new file mode 100644 index 0000000..638d4c4 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/phpfn.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/sb.gif b/plugins/dokuwiki/lib/images/interwiki/sb.gif new file mode 100644 index 0000000..e272a29 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/sb.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/wiki.gif b/plugins/dokuwiki/lib/images/interwiki/wiki.gif new file mode 100644 index 0000000..e8dc5d2 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/wiki.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/wp.gif b/plugins/dokuwiki/lib/images/interwiki/wp.gif new file mode 100644 index 0000000..ca853b8 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/wp.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/wpde.gif b/plugins/dokuwiki/lib/images/interwiki/wpde.gif new file mode 100644 index 0000000..ca853b8 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/wpde.gif differ diff --git a/plugins/dokuwiki/lib/images/interwiki/wpmeta.gif b/plugins/dokuwiki/lib/images/interwiki/wpmeta.gif new file mode 100644 index 0000000..ca853b8 Binary files /dev/null and b/plugins/dokuwiki/lib/images/interwiki/wpmeta.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/delete.gif b/plugins/dokuwiki/lib/images/smileys/delete.gif new file mode 100644 index 0000000..d668348 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/delete.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/fixme.gif b/plugins/dokuwiki/lib/images/smileys/fixme.gif new file mode 100644 index 0000000..b66ea99 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/fixme.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_arrow.gif b/plugins/dokuwiki/lib/images/smileys/icon_arrow.gif new file mode 100644 index 0000000..2880055 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_arrow.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_biggrin.gif b/plugins/dokuwiki/lib/images/smileys/icon_biggrin.gif new file mode 100644 index 0000000..d352772 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_biggrin.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_confused.gif b/plugins/dokuwiki/lib/images/smileys/icon_confused.gif new file mode 100644 index 0000000..0c49e06 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_confused.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_cool.gif b/plugins/dokuwiki/lib/images/smileys/icon_cool.gif new file mode 100644 index 0000000..cead030 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_cool.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_cry.gif b/plugins/dokuwiki/lib/images/smileys/icon_cry.gif new file mode 100644 index 0000000..7d54b1f Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_cry.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_doubt.gif b/plugins/dokuwiki/lib/images/smileys/icon_doubt.gif new file mode 100644 index 0000000..fd7903b Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_doubt.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_doubt2.gif b/plugins/dokuwiki/lib/images/smileys/icon_doubt2.gif new file mode 100644 index 0000000..eb4b70b Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_doubt2.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_eek.gif b/plugins/dokuwiki/lib/images/smileys/icon_eek.gif new file mode 100644 index 0000000..5d39781 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_eek.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_evil.gif b/plugins/dokuwiki/lib/images/smileys/icon_evil.gif new file mode 100644 index 0000000..ab1aa8e Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_evil.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_exclaim.gif b/plugins/dokuwiki/lib/images/smileys/icon_exclaim.gif new file mode 100644 index 0000000..6e50e2e Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_exclaim.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_frown.gif b/plugins/dokuwiki/lib/images/smileys/icon_frown.gif new file mode 100644 index 0000000..d2ac78c Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_frown.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_fun.gif b/plugins/dokuwiki/lib/images/smileys/icon_fun.gif new file mode 100644 index 0000000..a8bb8a3 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_fun.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_idea.gif b/plugins/dokuwiki/lib/images/smileys/icon_idea.gif new file mode 100644 index 0000000..a40ae0d Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_idea.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_kaddi.gif b/plugins/dokuwiki/lib/images/smileys/icon_kaddi.gif new file mode 100644 index 0000000..1410f7f Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_kaddi.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_lol.gif b/plugins/dokuwiki/lib/images/smileys/icon_lol.gif new file mode 100644 index 0000000..374ba15 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_lol.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_mrgreen.gif b/plugins/dokuwiki/lib/images/smileys/icon_mrgreen.gif new file mode 100644 index 0000000..b54cd0f Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_mrgreen.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_neutral.gif b/plugins/dokuwiki/lib/images/smileys/icon_neutral.gif new file mode 100644 index 0000000..4f31156 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_neutral.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_question.gif b/plugins/dokuwiki/lib/images/smileys/icon_question.gif new file mode 100644 index 0000000..9d07226 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_question.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_razz.gif b/plugins/dokuwiki/lib/images/smileys/icon_razz.gif new file mode 100644 index 0000000..29da2a2 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_razz.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_redface.gif b/plugins/dokuwiki/lib/images/smileys/icon_redface.gif new file mode 100644 index 0000000..ad76283 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_redface.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_rolleyes.gif b/plugins/dokuwiki/lib/images/smileys/icon_rolleyes.gif new file mode 100644 index 0000000..d7f5f2f Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_rolleyes.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_sad.gif b/plugins/dokuwiki/lib/images/smileys/icon_sad.gif new file mode 100644 index 0000000..d2ac78c Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_sad.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_silenced.gif b/plugins/dokuwiki/lib/images/smileys/icon_silenced.gif new file mode 100644 index 0000000..448399b Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_silenced.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_smile.gif b/plugins/dokuwiki/lib/images/smileys/icon_smile.gif new file mode 100644 index 0000000..7b1f6d3 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_smile.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_smile2.gif b/plugins/dokuwiki/lib/images/smileys/icon_smile2.gif new file mode 100644 index 0000000..769639d Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_smile2.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_surprised.gif b/plugins/dokuwiki/lib/images/smileys/icon_surprised.gif new file mode 100644 index 0000000..cb21424 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_surprised.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_twisted.gif b/plugins/dokuwiki/lib/images/smileys/icon_twisted.gif new file mode 100644 index 0000000..502fe24 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_twisted.gif differ diff --git a/plugins/dokuwiki/lib/images/smileys/icon_wink.gif b/plugins/dokuwiki/lib/images/smileys/icon_wink.gif new file mode 100644 index 0000000..d148288 Binary files /dev/null and b/plugins/dokuwiki/lib/images/smileys/icon_wink.gif differ diff --git a/plugins/dokuwiki/lib/plugins/changelinks/syntax.php b/plugins/dokuwiki/lib/plugins/changelinks/syntax.php new file mode 100644 index 0000000..263e066 --- /dev/null +++ b/plugins/dokuwiki/lib/plugins/changelinks/syntax.php @@ -0,0 +1,157 @@ + 'Florian Schmitz', + 'email' => 'floele@gmail.com', + 'date' => '2005-12-18', + 'name' => 'Change-Interwikilinks Plugin', + 'desc' => 'Changes the functionality of interwikilinks', + 'url' => 'http://flyspray.org/', + ); + } + + /** + * What kind of syntax are we? + */ + function getType(){ + return 'substition'; + } + + /** + * Where to sort in? + */ + function getSort(){ + return 299; + } + + /** + * Connect pattern to lexer + */ + + function connectTo($mode) { + // Word boundaries? + $this->Lexer->addSpecialPattern("\[\[.+?\]\]",$mode,'plugin_changelinks'); + } + + /** + * Handle the match + */ + function handle($match, $state, $pos, &$handler){ + // Strip the opening and closing markup + $link = preg_replace(array('/^\[\[/','/\]\]$/u'),'',$match); + + // Split title from URL + $link = preg_split('/\|/u',$link,2); + if ( !isset($link[1]) ) { + $link[1] = NULL; + } else if ( preg_match('/^\{\{[^\}]+\}\}$/',$link[1]) ) { + // If the title is an image, convert it to an array containing the image details + $link[1] = Doku_Handler_Parse_Media($link[1]); + } + $link[0] = trim($link[0]); + + //decide which kind of link it is + + if ( preg_match('/^[a-zA-Z]+>{1}.*$/u',$link[0]) ) { + // Interwiki + $interwiki = preg_split('/>/u',$link[0]); + $handler->_addCall( + 'interwikilink', + array($link[0],$link[1],strtolower($interwiki[0]),$interwiki[1]), + $pos + ); + } elseif ( preg_match('/^\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) { + // Windows Share + $handler->_addCall( + 'windowssharelink', + array($link[0],$link[1]), + $pos + ); + } elseif ( preg_match('#^([a-z0-9\-\.+]+?)://#i',$link[0]) ) { + // external link (accepts all protocols) + $handler->_addCall( + 'externallink', + array($link[0],$link[1]), + $pos + ); + } elseif ( preg_match('#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i',$link[0]) ) { + // E-Mail + $handler->_addCall( + 'emaillink', + array($link[0],$link[1]), + $pos + ); + } elseif ( preg_match('!^#.+!',$link[0]) ){ + // local link + $handler->_addCall( + 'locallink', + array(substr($link[0],1),$link[1]), + $pos + ); + } else { + return array($link[0],$link[1]); + } + } + + /** + * Create output + */ + function render($mode, &$renderer, $data) { + if($mode == 'xhtml') { + global $conf; + $id = $data[0]; + $name = $data[1]; + + //prepare for formating + $link['target'] = $conf['target']['wiki']; + $link['style'] = ''; + $link['pre'] = ''; + $link['suf'] = ''; + $link['more'] = ''; + $link['class'] = 'internallink'; + $link['url'] = DOKU_INTERNAL_LINK . $id; + + if(is_array($name)){ + $link['name'] = (isset($name['title'])) ? hsc($name['title']) : hsc($id); + $link['title'] = $id; + } else{ + $link['name'] = ($name) ? hsc($name) : hsc($id); + $link['title'] = ($name) ? $name : $id; + } + + //add search string + if($search){ + ($conf['userewrite']) ? $link['url'].='?s=' : $link['url'].='&s='; + $link['url'] .= urlencode($search); + } + + //output formatted + $renderer->doc .= $renderer->_formatLink($link); + } + return true; + } + +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : +?> diff --git a/plugins/dokuwiki/lib/plugins/fslink/syntax.php b/plugins/dokuwiki/lib/plugins/fslink/syntax.php new file mode 100644 index 0000000..57c91c3 --- /dev/null +++ b/plugins/dokuwiki/lib/plugins/fslink/syntax.php @@ -0,0 +1,81 @@ + 'Florian Schmitz', + 'email' => 'floele@gmail.com', + 'date' => '2005-12-17', + 'name' => 'FS-link Plugin', + 'desc' => 'Enables Flyspray\'s bug links', + 'url' => 'http://flyspray.org/', + ); + } + + /** + * What kind of syntax are we? + */ + function getType(){ + return 'substition'; + } + + /** + * Where to sort in? + */ + function getSort(){ + return 301; + } + + /** + * Connect pattern to lexer + */ + + function connectTo($mode) { + // Word boundaries? + $this->Lexer->addSpecialPattern('FS#\d+',$mode,'plugin_fslink'); + $this->Lexer->addSpecialPattern('bug \d+',$mode,'plugin_fslink'); + } + + /** + * Handle the match + */ + function handle($match, $state, $pos, &$handler){ + return array($match, $state); + } + + /** + * Create output + */ + function render($mode, &$renderer, $data) { + if($mode == 'xhtml'){ + $fsid = explode('#', $data[0]); + if(count($fsid) < 2) { + $fsid = explode(' ', $data[0]); + } + $renderer->doc .= tpl_tasklink($fsid[1], $data[0]); + } + return true; + } + +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : +?> \ No newline at end of file diff --git a/plugins/dokuwiki/lib/plugins/newline/syntax.php b/plugins/dokuwiki/lib/plugins/newline/syntax.php new file mode 100644 index 0000000..6a5eed8 --- /dev/null +++ b/plugins/dokuwiki/lib/plugins/newline/syntax.php @@ -0,0 +1,77 @@ +s + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Florian Schmitz floele at gmail dot com + */ + +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'syntax.php'); + +/** + * All DokuWiki plugins to extend the parser/rendering mechanism + * need to inherit from this class + */ +class syntax_plugin_newline extends DokuWiki_Syntax_Plugin { + + /** + * return some info + */ + function getInfo(){ + return array( + 'author' => 'Florian Schmitz', + 'email' => 'floele@gmail.com', + 'date' => '2005-12-17', + 'name' => '
Plugin', + 'desc' => 'Enables simple newlines', + 'url' => 'http://flyspray.org/', + ); + } + + /** + * What kind of syntax are we? + */ + function getType(){ + return 'substition'; + } + + /** + * Where to sort in? + */ + function getSort(){ + return 201; + } + + /** + * Connect pattern to lexer + */ + + function connectTo($mode) { + // Word boundaries? + $this->Lexer->addSpecialPattern("(?doc .= '
'; + return true; + } + return false; + } + +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : +?> \ No newline at end of file diff --git a/plugins/dokuwiki/lib/plugins/syntax.php b/plugins/dokuwiki/lib/plugins/syntax.php new file mode 100644 index 0000000..ccf6577 --- /dev/null +++ b/plugins/dokuwiki/lib/plugins/syntax.php @@ -0,0 +1,270 @@ + + */ +// must be run within Dokuwiki +if(!defined('DOKU_INC')) die(); + +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_INC.'inc/parser/parser.php'); + +/** + * All DokuWiki plugins to extend the parser/rendering mechanism + * need to inherit from this class + */ +class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { + + var $allowedModesSetup = false; + var $localised = false; // set to true by setupLocale() after loading language dependent strings + var $lang = array(); // array to hold language dependent strings, best accessed via ->getLang() + var $configloaded = false; // set to true by loadConfig() after loading plugin configuration variables + var $conf = array(); // array to hold plugin settings, best accessed via ->getConf() + + /** + * General Info + * + * Needs to return a associative array with the following values: + * + * author - Author of the plugin + * email - Email address to contact the author + * date - Last modified date of the plugin in YYYY-MM-DD format + * name - Name of the plugin + * desc - Short description of the plugin (Text only) + * url - Website with more information on the plugin (eg. syntax description) + */ + function getInfo(){ + trigger_error('getType() not implemented in '.get_class($this), E_USER_WARNING); + } + + /** + * Syntax Type + * + * Needs to return one of the mode types defined in $PARSER_MODES in parser.php + */ + function getType(){ + trigger_error('getType() not implemented in '.get_class($this), E_USER_WARNING); + } + + /** + * Allowed Mode Types + * + * Defines the mode types for other dokuwiki markup that maybe nested within the + * plugin's own markup. Needs to return an array of one or more of the mode types + * defined in $PARSER_MODES in parser.php + */ + function getAllowedTypes() { + return array(); + } + + /** + * Paragraph Type + * + * Defines how this syntax is handled regarding paragraphs. This is important + * for correct XHTML nesting. Should return one of the following: + * + * 'normal' - The plugin can be used inside paragraphs + * 'block' - Open paragraphs need to be closed before plugin output + * 'stack' - Special case. Plugin wraps other paragraphs. + * + * @see Doku_Handler_Block + */ + function getPType(){ + return 'normal'; + } + + /** + * Handler to prepare matched data for the rendering process + * + * This function can only pass data to render() via its return value - render() + * may be not be run during the object's current life. + * + * Usually you should only need the $match param. + * + * @param $match string The text matched by the patterns + * @param $state int The lexer state for the match + * @param $pos int The character position of the matched text + * @param $handler ref Reference to the Doku_Handler object + * @return array Return an array with all data you want to use in render + */ + function handle($match, $state, $pos, &$handler){ + trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING); + } + + /** + * Handles the actual output creation. + * + * The function must not assume any other of the classes methods have been run + * during the object's current life. The only reliable data it receives are its + * parameters. + * + * The function should always check for the given output format and return false + * when a format isn't supported. + * + * $renderer contains a reference to the renderer object which is + * currently handling the rendering. You need to use it for writing + * the output. How this is done depends on the renderer used (specified + * by $format + * + * The contents of the $data array depends on what the handler() function above + * created + * + * @param $format string output format to being Rendered + * @param $renderer ref reference to the current renderer object + * @param $data array data created by handler() + * @return boolean rendered correctly? + */ + function render($format, &$renderer, $data) { + trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING); + + } + + /** + * There should be no need to override these functions + */ + function accepts($mode) { + + if (!$this->allowedModesSetup) { + global $PARSER_MODES; + + $allowedModeTypes = $this->getAllowedTypes(); + foreach($allowedModeTypes as $mt) { + $this->allowedModes = array_merge($this->allowedModes, $PARSER_MODES[$mt]); + } + + $idx = array_search(substr(get_class($this), 7), $this->allowedModes); + if ($idx !== false) { + unset($this->allowedModes[$idx]); + } + $this->allowedModesSetup = true; + } + + return parent::accepts($mode); + } + + // plugin introspection methods + // extract from class name, format = _plugin_[_] + function getPluginType() { list($t) = explode('_', get_class($this), 2); return $t; } + function getPluginName() { list($t, $p, $n) = explode('_', get_class($this), 4); return $n; } + function getPluginComponent() { list($t, $p, $n, $c) = explode('_', get_class($this), 4); return (isset($c)?$c:''); } + + // localisation methods + /** + * getLang($id) + * + * use this function to access plugin language strings + * to try to minimise unnecessary loading of the strings when the plugin doesn't require them + * e.g. when info plugin is querying plugins for information about themselves. + * + * @param $id id of the string to be retrieved + * @return string string in appropriate language or english if not available + */ + function getLang($id) { + if (!$this->localised) $this->setupLocale(); + + return (isset($this->lang[$id]) ? $this->lang[$id] : ''); + } + + /** + * locale_xhtml($id) + * + * retrieve a language dependent wiki page and pass to xhtml renderer for display + * plugin equivalent of p_locale_xhtml() + * + * @param $id id of language dependent wiki page + * @return string parsed contents of the wiki page in xhtml format + */ + function locale_xhtml($id) { + return p_cached_output($this->localFN($id)); + } + + /** + * localFN($id) + * prepends appropriate path for a language dependent filename + * plugin equivalent of localFN() + */ + function localFN($id) { + global $conf; + $plugin = $this->getPluginName(); + $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt'; + if(!@file_exists($file)){ + //fall back to english + $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt'; + } + return $file; + } + + /** + * setupLocale() + * reads all the plugins language dependent strings into $this->lang + * this function is automatically called by getLang() + */ + function setupLocale() { + if ($this->localised) return; + + global $conf; // definitely don't invoke "global $lang" + $path = DOKU_PLUGIN.$this->getPluginName().'/lang/'; + + // don't include once, in case several plugin components require the same language file + @include($path.'en/lang.php'); + if ($conf['lang'] != 'en') @include($path.$conf['lang'].'/lang.php'); + + $this->lang = $lang; + $this->localised = true; + } + + // configuration methods + /** + * getConf($setting) + * + * use this function to access plugin configuration variables + */ + function getConf($setting){ + + if (!$this->configloaded){ $this->loadConfig(); } + + return $this->conf[$setting]; + } + + /** + * loadConfig() + * merges the plugin's default settings with any local settings + * this function is automatically called through getConf() + */ + function loadConfig(){ + global $conf; + + $defaults = $this->readDefaultSettings(); + $plugin = $this->getPluginName(); + + foreach ($defaults as $key => $value) { + if (isset($conf['plugin'][$plugin][$key])) continue; + $conf['plugin'][$plugin][$key] = $value; + } + + $this->configloaded = true; + $this->conf =& $conf['plugin'][$plugin]; + } + + /** + * read the plugin's default configuration settings from conf/default.php + * this function is automatically called through getConf() + * + * @return array setting => value + */ + function readDefaultSettings() { + + $path = DOKU_PLUGIN.$this->getPluginName().'/conf/'; + $conf = array(); + + if (@file_exists($path.'default.php')) { + include($path.'default.php'); + } + + return $conf; + } + +} +//Setup VIM: ex: et ts=4 enc=utf-8 : -- cgit v1.2.3-54-g00ecf