appendTemplate($file); else $this->templates = null; } function setAdmin($bool) { define("ADMIN", $bool); } /** * prependTemplate - Puts a new template file at the beginning of the queue * * @param $file string The template you want to load (just say 'main_body', instead of 'templates/main_body.tpl') */ function prependTemplate($file) { if ((defined("ADMIN")) && (ADMIN == TRUE)) { $prefix = "templates/"; } else { $prefix = "templates/"; } if (file_exists($prefix.$file)) array_unshift($this->templates, $prefix.$file); else echo "Template.inc.php: prependTemplate called with: " . $file . " - It doesn't exist!"; } /** * appendTemplate - Puts a new template file at the end of the queue * * @param $file string The template you want to load */ function appendTemplate($file) { if ((defined("ADMIN")) && (ADMIN == TRUE)) { $prefix = "templates/"; } else { $prefix = ""; } if (file_exists($prefix.$file)) $this->templates[] = $prefix.$file; else echo "Template.inc.php: appendTemplate called with: " . $file . " - It doesn't exist!"; } /** * setVar - Set a template variable * * @param $name string The name of the template variable to set * @param $value string The value of the template variable to set */ function setVar($name, $value) { if (is_object($value) && is_a($value, 'Template')) // Support for nested templates - NOTE: 'is_a' is deprecated as of PHP5 (use 'instanceof') $this->vars[$name] = $value->fetch(); else $this->vars[$name] = $value; } /** * setVar - Sets multiple template variables * * @param $vars array A key/value pair array. The keys are the variable names, the values the variable values. */ function setVars($vars) { foreach ($vars as $name => $value) $this->setVar($name, $value); } /** * isVarSet - Returns wheter or not a template variable was set * * If a variable is NULL, isSet returns FALSE * * @param $name string The name of the variable to test * @returns TRUE if the variable was set, FALSE otherwise */ function isVarSet($name) { return isset($this->vars[$name]); } /** * getVar - Returns the value of a set template variable * * If isVarSet($name) == FALSE, we return NULL * * @param $name string The name of the template variable * @returns The value of the variable if the variable was set, NULL otherwise */ function getVar($name) { return (isVarSet($name) ? $this->vars[$name] : NULL); } /** * parse - Returns the parsed template * * This function opens all the template files in sequence, and parses them. * * @returns The parsed template as a string, ready for printing to the browser */ function parse() { if (count($this->templates) == 0) { echo "Template.inc.php: parse called without any valid templates loaded!"; return FALSE; } extract($this->vars); // Extract the vars to local namespace ob_start(); // Start output buffering foreach ($this->templates as $file) include($file); // Include the file $contents = ob_get_contents(); // Get the contents of the buffer ob_end_clean(); // End buffering and discard return $contents; // Return the contents } } /** * An extension to Template that provides automatic caching of * template contents. */ class CachedTemplate extends Template { var $cache_id; var $expire; var $cached; /** * Constructor. * * @param $cache_id string unique cache identifier * @param $expire int number of seconds the cache will live */ function CachedTemplate($cache_id = null, $expire = 900) { $this->Template(); $this->cache_id = $cache_id ? 'cache/' . md5($cache_id) : $cache_id; $this->expire = $expire; } /** * Test to see whether the currently loaded cache_id has a valid * corrosponding cache file. */ function is_cached() { if($this->cached) return true; // Passed a cache_id? if(!$this->cache_id) return false; // Cache file exists? if(!file_exists($this->cache_id)) return false; // Can get the time of the file? if(!($mtime = filemtime($this->cache_id))) return false; // Cache expired? if(($mtime + $this->expire) < time()) { @unlink($this->cache_id); return false; } else { /** * Cache the results of this is_cached() call. Why? So * we don't have to double the overhead for each template. * If we didn't cache, it would be hitting the file system * twice as much (file_exists() & filemtime() [twice each]). */ $this->cached = true; return true; } } /** * This function returns a cached copy of a template (if it exists), * otherwise, it parses it as normal and caches the content. * * @param $file string the template file */ function fetch_cache($file) { if($this->is_cached()) { $fp = @fopen($this->cache_id, 'r'); $contents = fread($fp, filesize($this->cache_id)); fclose($fp); return $contents; } else { $contents = $this->fetch($file); // Write the cache if($fp = @fopen($this->cache_id, 'w')) { fwrite($fp, $contents); fclose($fp); } else { die('Unable to write cache.'); } return $contents; } } } ?>", $string); } return $string; echo mysql_error(); } */ //BBcode /* function bbcode($string) { $string = str_replace("\n", "
", $string); $string = preg_replace("/\[b\](.*?)\[\/b\]/si", "\\1", $string); $string = preg_replace("/\[i\](.*?)\[\/i\]/si", "\\1", $string); $string = preg_replace("#\[email\](.*?)\[/email\]#si", "\\1", $string); $string = preg_replace("/\[u\](.*?)\[\/u\]/si", "\\1", $string); $string = preg_replace("#\[url\](http://)?(.*?)\[/url\]#si", "\\2", $string); $string = preg_replace("#\[url=(http://)?(.*?)\](.*?)\[/url\]#si", "\\3", $string); $string = preg_replace("/\[code\](.*?)\[\/code\]/si", "
Code:
\\1
", $string); $string = preg_replace("/\[quote\](.*?)\[\/quote\]/si", "
Quote:
\\1
", $string); $string = preg_replace("/\[quote=(.*)\](.*?)\[\/quote\]/si", "
\\1 schreef:
\\2
", $string); return $string; } //Strip BBcode function stripBBcode($string) { $string = preg_replace("/\[b\](.*?)\[\/b\]/si", "\\1", $string); $string = preg_replace("/\[i\](.*?)\[\/i\]/si", "\\1", $string); $string = preg_replace("#\[email\](.*?)\[/email\]#si", "\\1", $string); $string = preg_replace("/\[u\](.*?)\[\/u\]/si", "\\1", $string); $string = preg_replace("#\[url\](http://)?(.*?)\[/url\]#si", "\\2", $string); $string = preg_replace("#\[url=(http://)?(.*?)\](.*?)\[/url\]#si", "\\3", $string); $string = preg_replace("/\[code\](.*?)\[\/code\]/si", "[code]", $string); $string = preg_replace("/\[quote\](.*?)\[\/quote\]/si", "", $string); return($string); } */ //Embed YouTube Video's met bb-code function youtube($string) { $youtube = " \n \n \n \n
\n \n "; $string = preg_replace("/\[youtube\](.*?)\[\/youtube\]/si", $youtube, $string); return $string; } function body_bbcode($string) { $string = preg_replace("/\[code\](.*?)\[\/code\]/si", "
Code:
\\1
", $string); $string = preg_replace("/\[quote\](.*?)\[\/quote\]/si", "
Quote:
\\1
", $string); $string = preg_replace("/\[quote=(.*)\](.*?)\[\/quote\]/si", "
\\1 schreef:
\\2
", $string); $string = youtube($string); $string = flv($string); //$string = mov($sting); $string = mp3($string); return $string; } //Converteert html naar bbcode function html_to_bbcode($string) { // // Function convert HTML to BBCode // (C) DeViAnThans3 - 2005 // $string = str_replace("\n", "", $string); $from[] = '~

(.*?)<\/p>~is'; $from[] = '~~is'; $from[] = '~(.*?)<\/i>~is'; $from[] = '~(.*?)<\/em>~is'; $from[] = '~(.*?)<\/b>~is'; $from[] = '~(.*?)<\/strong>~is'; $from[] = '~(.*?)<\/u>~is'; $from[] = '~(.*?)<\/del>~is'; $from[] = '~(.*?)<\/div>~is'; $from[] = '~(.*?)<\/div>~is'; $from[] = '~~is'; $from[] = '~(.*?)~is'; $from[] = '~~is'; $from[] = '~(.*?)~is'; $from[] = '~(.*?)~is'; $to[] = "\\1\n"; $to[] = "\n"; $to[] = '[i]\\1[/i]'; $to[] = '[i]\\1[/i]'; $to[] = '[b]\\1[/b]'; $to[] = '[b]\\1[/b]'; $to[] = '[u]\\1[/u]'; $to[] = '[s]\\1[/s]'; $to[] = '[quote]\\1[/quote]'; $to[] = '[quote]\\1[/quote]'; $to[] = "[img]\\1[/img]\n"; $to[] = '[url=\\1]\\2[/url]'; $to[] = "\n=================================================================================\n"; $to[] = '[size=\\1]\\2[/size]'; $to[] = '[color=\\1]\\2[/color]'; $string = preg_replace($from, $to, $string); //$string = str_replace("
", "\n", $string); return $string; } //converteert relatieve urls in een string naar absolute urls function relative_to_absolute($string) { $from[] = '~~is'; $from[] = '~~is'; $to[] = ''; $to[] = ''; $string = preg_replace($from, $to, $string); return $string; } //formatteer getallen naar Nederlandse schrijfwijze. function nl_format($nummer) { $fnummer = number_format($nummer, 2, ',', '.'); return $fnummer; } //Converteert een datetime waarde naar waarde uit configuratie function convert_date($date_format, $date=null) { if (isset($date)) { $date = strtotime($date); $date = strftime($date_format, $date); } else $date = strftime($date_format); return $date; } //Functie om Checked status van Radio button vast te leggen function setChecked($option, $value) { if ($option == $value) { return "checked=\"checked\""; } } //Functie om Selected status van selectbox vast te leggen function setSelect($option, $value) { if ($option == $value) { return "selected=\"selected\""; } } function random_string($len=8,$num=True) { mt_srand(microtime() * 1000000); for($password='';strlen($password)<$len;){ if (!mt_rand(0,2) && $num) { $password.=chr(mt_rand(48,57)); } else if (!mt_rand(0,1)) { $password.=chr(mt_rand(65,90)); } else { $password.=chr(mt_rand(97,122)); } } return $password; } function random_number($len=8) { for ($string='';strlen($string)<$len;) { if ($string == '') { $string .= mt_rand(1, 9); } else { $string .= mt_rand(0, 9); } } return $string; } //functie om snel de content van een array formatted te kunnen bekijken function print_array($array) { echo "

