version 1.1, 2002/03/15 00:09:03 |
version 1.7, 2002/03/29 19:45:45 |
|
|
<? |
<?
|
/* |
/*
|
Module: WolBoard.php3 |
Module: WolBoard.php3
|
|
|
Author: Martin Karas a.k.a. Wolcano |
Author: Martin Karas a.k.a. Wolcano
|
Date: 14.03.2002 |
Date: 14.03.2002
|
Mail: wolcano@pobox.sk |
Mail: wolcano@pobox.sk
|
Version: v4.4 |
Version: v5.0
|
|
License: not chosen yet - this file is strictly private,
|
|
you may not copy/change/distribute it without authors
|
Description: Simple message-board. Uses two external files to store |
explicit premission.
|
data - messages, usernames and e-mails. Main functions are show_data_form, |
Description: Simple message-board. Can store data in files or
|
show_messages. Other runtime information (new user creation form, etc) are |
PEAR-compliant DB (not fully implemented yet)
|
shown not using function calls. |
|
|
TODO: (see TODO file)
|
|
|
TODO: |
External files specification:
|
* zmena hesla/e-mailu usera |
$message_file :== (<message_line><eoln>)*
|
* zmazanie usera (suicide) |
<message_line> :== <unix_time>:<username>:<message> ||
|
* moznost nastavit si pocet messages pre kazdeho usera zvlast |
<unix_time>:<username>:<deleted_message>
|
* OPTIONS_DIALOG (autorefresh, pagesize, nick, pass, email...all) |
<deleted_message> :== *<message>
|
* stalost nastaveni uzivatela (cookies?) |
|
* plne implementovat pracu s DB/PEAR |
$user_file :== (<user_line><eoln>)*
|
|
<user_line> :== <username>:<email>:<md5sum_of_password>
|
|
|
External files specification: |
Database specification:
|
$message_file :== (<message_line><eoln>)* |
create table messages <unknown for now>
|
<message_line> :== <unix_time>:<username>:<message> || |
|
<unix_time>:<username>:<deleted_message> |
create table users <unknown>
|
<deleted_message> :== *<message> |
|
|
|
$user_file :== (<user_line><eoln>)* |
Input parameters:
|
<user_line> :== <username>:<email>:<md5sum_of_password> |
$pagesize - # of messages per page
|
|
$page - #th page
|
Database specification: |
$autorefresh - refresh time (secs)
|
create table messages <unknown for now> |
// $admin - user/message mantainance
|
|
$style - message view style (0 = board, 1 = chat)
|
create table users <unknown> |
$time - message time index
|
|
$nick - user nickname
|
|
$pass - password
|
Input parameters: |
$message - text of the posted message
|
$pagesize - # of messages per page |
$header - shows only header
|
$page - #th page |
$body - show only body
|
$autorefresh - refresh time (secs) |
$bodyframe - target body frame
|
// $admin - user mantainance |
$headerframe - targer header frame
|
$style - message view style (0 = board, 1 = chat) |
$disablepart - Wont show some parts of the whole document
|
$time - message time index |
(0 - none, 1 - body, 2 - head, 3 - both)
|
$nick - |
$setframes - 1 - create <framesset>
|
$pass - |
0 - disable frames (?? :))
|
$message - |
$frameset - are the frames set? :)
|
$header - shows only header |
|
$body - show only body |
$createuser - (internal)
|
$bodyframe - target body frame |
$deleteok - (internal)
|
$headerframe - targer header frame |
$newnick - (internal)
|
$disablepart - Wont show some parts of the whole document |
$archive - archive file prefix
|
(0 - none, 1 - body, 2 - head, 3 - both) |
$archive_no - index of archived file
|
$setframes - 1 - create frames |
$submit_type - submit button type
|
0 - disable frames (?? :)) |
|
|
CHANGE LOG:
|
$createuser - (internal) |
* 5.0 - DB implementation finished (hopefully)
|
$deleteok - (internal) |
- now allowing some html tags (specified by (array) $allowed_tags)
|
$newnick - (internal) |
- no more dependent on external <framesets>! :) we do the dirty work
|
$archive - archive file prefix |
ourselves (try setting the setframes=1 GET parameter)
|
$archive_no - index of archived file |
* 4.4.2 - 3/4 implementation DB done
|
$submit_type |
* 4.4 - DB/PEAR drafts
|
|
- sources moved to CVS
|
CHANGE LOG: |
* 4.3 - starting MySQL DB implementation
|
* 4.4 - PEAR basic implementation (not functional fully) |
* 4.2 - started documentation
|
* 4.3 - starting MySQL DB implementation |
- removed autosubmit on nick change
|
* 4.2 - started documentation |
- changed default autorefresh to 5 mins
|
- removed autosubmit on nick change |
*FIX* now rawurldecoding username (previously rawurlencoded)
|
- changed default autorefresh to 5 mins |
* 4.1 - undocumented :)
|
*FIX* now rawurldecoding username (previously rawurlencoded) |
*/
|
* 4.1 - undocumented :) |
|
*/ |
|
|
// IMPORTANT CONSTANTS (change if needed)
|
|
$WB_version = "5.0";
|
// IMPORTANT CONSTANTS (change if needed) |
$WB_name = "Wol's Message Board";
|
$WB_version = "4.4"; |
$strip_slashes = 1;
|
$WB_name = "Wol's Message Board"; |
$DEFAULT_HEAD_FRAME = "";
|
$strip_slashes = 1; |
$DEFAULT_BODY_FRAME = "";
|
$DEFAULT_HEAD_FRAME = ""; |
$use_virtual_delete = 1; //use delete flagging instead of real delete
|
$DEFAULT_BODY_FRAME = ""; |
$root_name = "root";
|
$use_virtual_delete = 1; //use delete flagging instead of real delete |
$root_md5_password = "896ae34257056a6edb7643e3db85bb21";
|
$root_name = "root"; |
|
$root_md5_password = "896ae34257056a6edb7643e3db85bb21"; |
// Filesystem defaults
|
|
$message_file = "board_messages.txt";
|
// Filesystem defaults |
$user_file = "board_emails.txt";
|
$message_file = "board_messages.txt"; |
$move_old_mesages = 1;
|
$user_file = "board_emails.txt"; |
$old_messages_folder = "history/";
|
$move_old_mesages = 1; |
$hist_file_prefix = "board_hist_file_"; // used in REGEXPs! alphabeticals only
|
$old_messages_folder = "history/"; |
$max_msgs_in_one_file = 200;
|
$hist_file_prefix = "board_hist_file_"; // used in REGEXPs! alphabeticals only |
$min_msgs_in_board = 50;
|
$max_msgs_in_one_file = 200; |
|
$min_msgs_in_board = 50; |
// Database defaults
|
|
$use_db = 1;
|
// Database defaults |
$db_message_table = "wolboard_messages";
|
$use_db = 0; |
$db_user_table = "wolboard_users";
|
$db_message_table = "wolboard_messages"; |
//$db_host = "db.host.sk";
|
$db_user_table = "wolboard_users"; |
$db_host = "localhost";
|
$db_host = "db.host.sk"; |
$db_database = "syndrome";
|
$db_database = "syndrome"; |
//$db_user = "syndrome";
|
$db_user = "syndrome";// THIS HAS TO BE CHANGED TO "syndrome" |
$db_user = "";
|
$db_pass = "kofola"; |
//$db_pass = "kofola";
|
|
$db_pass = "";
|
|
|
|
$allowed_tags = array(
|
// FUNCTIONS |
"<b>", "</b>",
|
|
"<i>", "</i>",
|
function good($a) { |
"<u>", "</u>",
|
return (isset($a) |
"<del>", "</del>",
|
&& ( |
"©"
|
(is_string($a) && ($a != "")) || |
);
|
(!is_string($a) && ($a != 0)) |
|
) |
|
); |
// FUNCTIONS
|
} |
|
|
function good($a) {
|
function link_replace($link, $paramname, $paramvalue) { |
return (isset($a)
|
$link = eregi_replace("&$", "", $link); |
&& (
|
$link = eregi_replace("&?$paramname=[^&]*", "", $link); |
(is_string($a) && ($a != "")) ||
|
if ($paramvalue) |
(!is_string($a) && ($a != 0))
|
$link .= "&$paramname=$paramvalue"; |
)
|
return $link; |
);
|
} |
}
|
|
|
function show_array($a) { |
function link_replace($link, $paramname, $paramvalue) {
|
echo "<table border=1>\n"; |
$link = eregi_replace("&$", "", $link);
|
$keys = array_keys($a); |
$link = eregi_replace("&?$paramname=[^&]*", "", $link);
|
|
if ($paramvalue)
|
for($i = 0; $i < sizeof($a); $i++) { |
$link .= "&$paramname=$paramvalue";
|
echo "<tr>\n"; |
return $link;
|
echo "<td>"; |
}
|
echo $keys[$i]."</td>\n<td>"; |
|
|
function show_array($a) {
|
if ((is_array($a[$keys[$i]])) && ($keys[$i] !== "GLOBALS")) { |
echo "<table border=1>\n";
|
show_array($a[$keys[$i]]); |
$keys = array_keys($a);
|
} |
|
else { |
for($i = 0; $i < sizeof($a); $i++) {
|
echo $a[$keys[$i]]; |
echo "<tr>\n";
|
}; |
echo "<td>";
|
echo "</td>\n</tr>\n"; |
echo $keys[$i]."</td>\n<td>";
|
} |
|
echo "</table>"; |
if ((is_array($a[$keys[$i]])) && ($keys[$i] !== "GLOBALS")) {
|
} |
show_array($a[$keys[$i]]);
|
|
}
|
function array_copy($a, $i, $n = "x") { |
else {
|
if (($n == "x") || ($n > (sizeof($a) - $i))) |
echo $a[$keys[$i]];
|
$n = sizeof($a) - $i; |
};
|
|
echo "</td>\n</tr>\n";
|
for($j = 0; $j < $n; $j++) { |
}
|
$ret[$j] = $a[$j + $i]; |
echo "</table>";
|
} |
}
|
|
|
return $ret; |
function array_copy($a, $i, $n = "x") {
|
} |
if (($n == "x") || ($n > (sizeof($a) - $i)))
|
|
$n = sizeof($a) - $i;
|
function array_chunk($a, $n) { |
|
if (!is_array($a)) |
for($j = 0; $j < $n; $j++) {
|
return $a; |
$ret[$j] = $a[$j + $i];
|
$splits = sizeof($a) / $n; |
}
|
for($i = 0; $i < $splits; $i++) { |
|
$ret[$i] = array_copy($a, $i*$n, $n); |
return $ret;
|
} |
}
|
return $ret; |
|
} |
function array_chunk($a, $n) {
|
|
if (!is_array($a))
|
function w_chk($n, $v) { |
return $a;
|
return ($v?"$n=$v&":""); |
$splits = sizeof($a) / $n;
|
} |
for($i = 0; $i < $splits; $i++) {
|
|
$ret[$i] = array_copy($a, $i*$n, $n);
|
function create_link() { |
}
|
global $pagesize, $page, $autorefresh, $admin, $style, |
return $ret;
|
$time, $nick, $pass, $message, $createuser, $deleteok, |
}
|
$autorefresh, $disablepart, $frameset, $headframe, |
|
$bodyframe, $archive, $archive_no; |
function w_chk($n, $v) {
|
return eregi_replace("&$", "", |
return ($v?"$n=$v&":"");
|
w_chk("nick", $nick). |
}
|
w_chk("pagesize", $pagesize). |
|
w_chk("page", $page). |
function create_link() {
|
// w_chk("time", $time). |
global $pagesize, $page, $autorefresh, $admin, $style,
|
// w_chk("pass", $pass). |
$time, $nick, $pass, $message, $createuser, $deleteok,
|
// w_chk("message", $message). |
$autorefresh, $disablepart, $frameset, $headframe,
|
// w_chk("deleteok", $deleteok). |
$bodyframe, $archive, $archive_no;
|
// w_chk("createuser", $createuser). |
return eregi_replace("&$", "",
|
// w_chk("newnick", $newnick). |
w_chk("nick", $nick).
|
w_chk("autorefresh", $autorefresh). |
w_chk("pagesize", $pagesize).
|
w_chk("style", $style). |
w_chk("page", $page).
|
w_chk("admin", $admin). |
// w_chk("time", $time).
|
w_chk("disablepart", $disablepart). |
// w_chk("pass", $pass).
|
w_chk("frameset", $frameset). |
// w_chk("message", $message).
|
w_chk("headframe", $headframe). |
// w_chk("deleteok", $deleteok).
|
w_chk("bodyframe", $bodyframe). |
// w_chk("createuser", $createuser).
|
w_chk("archive", $archive). |
// w_chk("newnick", $newnick).
|
w_chk("archive_no", $archive_no) |
w_chk("autorefresh", $autorefresh).
|
); |
w_chk("style", $style).
|
} |
w_chk("admin", $admin).
|
|
w_chk("disablepart", $disablepart).
|
function wait_read_lock($f, $max_wait = 9999) { |
w_chk("frameset", $frameset).
|
$start = time(); |
w_chk("headframe", $headframe).
|
while ((!flock($f, 1)) && ($start + $max_wait < time())) |
w_chk("bodyframe", $bodyframe).
|
sleep(1); |
w_chk("archive", $archive).
|
return ($start + $max_wait < time())? |
w_chk("archive_no", $archive_no)
|
1:0; |
);
|
} |
}
|
|
|
function wait_write_lock($f, $max_wait = 9999) { |
function wait_read_lock($f, $max_wait = 9999) {
|
$start = time(); |
$start = time();
|
while ((!flock($f, 2)) && ($start + $max_wait < time())) |
while ((!flock($f, 1)) && ($start + $max_wait < time()))
|
sleep(1); |
sleep(1);
|
} |
return ($start + $max_wait < time())?
|
|
1:0;
|
function release_lock($f) { |
}
|
flock($f, 3); |
|
return 1; |
function wait_write_lock($f, $max_wait = 9999) {
|
} |
$start = time();
|
|
while ((!flock($f, 2)) && ($start + $max_wait < time()))
|
function show_options($optnames, $optvalues, $selected) { |
sleep(1);
|
if (!is_array($optvalues)) |
}
|
return 0; |
|
|
function release_lock($f) {
|
$found = 0; |
flock($f, 3);
|
$ret = ""; |
return 1;
|
for($i = 0; $i < sizeof($optvalues); $i++) { |
}
|
$ret .= "<option"; |
|
if (good($optvalues[$i])) { |
function show_options($optnames, $optvalues, $selected) {
|
$ret .= " value=".$optvalues[$i]; |
if (!is_array($optvalues))
|
if ($optvalues[$i] == $selected) { |
return 0;
|
$found++; |
|
$ret .= " selected"; |
$found = 0;
|
} |
$ret = "";
|
} |
for($i = 0; $i < sizeof($optvalues); $i++) {
|
$ret .= ">"; |
$ret .= "<option";
|
if (good($optnames[$i])) |
if (good($optvalues[$i])) {
|
$ret .= $optnames[$i]; |
$ret .= " value=".$optvalues[$i];
|
$ret .= "</option>\n"; |
if ($optvalues[$i] == $selected) {
|
} |
$found++;
|
if ((!$found) && ($selected != "")) |
$ret .= " selected";
|
$ret .= "<option value=$selected selected>Custom</option>\n"; |
}
|
echo $ret; |
}
|
} |
$ret .= ">";
|
|
if (good($optnames[$i]))
|
function get_user($str, $i = 0) { |
$ret .= $optnames[$i];
|
$tmp = strtok(trim($str), ":"); |
$ret .= "</option>\n";
|
if ($i) |
}
|
// (1) from $MESSAGE_FILE |
if ((!$found) && ($selected != ""))
|
return strtok(":"); |
$ret .= "<option value=$selected selected>Custom</option>\n";
|
else |
echo $ret;
|
// (0) from $USER_FILE |
}
|
return $tmp; |
|
} |
function get_user($str, $i = 0) {
|
|
$tmp = strtok(trim($str), ":");
|
function get_users($usr_file, $use_db = 0, $db_conn = 0) { |
if ($i)
|
if ($use_db) |
// (1) from $MESSAGE_FILE
|
// Working with files |
return strtok(":");
|
$fp = fopen($usr_file, "r"); |
else
|
wait_read_lock($fp); |
// (0) from $USER_FILE
|
$ret = file($usr_file); |
return $tmp;
|
for($i = 0; $i < sizeof($ret); $i++) { |
}
|
$ret[$i] = trim($ret[$i]); |
|
$ret[$i] = get_user($ret[$i], 0); |
function get_users($usr_file, $use_db = 0, $db_conn = 0) {
|
} |
if (!$use_db) {
|
release_lock($fp); |
// Working with files
|
return $ret; |
$fp = fopen($usr_file, "r");
|
} |
wait_read_lock($fp);
|
else { |
$ret = file($usr_file);
|
// Working with DB |
for($i = 0; $i < sizeof($ret); $i++) {
|
$res = $db_conn->query("select nick from $usr_file where nick <> ''"); |
$ret[$i] = trim($ret[$i]);
|
$i = 0; |
$ret[$i] = get_user($ret[$i], 0);
|
while ($tmp = $res->fetchRow()) { |
}
|
$ret[$i] = $tmp[0]; |
release_lock($fp);
|
$i++; |
return $ret;
|
} |
}
|
$db_conn->free; |
else {
|
return $ret; |
// Working with DB
|
} |
// $usr_file stores Table name
|
} |
if (!$db_conn)
|
|
return false;
|
function format_time($time, $style = 0) { |
|
switch($style) { |
$res = $db_conn->query("select nick from $usr_file");
|
case 1: |
$i = 0;
|
return date("H:i:s", $time); |
while ($tmp = $res->fetchRow()) {
|
default: |
$ret[$i++] = $tmp["nick"];
|
return date("H:i:s - d. M Y", $time); |
}
|
} |
|
} |
$db_conn->free;
|
|
return $ret;
|
function get_time($str) { |
}
|
return strtok(trim($str), ":"); |
}
|
} |
|
|
function format_time($time, $style = 0) {
|
function get_pass($str) { |
switch($style) {
|
return rawurldecode(trim(strtr(strrchr($str, ":"), ":", ";"))); |
case 1:
|
} |
return date("H:i:s", $time);
|
|
default:
|
function get_email($str) { |
return date("H:i:s - d. M Y", $time);
|
if (ereg("[^:]*:([^:]*):", $str, $regs)) |
}
|
return $regs[1]; |
}
|
else |
|
return ""; |
function get_time($str) {
|
} |
return strtok(trim($str), ":");
|
|
}
|
function write_mail($usr_file, $user, $mail = "", $pass = "", $use_db = 0, $db_conn) { |
|
$pass = md5(rawurlencode($pass)); |
function get_pass($str) {
|
if (!$use_db) { |
return rawurldecode(trim(strtr(strrchr($str, ":"), ":", ";")));
|
// Working with files |
}
|
$fp = fopen($usr_file, "a"); |
|
if (!wait_write_lock($fp)) |
function get_email($str) {
|
return false; |
if (ereg("[^:]*:([^:]*):", $str, $regs))
|
fwrite($fp, strtr($user, ":", ";").":".strtr($mail, ":", ";"). |
return $regs[1];
|
":".$pass."\n"); |
else
|
release_lock($fp); |
return "";
|
fclose($fp); |
}
|
return true; |
|
} |
function write_mail($usr_file, $user, $mail = "", $pass = "", $use_db = 0, $db_conn) {
|
else { |
$pass = md5(rawurlencode($pass));
|
// Working with DB |
if (!$use_db) {
|
$user = addslashes($user); |
// Working with files
|
$mail = addslashes($mail); |
$fp = fopen($usr_file, "a");
|
$res = $db_conn->query("insert into $usr_file values". |
if (!wait_write_lock($fp))
|
"('$user', '$mail', '$pass', '', '', '')");//!!!TODO |
return false;
|
return (DB::isError($res)); |
fwrite($fp, strtr($user, ":", ";").":".strtr($mail, ":", ";").
|
} |
":".$pass."\n");
|
} |
release_lock($fp);
|
|
fclose($fp);
|
function change_mail($usr_file, $user, $newmail = "", $pass = "", |
return true;
|
$use_db = 0, $db_conn = 0) { |
}
|
function set_mail($usr_line, $newmail) { |
else {
|
$ret = strtok($usr_line, ":"); |
// Working with DB
|
strtok(":"); |
if (!$db_conn)
|
$ret .= $newmail.":".strtok(":"); |
return false;
|
return $ret; |
|
} |
$user = addslashes($user);
|
|
$mail = addslashes($mail);
|
//check if valid data is sent |
$sql = "insert into $usr_file ".
|
//we dont want to run for now |
"(nick, email, pass) ".
|
if (true)//!!!!!!!! |
"values ".
|
return 0; |
"('$user', '$mail', '$pass')";
|
|
$res = $db_conn->query($sql);
|
if (!$use_db) { |
return (DB::isError($res));
|
// Using files |
}
|
$fp = fopen($usr_file, "w+"); |
}
|
wait_write_lock($fp); |
|
$tmp = files($usr_file); |
function change_mail($usr_file, $user, $newmail = "", $pass = "",
|
$i = 0; |
$use_db = 0, $db_conn = 0) {
|
$found = false; |
function set_mail($usr_line, $newmail) {
|
while (($i < length($tmp)) && (!$found)) { |
$ret = strtok($usr_line, ":");
|
$u = get_user($tmp[$i]); |
strtok(":");
|
if ($u == $user) { |
$ret .= $newmail.":".strtok(":");
|
$tmp[$i] = set_mail($tmp[$i], $newmail); |
return $ret;
|
$found = true; |
}
|
} |
|
$i++; |
if (!$use_db) {
|
} |
//check if valid data is sent
|
|
//we dont want to run for now
|
if ($found) { |
if (true)//!!!!!!!!
|
fwrite($fp, $u); |
return 0;
|
release_lock($fp); |
|
fclose($fp); |
// Using files
|
return 1; |
$fp = fopen($usr_file, "w+");
|
} |
wait_write_lock($fp);
|
else |
$tmp = files($usr_file);
|
return 0; |
$i = 0;
|
} |
$found = false;
|
else { |
while (($i < length($tmp)) && (!$found)) {
|
// Using DB |
$u = get_user($tmp[$i]);
|
//!!!TODO |
if ($u == $user) {
|
// "update $usr_file set mail = '$newmail' where name = '$user' and pass = '$pass'" |
$tmp[$i] = set_mail($tmp[$i], $newmail);
|
return 0; |
$found = true;
|
} |
}
|
} |
$i++;
|
|
}
|
function delete_mail($usr_file, $user = "", $mail = "", $pass = "", |
|
$use_db = 0, $db_conn = 0) { |
if ($found) {
|
//!!!! TODO |
fwrite($fp, $u);
|
if (!$use_db) { |
release_lock($fp);
|
// Use files |
fclose($fp);
|
return 0; |
return 1;
|
} |
}
|
else { |
else
|
// Use DB |
return 0;
|
// "update $usr_file set mail = ''". |
}
|
// where name = '$user' and pass = '$pass' and mail = '$mail'" |
else {
|
return 0; |
// Using DB
|
} |
if (!$db_conn)
|
} |
return false;
|
|
|
function get_emails($usr_file, $use_db = 0, $db_conn = 0) { |
$sql = "update $usr_file set mail = '$newmail' ".
|
if (!$use_db) { |
"where name = '$user' and pass = '$pass'";
|
// Use files |
$res = $db_conn->query($sql);
|
$fp = fopen($usr_file, "r"); |
if (DB::isError($res))
|
wait_read_lock($fp); |
return false;
|
$f = file($usr_file); |
return 1;
|
for($i = 0; $i < sizeof($f); $i++) |
}
|
$ret[get_user($f[$i], 0)] = get_email($f[$i]); |
}
|
|
|
release_lock($fp); |
function delete_mail($usr_file, $user = "", $mail = "", $pass = "",
|
return $ret; |
$use_db = 0, $db_conn = 0) {
|
} |
if (!$use_db) {
|
else { |
//!!!! TODO
|
// Use DB |
// Use files
|
// TODO |
return 0;
|
// "select * from $usr_file where status = 1" |
}
|
return ""; |
else {
|
} |
// Use DB
|
} |
if (!$db_conn)
|
|
return false;
|
function read_messages($msg_file, $usr_file, $full = 0, $use_db = 0, |
|
$db_messages = 0, $db_users = 0) { |
$sql = "update $usr_file set mail = '' ".
|
if (!$use_db) { |
"where name = '$user' and pass = '$pass'".
|
$mails = get_emails($usr_file, 0); |
"and mail = '$mail'";
|
$mfp = fopen($msg_file, "r"); |
$res = $db_conn->query($sql);
|
wait_read_lock($mfp); |
if (DB::isError($res))
|
$f = file($msg_file); |
return false;
|
$n = 0; |
|
for ($i = 0; $i < sizeof($f); $i++) { |
return 0;
|
if ($f[$i] != "") { |
}
|
if ((!$full) && ereg("[^:]*:[^:]*:\*", $f[$i], $regs)) |
}
|
continue; |
|
$ret[$n]["time"] = strtok($f[$i], ":"); |
function get_emails($usr_file, $use_db = 0, $db_conn = 0) {
|
$ret[$n]["name"] = rawurldecode(strtok(":")); |
if (!$use_db) {
|
$ret[$n]["message"] = trim(rawurldecode(strtok(":"))); |
// Use files
|
$ret[$n]["email"] = $mails[$ret[$n]["name"]]; |
$fp = fopen($usr_file, "r");
|
$n++; |
wait_read_lock($fp);
|
} |
$f = file($usr_file);
|
} |
for($i = 0; $i < sizeof($f); $i++)
|
release_lock($mfp); |
$ret[get_user($f[$i], 0)] = get_email($f[$i]);
|
return $ret; |
|
} |
release_lock($fp);
|
else { |
return $ret;
|
// Use DB |
}
|
if ($full) |
else {
|
$q = board_db_query("select autor_id, ". |
// Use DB
|
"text, created from $msg_file"); |
if (!$db_conn)
|
else |
return false;
|
$q = board_db_query("select autor_id, ". |
|
"text, created from $msg_file where flags = 0"); |
$sql = "select nick, email from $usr_file";
|
// TODO |
$res = $db_conn->query($sql);
|
} |
if (DB::isError($res))
|
} |
return false;
|
|
while ($row = $res->fetchRow()) {
|
function need_to_split($a, $max, $min) { |
$rows[$row["nick"]] = $row["email"];
|
if ((sizeof($a) - $max) <= $min) |
}
|
return false; |
return $rows;
|
else |
}
|
return true; |
}
|
} |
|
|
function read_messages($msg_file, $usr_file, $full = 0, $use_db = 0,
|
function split_messages_to_more_files($msgs, $max_len, $min_len, |
$db_conn = 0) {
|
$hist_dir, $hist_file_prefix = "board_hist_file_", $index_style = 0) { |
if (!$use_db) {
|
if (!need_to_split($msgs, $max_len, $min_len)) |
$mails = get_emails($usr_file, 0);
|
return $msgs; |
$mfp = fopen($msg_file, "r");
|
$full = array_chunk($msgs, $max_len); |
wait_read_lock($mfp);
|
|
$f = file($msg_file);
|
$d = opendir($hist_dir); |
$n = 0;
|
$i = -1; |
for ($i = 0; $i < sizeof($f); $i++) {
|
$max_num = -1; |
if ($f[$i] != "") {
|
// looking for previous save of maximum index (and count of saves) |
if ((!$full) && ereg("[^:]*:[^:]*:\*", $f[$i], $regs))
|
while (($file = readdir($d)) !== false) { |
continue;
|
if (ereg("^$hist_file_prefix([0-9]*)", $file, $regs)) { |
$ret[$n]["time"] = strtok($f[$i], ":");
|
$i++; |
$ret[$n]["name"] = rawurldecode(strtok(":"));
|
if ($max_num < $regs[1]) |
$ret[$n]["message"] = trim(rawurldecode(strtok(":")));
|
$max_num = $regs[1]; |
$ret[$n]["email"] = $mails[$ret[$n]["name"]];
|
} |
$n++;
|
} |
}
|
closedir($d); |
}
|
|
release_lock($mfp);
|
switch($index_style) { |
return $ret;
|
case "0": |
}
|
$new_index = $max_num + 1; |
else {
|
break; |
// Use DB
|
case "1": |
if (!$db_conn)
|
$new_index = ++$i; |
return false;
|
break; |
|
} |
$sql = "select author_id, created AS time, text AS message from $msg_file";
|
|
if (!$full)
|
for($i = 0; $i < (sizeof($full) - 1); $i++) { |
$sql .= " where flags = 0";
|
$new_file = $hist_dir.$hist_file_prefix.($new_index + $i); |
|
$fp = fopen($new_file, "a"); |
$res = $db_conn->query($sql);
|
wait_write_lock($fp); |
|
fwrite($fp, implode($full[$i], "")); |
if (DB::isError($res))
|
release_lock($fp); |
return false;
|
} |
$j = 0;
|
$msgs = $full[sizeof($full) - 1]; |
while ($row = $res->fetchRow()) {
|
|
$authors[$row["author_id"]][] = $j;
|
return $msgs; |
$t = $row["time"];
|
} |
/*
|
|
$time = unpack($row["time"],
|
function write_message($msg_file, $user = "Anonym", $text = "<no message>", |
"a4year/a2month/a2day/a2hours/a2minutes/a2seconds");
|
$time = 0, $old_messages_folder, $max_msgs_in_one_file, |
$row["time"] = mktime($time["seconds"],
|
$min_msgs_in_board, $hist_file_prefix, $use_db = 0, $db_conn = 0) { |
$time["minutes"], $time["hours"],
|
|
$time["day"], $time["month"], $time["year"]);
|
if (($time == 0) || !ereg("^[0-9]*$", $time)) |
/*/
|
$time = time(); |
$row["time"] = mktime(
|
$user = rawurlencode($user); |
$row["time"][8] . $row["time"][9],
|
$text = trim($text); |
$row["time"][10] . $row["time"][11],
|
$text = str_replace("ignorant", "ign-co? (c) Wol", $text); //some fun :) |
$row["time"][12] . $row["time"][13],
|
if ($text[0] == '*') // this is used as the deleted flag prefix |
$row["time"][4] . $row["time"][5],
|
$text = " ".$text; |
$row["time"][6] . $row["time"][7],
|
|
$row["time"][0] . $row["time"][1] .
|
if (!$use_db) { |
$row["time"][2] . $row["time"][3]
|
// Use files |
);
|
$new_msg = |
//*/
|
$time.":". |
$row["message"] = rawurldecode($row["message"]);
|
$user.":". |
$messages[$j++] = $row;
|
rawurlencode(nl2br(htmlspecialchars($text)))."\n"; |
}
|
$msgs = file($msg_file); |
$req->free;
|
$msgs[] = $new_msg; |
|
|
$sql = "select id, nick AS name, email from $usr_file ";
|
if (need_to_split($msgs, $max_msgs_in_one_file, $min_msgs_in_board)) { |
if (is_array($authors))
|
$fp = fopen($msg_file, "w"); |
$sql .= "where id = " . implode(array_keys($authors), "or id = ");
|
wait_write_lock($fp); |
|
sort($msgs); |
$res = $db_conn->query($sql);
|
$msgs = split_messages_to_more_files( |
|
$msgs, |
if (DB::isError($res))
|
$max_msgs_in_one_file, |
return false;
|
$min_msgs_in_board, |
|
$old_messages_folder, |
while ($row = $res->fetchRow())
|
$hist_file_prefix, |
for ($i = 0; $i < sizeof($authors[$row["id"]]); $i++) {
|
0 |
$messages[$authors[$row["id"]][$i]]["name"] = rawurldecode($row["name"]);
|
); |
$messages[$authors[$row["id"]][$i]]["email"] = $row["email"];
|
$msgs = implode($msgs, ""); |
}
|
if (trim($msgs) == "") |
|
$msgs = ""; |
return $messages;
|
fwrite($fp, $msgs); |
}
|
} |
}
|
else { |
|
unset($msgs); |
function need_to_split($a, $max, $min) {
|
$fp = fopen($msg_file, "a"); |
if ((sizeof($a) - $max) <= $min)
|
wait_write_lock($fp); |
return false;
|
fwrite($fp, $new_msg); |
else
|
} |
return true;
|
|
}
|
release_lock($fp); |
|
fclose($fp); |
function split_messages_to_more_files($msgs, $max_len, $min_len,
|
return 1; |
$hist_dir, $hist_file_prefix = "board_hist_file_", $index_style = 0) {
|
} |
if (!need_to_split($msgs, $max_len, $min_len))
|
else { |
return $msgs;
|
// Use DB |
$full = array_chunk($msgs, $max_len);
|
// TOdO |
|
// "insert into $msg_file values (". |
$d = opendir($hist_dir);
|
// "'$user', '$text', '$time', '', '')" |
$i = -1;
|
return 0; |
$max_num = -1;
|
} |
// looking for previous save of maximum index (and count of saves)
|
} |
while (($file = readdir($d)) !== false) {
|
|
if (ereg("^$hist_file_prefix([0-9]*)", $file, $regs)) {
|
|
$i++;
|
function delete_message($msg_file, $usr_file, $user, $time, $pass, |
if ($max_num < $regs[1])
|
$use_virtual_delete, $use_db = 0, $db_messages = 0, $db_users = 0) { |
$max_num = $regs[1];
|
if (!$use_db) { |
}
|
// Use files |
}
|
$found = false; |
closedir($d);
|
$i = 0; |
|
$fp = fopen($usr_file, "r"); |
switch($index_style) {
|
wait_read_lock($fp); |
case "0":
|
$p = file($usr_file); |
$new_index = $max_num + 1;
|
release_lock($fp); |
break;
|
if ($user != "") { |
case "1":
|
while ((!$found) && ($i < sizeof($p))) { |
$new_index = ++$i;
|
if ($user == get_user($p[$i], 0)) |
break;
|
$found = true; |
}
|
$i++; |
|
}; |
for($i = 0; $i < (sizeof($full) - 1); $i++) {
|
} |
$new_file = $hist_dir.$hist_file_prefix.($new_index + $i);
|
else |
$fp = fopen($new_file, "a");
|
$found = true; |
wait_write_lock($fp);
|
|
fwrite($fp, implode($full[$i], ""));
|
if (!$found) |
release_lock($fp);
|
return 1; |
}
|
|
$msgs = $full[sizeof($full) - 1];
|
if (!(($user == "") && ($pass == ""))) |
|
if (get_pass($p[--$i]) != md5($pass)) |
return $msgs;
|
return 2; |
}
|
|
|
$fp = fopen($msg_file, "r"); |
function validate_message($message, $allowed_tags) {
|
wait_read_lock($fp); |
$message = trim($message);
|
$f = file($msg_file); |
//some fun :)
|
$found = false; |
$message = ereg_replace("ignor[^a-zA-Z]*", "igno-what? © Wol ", $message);
|
$i = 0; |
$message = rawurlencode(nl2br(htmlspecialchars($message)));
|
while (!$found && ($i < sizeof($f))) { |
|
if (get_user($f[$i], 1) == $user && get_time($f[$i]) == $time) |
for ($i = 0; $i < sizeof($allowed_tags); $i++) {
|
$found = true; |
$message = str_replace(
|
$i++; |
rawurlencode(htmlspecialchars($allowed_tags[$i])),
|
} |
$allowed_tags[$i],
|
if (!$found) |
$message
|
return 3; |
);
|
$i--; |
}
|
|
|
if ($use_virtual_delete) { |
return $message;
|
// if already marked as deleted then delete it really |
}
|
if (ereg("[^:]*:[^:]*:\*.*", $f[$i], $regs)) |
|
$f[$i] = $f[sizeof($f) - 1]; |
function write_message($msg_file, $usr_file, $user = "Anonym", $text = "<no message>",
|
// if not marked, mark it :) |
$time = 0, $old_messages_folder, $max_msgs_in_one_file, $min_msgs_in_board,
|
else |
$hist_file_prefix, $allowed_tags, $use_db = 0, $db_conn = 0) {
|
$f[$i] = ereg_replace("([^:]*:[^:]*:)(.*)", "\\1*\\2", $f[$i]); |
|
} |
if (($time == 0) || !ereg("^[0-9]*$", $time))
|
else { |
$time = time();
|
if (sizeof($f) > 0) { |
$text = validate_message($text, $allowed_tags);
|
$f[$i] = $f[sizeof($f) - 1]; |
|
} |
if (!$use_db) {
|
else |
// Use files
|
$f = array(); |
$user = rawurlencode($user);
|
} |
if ($text[0] == '*') // this is used as the deleted flag prefix
|
|
$text = " ".$text;
|
// we supppose the array to be sorted (sorting while insert) |
$new_msg =
|
//sort($f); |
"$time:$user:$text\n";
|
|
$msgs = file($msg_file);
|
release_lock($fp); |
$msgs[] = $new_msg;
|
|
|
$fp = fopen($msg_file, "w"); |
if (need_to_split($msgs, $max_msgs_in_one_file,
|
wait_write_lock($fp); |
$min_msgs_in_board)) {
|
if (is_array($f)) |
$fp = fopen($msg_file, "w");
|
fwrite($fp, trim(implode($f, ""))."\n"); |
wait_write_lock($fp);
|
else |
sort($msgs);
|
if (trim($f) != "") |
$msgs = split_messages_to_more_files(
|
fwrite($fp, trim($f)."\n"); |
$msgs,
|
release_lock($fp); |
$max_msgs_in_one_file,
|
fclose($fp); |
$min_msgs_in_board,
|
|
$old_messages_folder,
|
return 0; |
$hist_file_prefix,
|
} |
0
|
else { |
);
|
// Use DB |
$msgs = implode($msgs, "");
|
// TODO |
if (trim($msgs) == "")
|
// if ! "select count(*) from $usr_file where name = '$user' and pass = '$pass'" |
$msgs = "";
|
// if $use_virtual_delete |
fwrite($fp, $msgs);
|
// "select message, id from $msg_file where name = '$user' and time='$time'" |
}
|
// else |
else {
|
// "delete from $msg_file where name = '$user' and time='$time'" |
unset($msgs);
|
return -1; |
$fp = fopen($msg_file, "a");
|
} |
wait_write_lock($fp);
|
} |
fwrite($fp, $new_msg);
|
|
}
|
function show_data_form($user_file, $self, $nick, |
|
$style, $WB_name, $autorefresh, $pagesize, $use_db = 0, $db_conn = 0) { |
release_lock($fp);
|
global $headframe; |
fclose($fp);
|
global $bodyframe; |
return 1;
|
global $show_body; |
}
|
global $frameset; |
else {
|
?> |
// Use DB
|
<center> |
// $msg_file stores Message Table name
|
<font color="#C0C0C0" face="Courier" size=5><b><?echo $WB_name?></b></font><br> |
if (!$db_conn)
|
Current time is <?echo format_time(time())?>. |
return false;
|
<br> |
|
<table border=0> |
$user = addslashes($user);
|
<form name=data method=POST action="<? |
$text = addslashes($text);
|
echo "$self?"; |
|
$tmp = link_replace(create_link(), "page", ""); |
// get the authors id
|
if (good($frameset)) |
$sql = "select id from $usr_file where nick='$user'";
|
$tmp = link_replace($tmp, "disablepart", "2"); |
$res = $db_conn->query($sql);
|
echo $tmp; |
|
?>" target="<?echo $bodyframe?>"> |
if (DB::isError($res))
|
<tr> |
return false;
|
<td align=center valign=middle rowspan=3> |
|
<textarea name="message" cols=30 rows=5></textarea></td> |
$row = $res->fetchRow();
|
<td align=center valign=middle><font face="Arial" color=#ffcc00 size=3>Nick</font></td> |
$author_id = $row["id"];
|
<td align=left valign=middle> |
|
<select name="nick"> |
$sql = "insert into $msg_file" .
|
<option value="Anonym"><choose></option> |
" (author_id, created, text) values " .
|
<? |
" ('$author_id', sysdate(), '$text')";
|
|
$res = $db_conn->query($sql);
|
$nicknames = get_users($user_file $use_db, $db_conn); |
|
sort($nicknames); |
if (DB::isError($res))
|
show_options( |
return false;
|
$nicknames, |
|
$nicknames, |
return true;
|
$nick); |
}
|
?> |
}
|
</select> |
|
</td> |
|
</tr> |
function delete_message($msg_file, $usr_file, $user, $time, $pass,
|
<tr> |
$use_virtual_delete, $use_db = 0, $db_conn = 0) {
|
<td valign=middle align=center colspan=2 rowspan=1><input type=submit name=submit_type value="Send"<? |
if (!$use_db) {
|
echo "showing=$show_body"; |
// Use files
|
if (!$show_body) //!!!!!!!!!!!!TOTO NEJDE - JS clearovanie textarea v combo prikaze, aspon nie v tomto zdrojaku :( |
$found = false;
|
echo " onClick=\"javascript:submit();message.value=''\""; |
$i = 0;
|
|
$fp = fopen($usr_file, "r");
|
?>></td> |
wait_read_lock($fp);
|
</tr> |
$p = file($usr_file);
|
<tr></tr> |
release_lock($fp);
|
<tr> |
if ($user != "") {
|
<td align=center> |
while ((!$found) && ($i < sizeof($p))) {
|
<a href="<?echo $self."?".link_replace(create_link(), "createuser", "1")?>">New nick</a> |
if ($user == get_user($p[$i], 0))
|
</td> |
$found = true;
|
<td align=right><? |
$i++;
|
if (!$style) |
};
|
echo "Board\t /</td><td><a href=$self?". |
}
|
link_replace(create_link(), "style", "1").">Chat</a></td>"; |
else
|
else |
$found = true;
|
echo "<a href=$self?".link_replace(create_link(), "style", "0"). |
|
">Board</a> /</td><td>Chat</td>"; |
if (!$found)
|
?> |
return 1;
|
</tr> |
|
<tr> |
if (!(($user == "") && ($pass == "")))
|
<td align=center colspan=1>Autorefresh time: |
if (get_pass($p[--$i]) != md5($pass))
|
<select name=autorefresh onChange="javascript:form.submit()"> |
return 2;
|
<? |
|
show_options( |
$fp = fopen($msg_file, "r");
|
array("10 secs","30 secs", "1 min", "5 min", "10 min", "30 min", "infinite"), |
wait_read_lock($fp);
|
array("10", "30", "60", "300", "600", "1800", "999999999"), |
$f = file($msg_file);
|
$autorefresh); |
$found = false;
|
?> |
$i = 0;
|
</select> |
while (!$found && ($i < sizeof($f))) {
|
</td><td align=center colspan=1>Page size: |
if (get_user($f[$i], 1) == $user && get_time($f[$i]) == $time)
|
<select name=pagesize onChange="javascript:form.submit()"> |
$found = true;
|
<? |
$i++;
|
show_options( |
}
|
array("10", "25", "50", "100", "all"), |
if (!$found)
|
array("10", "25", "50", "100", "999999"), |
return 3;
|
$pagesize); |
$i--;
|
?> |
|
</select> |
if ($use_virtual_delete) {
|
</td><td align=center><a href="boardframes.html" target=_top>Switch </a><a href="boardframes.html" target=_blank>to</a> <a href="boardframes.html" target=_parent>frames</a></td> |
// if already marked as deleted then delete it really
|
</tr> |
if (ereg("[^:]*:[^:]*:\*.*", $f[$i], $regs))
|
</form> |
$f[$i] = $f[sizeof($f) - 1];
|
</table> |
// if not marked, mark it :)
|
</center> |
else
|
<? |
$f[$i] = ereg_replace("([^:]*:[^:]*:)(.*)", "\\1*\\2", $f[$i]);
|
return 1; |
}
|
} |
else {
|
|
if (sizeof($f) > 0) {
|
function show_page_walk($currentpage, $pagesize, $nummsgs, $firstmsg, $lastmsg) { |
$f[$i] = $f[sizeof($f) - 1];
|
global $self; |
}
|
$lastpage = ceil($nummsgs / $pagesize); |
else
|
|
$f = array();
|
echo "<center>Messages ".($firstmsg + 1)."-". |
}
|
($lastmsg + 1)." of $nummsgs<br>"; |
|
|
// we supppose the array to be sorted (sorting while insert)
|
// REWIND to begin |
//sort($f);
|
if ($firstmsg == 0) |
|
echo "<<"; |
release_lock($fp);
|
else |
|
echo "<a href=$self?".link_replace(create_link(), "page", "1")."><<</a>"; |
$fp = fopen($msg_file, "w");
|
echo " "; |
wait_write_lock($fp);
|
|
if (is_array($f))
|
// PREVIOUS PAGE |
fwrite($fp, trim(implode($f, ""))."\n");
|
if ($firstmsg == 0) |
else
|
echo "<"; |
if (trim($f) != "")
|
else |
fwrite($fp, trim($f)."\n");
|
echo "<a href=$self?".link_replace(create_link(), "page", ($currentpage-1))."><</a>"; |
release_lock($fp);
|
|
fclose($fp);
|
echo " "; |
|
|
return 0;
|
// OTHER PAGES |
}
|
for ($i = 1; $i <= $lastpage; $i++) { |
else {
|
echo ($i == $currentpage)?"$i ":"<a href=$self?". |
// Use DB
|
link_replace(create_link(), "page", $i).">".$i."</a> "; |
if (!$db_conn)
|
} |
return false;
|
|
|
// NEXT PAGE |
$user = addslashes($user);
|
if ($lastmsg >= ($nummsgs - 1)) |
$pass = md5(addslashes($pass));
|
echo ">"; |
$time = date("YmdHis", $time);
|
else |
|
echo "<a href=$self?". |
$sql = "select id from $usr_file where " .
|
link_replace(create_link(), "page", ($currentpage+1)). |
"nick = '$user' and pass = '$pass'";
|
">></a>"; |
$res = $db_conn->query($sql);
|
|
|
echo " "; |
if ((DB::isError($res)) || ($res->numRows() != 1))
|
|
return 0;
|
// REWIND PAGE to end |
|
if ($lastmsg >= ($nummsgs - 1)) |
$res->fetchInto($row);
|
echo ">>"; |
$res->free;
|
else |
$author_id = $row["id"];
|
echo "<a href=$self?". |
|
link_replace(create_link(), "page", $lastpage). |
switch($use_virtual_delete) {
|
">>></a>"; |
case true:
|
|
$sql = "select id from $msg_file where flags=1 and author_id='".
|
echo "</center>\n"; |
"$author_id' and created='$time'";
|
} |
$res = $db_conn->query($sql);
|
|
if ($res->numRows() == 0) {
|
function show_nonrefresh_head() { |
$sql = "update $msg_file " .
|
global $WB_name, $WB_version; |
"set created='$time', deleted=sysdate(), flags=1 where ".
|
?> |
"author_id = '$author_id' and created='$time'";
|
<html> |
$res->free;
|
<head> |
break;
|
<title><?echo "$WB_name v$WB_version"?></title> |
}
|
</head> |
// else continue to hard delete
|
<body bgcolor="black" text="#C0C0C0" link="#888ff" alink="#888ff" vlink="#888ff"> |
case false:
|
<? |
$sql = "delete from $msg_file where ".
|
} |
"author_id = '$author_id' and created='$time'";
|
|
}
|
function show_delete_dialog($nick, $time) { |
echo "!@#$sql#@!";
|
global $self; |
$res = $db_conn->query($sql);
|
echo "\n<center><font color=#C0C0C0 face=Courier size=4><b>Delete message</font></b><br><br>"; |
if (DB::isError($res))
|
echo "\n<center>\n<form name=deletemessage method=post action=$self?". |
return false;
|
link_replace(link_replace(create_link(), "deleteok", 1), |
|
"time", $time).">\n"; |
$res->free;
|
echo "<table align=center>\n"; |
return true;
|
echo "\t\n<tr>\n\t\t<td>Nick:</td><td><input type=text value=\"$nick\" readonly></td></tr>\n"; |
}
|
echo "\t\n<tr>\n\t\t<td>Message No.:</td><td><input type=text value=\"$time\" readonly></td></tr>\n"; |
}
|
echo "\t\n<tr>\n\t\t<td>Password:</td><td><input type=password name=pass></td></tr>\n"; |
|
echo "\t\n<tr>\n\t\t<td colspan=2 align=center><input type=submit name=submit_type value=Delete>\n</td></tr>\n"; |
function show_data_form($user_file, $self, $nick,
|
echo "\t<tr><td align=center colspan=2><a href=$self?". |
$style, $WB_name, $autorefresh, $pagesize, $use_db = 0, $db_conn = 0) {
|
create_link(). |
global $headframe;
|
">cancel</a></td></tr>\n"; |
global $bodyframe;
|
echo "</table>\n"; |
global $show_body;
|
echo "</form>\n</center>\n"; |
global $frameset;
|
} |
?>
|
|
<center>
|
function show_createuser_dialog($newnick, $email) { |
<font color="#C0C0C0" face="Courier" size=5><b><?echo $WB_name?></b></font><br>
|
global $self; |
Current time is <?echo format_time(time())?>.
|
echo "\n<center><font color=#C0C0C0 face=Courier size=4><b>Create new user</font></b><br><br>"; |
<br>
|
echo "<table size=90% align=center>\n"; |
<table border=0>
|
|
<form name=data method=POST action="<?
|
echo "\n<form name=createuser method=post action=$self?". |
echo "$self?";
|
link_replace(link_replace( |
$tmp = link_replace(create_link(), "page", "");
|
create_link(), "createok", 1), "createuser", 1 |
if (good($frameset))
|
). |
$tmp = link_replace($tmp, "disablepart", "2");
|
">\n"; |
echo $tmp;
|
echo "\t<tr>\n\t\t<td>New Nick:</td><td><input type=text name=newnick maxsize=16 value=$newnick></td>\n"; |
?>" target="<?echo $bodyframe?>">
|
echo "\t<tr><td>E-mail:</td><td><input type=text name=mail value=$email></td>\n\t</tr>\n"; |
<tr>
|
echo "\t<tr><td>Password:</td><td><input type=password name=pass></td>\n\t</tr>\n"; |
<td align=center valign=middle rowspan=3>
|
echo "\t<tr><td align=center colspan=2><input type=submit name=submit_type value=Create></td>\n\t</tr>\n"; |
<textarea name="message" cols=30 rows=5></textarea></td>
|
echo "\t<tr><td align=center colspan=2><a href=$self?". |
<td align=center valign=middle><font face="Arial" color=#ffcc00 size=3>Nick</font></td>
|
link_replace(create_link(), "createuser", ""). |
<td align=left valign=middle>
|
">cancel</a></td></tr>\n"; |
<select name="nick">
|
echo "</form>\n</table>\n</center>\n"; |
<option value="Anonym"><choose></option>
|
} |
<?
|
|
|
function show_message($message, $style = 0) { |
$nicknames = get_users($user_file, $use_db, $db_conn);
|
global $self; |
sort($nicknames);
|
switch($style) { |
show_options(
|
case 1: |
$nicknames,
|
// Chat message line |
$nicknames,
|
echo "<tr><td valign=top>"; |
$nick);
|
echo "<a href=$self?". |
?>
|
link_replace( |
</select>
|
link_replace( |
</td>
|
create_link(), "time", $message["time"] |
</tr>
|
), |
<tr>
|
"nick", |
<td valign=middle align=center colspan=2 rowspan=1><input type=submit name=submit_type value="Send"<?
|
$message["name"]). |
// TODO redo the JS inline function (it doesn't clear the memo now)
|
">".format_time($message["time"], 1)."</a>_"; |
if (!$show_body)
|
if ($message["email"] != "") |
echo " onClick=\"javascript:submit();message.value=''\"";
|
echo "<a href=\"mailto:".$message["email"]. |
|
"\""." class=\"amsg\">". |
?>></td>
|
$message["name"]."</a>"; |
</tr>
|
else |
<tr></tr>
|
echo $message["name"]; |
<tr>
|
echo ":</td><td>".$message["message"]; |
<td align=center>
|
echo "</td></tr>\n"; |
<a href="<?echo $self."?".link_replace(create_link(), "createuser", "1")?>">New nick</a>
|
break; |
</td>
|
default: |
<td align=right><?
|
// Board message style |
if (!$style)
|
echo "<tr><td>"; |
echo "Board\t /</td><td><a href=$self?".
|
if ($message["email"] != "") |
link_replace(create_link(), "style", "1").">Chat</a></td>";
|
echo "<a href=\"mailto:" . |
else
|
$message["email"] . |
echo "<a href=$self?".link_replace(create_link(), "style", "0").
|
"\" class=\"amsg\">\n"; |
">Board</a> /</td><td>Chat</td>";
|
echo "\t" . $message["name"] . "\n"; |
?>
|
echo "</a>\n\t - "; |
</tr>
|
echo "\t" . format_time($message["time"])."\n"; |
<tr>
|
echo "\t\t - <a href=$self?" . |
<td align=center colspan=1>Autorefresh time:
|
link_replace( |
<select name=autorefresh onChange="javascript:form.submit()">
|
link_replace( |
<?
|
create_link(), "time", $message["time"] |
show_options(
|
), |
array("10 secs","30 secs", "1 min", "5 min", "10 min", "30 min", "infinite"),
|
"nick", |
array("10", "30", "60", "300", "600", "1800", "999999999"),
|
$message["name"]). |
$autorefresh);
|
">delete</a>\n"; |
?>
|
echo "<br>"; |
</select>
|
echo "\t" . $message["message"] . "\n"; |
</td><td align=center colspan=1>Page size:
|
echo "</td></tr>\n"; |
<select name=pagesize onChange="javascript:form.submit()">
|
break; |
<?
|
} |
show_options(
|
} |
array("10", "25", "50", "100", "all"),
|
|
array("10", "25", "50", "100", "999999"),
|
function show_messages($message_file, $user_file, $page, $pagesize, |
$pagesize);
|
$msg_style = 0, $show_all = 0, $use_db = 0, $db_messages = 0, $db_users = 0) { |
?>
|
|
</select>
|
$messages = read_messages($message_file, $user_file, $show_all, |
</td>
|
$use_db, $db_messages, $db_users); |
<td align=center>
|
$n = sizeof($messages); |
<a href="<?
|
global $self;//!!!!! TODO |
echo "$self?".link_replace(link_replace(create_link(), "setframes", 1), "disablepart", 3);
|
|
?>" target=_top>Switch to frames</a>
|
if ($n <= 0) { |
</td>
|
echo "<center><font color=red><b>No messages YeT !</b></font></center>"; |
</tr>
|
} |
</form>
|
else { |
</table>
|
if ($page < 1) |
</center>
|
$page = 1; |
<?
|
if ($page >= ($n / $pagesize)) |
return 1;
|
$page = ceil($n / $pagesize); |
}
|
|
|
$first = $pagesize * ($page - 1); |
function show_page_walk($currentpage, $pagesize, $nummsgs, $firstmsg, $lastmsg) {
|
$last = ($pagesize * $page) - 1; |
global $self;
|
|
$lastpage = ceil($nummsgs / $pagesize);
|
if ($first < 0) |
|
$first = 0; |
echo "<center>Messages ".($firstmsg + 1)."-".
|
if ($first > $n) |
($lastmsg + 1)." of $nummsgs<br>";
|
$first = $n - 1; |
|
|
// REWIND to begin
|
if ($last > ($n - 1)) |
if ($firstmsg == 0)
|
$last = $n - 1; |
echo "<<";
|
if ($last < $first) |
else
|
$last = $first; |
echo "<a href=$self?".link_replace(create_link(), "page", "1")."><<</a>";
|
|
echo " ";
|
show_page_walk($page, $pagesize, $n, $first, $last); |
|
|
// PREVIOUS PAGE
|
echo "<table width=100%>"; |
if ($firstmsg == 0)
|
for ($i = $first; $i <= $last; $i++) { |
echo "<";
|
show_message($messages[sizeof($messages) - 1 - $i], $msg_style); |
else
|
} |
echo "<a href=$self?".link_replace(create_link(), "page", ($currentpage-1))."><</a>";
|
echo "</table>"; |
|
|
echo " ";
|
show_page_walk($page, $pagesize, $n, $first, $last); |
|
} |
// OTHER PAGES
|
} |
for ($i = 1; $i <= $lastpage; $i++) {
|
|
echo ($i == $currentpage)?"$i ":"<a href=$self?".
|
|
link_replace(create_link(), "page", $i).">".$i."</a> ";
|
// /////////////////////////////////////////////// |
}
|
// /////////// THIS IS MAIN FUNCTION ///////////// |
|
// /////////////////////////////////////////////// |
// NEXT PAGE
|
|
if ($lastmsg >= ($nummsgs - 1))
|
// DEFAULTS |
echo ">";
|
if ($use_db) { |
else
|
require_once "db.php"; |
echo "<a href=$self?".
|
$db_messages = DB::connect("mysql://$db_user:$db_pass/$db_host/$db_message_table"); |
link_replace(create_link(), "page", ($currentpage+1)).
|
$db_users = DB::connect("mysql://$db_user:$db_pass/$db_host/$db_user_table"); |
">></a>";
|
if (DB::isError($db_messages)) { |
|
$use_db = 0; |
echo " ";
|
} |
|
if (DB::isError($db_users)) |
// REWIND PAGE to end
|
if (!(DB::isError($db_messages))) |
if ($lastmsg >= ($nummsgs - 1))
|
$db_messages->disconnect(); |
echo ">>";
|
$use_db = 0; |
else
|
} |
echo "<a href=$self?".
|
if ($use_db) { |
link_replace(create_link(), "page", $lastpage).
|
$user_file = $db_users; |
">>></a>";
|
$message_file = $db_messages; |
|
} |
echo "</center>\n";
|
} |
}
|
|
|
if (!good($self)) |
function show_nonrefresh_head() {
|
$self = $PHP_SELF; |
global $WB_name, $WB_version;
|
|
?>
|
if ($strip_slashes) { |
<html>
|
$message = stripslashes($message); |
<head>
|
$nick = stripslashes($nick); |
<title><?echo "$WB_name v$WB_version"?></title>
|
$pass = stripslashes($pass); |
</head>
|
$header = stripslashes($header); |
<body bgcolor="black" text="#C0C0C0" link="#888ff" alink="#888ff" vlink="#888ff">
|
$body = stripslashes($body); |
<?
|
$bodyframe = stripslashes($bodyframe); |
}
|
$headerframe = stripslashes($headerframe); |
|
$disablepart = stripslashes($disablepart); |
function show_delete_dialog($nick, $time) {
|
$setframes = stripslashes($setframes); |
global $self; //!!!!!!!TODO
|
$newnick = stripslashes($newnick); |
echo "\n<center><font color=#C0C0C0 face=Courier size=4><b>Delete message</font></b><br><br>";
|
} |
echo "\n<center>\n<form name=deletemessage method=post action=$self?".
|
|
link_replace(link_replace(create_link(), "deleteok", 1),
|
if ($pagesize < 10) |
"time", $time).">\n";
|
$pagesize = 50; |
echo "<table align=center>\n";
|
settype($pagesize, integer); |
echo "\t\n<tr>\n\t\t<td>Nick:</td><td><input type=text value=\"$nick\" readonly></td></tr>\n";
|
if ($autorefresh < 10) |
echo "\t\n<tr>\n\t\t<td>Message No.:</td><td><input type=text value=\"$time\" readonly></td></tr>\n";
|
$autorefresh = 300; |
echo "\t\n<tr>\n\t\t<td>Password:</td><td><input type=password name=pass></td></tr>\n";
|
settype($autorefresh, integer); |
echo "\t\n<tr>\n\t\t<td colspan=2 align=center><input type=submit name=submit_type value=Delete>\n</td></tr>\n";
|
|
echo "\t<tr><td align=center colspan=2><a href=$self?".
|
|
create_link().
|
if (!good($disablepart) || ($disablepart>3) || ($disablepart<0)) |
">cancel</a></td></tr>\n";
|
$disablepart = 0; |
echo "</table>\n";
|
|
echo "</form>\n</center>\n";
|
if (!good($headframe)) |
}
|
$headframe = $DEFAULT_HEAD_FRAME; |
|
|
function show_createuser_dialog($newnick, $email) {
|
if (!good($bodyframe)) |
global $self; // !!! TODO
|
$bodyframe = $DEFAULT_BODY_FRAME; |
echo "\n<center><font color=#C0C0C0 face=Courier size=4><b>Create new user</font></b><br><br>";
|
|
echo "<table size=90% align=center>\n";
|
switch ($disablepart) { |
|
case 0: |
echo "\n<form name=createuser method=post action=$self?".
|
$show_body = true; |
link_replace(link_replace(
|
$show_head = true; |
create_link(), "createok", 1), "createuser", 1
|
break; |
).
|
case 1: |
">\n";
|
$show_head = true; |
echo "\t<tr>\n\t\t<td>New Nick:</td><td><input type=text name=newnick maxsize=16 value=$newnick></td>\n";
|
$show_body = false; |
echo "\t<tr><td>E-mail:</td><td><input type=text name=mail value=$email></td>\n\t</tr>\n";
|
break; |
echo "\t<tr><td>Password:</td><td><input type=password name=pass></td>\n\t</tr>\n";
|
case 2: |
echo "\t<tr><td align=center colspan=2><input type=submit name=submit_type value=Create></td>\n\t</tr>\n";
|
$show_head = false; |
echo "\t<tr><td align=center colspan=2><a href=$self?".
|
$show_body = true; |
link_replace(create_link(), "createuser", "").
|
break; |
">cancel</a></td></tr>\n";
|
case 3: |
echo "</form>\n</table>\n</center>\n";
|
$show_body = false; |
}
|
$show_head = false; |
|
break; |
function show_message($message, $style = 0) {
|
} |
global $self; // !!!TODO
|
|
switch($style) {
|
if (!good($page)) |
case 1:
|
$page = 0; |
// Chat message line
|
|
echo "<tr><td valign=top>";
|
if (!isset($nick) && good($newnick)) |
echo "<a href=$self?".
|
$nick = $newnick; |
link_replace(
|
|
link_replace(
|
if (!good($mail)) |
create_link(), "time", $message["time"]
|
$mail = get_email($nick); |
),
|
|
"nick",
|
if (good($archive)) |
$message["name"]).
|
$hist_file_prefix = $archive; |
">".format_time($message["time"], 1)."</a>_";
|
|
if ($message["email"] != "")
|
if (good($archive_no) && !$use_db) |
echo "<a href=\"mailto:".$message["email"].
|
$message_file = $old_messages_folder.$hist_file_prefix.$archive_no; |
"\""." class=\"amsg\">".
|
|
$message["name"]."</a>";
|
//header ("Cache-Control: no-cache, must-revalidate"); |
else
|
//header ("Pragma: no-cache"); |
echo $message["name"];
|
|
echo ":</td><td>".$message["message"];
|
// CREATE NEW USER |
echo "</td></tr>\n";
|
if ($createuser) { |
break;
|
$mails = get_emails($user_file, $use_db, $db_users); |
default:
|
|
// Board message style
|
if (good($newnick) && |
echo "<tr><td>";
|
($mails[$newnick] == "") && |
if ($message["email"] != "")
|
good($mail) && |
echo "<a href=\"mailto:" .
|
good($createok) && |
$message["email"] .
|
($createok == 1)) |
"\" class=\"amsg\">\n";
|
write_mail($user_file, $newnick, $mail, $pass, $use_db, $db_users); |
echo "\t" . $message["name"] . "\n";
|
else { |
echo "</a>\n\t - ";
|
show_nonrefresh_head(); |
echo "\t" . format_time($message["time"])."\n";
|
show_createuser_dialog($newnick, $email); |
echo "\t\t - <a href=$self?" .
|
$show_body = false; |
link_replace(
|
} |
link_replace(
|
} |
create_link(), "time", $message["time"]
|
|
),
|
// WRITE MESSAGE TO DB |
"nick",
|
if (good($message) && good($submit_type)) |
$message["name"]).
|
write_message($message_file, $nick, $message, 0, |
">delete</a>\n";
|
$old_messages_folder, $max_msgs_in_one_file, |
echo "<br>";
|
$min_msgs_in_board, $hist_file_prefix, $use_db, $db_messages); |
echo "\t" . $message["message"] . "\n";
|
|
echo "</td></tr>\n";
|
// DELETE MESSAGE FROM DB |
break;
|
if (good($time)) { |
}
|
if (good($deleteok) && ($deleteok == 1)){ |
}
|
switch(delete_message($message_file, $user_file, $nick, |
|
$time, $pass, $use_virtual_delete, $use_db, $db_messages, $db_users)) { |
function show_messages($message_file, $user_file, $page, $pagesize,
|
// TOTO ESTE DOROBIT - SPRAVANIE SA |
$msg_style = 0, $show_all = 0, $use_db = 0, $db_conn = 0) {
|
// SKRIPTU KED NASTANU PROBLEMY PRI DELETOVANI SPRAVY |
|
case 0: // All OK |
$messages = read_messages($message_file, $user_file, $show_all,
|
// echo "<center>Message deleted succesfully<br></center>\n"; |
$use_db, $db_conn);
|
break; |
if ($messages === false)
|
case 1: // No such user |
$messages = array();
|
// echo "<center>Error while deleting: There is no such user!<br></center>\n"; |
$n = sizeof($messages);
|
break; |
global $self;//!!!!! TODO
|
case 2: // Wrong password |
|
// echo "<center>Error while deleting: Wrong password!<br></center>\n"; |
if ($n <= 0) {
|
break; |
echo "<center><font color=red><b>No messages YeT !</b></font></center>";
|
case 3: // No such message |
}
|
// echo "<center>Error while deleting: No such message!<br></center>\n"; |
else {
|
break; |
if ($page < 1)
|
default:// Unknown error |
$page = 1;
|
// echo "<center>Fatal Error while deleting: unknown error code!</center><br>\n"; |
if ($page >= ($n / $pagesize))
|
break; |
$page = ceil($n / $pagesize);
|
} |
|
} else { |
$first = $pagesize * ($page - 1);
|
show_nonrefresh_head(); |
$last = ($pagesize * $page) - 1;
|
show_delete_dialog($nick, $time); |
|
$show_body = false; |
if ($first < 0)
|
} |
$first = 0;
|
} |
if ($first > $n)
|
|
$first = $n - 1;
|
// check for superuser view |
|
if (($nick == $root_name) && (md5($pass) == $root_md5_password)) |
if ($last > ($n - 1))
|
$superuser = 1; |
$last = $n - 1;
|
else |
if ($last < $first)
|
$superuser = 0; |
$last = $first;
|
|
|
// We don't want to show body, when other form is shown |
show_page_walk($page, $pagesize, $n, $first, $last);
|
|
|
?> |
echo "<table width=100%>";
|
<html> |
for ($i = $first; $i <= $last; $i++) {
|
<head> |
show_message($messages[sizeof($messages) - 1 - $i], $msg_style);
|
<title><?echo "$WB_name v$WB_version"?></title> |
}
|
<? |
echo "</table>";
|
if ($show_head) { |
|
?> |
show_page_walk($page, $pagesize, $n, $first, $last);
|
</head> |
}
|
<body bgcolor=black text=#C0C0C0 link=#888ff alink=#888ff vlink=#888ff> |
}
|
<? |
|
show_data_form($user_file, $self, $nick, $style, $WB_name, |
|
$autorefresh, $pagesize, $use_db, $db_users); |
// ///////////////////////////////////////////////
|
} |
// /////////// THIS IS MAIN FUNCTION /////////////
|
|
// ///////////////////////////////////////////////
|
if ($show_body) { |
|
echo "<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"$autorefresh URL=$self?". |
// DEFAULTS
|
create_link()."\">\n"; |
|
?> |
if (!good($self))
|
</head> |
$self = $PHP_SELF;
|
<body bgcolor=black text=#C0C0C0 link=#888ff alink=#888ff vlink=#888ff> |
|
<? |
if ($strip_slashes) {
|
show_messages($message_file, $user_file, $page, $pagesize, |
$message = stripslashes($message);
|
$style, $superuser, $use_db, $db_messages, $db_users); |
$nick = stripslashes($nick);
|
} |
$pass = stripslashes($pass);
|
|
$header = stripslashes($header);
|
if ($use_db) { |
$body = stripslashes($body);
|
$user_file->disconnect(); |
$bodyframe = stripslashes($bodyframe);
|
$message_file->disconnect(); |
$headerframe = stripslashes($headerframe);
|
} |
$disablepart = stripslashes($disablepart);
|
?> |
$newnick = stripslashes($newnick);
|
</p> |
}
|
</body> |
|
</html> |
|
|
if ($pagesize < 10)
|
|
$pagesize = 50;
|
|
settype($pagesize, integer);
|
|
|
|
if ($autorefresh < 10)
|
|
$autorefresh = 300;
|
|
settype($autorefresh, integer);
|
|
|
|
if (!good($disablepart) || ($disablepart > 3) || ($disablepart < 0))
|
|
$disablepart = 0;
|
|
|
|
if (!good($headframe))
|
|
$headframe = $DEFAULT_HEAD_FRAME;
|
|
|
|
if (!good($bodyframe))
|
|
$bodyframe = $DEFAULT_BODY_FRAME;
|
|
|
|
switch ($disablepart) {
|
|
case 0:
|
|
$show_body = true;
|
|
$show_head = true;
|
|
break;
|
|
case 1:
|
|
$show_head = true;
|
|
$show_body = false;
|
|
break;
|
|
case 2:
|
|
$show_head = false;
|
|
$show_body = true;
|
|
break;
|
|
case 3:
|
|
$show_body = false;
|
|
$show_head = false;
|
|
break;
|
|
}
|
|
|
|
if (!good($page))
|
|
$page = 0;
|
|
|
|
if (!isset($nick) && good($newnick))
|
|
$nick = $newnick;
|
|
|
|
if (!good($mail))
|
|
$mail = get_email($nick);
|
|
|
|
if (good($archive))
|
|
$hist_file_prefix = $archive;
|
|
|
|
if (good($archive_no) && !$use_db)
|
|
$message_file = $old_messages_folder.$hist_file_prefix.$archive_no;
|
|
|
|
//header ("Cache-Control: no-cache, must-revalidate");
|
|
//header ("Pragma: no-cache");
|
|
|
|
if ($use_db) {
|
|
require_once "DB.php";
|
|
$db_handle = DB::connect("mysql://$db_user:$db_pass"
|
|
. "@$db_host/$db_database");
|
|
if (DB::isError($db_handle)) {
|
|
echo $db_handle->getMessage();
|
|
$db_handle = 0;
|
|
//exit;
|
|
}
|
|
if ($use_db) {
|
|
$db_handle->setFetchMode(DB_FETCHMODE_ASSOC);
|
|
$user_file = $db_user_table;
|
|
$message_file = $db_message_table;
|
|
}
|
|
}
|
|
// CREATE NEW USER
|
|
if ($createuser) {
|
|
$mails = get_emails($user_file, $use_db, $db_handle);
|
|
|
|
if (good($newnick) &&
|
|
($mails[$newnick] == "") &&
|
|
good($createok) &&
|
|
($createok == 1))
|
|
write_mail($user_file, $newnick, $mail, $pass, $use_db, $db_handle);
|
|
else {
|
|
show_nonrefresh_head();
|
|
show_createuser_dialog($newnick, $email);
|
|
$show_head = false;
|
|
$show_body = false;
|
|
}
|
|
}
|
|
|
|
// WRITE MESSAGE TO DB
|
|
if (good($message) && good($submit_type))
|
|
write_message($message_file, $user_file, $nick, $message, 0,
|
|
$old_messages_folder, $max_msgs_in_one_file, $min_msgs_in_board,
|
|
$hist_file_prefix, $allowed_tags, $use_db, $db_handle);
|
|
|
|
// DELETE MESSAGE FROM DB
|
|
if (good($time)) {
|
|
if (good($deleteok) && ($deleteok == 1)){
|
|
switch(delete_message($message_file, $user_file, $nick,
|
|
$time, $pass, $use_virtual_delete, $use_db, $db_handle)) {
|
|
// TOTO ESTE DOROBIT - SPRAVANIE SA
|
|
// SKRIPTU KED NASTANU PROBLEMY PRI DELETOVANI SPRAVY
|
|
case 0: // All OK
|
|
// echo "<center>Message deleted succesfully<br></center>\n";
|
|
break;
|
|
case 1: // No such user
|
|
// echo "<center>Error while deleting: There is no such user!<br></center>\n";
|
|
break;
|
|
case 2: // Wrong password
|
|
// echo "<center>Error while deleting: Wrong password!<br></center>\n";
|
|
break;
|
|
case 3: // No such message
|
|
// echo "<center>Error while deleting: No such message!<br></center>\n";
|
|
break;
|
|
default:// Unknown error
|
|
// echo "<center>Fatal Error while deleting: unknown error code!</center><br>\n";
|
|
break;
|
|
}
|
|
} else {
|
|
show_nonrefresh_head();
|
|
show_delete_dialog($nick, $time);
|
|
$show_body = false;
|
|
$show_head = false;
|
|
}
|
|
}
|
|
|
|
// check for superuser view
|
|
if (($nick == $root_name) && (md5($pass) == $root_md5_password))
|
|
$superuser = 1;
|
|
else
|
|
$superuser = 0;
|
|
|
|
// We don't want to show body, when other form is shown
|
|
|
|
?>
|
|
<html>
|
|
<head>
|
|
<title><?echo "$WB_name v$WB_version"?></title>
|
|
<?
|
|
/*
|
|
If set, do nothing, just create frames and recursively call self
|
|
*/
|
|
if (good($setframes)) {
|
|
$frmlnk =
|
|
link_replace(
|
|
link_replace(
|
|
link_replace(create_link(), "frameset", 1),
|
|
"bodyframe",
|
|
"bodyframe"),
|
|
"headframe",
|
|
"headframe"
|
|
);
|
|
echo "<frameset rows=\"230,*\" framespacing=0 cols=*>\n";
|
|
echo "<frame name=headframe src=\"$self?" .
|
|
link_replace($frmlnk, "disablepart", 1) .
|
|
"\">\n";
|
|
echo "<frame name=headframe src=\"$self?" .
|
|
link_replace($frmlnk, "disablepart", 2) .
|
|
"\" scrolling=AUTO>\n";
|
|
echo "</frameset>\n";
|
|
echo "</html>";
|
|
$show_body = false;
|
|
$show_head = false;
|
|
}
|
|
|
|
if ($show_head) {
|
|
?>
|
|
</head>
|
|
<body bgcolor=black text=#C0C0C0 link=#888ff alink=#888ff vlink=#888ff>
|
|
<?
|
|
show_data_form($user_file, $self, $nick, $style, $WB_name,
|
|
$autorefresh, $pagesize, $use_db, $db_handle);
|
|
}
|
|
|
|
if ($show_body) {
|
|
echo "<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"$autorefresh URL=$self?".
|
|
create_link()."\">\n";
|
|
?>
|
|
</head>
|
|
<body bgcolor=black text=#C0C0C0 link=#888ff alink=#888ff vlink=#888ff>
|
|
<?
|
|
show_messages($message_file, $user_file, $page, $pagesize,
|
|
$style, $superuser, $use_db, $db_handle);
|
|
}
|
|
|
|
if ($use_db && $db_handle) {
|
|
$db_handle->disconnect();
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|