'; if ($print) echo $out; else return $out; } } public function footer($print=true) { if (file_exists(BASE_DIR . '/user_footer.php')) { require_once BASE_DIR . '/user_footer.php'; } else { $out = ' '; if ($print) echo $out; else return $out; } } public function formatText($text) { $text = preg_replace('#(^|\s)([a-z]+://([^\s\w/]?[\w/])*)(\s|$)#im', '\\1\\2\\4', $text); $text = preg_replace('#(^|\s)wp:?([a-z]{2}|):([\w]+)#im', '\\1\\3', $text); $text = str_replace('http://.wikipedia.org/wiki/', 'http://www.wikipedia.org/wiki/', $text); $text = str_replace('\wp:', 'wp:', $text); $text = str_replace('\http:', 'http:', $text); $text = nl2br($text); return $text; } public function getCurrentDir($dir) { return preg_replace('!.*([^/]*)$!U', '\\1', $dir); } public function currentUserPosition($dir) { $dir = explode('/', $dir); $out = ' '.$this->title."\n"; $current = ''; foreach ($dir as $d) { if ($current) $current .= '/'; $current .= $d; $out .= ' '.$d."\n"; } return $out; } public function picThumb($pic, $mode=false) { $out = '
  • '; $out.= ''.htmlspecialchars($pic['filename']).''; $out .= "
  • \n"; return $out; } } function __() { $args = func_get_args(); $plural_count = 0; foreach ($args as $arg) { if (is_array($arg) && !isset($params)) { $params = $arg; continue; } if (!is_string($arg)) throw new Exception("Unexpected parameter of type ".gettype($arg)." in __() function."); if (!isset($text)) $text = $arg; elseif (!isset($plural_text)) $plural_text = $arg; elseif (!isset($plural_count)) $plural_count = $arg; } if (!isset($text)) { throw new Exception("No text to display"); } if (isset($plural_text)) { $text = translation::isPlural($plural_count) ? $plural_text : $text; } $translation = translation::get($text); if (!$translation) $translation = $text; if (isset($params)) { foreach ($params as $key=>$value) { $translation = str_replace('%' . ($key+1), $value, $translation); } } return $translation; } // Returns a 1x1 transparent GIF function show_inline_pixel() { header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header('Content-Type: image/gif'); echo base64_decode("R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="); } function save_config($cfg) { $out = '$value) { $value = strtr($value, array('$' => '\\$', '"' => '\\"')); $out .= '$f->'.$key.' = "'.$value."\";\n"; } $out.= '?>'; if (!@file_put_contents(BASE_DIR . '/user_config.php', $out)) return false; return true; } function redirect($url='') { if (substr($url, 0, 7) != 'http://') $url = $GLOBALS['f']->base_url . $url; header('Location: '.$url); exit; } ?>