";
	print_r($array);
	echo "
"; } //Zet text tussen procenttekens om naar bijbehorende Config constante waarde, mits deze bestaat //Gebruik in tekst: %SITE_NAME% function constant_text($string) { preg_match_all('/%([a-zA-Z0-9-_]+)%/i', $string, $tags); foreach($tags[1] as $tag) { $tag = strtoupper($tag); if ($tag == "YEAR") { $string = preg_replace('/%('.$tag.')%/i', date("Y"), $string); } elseif ($tag == "USERNAME") { if (isset($_SESSION['user'])) { $username = $_SESSION['user']; } else { $username = "gast"; } $string = preg_replace('/%('.$tag.')%/i', $username, $string); } elseif (defined($tag)) { $constant = constant($tag); $string = preg_replace('/%('.$tag.')%/i', $constant, $string); } } return $string; } function parseUrls($text) { /* $text = @eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1', $text); $text = @eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1\\2', $text); $text = @eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','\\1', $text); */ $pattern = '/(?i)(((https?|ftp|gopher):\/\/([^:]+\:[^@]*@)?)?([\d\w\-]+\.)?[\w\d\-\.]+\.[\w\d]+((\/[\w\d\-@%]+)*(\/([\w\d\.\_\-@]+\.[\w\d]+)?(\?[\w\d\?%,\.\/\##!@:=\+~_\-&]*(?\\1'; $text = preg_replace($pattern, $replacement, $text); return $text; } ?>\n"; for ($i = 0; $i < db_num_rows($dbResult); $i++) { $url_name = db_result($dbResult, $i, 0); $name = htmlentities(db_result($dbResult, $i, 1), ENT_QUOTES, "UTF-8"); $menu .= "
  • ".$name."
  • \n"; } $menu .= "\n"; return $menu; } } /* if (OFFLINE == TRUE) { $page = new Template('templates/header.tpl'); $page->setVar('pageTitle', OFFLINE_TITLE); $page->appendTemplate("templates/static.tpl"); $page->setVar('name', OFFLINE_TITLE); $page->setVar('current', ""); $page->setVar('body', OFFLINE_TEXT); $page->appendTemplate('templates/footer.tpl'); print $page->parse(); exit(); } */ /* //Homepage texts $homepage = ""; $dbResult = db_query("SELECT name, body FROM homepage ORDER BY id ASC"); for ($i = 0; $i < db_num_rows($dbResult); $i++) { $name = db_result($dbResult, $i, 0); $body = db_result($dbResult, $i, 1); $homepage[$name] = $body; } define('FOOTER_LEFT', $homepage['footer_left']); define('FOOTER_RIGHT', $homepage['footer_right']); */ ?>
    Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() in /home/deb55154/domains/toneeluitgeverijpodium.nl/public_html/index.php:24 Stack trace: #0 {main} thrown in /home/deb55154/domains/toneeluitgeverijpodium.nl/public_html/index.php on line 24