more lib1 cleanup

This commit is contained in:
following
2013-07-14 23:07:52 +02:00
parent c61ead6da5
commit ba345a49be
44 changed files with 24 additions and 2094 deletions

View File

@ -24,7 +24,7 @@
//prepare the templates and include all neccessary
require_once('./lib/common.inc.php');
require_once('./lib/logtypes.inc.php');
require_once('./lib2/logic/logtypes.inc.php');
require($stylepath.'/smilies.inc.php');
require_once($opt['rootpath'] . '../lib/htmlpurifier-4.2.0/library/HTMLPurifier.auto.php');
require_once('./lib/recommendation.inc.php');

View File

@ -0,0 +1,4 @@
DO NOT DELETE any of the images in this directory, even after completely
discarding lib1. Some images are linked in cache descriptions, on OC.de
or on other sites which refer to OC.de listings.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,4 @@
DO NOT DELETE any of the images in this directory, even after completely
discarding lib1. Some images are linked in cache descriptions, on OC.de
or on other sites which refer to OC.de listings.

View File

@ -1,727 +0,0 @@
<?php
/**
* PHP Class b2evo_captcha Version 1.3.1, released 27-Jan-2006
*
* a PHP Class for creating and testing captchas used in b2evolution
*
* Author : Ben Franske, ben@franske.com, http://ben.franske.com
*
* Based on hn_captcha Version 1.2 by Horst Nogajski, horst@nogajski.de
* - hn_captcha is a fork of ocr_captcha by Julien Pachet
*
* License: GNU GPL (http://www.opensource.org/licenses/gpl-license.html)
*
**/
/**
*
* changes in version 1.3.1:
* - removed unrequired double quotes
* - use function_exists() to check for some required functions
*
* changes in version 1.3:
* - modified for use in b2evolution and to make more of a standalone class:
* - stripped code so only image generation and testing remain
* - removed code for multiple attempts, one shot per image only (K.I.S.S.)
* - automatically select from multiple random fonts from the fonts folder
* - support for random captcha length
* - support for easily selecting valid characters and number of characters
* - added built-in garbage cleanup
* - support for case sensitive captchas
* - upgraded from rand() functions to mt_rand() functions
* - support for full md5 hashes instead of hash substrings
* - made it easier to drop in different image generation function
*
* changes in version 1.2:
* - added a new configuration-variable: secretposition
* - once more modified the function get_try(): generate a string of 32 chars length,
* where at secretposition is the number of current-try.
* Hopefully this is enough for hackprevention.
*
* changes in version 1.1:
* - added a new configuration-variable: maxrotation
* - added a new configuration-variable: secretstring
* - modified function get_try(): now ever returns a string of 16 chars
*
**/
/**
* License: GNU GPL (http://www.opensource.org/licenses/gpl-license.html)
*
* This program is free software;
*
* you can redistribute it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**/
class b2evo_captcha
{
////////////////////////////////
//
// Default options, can be overridden from the calling code
//
/**
* Absolute path to a Tempfolder (with trailing slash!). This must be writeable for PHP and also accessible via HTTP, because the image will be stored there.
*
**/
var $tempfolder;
/**
* Absolute path to folder with TrueTypeFonts (with trailing slash!). This must be readable by PHP.
*
**/
var $TTF_folder;
/**
* The minimum number of characters to use for the captcha
* Set to the same as maxchars to use fixed length captchas
**/
var $minchars = 5;
/**
* The maximum number of characters to use for the captcha
* Set to the same as minchars to use fixed length captchas
**/
var $maxchars = 7;
/**
* The minimum font size to use
*
**/
var $minsize = 20;
/**
* The maximum font size to use
*
**/
var $maxsize = 30;
/**
* The maximum degrees a Char should be rotated. Set it to 30 means a random rotation between -30 and 30.
*
**/
var $maxrotation = 25;
/**
* Background noise On/Off (if is FALSE, a grid will be created)
*
**/
var $noise = TRUE;
/**
* This will only use the 216 websafe color pallette for the image.
*
**/
var $websafecolors = FALSE;
/**
* Outputs configuration values for testing
*
**/
var $debug = FALSE;
/**
* Filename of garbage collector counter which is stored in the tempfolder
*
**/
var $counter_filename = 'b2evo_captcha_counter.txt';
/**
* Prefix of captcha image filenames
*
**/
var $filename_prefix = 'b2evo_captcha_';
/**
* Number of captchas to generate before garbage collection is done
*
**/
var $collect_garbage_after = 100;
/**
* Maximum lifetime of a captcha (in seconds) before being deleted during garbage collection
*
**/
var $maxlifetime = 600;
/**
* Make all letters uppercase (does not preclude symbols)
*
**/
var $case_sensitive = TRUE;
////////////////////////////////
//
// Private options, these are fixed options
//
/**
* String of valid characters which may appear in the captcha
*
**/
var $validchars = 'abcdefghjkmnpqrstuvwxyz23456789?@#$%&*ABCDEFGHJKLMNPQRSTUVWXYZ23456789?@#$%&*';
/**
* Picture width
*
**/
var $lx;
/**
* Picture height
*
**/
var $ly;
/**
* JPEG Image quality
*
**/
var $jpegquality = 80;
/**
* Noise multiplier (number of characters gets multipled by this to define noise)
* Note: This doesn't quite make sense, do you really want less noise in a smaller captcha?
**/
var $noisefactor = 9;
/**
* Number of backgrond noise characters
*
**/
var $nb_noise;
/**
* Holds the list of possible fonts
*
**/
var $TTF_RANGE;
/**
* Holds the currently selected font filename
*
**/
var $TTF_file;
/**
* Holds the number of characters in the captcha
*
**/
var $chars;
var $public_K;
var $private_K;
/**
* Captcha filename
*
**/
var $filename;
/**
* Holds the version number of the GD-Library
*
**/
var $gd_version;
var $r;
var $g;
var $b;
////////////////////////////////
//
// CONSTRUCTOR
//
/**
* Extracts the config array and overrides default settings.
*
**/
function b2evo_captcha($config,$secure=TRUE)
{
// Test for GD-Library(-Version)
$this->gd_version = $this->get_gd_version();
if($this->gd_version == 0) die('There is no GD-Library-Support enabled. The b2evo captcha class cannot be used!');
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: The available GD-Library has major version ".$this->gd_version;
// extracts config array
if(is_array($config))
{
if($secure && (!function_exists('version_compare') || version_compare(phpversion(), '4.2.0', '< ')) && function_exists(array_key_exists))
{
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Extracts Config-Array in secure-mode!";
$valid = get_class_vars(get_class($this));
foreach($config as $k=>$v)
{
if(array_key_exists($k,$valid)) $this->$k = $v;
}
}
else
{
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Extracts Config-Array in unsecure-mode!";
foreach($config as $k=>$v) $this->$k = $v;
}
}
// check vars for min-max-chars and min-max-size
if($this->minchars > $this->maxchars)
{
$temp = $this->minchars;
$this->minchars = $this->maxchars;
$this->maxchars = $temp;
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Arrghh! What do you think I mean with min and max? Switch minchars with maxchars.";
}
if($this->minsize > $this->maxsize)
{
$temp = $this->minsize;
$this->minsize = $this->maxsize;
$this->maxsize = $temp;
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Arrghh! What do you think I mean with min and max? Switch minsize with maxsize.";
}
// check TrueTypeFonts
$this->TTF_RANGE = array('0');
if ($handle = opendir($this->TTF_folder)) {
$i=0;
while (false !== ($file = readdir($handle))) {
//You could add a regex to this if to make sure the files are all *.ttf
if ($file != '.' && $file != '..') {
if (is_file($this->TTF_folder . $file)) {
$this->TTF_RANGE[$i]=$file;
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Found font file (".$file.')';
}
}
}
closedir($handle);
}
if(is_array($this->TTF_RANGE))
{
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Checking given TrueType-Array! (".count($this->TTF_RANGE).')';
$temp = array();
foreach($this->TTF_RANGE as $k=>$v)
{
if(is_readable($this->TTF_folder.$v)) $temp[] = $v;
}
$this->TTF_RANGE = $temp;
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Valid TrueType-files: (".count($this->TTF_RANGE).')';
if(count($this->TTF_RANGE) < 1) die('No Truetype fonts available for the CaptchaClass.');
}
else
{
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Check given TrueType-File! (".$this->TTF_RANGE.')';
if(!is_readable($this->TTF_folder.$this->TTF_RANGE)) die('No Truetypefont available for the b2evo captcha class.');
}
// select first TrueTypeFont
$this->change_TTF();
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Set current TrueType-File: (".$this->TTF_file.")";
// get number of noise-chars for background if is enabled
$this->nb_noise = $this->noise ? ($this->chars * $this->noisefactor) : 0;
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Set number of noise characters to: (".$this->nb_noise.')';
// seed the random number generator if less than php 4.2.0
if( !function_exists('version_compare') || version_compare(phpversion(), '4.2.0', '< ') )
{
mt_srand((double)microtime()*1000000);
}
// specify counter-filename
if($this->debug) echo "\n<br>-Captcha-Debug: The counterfilename is (".$this->tempfolder.$this->counter_filename.')';
// retrieve last counter-value
$test = $this->txt_counter($this->tempfolder.$this->counter_filename);
// set and retrieve current counter-value
$counter = $this->txt_counter($this->tempfolder.$this->counter_filename,TRUE);
// check if counter works correct
if(($counter !== FALSE) && ($counter - $test == 1))
{
// Counter works perfect, =:)
if($this->debug) echo "\n<br>-Captcha-Debug: Current counter-value is ($counter). Garbage-collector should start at (".$this->collect_garbage_after.')';
// check if garbage-collector should run
if($counter >= $this->collect_garbage_after)
{
// Reset counter
if($this->debug) echo "\n<br>-Captcha-Debug: Reset the counter-value. (0)";
$this->txt_counter($this->tempfolder.$this->counter_filename,TRUE,0);
// start garbage-collector
$this->garbage_collector_error = $this->collect_garbage() ? FALSE : TRUE;
if($this->debug) echo "\n<br>-Captcha-Debug: ERROR! SOME TRASHFILES COULD NOT BE DELETED!";
}
}
else
{
// Counter-ERROR!
if($this->debug) echo "\n<br>-Captcha-Debug: ERROR! NO COUNTER-VALUE AVAILABLE!";
}
}
////////////////////////////////
//
// PUBLIC METHODS
//
/**
* Generates a captcha image and returns the complete path to the image
*
**/
function get_b2evo_captcha()
{
$this->make_captcha();
if($public=='') $public = $this->public_key;
return str_replace($_SERVER['DOCUMENT_ROOT'],'',$this->tempfolder).$this->filename_prefix.$public.'.jpg';
}
/**
*
* Validates submission and returns result
* Returns 0 = invalid sumbit | 1 = valid submit
*
**/
function validate_submit($image,$attempt)
{
$correct_hash = substr($image,-36,32);
if($this->case_sensitive==0) $attempt = strtoupper($attempt);
if($this->check_captcha($correct_hash,$attempt))
{
if($this->debug) echo "\n<br>-Captcha-Debug: Validating submitted form returns: (1)";
return 1;
}
else
{
if($this->debug) echo "\n<br>-Captcha-Debug: Validating submitted form returns: (0)";
return 0;
}
}
////////////////////////////////
//
// PRIVATE METHODS
//
/** @private **/
function make_captcha($private_key='')
{
if($private_key=='') $private_key = $this->generate_keypair();
// set dimension of image
$this->lx = (strlen($private_key) + 1) * (int)(($this->maxsize + $this->minsize) / 1.5);
$this->ly = (int)(2.4 * $this->maxsize);
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Set image dimension to: (".$this->lx.' x '.$this->ly.')';
if($this->debug) echo "\n<br>-Captcha-Debug: Generate private key: ($private_key)";
// set number of noise-chars for background if is enabled
$this->nb_noise = $this->noise ? (strlen($private_key) * $this->noisefactor) : 0;
if($this->debug) echo "\n<br>-b2evo-Captcha-Debug: Set number of noise characters to: (".$this->nb_noise.')';
// create Image and set the apropriate function depending on GD-Version & websafecolor-value
if($this->gd_version >= 2 && !$this->websafecolors)
{
$func1 = 'imagecreatetruecolor';
$func2 = 'imagecolorallocate';
}
else
{
$func1 = 'imageCreate';
$func2 = 'imagecolorclosest';
}
$image = $func1($this->lx,$this->ly);
if($this->debug) echo "\n<br>-Captcha-Debug: Generate ImageStream with: ($func1())";
if($this->debug) echo "\n<br>-Captcha-Debug: For colordefinitions we use: ($func2())";
// Set Backgroundcolor
$this->random_color(224, 255);
$back = @imagecolorallocate($image, $this->r, $this->g, $this->b);
@ImageFilledRectangle($image,0,0,$this->lx,$this->ly,$back);
if($this->debug) echo "\n<br>-Captcha-Debug: We allocate one color for Background: (".$this->r.'-'.$this->g.'-'.$this->b.')';
// allocates the 216 websafe color palette to the image
if($this->gd_version < 2 || $this->websafecolors) $this->makeWebsafeColors($image);
// fill with noise or grid
if($this->nb_noise > 0)
{
// random characters in background with random position, angle, color
if($this->debug) echo "\n<br>-Captcha-Debug: Fill background with noise: (".$this->nb_noise.')';
for($i=0; $i < $this->nb_noise; $i++)
{
$size = intval(mt_rand((int)($this->minsize / 2.3), (int)($this->maxsize / 1.7)));
$angle = intval(mt_rand(0, 360));
$x = intval(mt_rand(0, $this->lx));
$y = intval(mt_rand(0, (int)($this->ly - ($size / 5))));
$this->random_color(160, 224);
$color = $func2($image, $this->r, $this->g, $this->b);
$text = chr(intval(mt_rand(45,250)));
@ImageTTFText($image, $size, $angle, $x, $y, $color, $this->change_TTF(), $text);
}
}
else
{
// generate grid
if($this->debug) echo "\n<br>-Captcha-Debug: Fill background with x-gridlines: (".(int)($this->lx / (int)($this->minsize / 1.5)).')';
for($i=0; $i < $this->lx; $i += (int)($this->minsize / 1.5))
{
$this->random_color(160, 224);
$color = $func2($image, $this->r, $this->g, $this->b);
@imageline($image, $i, 0, $i, $this->ly, $color);
}
if($this->debug) echo "\n<br>-Captcha-Debug: Fill background with y-gridlines: (".(int)($this->ly / (int)(($this->minsize / 1.8))).')';
for($i=0 ; $i < $this->ly; $i += (int)($this->minsize / 1.8))
{
$this->random_color(160, 224);
$color = $func2($image, $this->r, $this->g, $this->b);
@imageline($image, 0, $i, $this->lx, $i, $color);
}
}
// generate Text
if($this->debug) echo "\n<br>-Captcha-Debug: Fill forground with chars and shadows: (".$this->chars.')';
for($i=0, $x = intval(mt_rand($this->minsize,$this->maxsize)); $i < strlen($private_key); $i++)
{
$text = substr($private_key, $i, 1);
$angle = intval(mt_rand(($this->maxrotation * -1), $this->maxrotation));
$size = intval(mt_rand($this->minsize, $this->maxsize));
$y = intval(mt_rand((int)($size * 1.5), (int)($this->ly - ($size / 7))));
$this->random_color(0, 127);
$color = $func2($image, $this->r, $this->g, $this->b);
$this->random_color(0, 127);
$shadow = $func2($image, $this->r + 127, $this->g + 127, $this->b + 127);
@ImageTTFText($image, $size, $angle, $x + (int)($size / 15), $y, $shadow, $this->change_TTF(), $text);
@ImageTTFText($image, $size, $angle, $x, $y - (int)($size / 15), $color, $this->TTF_file, $text);
$x += (int)($size + ($this->minsize / 5));
}
@ImageJPEG($image, $this->get_filename(), $this->jpegquality);
$res = file_exists($this->get_filename());
if($this->debug) echo "\n<br>-Captcha-Debug: Save Image with quality [".$this->jpegquality.'] as ('.$this->get_filename().') returns: ('.($res ? 'TRUE' : 'FALSE').')';
@ImageDestroy($image);
if($this->debug) echo "\n<br>-Captcha-Debug: Destroy Imagestream.";
if(!$res) die('Unable to save captcha-image.');
}
/** @private **/
function makeWebsafeColors(&$image)
{
//$a = array();
for($r = 0; $r <= 255; $r += 51)
{
for($g = 0; $g <= 255; $g += 51)
{
for($b = 0; $b <= 255; $b += 51)
{
$color = imagecolorallocate($image, $r, $g, $b);
//$a[$color] = array('r'=>$r,'g'=>$g,'b'=>$b);
}
}
}
if($this->debug) echo "\n<br>-Captcha-Debug: Allocate 216 websafe colors to image: (".imagecolorstotal($image).')';
//return $a;
}
/** @private **/
function random_color($min,$max)
{
$this->r = intval(mt_rand($min,$max));
$this->g = intval(mt_rand($min,$max));
$this->b = intval(mt_rand($min,$max));
//echo ' ('.$this->r.'-'.$this->g.'-'.$this->b.') ';
}
/** @private **/
function change_TTF()
{
if(is_array($this->TTF_RANGE))
{
$key = array_rand($this->TTF_RANGE);
$this->TTF_file = $this->TTF_folder.$this->TTF_RANGE[$key];
}
else
{
$this->TTF_file = $this->TTF_folder.$this->TTF_RANGE;
}
return $this->TTF_file;
}
/** @private **/
function check_captcha($correct_hash,$attempt)
{
// when check, destroy picture on disk
if(file_exists($this->get_filename($correct_hash)))
{
$res = @unlink($this->get_filename($correct_hash)) ? 'TRUE' : 'FALSE';
if($this->debug) echo "\n<br>-Captcha-Debug: Delete image (".$this->get_filename($correct_hash).") returns: ($res)";
}
else
return FALSE;
$res = (md5($attempt)===$correct_hash) ? 'TRUE' : 'FALSE';
if($this->debug) echo "\n<br>-Captcha-Debug: Comparing public with private key returns: ($res)";
return $res == 'TRUE' ? TRUE : FALSE;
}
/** @private **/
function get_filename($public='')
{
if($public=='') $public=$this->public_key;
return $this->tempfolder.$this->filename_prefix.$public.'.jpg';
}
/** @private **/
function get_filename_url($public="")
{
if($public=='') $public = $this->public_key;
return str_replace($_SERVER['DOCUMENT_ROOT'],'',$this->tempfolder).$this->filename_prefix.$public.'.jpg';
}
/** @private **/
function get_gd_version()
{
if (!function_exists('imagejpeg')) {
$gd_version_number = 0;
} else {
static $gd_version_number = null;
if($gd_version_number === null)
{
ob_start();
phpinfo(8);
$module_info = ob_get_contents();
ob_end_clean();
if(preg_match("/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i", $module_info, $matches))
{
$gd_version_number = $matches[1];
}
else
{
$gd_version_number = 0;
}
}
}
return $gd_version_number;
}
// this is where the actual text and public hash is generated and stored
function generate_keypair()
{
$key = '';
$this->chars = mt_rand($this->minchars,$this->maxchars);
for($i=0; $i < $this->chars; $i++) {
$key .= $this->validchars{mt_rand(0,strlen($this->validchars))};
}
if($this->case_sensitive==0) $key = strtoupper($key);
$this->public_key = md5($key);
if($this->debug) echo "\n<br>-Captcha-Debug: Generate Keys, private key is: (".$key.')';
if($this->debug) echo "\n<br>-Captcha-Debug: Generate Keys, public key is: (".$this->public_key.')';
return $key;
}
//Store/Retrieve a counter-value in/from a textfile. Optionally count it up or store a (as third param) specified value.
// Returns counter-value
function txt_counter($filename,$add=FALSE,$fixvalue=FALSE)
{
if(is_file($filename) ? TRUE : touch($filename))
{
if(is_readable($filename) && is_writable($filename))
{
$fp = @fopen($filename, 'r');
if($fp)
{
$counter = (int)trim(fgets($fp));
fclose($fp);
if($add)
{
if($fixvalue !== FALSE)
{
$counter = (int)$fixvalue;
}
else
{
$counter++;
}
$fp = @fopen($filename, 'w');
if($fp)
{
fputs($fp,$counter);
fclose($fp);
return $counter;
}
else return FALSE;
}
else
{
return $counter;
}
}
else return FALSE;
}
else return FALSE;
}
else return FALSE;
}
// Scanns the tempfolder for jpeg-files with nameprefix used by the class and trash them if they are older than maxlifetime.
function collect_garbage()
{
$OK = FALSE;
$captchas = 0;
$trashed = 0;
if($handle = @opendir($this->tempfolder))
{
$OK = TRUE;
while(false !== ($file = readdir($handle)))
{
if(!is_file($this->tempfolder.$file)) continue;
// check for name-prefix, extension and filetime
if(substr($file,0,strlen($this->prefix)) == $this->prefix)
{
if(strrchr($file, '.') == '.jpg')
{
$captchas++;
if((time() - filemtime($this->tempfolder.$file)) >= $this->maxlifetime)
{
$trashed++;
$res = @unlink($this->tempfolder.$file);
if(!$res) $OK = FALSE;
}
}
}
}
closedir($handle);
}
if($this->debug) echo "\n<br>-Captcha-Debug: There are ($captchas) captcha-images in tempfolder, where ($trashed) are seems to be lost.";
return $OK;
}
} // END CLASS b2evo_captcha
?>

View File

@ -1 +0,0 @@
see http://sourceforge.net/projects/b2evo-captcha

View File

@ -1,138 +0,0 @@
<?php
/****************************************************************************
./lib/caches.inc.php
--------------------
begin : June 24 2004
For license information see doc/license.txt
****************************************************************************/
/****************************************************************************
Unicode Reminder メモ
functions and variables for cache-submission related things
****************************************************************************/
// Array with cachetypes, also stored in database - table cache_type
$cache_types[] = array('id' => '2', 'short' => 'Trad.', 'de' => 'normaler Cache', 'en' => 'Traditional Cache');
$cache_types[] = array('id' => '10', 'short' => 'Driv.', 'de' => 'Drive-In', 'en' => 'Drive-In');
$cache_types[] = array('id' => '3', 'short' => 'Multi', 'de' => 'Multicache', 'en' => 'Multicache');
$cache_types[] = array('id' => '7', 'short' => 'Quiz', 'de' => 'Rätselcache', 'en' => 'Quizcache');
$cache_types[] = array('id' => '8', 'short' => 'Math', 'de' => 'Mathe-/Physikcache', 'en' => 'Math/Physics-Cache');
$cache_types[] = array('id' => '9', 'short' => 'Moving', 'de' => 'Beweglicher Cache', 'en' => 'Moving Cache');
$cache_types[] = array('id' => '4', 'short' => 'Virt.', 'de' => 'virtueller Cache', 'en' => 'virtual Cache');
$cache_types[] = array('id' => '5', 'short' => 'ICam.', 'de' => 'Webcam Cache', 'en' => 'Webcam Cache');
$cache_types[] = array('id' => '6', 'short' => 'Event', 'de' => 'Event Cache', 'en' => 'Event Cache');
$cache_types[] = array('id' => '1', 'short' => 'Other', 'de' => 'unbekannter Cachetyp', 'en' => 'unknown cachetyp');
// Cachetype-ID selected by default
// $default_cachetype_id = -1;
// Array with cachestatus, also stored in database - table cache_status
$cache_status[] = array('id' => '1', 'de' => 'Kann gesucht werden', 'en' => 'Ready for search');
$cache_status[] = array('id' => '2', 'de' => 'Momentan nicht verfügbar', 'en' => 'Temporary not available');
$cache_status[] = array('id' => '3', 'de' => 'Archiviert', 'en' => 'Archived');
$cache_status[] = array('id' => '4', 'de' => 'Von den Approvern entfernt, um geprüft zu werden', 'en' => 'Hidden by approvers to check');
$cache_status[] = array('id' => '5', 'de' => 'Noch nicht veröffentlicht', 'en' => 'Not yet available');
$cache_status[] = array('id' => '6', 'de' => 'Gesperrt', 'en' => 'Locked, visible');
$cache_status[] = array('id' => '7', 'de' => 'Gesperrt, unsichtbar', 'en' => 'Locked, invisible');
// Sachestatus-ID selected by default
$default_cachestatus_id = 1;
// Array with cachesizes, also stored in database - table cache_size
$cache_size[] = array('id' => '2', 'de' => 'mikro', 'en' => 'micro');
$cache_size[] = array('id' => '3', 'de' => 'klein', 'en' => 'small');
$cache_size[] = array('id' => '4', 'de' => 'normal', 'en' => 'normal');
$cache_size[] = array('id' => '5', 'de' => 'groß', 'en' => 'large');
$cache_size[] = array('id' => '6', 'de' => 'extrem groß', 'en' => 'very large');
$cache_size[] = array('id' => '1', 'de' => 'andere Größe', 'en' => 'other size');
$cache_size[] = array('id' => '7', 'de' => 'kein Behälter', 'en' => 'no container');
// Sachesize-ID selected by default
// $default_cachesize_id = -1;
// Array with log_types
/*
$log_types[] = array('id' => '1', 'de' => 'Gefunden', 'en' => 'Found');
$log_types[] = array('id' => '2', 'de' => 'Nicht gefunden', 'en' => 'Not found');
$log_types[] = array('id' => '3', 'de' => 'Bemerkung', 'en' => 'Note');
$log_types[] = array('id' => '4', 'de' => 'Gesperrt', 'en' => 'Closed');
$log_types[] = array('id' => '5', 'de' => 'Freigegeben', 'en' => 'Opened');
$log_types[] = array('id' => '6', 'de' => 'Entfernt', 'en' => 'Removed');
*/
$log_types = array();
// Sachesize-ID selected by default
$default_logtype_id = 1;
// new: get log_types from database
get_log_types_from_database();
function get_log_types_from_database()
{
global $dblink;
global $log_types;
$resp = sql("SELECT * FROM log_types ORDER BY id");
while($row = sql_fetch_assoc($resp))
{
$log_types[] = $row;
}
}
function log_type_from_id($id, $lang)
{
global $log_types;
foreach ($log_types AS $type)
{
if ($type['id'] == $id)
{
return $type[$lang];
}
}
}
function cache_type_from_id($id, $lang)
{
global $cache_types;
foreach ($cache_types AS $cache_type)
{
if ($cache_type['id'] == $id)
{
return $cache_type[$lang];
}
}
}
function cache_size_from_id($id, $lang)
{
global $cache_size;
foreach ($cache_size AS $size)
{
if ($size['id'] == $id)
{
return $size[$lang];
}
}
}
function cache_status_from_id($id, $lang)
{
global $cache_status;
foreach ($cache_status AS $status)
{
if ($status['id'] == $id)
{
return $status[$lang];
}
}
}
?>

View File

@ -1,112 +0,0 @@
<?php
/****************************************************************************
./lib/captcha.inc.php
--------------------
begin : April 30 2007
For license information see doc/license.txt
****************************************************************************/
/****************************************************************************
Unicode Reminder メモ
captcha generator
****************************************************************************/
/* generate configuration
*/
//Change these settings to change the way the captcha generation works and match your server settings
//Folder Path where image files can be stored, must be readable and writable by the web server
//Don't forget the trailing slash
$tempfolder = 'cache/captcha/';
//Folder Path where your captcha font files are stored, must be readable by the web server
//Don't forget the trailing slash
$TTF_folder = 'lib/b2evo-captcha/b2evo_captcha_fonts/';
//The minimum number of characters to use for the captcha
//Set to the same as maxchars to use fixed length captchas
$minchars = 5;
//The maximum number of characters to use for the captcha
//Set to the same as minchars to use fixed length captchas
$maxchars = 7;
//The minimum character font size to use for the captcha
//Set to the same as maxsize to use fixed font size
$minsize = 20;
//The maximum character font size to use for the captcha
//Set to the same as minsize to use fixed font size
$maxsize = 30;
//The maximum rotation (in degrees) for each character
$maxrotation = 25;
//Use background noise instead of a grid
$noise = TRUE;
//Use web safe colors (only 216 colors)
$websafecolors = TRUE;
//Enable debug messages
$debug = FALSE;
//Filename of garbage collector counter which is stored in the tempfolder
$counter_filename = 'b2evo_captcha_counter.txt';
//Prefix of captcha image filenames
$filename_prefix = '';
//Number of captchas to generate before garbage collection is done
$collect_garbage_after = 50;
//Maximum lifetime of a captcha (in seconds) before being deleted during garbage collection
$maxlifetime = 1800;
//Make all letters uppercase (does not preclude symbols)
$case_sensitive = FALSE;
//////////////////////////////////////////
//DO NOT EDIT ANYTHING BELOW THIS LINE!
//
//
//$folder_root = substr(__FILE__,0,(strpos(__FILE__,'.php')));
$folder_root = $opt['rootpath'];
$CAPTCHA_CONFIG = array('tempfolder'=>$folder_root.$tempfolder,'TTF_folder'=>$folder_root.$TTF_folder,'minchars'=>$minchars,'maxchars'=>$maxchars,'minsize'=>$minsize,'maxsize'=>$maxsize,'maxrotation'=>$maxrotation,'noise'=>$noise,'websafecolors'=>$websafecolors,'debug'=>$debug,'counter_filename'=>$counter_filename,'filename_prefix'=>$filename_prefix,'collect_garbage_after'=>$collect_garbage_after,'maxlifetime'=>maxlifetime,'case_sensitive'=>$case_sensitive);
require_once($opt['rootpath'] . 'lib/b2evo-captcha/b2evo_captcha.class.php');
// return true/false
function checkCaptcha($id, $string)
{
global $CAPTCHA_CONFIG;
$captcha =& new b2evo_captcha($CAPTCHA_CONFIG);
// additional check ... id and string can only contain [a-f0-9]
if (mb_ereg_match('^[0-9a-f]{32}$', $id) == false)
return false;
if ($captcha->validate_submit($id, $string) == 1)
return true;
else
return false;
}
// return array(id, filename)
function createCaptcha()
{
global $CAPTCHA_CONFIG;
$captcha =& new b2evo_captcha($CAPTCHA_CONFIG);
$ret['filename'] = $captcha->get_b2evo_captcha();
$ret['id'] = substr($ret['filename'], -36, 32);
return $ret;
}
?>

View File

@ -1,572 +0,0 @@
<?php
/****************************************************************************
For license information see doc/license.txt
Unicode Reminder メモ
****************************************************************************/
$allowedtags = mb_split(',', 'a,b,i,p,q,s,u,br,dd,dl,dt,em,h1,h2,h3,h4,h5,h6,hr,li,td,th,tr,tt,ol,ul,big,bdo,col,dfn,del,dir,div,ins,img,kbd,map,pre,sub,sup,var,abbr,area,cite,code,font,menu,samp,span,small,thead,tfoot,tbody,table,strong,center,strike,acronym,address,caption,isindex,colgroup,fieldset');
$allowedattr = mb_split(',', 'id,src,alt,dir,rel,rev,abbr,axis,char,cite,face,href,lang,name,size,span,type,align,class,clear,color,frame,ismap,rules,scope,shape,start,style,title,value,width,border,coords,height,hspace,nowrap,nohref,target,usemap,vspace,valign,bgcolor,charoff,charset,colspan,compact,headers,noshade,rowspan,summary,longdesc,hreflang,datetime,tabindex,accesskey,background,cellspacing,cellpadding');
/** @class: InputFilter (PHP4 & PHP5, with comments)
* @project: PHP Input Filter
* @date: 10-05-2005
* @version: 1.2.2_php4/php5
* @author: Daniel Morris
* @contributors: Gianpaolo Racca, Ghislain Picard, Marco Wandschneider, Chris Tobin and Andrew Eddie.
* @copyright: Daniel Morris
* @email: dan@rootcube.com
* @license: GNU General Public License (GPL)
*/
class InputFilter
{
var $tagsArray; // default = empty array
var $attrArray; // default = empty array
var $tagsMethod; // default = 0
var $attrMethod; // default = 0
var $xssAuto; // default = 1
var $tagBlacklist = array('applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml');
var $attrBlacklist = array('action', 'codebase', 'dynsrc', 'lowsrc'); // also will strip ALL event handlers
/**
* Constructor for inputFilter class. Only first parameter is required.
* @access constructor
* @param Array $tagsArray - list of user-defined tags
* @param Array $attrArray - list of user-defined attributes
* @param int $tagsMethod - 0= allow just user-defined, 1= allow all but user-defined
* @param int $attrMethod - 0= allow just user-defined, 1= allow all but user-defined
* @param int $xssAuto - 0= only auto clean essentials, 1= allow clean blacklisted tags/attr
*/
function inputFilter($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) {
// make sure user defined arrays are in lowercase
for ($i = 0; $i < count($tagsArray); $i++)
$tagsArray[$i] = mb_strtolower($tagsArray[$i]);
for ($i = 0; $i < count($attrArray); $i++)
$attrArray[$i] = mb_strtolower($attrArray[$i]);
// assign to member vars
$this->tagsArray = (array)$tagsArray;
$this->attrArray = (array)$attrArray;
$this->tagsMethod = $tagsMethod;
$this->attrMethod = $attrMethod;
$this->xssAuto = $xssAuto;
}
/**
* Method to be called by another php script. Processes for XSS and specified bad code.
* @access public
* @param Mixed $source - input string/array-of-string to be 'cleaned'
* @return String $source - 'cleaned' version of input parameter
*/
function process($source)
{
// clean all elements in this array
if (is_array($source))
{
// filter element for XSS and other 'bad' code etc.
foreach($source as $key => $value)
if (is_string($value)) $source[$key] = $this->remove($this->decode($value));
return $source;
// clean this string
}
else if (is_string($source))
{
// filter source for XSS and other 'bad' code etc.
return $this->remove($this->decode($source));
// return parameter as given
}
else
return $source;
}
/**
* Internal method to iteratively remove all unwanted tags and attributes
* @access protected
* @param String $source - input string to be 'cleaned'
* @return String $source - 'cleaned' version of input parameter
*/
function remove($source)
{
$loopCounter=0;
// provides nested-tag protection
while($source != $this->filterTags($source))
{
$source = $this->filterTags($source);
$loopCounter++;
}
return $source;
}
/**
* Internal method to strip a string of certain tags
* @access protected
* @param String $source - input string to be 'cleaned'
* @return String $source - 'cleaned' version of input parameter
*/
function filterTags($source)
{
// filter pass setup
$preTag = NULL;
$postTag = $source;
// find initial tag's position
$tagOpen_start = mb_strpos($source, '<');
// interate through string until no tags left
while($tagOpen_start !== FALSE)
{
// process tag interatively
$preTag .= mb_substr($postTag, 0, $tagOpen_start);
$postTag = mb_substr($postTag, $tagOpen_start);
$fromTagOpen = mb_substr($postTag, 1);
// end of tag
$tagOpen_end = mb_strpos($fromTagOpen, '>');
if ($tagOpen_end === false) break;
// next start of tag (for nested tag assessment)
$tagOpen_nested = mb_strpos($fromTagOpen, '<');
if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end))
{
$preTag .= mb_substr($postTag, 0, ($tagOpen_nested+1));
$postTag = mb_substr($postTag, ($tagOpen_nested+1));
$tagOpen_start = mb_strpos($postTag+1, '<');
continue;
}
$tagOpen_nested = (mb_strpos($fromTagOpen, '<') + $tagOpen_start + 1);
$currentTag = mb_substr($fromTagOpen, 0, $tagOpen_end);
$tagLength = mb_strlen($currentTag);
if (!$tagOpen_end)
{
$preTag .= $postTag;
$tagOpen_start = mb_strpos($postTag, '<');
}
// this is needed when additional spaces between attrname and attrvalue or tagname and first attrname
$currentTag = $this->wellFormTagWithAttr($currentTag);
// iterate through tag finding attribute pairs - setup
$tagLeft = $currentTag;
$attrSet = array();
$currentSpace = mb_strpos($tagLeft, ' ');
// is end tag
if (mb_substr($currentTag, 0, 1) == "/")
{
$isCloseTag = TRUE;
list($tagName) = mb_split(' ', $currentTag);
$tagName = mb_substr($tagName, 1);
// is start tag
}
else
{
$isCloseTag = FALSE;
list($tagName) = mb_split(' ', $currentTag);
}
// excludes all "non-regular" tagnames OR no tagname OR remove if xssauto is on and tag is blacklisted
if ((!mb_eregi("^[a-z][a-z0-9]*$",$tagName)) || (!$tagName) || ((in_array(mb_strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto)))
{
$postTag = mb_substr($postTag, ($tagLength + 2));
$tagOpen_start = mb_strpos($postTag, '<');
// don't append this tag
continue;
}
// this while is needed to support attribute values with spaces in!
while ($currentSpace !== FALSE)
{
$fromSpace = mb_substr($tagLeft, ($currentSpace+1));
$nextSpace = mb_strpos($fromSpace, ' ');
$openQuotes = mb_strpos($fromSpace, '"');
$closeQuotes = mb_strpos(mb_substr($fromSpace, ($openQuotes+1)), '"') + $openQuotes + 1;
// another equals exists
if (mb_strpos($fromSpace, '=') !== FALSE)
{
if (($openQuotes !== FALSE) && (mb_strpos(mb_substr($fromSpace, ($openQuotes+1)), '"') !== FALSE) && ($openQuotes < $nextSpace))
{
// opening and closing quotes exists
$attr = mb_substr($fromSpace, 0, ($closeQuotes + 1));
}
else
{
// one or neither exist
$attr = mb_substr($fromSpace, 0, $nextSpace);
}
}
else
{
// no more equals exist
$attr = mb_substr($fromSpace, 0, $nextSpace);
}
// last attr pair
if (!$attr) $attr = $fromSpace;
// add to attribute pairs array
$attrSet[] = $attr;
// next inc
$tagLeft = mb_substr($fromSpace, mb_strlen($attr));
$currentSpace = mb_strpos($tagLeft, ' ');
}
// check the last element of attrSet ... maybe empty or attr="value"/
if (count($attrSet) > 0)
{
if ($attrSet[count($attrSet) - 1] == '')
unset($attrSet[count($attrSet) - 1]);
if (mb_substr($attrSet[count($attrSet) - 1], -1) == '/')
$attrSet[count($attrSet) - 1] = mb_substr($attrSet[count($attrSet) - 1], 0, mb_strlen($attrSet[count($attrSet) - 1]) - 1);
}
// appears in array specified by user
$tagFound = in_array(mb_strtolower($tagName), $this->tagsArray);
// remove this tag on condition
if ((!$tagFound && $this->tagsMethod) || ($tagFound && !$this->tagsMethod))
{
// reconstruct tag with allowed attributes
if (!$isCloseTag)
{
$attrSet = $this->filterAttr($attrSet);
$preTag .= '<' . $tagName;
for ($i = 0; $i < count($attrSet); $i++)
$preTag .= ' ' . $attrSet[$i];
// reformat single tags to XHTML
if (mb_strpos($fromTagOpen, "</" . $tagName))
$preTag .= '>';
else
$preTag .= ' />';
// just the tagname
}
else
$preTag .= '</' . $tagName . '>';
}
// find next tag's start
$postTag = mb_substr($postTag, ($tagLength + 2));
$tagOpen_start = mb_strpos($postTag, '<');
}
// append any code after end of tags
$preTag .= $postTag;
return $preTag;
}
/**
* Internal method to strip a tag of certain attributes
* @access protected
* @param Array $attrSet
* @return Array $newSet
*/
function filterAttr($attrSet)
{
$newSet = array();
// process attributes
for ($i = 0; $i <count($attrSet); $i++)
{
// skip blank spaces in tag
if (!$attrSet[$i]) continue;
// split into attr name and value
$attrSubSet = mb_split('=', trim($attrSet[$i]));
list($attrSubSet[0]) = mb_split(' ', $attrSubSet[0]);
// bugfix ... '=' inside attributes
$aCount = count($attrSubSet);
for ($aN = 2; $aN < $aCount; $aN++)
$attrSubSet[1] .= '=' . $attrSubSet[$aN];
while (count($attrSubSet) > 2)
unset($attrSubSet[count($attrSubSet) - 1]);
// removes all "non-regular" attr names AND also attr blacklisted
if ((!mb_eregi("^[a-z]*$",$attrSubSet[0])) || (($this->xssAuto) && ((in_array(mb_strtolower($attrSubSet[0]), $this->attrBlacklist)) || (mb_substr($attrSubSet[0], 0, 2) == 'on'))))
continue;
// xss attr value filtering
if ($attrSubSet[1])
{
// strips unicode, hex, etc
$attrSubSet[1] = mb_ereg_replace('&#', '', $attrSubSet[1]);
// strip normal newline within attr value
$attrSubSet[1] = mb_ereg_replace('[\t\n\r\f]+', '', $attrSubSet[1]);
// strip double quotes
$attrSubSet[1] = mb_ereg_replace('"', '', $attrSubSet[1]);
// [requested feature] convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr value)
if ((mb_substr($attrSubSet[1], 0, 1) == "'") && (mb_substr($attrSubSet[1], (mb_strlen($attrSubSet[1]) - 1), 1) == "'"))
$attrSubSet[1] = mb_substr($attrSubSet[1], 1, (mb_strlen($attrSubSet[1]) - 2));
// strip slashes
$attrSubSet[1] = stripslashes($attrSubSet[1]);
}
// auto strip attr's with "javascript:
if ( ((mb_strpos(mb_strtolower($attrSubSet[1]), 'expression') !== false) && (mb_strtolower($attrSubSet[0]) == 'style')) ||
(mb_strpos(mb_strtolower($attrSubSet[1]), 'javascript:') !== false) ||
(mb_strpos(mb_strtolower($attrSubSet[1]), 'behaviour:') !== false) ||
(mb_strpos(mb_strtolower($attrSubSet[1]), 'vbscript:') !== false) ||
(mb_strpos(mb_strtolower($attrSubSet[1]), 'mocha:') !== false) ||
(mb_strpos(mb_strtolower($attrSubSet[1]), 'livescript:') !== false)
) continue;
// if matches user defined array
$attrFound = in_array(mb_strtolower($attrSubSet[0]), $this->attrArray);
// keep this attr on condition
if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod))
{
// attr has value
if (isset($attrSubSet[1]))
{
$newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"';
}
else
{
// reformat single attributes to XHTML
$newSet[] = $attrSubSet[0] . '="' . $attrSubSet[0] . '"';
}
}
}
return $newSet;
}
/**
* Try to convert to plaintext
* @access protected
* @param String $source
* @return String $source
*/
function decode($source) {
// url decode
// $source = html_entity_decode($source, ENT_QUOTES, "UTF-8");
// convert decimal
// $source = mb_ereg_replace('&#(\d+);',"chr(\\1)", $source); // decimal notation
// convert hex
// $source = mb_eregi_replace('&#x([a-f0-9]+);',"chr(0x\\1)", $source); // hex notation
return $source;
}
/**
* Method to be called by another php script. Processes for SQL injection
* @access public
* @param Mixed $source - input string/array-of-string to be 'cleaned'
* @param Buffer $connection - An open MySQL connection
* @return String $source - 'cleaned' version of input parameter
*/
function safeSQL($source, &$connection)
{
// clean all elements in this array
if (is_array($source))
{
// filter element for SQL injection
foreach($source as $key => $value)
if (is_string($value))
$source[$key] = $this->quoteSmart($this->decode($value), $connection);
return $source;
// clean this string
}
else if (is_string($source))
{
// filter source for SQL injection
if (is_string($source)) return $this->quoteSmart($this->decode($source), $connection);
// return parameter as given
}
else
return $source;
}
/**
* @author Chris Tobin
* @author Daniel Morris
* @access protected
* @param String $source
* @param Resource $connection - An open MySQL connection
* @return String $source
*/
function quoteSmart($source, &$connection)
{
// strip slashes
if (get_magic_quotes_gpc()) $source = stripslashes($source);
// quote both numeric and text
$source = $this->escapeString($source, $connection);
return $source;
}
/**
* @author Chris Tobin
* @author Daniel Morris
* @access protected
* @param String $source
* @param Resource $connection - An open MySQL connection
* @return String $source
*/
function escapeString($string, &$connection)
{
// depreciated function
if (version_compare(phpversion(),"4.3.0", "<"))
{
mysql_escape_string($string);
// current function
}
else
mysql_real_escape_string($string);
return $string;
}
/**
* @author Oliver Dietz
* @access protected
* @param String $tag
* @return String $tag
*
* this function well forms the attrlist
*
* examples
* input ' a href = "abc" '
* output 'a href="abc"'
*
* input ' / a href = "abc" '
* output '/a'
*
* input ' a href = abc '
* output 'a href=abc'
*
*/
function wellFormTagWithAttr($tag)
{
/** replace ' ' by ' '
* remove ' ' left and right from '='
* remove ' ' from beginning and end
* add a single or double quote if last quote is not terminated
* remove all attrs from closing tags
* remove cr's, lf's tab's and such things
* and do all that things (expect the last) only outside (single or double) quotes
*/
$tag = mb_ereg_replace('[\t\n\r\f]+', ' ', $tag);
$pos = 0;
$retval = '';
$appendTermchar = false;
while ($pos < mb_strlen($tag))
{
$nextdPos = mb_strpos($tag, '"', $pos);
$nextsPos = mb_strpos($tag, '\'', $pos);
if (($nextdPos === false) && ($nextsPos === false))
{
// keine weiteren Tags ... bis zum ende filtern
$filter_len = mb_strlen($tag) - $pos;
$no_filter_len = 0;
}
else
{
if ($nextdPos === false) $nextdPos = mb_strlen($tag) + 1;
if ($nextsPos === false) $nextsPos = mb_strlen($tag) + 1;
if ($nextsPos < $nextdPos)
{
$nextPos = $nextsPos;
$termchar = '\'';
}
else
{
$nextPos = $nextdPos;
$termchar = '"';
}
$filter_len = $nextPos - $pos + 1;
// ok, wir haben einen Anfang ... nach dem Ende suchen
$endFilter = mb_strpos($tag, $termchar, $nextPos + 1);
if ($endFilter === false)
{
$appendTermchar = true;
$no_filter_len = mb_strlen($tag) - $nextPos - 1;
}
else
{
$no_filter_len = $endFilter - $nextPos + 1;
}
}
$retval .= $this->spaceReplace(mb_substr($tag, $pos, $filter_len));
$pos += $filter_len;
$retval .= mb_substr($tag, $pos, $no_filter_len);
$pos += $no_filter_len;
}
if ($appendTermchar == true)
$retval .= $termchar;
if (mb_substr($retval, 0, 1) == '/')
{
//alle Attribute entfernen
$spacePos = mb_strpos($retval, ' ');
if ($spacePos !== false)
$retval = mb_substr($retval, 0, $spacePos);
}
return $retval;
}
function spaceReplace($str)
{
while (mb_strpos($str, ' ') !== false)
$str = mb_ereg_replace(' ', ' ', $str);
if (mb_substr($str, 0, 1) == ' ')
$str = mb_substr($str, 1);
if (mb_substr($str, -1) == ' ')
$str = mb_substr($str, 0, mb_strlen($str) - 1);
$str = mb_ereg_replace(' =', '=', $str);
$str = mb_ereg_replace('= ', '=', $str);
$str = mb_ereg_replace('/ ', '/', $str);
if (mb_substr($str, -1) == '/')
if (mb_substr($str, -2) != ' /')
$str = mb_substr($str, 0, mb_strlen($str) - 1);
return $str;
}
}
?>

View File

@ -1,529 +0,0 @@
<?php
/*
*------------------------------------------------------------
* BMP Image functions
*------------------------------------------------------------
* By JPEXS
*/
/*
*------------------------------------------------------------
* ImageBMP
*------------------------------------------------------------
* - Creates new BMP file
*
* Parameters: $img - Target image
* $file - Target file to store
* - if not specified, bmp is returned
*
* Returns: if $file specified - true if OK
if $file not specified - image data
*/
function imagebmp($img,$file="",$RLE=0)
{
$ColorCount=imagecolorstotal($img);
$Transparent=imagecolortransparent($img);
$IsTransparent=$Transparent!=-1;
if($IsTransparent) $ColorCount--;
if($ColorCount==0) {$ColorCount=0; $BitCount=24;};
if(($ColorCount>0)and($ColorCount<=2)) {$ColorCount=2; $BitCount=1;};
if(($ColorCount>2)and($ColorCount<=16)) { $ColorCount=16; $BitCount=4;};
if(($ColorCount>16)and($ColorCount<=256)) { $ColorCount=0; $BitCount=8;};
$Width=imagesx($img);
$Height=imagesy($img);
$Zbytek=(4-($Width/(8/$BitCount))%4)%4;
if($BitCount<24) $palsize=pow(2,$BitCount)*4;
$size=(floor($Width/(8/$BitCount))+$Zbytek)*$Height+54;
$size+=$palsize;
$offset=54+$palsize;
// Bitmap File Header
$ret = 'BM'; // header (2b)
$ret .= int_to_dword($size); // size of file (4b)
$ret .= int_to_dword(0); // reserved (4b)
$ret .= int_to_dword($offset); // byte location in the file which is first byte of IMAGE (4b)
// Bitmap Info Header
$ret .= int_to_dword(40); // Size of BITMAPINFOHEADER (4b)
$ret .= int_to_dword($Width); // width of bitmap (4b)
$ret .= int_to_dword($Height); // height of bitmap (4b)
$ret .= int_to_word(1); // biPlanes = 1 (2b)
$ret .= int_to_word($BitCount); // biBitCount = {1 (mono) or 4 (16 clr ) or 8 (256 clr) or 24 (16 Mil)} (2b)
$ret .= int_to_dword($RLE); // RLE COMPRESSION (4b)
$ret .= int_to_dword(0); // width x height (4b)
$ret .= int_to_dword(0); // biXPelsPerMeter (4b)
$ret .= int_to_dword(0); // biYPelsPerMeter (4b)
$ret .= int_to_dword(0); // Number of palettes used (4b)
$ret .= int_to_dword(0); // Number of important colour (4b)
// image data
$CC=$ColorCount;
$sl1=strlen($ret);
if($CC==0) $CC=256;
if($BitCount<24)
{
$ColorTotal=imagecolorstotal($img);
if($IsTransparent) $ColorTotal--;
for($p=0;$p<$ColorTotal;$p++)
{
$color=imagecolorsforindex($img,$p);
$ret.=inttobyte($color["blue"]);
$ret.=inttobyte($color["green"]);
$ret.=inttobyte($color["red"]);
$ret.=inttobyte(0); //RESERVED
};
$CT=$ColorTotal;
for($p=$ColorTotal;$p<$CC;$p++)
{
$ret.=inttobyte(0);
$ret.=inttobyte(0);
$ret.=inttobyte(0);
$ret.=inttobyte(0); //RESERVED
};
};
if($BitCount<=8)
{
for($y=$Height-1;$y>=0;$y--)
{
$bWrite="";
for($x=0;$x<$Width;$x++)
{
$color=imagecolorat($img,$x,$y);
$bWrite.=decbinx($color,$BitCount);
if(strlen($bWrite)==8)
{
$retd.=inttobyte(bindec($bWrite));
$bWrite="";
};
};
if((strlen($bWrite)<8)and(strlen($bWrite)!=0))
{
$sl=strlen($bWrite);
for($t=0;$t<8-$sl;$t++)
$sl.="0";
$retd.=inttobyte(bindec($bWrite));
};
for($z=0;$z<$Zbytek;$z++)
$retd.=inttobyte(0);
};
};
if(($RLE==1)and($BitCount==8))
{
for($t=0;$t<strlen($retd);$t+=4)
{
if($t!=0)
if(($t)%$Width==0)
$ret.=chr(0).chr(0);
if(($t+5)%$Width==0)
{
$ret.=chr(0).chr(5).substr($retd,$t,5).chr(0);
$t+=1;
}
if(($t+6)%$Width==0)
{
$ret.=chr(0).chr(6).substr($retd,$t,6);
$t+=2;
}
else
{
$ret.=chr(0).chr(4).substr($retd,$t,4);
};
};
$ret.=chr(0).chr(1);
}
else
{
$ret.=$retd;
};
if($BitCount==24)
{
for($z=0;$z<$Zbytek;$z++)
$Dopl.=chr(0);
for($y=$Height-1;$y>=0;$y--)
{
for($x=0;$x<$Width;$x++)
{
$color=imagecolorsforindex($img,ImageColorAt($img,$x,$y));
$ret.=chr($color["blue"]).chr($color["green"]).chr($color["red"]);
}
$ret.=$Dopl;
};
};
if($file!="")
{
$r=($f=fopen($file,"w"));
$r=$r and fwrite($f,$ret);
$r=$r and fclose($f);
return $r;
}
else
{
echo $ret;
};
};
/*
*------------------------------------------------------------
* ImageCreateFromBmp
*------------------------------------------------------------
* - Reads image from a BMP file
*
* Parameters: $file - Target file to load
*
* Returns: Image ID
*/
function imagecreatefrombmp($file)
{
global $CurrentBit, $echoMode;
$f=fopen($file,"r");
$Header=fread($f,2);
if($Header=="BM")
{
$Size=freaddword($f);
$Reserved1=freadword($f);
$Reserved2=freadword($f);
$FirstByteOfImage=freaddword($f);
$SizeBITMAPINFOHEADER=freaddword($f);
$Width=freaddword($f);
$Height=freaddword($f);
$biPlanes=freadword($f);
$biBitCount=freadword($f);
$RLECompression=freaddword($f);
$WidthxHeight=freaddword($f);
$biXPelsPerMeter=freaddword($f);
$biYPelsPerMeter=freaddword($f);
$NumberOfPalettesUsed=freaddword($f);
$NumberOfImportantColors=freaddword($f);
if($biBitCount<24)
{
$img=imagecreate($Width,$Height);
$Colors=pow(2,$biBitCount);
for($p=0;$p<$Colors;$p++)
{
$B=freadbyte($f);
$G=freadbyte($f);
$R=freadbyte($f);
$Reserved=freadbyte($f);
$Palette[]=imagecolorallocate($img,$R,$G,$B);
};
if($RLECompression==0)
{
$Zbytek=(4-ceil(($Width/(8/$biBitCount)))%4)%4;
for($y=$Height-1;$y>=0;$y--)
{
$CurrentBit=0;
for($x=0;$x<$Width;$x++)
{
$C=freadbits($f,$biBitCount);
imagesetpixel($img,$x,$y,$Palette[$C]);
};
if($CurrentBit!=0) {freadbyte($f);};
for($g=0;$g<$Zbytek;$g++)
freadbyte($f);
};
};
};
if($RLECompression==1) //$BI_RLE8
{
$y=$Height;
$pocetb=0;
while(true)
{
$y--;
$prefix=freadbyte($f);
$suffix=freadbyte($f);
$pocetb+=2;
$echoit=false;
if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>";
if(($prefix==0)and($suffix==1)) break;
if(feof($f)) break;
while(!(($prefix==0)and($suffix==0)))
{
if($prefix==0)
{
$pocet=$suffix;
$Data.=fread($f,$pocet);
$pocetb+=$pocet;
if($pocetb%2==1) {freadbyte($f); $pocetb++;};
};
if($prefix>0)
{
$pocet=$prefix;
for($r=0;$r<$pocet;$r++)
$Data.=chr($suffix);
};
$prefix=freadbyte($f);
$suffix=freadbyte($f);
$pocetb+=2;
if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>";
};
for($x=0;$x<strlen($Data);$x++)
{
imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]);
};
$Data="";
};
};
if($RLECompression==2) //$BI_RLE4
{
$y=$Height;
$pocetb=0;
/*while(!feof($f))
echo freadbyte($f)."_".freadbyte($f)."<BR>";*/
while(true)
{
//break;
$y--;
$prefix=freadbyte($f);
$suffix=freadbyte($f);
$pocetb+=2;
$echoit=false;
if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>";
if(($prefix==0)and($suffix==1)) break;
if(feof($f)) break;
while(!(($prefix==0)and($suffix==0)))
{
if($prefix==0)
{
$pocet=$suffix;
$CurrentBit=0;
for($h=0;$h<$pocet;$h++)
$Data.=chr(freadbits($f,4));
if($CurrentBit!=0) freadbits($f,4);
$pocetb+=ceil(($pocet/2));
if($pocetb%2==1) {freadbyte($f); $pocetb++;};
};
if($prefix>0)
{
$pocet=$prefix;
$i=0;
for($r=0;$r<$pocet;$r++)
{
if($i%2==0)
{
$Data.=chr($suffix%16);
}
else
{
$Data.=chr(floor($suffix/16));
};
$i++;
};
};
$prefix=freadbyte($f);
$suffix=freadbyte($f);
$pocetb+=2;
if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>";
};
for($x=0;$x<strlen($Data);$x++)
{
imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]);
};
$Data="";
};
};
if($biBitCount==24)
{
$img=imagecreatetruecolor($Width,$Height);
$Zbytek=$Width%4;
for($y=$Height-1;$y>=0;$y--)
{
for($x=0;$x<$Width;$x++)
{
$B=freadbyte($f);
$G=freadbyte($f);
$R=freadbyte($f);
$color=imagecolorexact($img,$R,$G,$B);
if($color==-1) $color=imagecolorallocate($img,$R,$G,$B);
imagesetpixel($img,$x,$y,$color);
}
for($z=0;$z<$Zbytek;$z++)
freadbyte($f);
};
};
return $img;
};
fclose($f);
};
/*
* Helping functions:
*-------------------------
*
* freadbyte($file) - reads 1 byte from $file
* freadword($file) - reads 2 bytes (1 word) from $file
* freaddword($file) - reads 4 bytes (1 dword) from $file
* freadlngint($file) - same as freaddword($file)
* decbin8($d) - returns binary string of d zero filled to 8
* RetBits($byte,$start,$len) - returns bits $start->$start+$len from $byte
* freadbits($file,$count) - reads next $count bits from $file
* RGBToHex($R,$G,$B) - convert $R, $G, $B to hex
* int_to_dword($n) - returns 4 byte representation of $n
* int_to_word($n) - returns 2 byte representation of $n
*/
function freadbyte($f)
{
return ord(fread($f,1));
};
function freadword($f)
{
$b1=freadbyte($f);
$b2=freadbyte($f);
return $b2*256+$b1;
};
function freadlngint($f)
{
return freaddword($f);
};
function freaddword($f)
{
$b1=freadword($f);
$b2=freadword($f);
return $b2*65536+$b1;
};
function RetBits($byte,$start,$len)
{
$bin=decbin8($byte);
$r=bindec(substr($bin,$start,$len));
return $r;
};
$CurrentBit=0;
function freadbits($f,$count)
{
global $CurrentBit,$SMode;
$Byte=freadbyte($f);
$LastCBit=$CurrentBit;
$CurrentBit+=$count;
if($CurrentBit==8)
{
$CurrentBit=0;
}
else
{
fseek($f,ftell($f)-1);
};
return RetBits($Byte,$LastCBit,$count);
};
function RGBToHex($Red,$Green,$Blue)
{
$hRed=dechex($Red);if(strlen($hRed)==1) $hRed="0$hRed";
$hGreen=dechex($Green);if(strlen($hGreen)==1) $hGreen="0$hGreen";
$hBlue=dechex($Blue);if(strlen($hBlue)==1) $hBlue="0$hBlue";
return($hRed.$hGreen.$hBlue);
};
function int_to_dword($n)
{
return chr($n & 255).chr(($n >> 8) & 255).chr(($n >> 16) & 255).chr(($n >> 24) & 255);
}
function int_to_word($n)
{
return chr($n & 255).chr(($n >> 8) & 255);
}
function decbin8($d)
{
return decbinx($d,8);
};
function decbinx($d,$n)
{
$bin=decbin($d);
$sbin=strlen($bin);
for($j=0;$j<$n-$sbin;$j++)
$bin="0$bin";
return $bin;
};
function inttobyte($n)
{
return chr($n);
};
?>

