");
$text = eregi_replace("([ \f\r\t\n\'\"])style=[^>]+", "\\1", $text);
// $text = eregi_replace("([ \f\r\t\n\'\"])class=[^>]+", "\\1", $text);
$text = eregi_replace("([ \f\r\t\n\'\"])on[a-z]+=[^>]+", "\\1", $text);
$text=preg_replace('//','',$text);
$text = preg_replace("%href=(.+?)>%i", "href=$1 target=\"new\">",$text);
return $text;
}
/* ***************************************************** */
function format_plural($count, $singular, $plural) {
return ($count == 1) ? "$count ". $singular : "$count ". $plural;
}
/* ***************************************************** */
function format_interval($timestamp) {
$units = array("year|years" => 31536000, "week|weeks" => 604800, "day|days" => 86400, "hour|hours" => 3600, "min|min" => 60, "sec|sec" => 1);
foreach ($units as $key=>$value) {
$key = explode("|", $key);
if ($timestamp >= $value) {
$output .= ($output ? " " : "") . format_plural(floor($timestamp / $value), $key[0], $key[1]);
$timestamp %= $value;
}
}
return ($output) ? $output : "0 sec";
}
/* ***************************************************** */
function form($action, $form, $method = "post", $options = 0) {
return "
\n";
}
/* ***************************************************** */
function form_item($title, $value, $description = 0) {
return ($description) ? (($title)?"$title:
":"")."$value
$description\n" : "$title:
$value\n";
}
/* ***************************************************** */
function form_textfield($title, $name, $value, $size, $maxlength, $description = 0) {
return form_item($title, "", $description);
}
/* ***************************************************** */
function form_textfield2($title, $name, $value, $size, $maxlength, $description = 0) {
return form_item($title, "", $description);
}
/* ***************************************************** */
function form_textfield_noedit($title, $name, $value, $size, $maxlength, $description = 0) {
return form_item($title, "", $description);
}
/* ***************************************************** */
function form_select($title, $name, $value, $options, $description = 0, $extra = 0) {
if (count($options) > 0) {
foreach ($options as $key=>$choice) $select .= "";
return form_item($title, "", $description);
}
}
/* ***************************************************** */
function form_select2($title, $name, $value, $options, $description = 0, $extra = 0) {
if (count($options) > 0) {
foreach ($options as $key=>$choice) $select .= "";
return form_item($title, "", $description);
}
}
/* ***************************************************** */
function form_hidden($name, $value) {
return "\n";
}
/* ***************************************************** */
function form_submit($value) {
return "\n";
}
/* ***************************************************** */
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
/* ***************************************************** */
function timer_start() {
global $timer_start;
$timer_start = getmicrotime();
}
/* ***************************************************** */
function timer_print() {
global $timer_start;
$stop = getmicrotime();
// $diff = $stop[0] - $timer[0];
$diff = $stop-$timer_start;
print "
PHP execution time: ".round($diff,3)." s";
}
/* ***************************************************** */
function rn2n($data) {
$data = str_replace("\r\n", "\n", $data);
$data = str_replace("\r", "\n", $data);
return $data;
}
/* ***************************************************** */
function send_mymail($to, $subject, $message, $extra="", $from="") {
global $theme, $debug;
$debug=0;
$to = "$to";
$message = strip_tags($message);
$message = stripslashes($message);
$message = rn2n($message);
$subject = strip_tags($subject);
$subject = stripslashes($subject);
$sendmail_path = ini_get("sendmail_path");
if ($from) {
ini_set("sendmail_path", "$sendmail_path -f $from");
$headers .= "From: $from\r\n";
$headers .= "Reply-To: $from\r\n";
$headers .= "X-Sender: $from\r\n";
$headers .= "Return-Path: $from";
if ($extra) {
$extra = $headers."\r\n".$extra;
} else {
$extra = $headers;
}
}
if ($debug) {
$output = "To: $to\n$extra\nSubject: $subject\n\n".check_output($message);
$output = "".htmlentities($output)."";
$theme->box($subject, $output);
} else {
mail($to, $subject, $message, $extra);
}
ini_set("sendmail_path", "$sendmail_path");
}
//**************************
//Globals
include_once "conf.inc.php";
include_once "namespace.inc.php";
// set error handler:
//set_error_handler("error_handler");
?>