View File

@ -10,7 +10,7 @@
require_once($opt['rootpath'] . 'lib2/logic/rowEditor.class.php');
require_once($opt['rootpath'] . 'lib2/logic/cache.class.php');
require_once($opt['rootpath'] . 'lib/logtypes.inc.php');
require_once($opt['rootpath'] . 'lib2/logic/logtypes.inc.php');
class cachelog
{

View File

@ -21,7 +21,7 @@
//prepare the templates and include all neccessary
require_once('./lib/common.inc.php');
require_once('./lib/logtypes.inc.php');
require_once('./lib2/logic/logtypes.inc.php');
require($stylepath.'/smilies.inc.php');
require_once($opt['rootpath'] . '../lib/htmlpurifier-4.2.0/library/HTMLPurifier.auto.php');

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 987 B

After

Width:  |  Height:  |  Size: 987 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 718 B

After

Width:  |  Height:  |  Size: 718 B

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -5,20 +5,21 @@
* Unicode Reminder メモ
***************************************************************************/
// define image paths
$imgurl_404[1] = 'lang/de/ocstyle/images/thumb/thumb404_1.gif';
$imgurl_404[2]= 'lang/de/ocstyle/images/thumb/thumb404_2.gif';
$imgurl_intern[1] = 'lang/de/ocstyle/images/thumb/thumbintern_1.gif';
$imgurl_intern[2] = 'lang/de/ocstyle/images/thumb/thumbintern_2.gif';
$imgurl_extern[1] = 'lang/de/ocstyle/images/thumb/thumbextern_1.gif';
$imgurl_extern[2] = 'lang/de/ocstyle/images/thumb/thumbextern_2.gif';
$imgurl_spoiler[1] = 'lang/de/ocstyle/images/thumb/thumbspoiler_1.gif';
$imgurl_spoiler[2] = 'lang/de/ocstyle/images/thumb/thumbspoiler_2.gif';
$imgurl_format[1] = 'lang/de/ocstyle/images/thumb/thumbunknown_1.gif';
$imgurl_format[2] = 'lang/de/ocstyle/images/thumb/thumbunknown_2.gif';
require('./lib2/web.inc.php');
// define image paths
$imgpath = "resource2/".$opt['template']['style']."/images/thumb/";
$imgurl_404[1] = $imgpath.'thumb404_1.gif';
$imgurl_404[2] = $imgpath.'thumb404_2.gif';
$imgurl_intern[1] = $imgpath.'thumbintern_1.gif';
$imgurl_intern[2] = $imgpath.'thumbintern_2.gif';
$imgurl_extern[1] = $imgpath.'thumbextern_1.gif';
$imgurl_extern[2] = $imgpath.'thumbextern_2.gif';
$imgurl_spoiler[1] = $imgpath.'thumbspoiler_1.gif';
$imgurl_spoiler[2] = $imgpath.'thumbspoiler_2.gif';
$imgurl_format[1] = $imgpath.'thumbunknown_1.gif';
$imgurl_format[2] = $imgpath.'thumbunknown_2.gif';
$login->verify();
$uuid = isset($_REQUEST['uuid']) ? $_REQUEST['uuid'] : '';