=================================================================== RCS file: /home/cvsd/home/cvs/wolboard/wolboard.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -p -r1.12 -r1.13 --- wolboard/wolboard.php 2002/05/31 08:29:09 1.12 +++ wolboard/wolboard.php 2002/06/10 14:23:45 1.13 @@ -5,7 +5,7 @@ Author: Martin Karas a.k.a. Wolcano Date: 24.04.2002 Mail: wolcano@pobox.sk - Version: v5.4 + Version: v5.2 License: not chosen yet - this file is strictly private, you may not copy/change/distribute it without authors explicit premission. @@ -55,9 +55,11 @@ $archive_no - index of archived file $submit_type - submit button type $reply_to - index of message you want to reply (inserts quoted message) + $rootlogin - wether should display the root login dialog CHANGE LOG: - * 5.4 - fixed
<-> conflicts + * 5.4 - "fixed" adduser bug (now ignoring result of flock() :() + - added root login for viewing deleted messages * 5.3 - external CSS file * 5.2 - added "reply" link * 5.1 - updated SQL queries @@ -80,7 +82,7 @@ // IMPORTANT CONSTANTS (change if needed) - $WB_version = "5.4"; + $WB_version = "5.2"; $WB_name = "Wol's Message Board"; $strip_slashes = 1; $DEFAULT_HEAD_FRAME = ""; @@ -91,8 +93,8 @@ $root_md5_password = "896ae34257056a6edb7643e3db85bb21"; // Filesystem defaults - $message_file = "board_messages.txt"; - $user_file = "board_emails.txt"; + $message_file = "messages.dat"; + $user_file = "users.dat"; $move_old_mesages = 1; $old_messages_folder = "history/"; $hist_file_prefix = "board_hist_file_"; // used in REGEXPs! alphabeticals only @@ -255,14 +257,14 @@ $start = time(); while ((!flock($f, 1)) && ($start + $max_wait < time())) sleep(1); - return ($start + $max_wait < time())? - 1:0; + return ($start + $max_wait < time()); } // wait_read_lock($f, $max_wait = 9999) function wait_write_lock($f, $max_wait = 9999) { $start = time(); while ((!flock($f, 2)) && ($start + $max_wait < time())) sleep(1); + return ($start + $max_wait < time()); } // wait_write_lock($f, $max_wait = 9999) function release_lock($f) { @@ -364,13 +366,20 @@ return ""; } // get_email($str) - function write_mail($usr_file, $user, $mail = "", $pass = "", $use_db = 0, $db_conn) { + function write_mail($usr_file, $user, $mail = '', $pass = '', $root_name = '', $use_db = 0, $db_conn) { $pass = md5(rawurlencode($pass)); + if ($user == $root_name) + return false; if (!$use_db) { // Working with files $fp = fopen($usr_file, "a"); + wait_write_lock($fp); + /* + // this should work, but doesn't :((( + // won't use this shitty file locking mechanism if (!wait_write_lock($fp)) return false; + */ fwrite($fp, strtr($user, ":", ";") . ":" . strtr($mail, ":", ";") . ":" . $pass . "\n"); release_lock($fp); @@ -850,6 +859,21 @@ } } + function show_root_login_form($rootnick, $user_nick = '') { + global $self; + echo "\n

Admin login



"; + echo "\n
\n\n"; + echo create_hidden_inputs(split_url_vars(link_replace(link_replace(create_link(), 'nick', $rootnick), 'newnick', $user_nick))); + echo "\n"; + echo "\t\n\n\t\t\n"; + echo "\t\n\n\t\t\n"; + echo "\t\n"; + echo "
Password:
\n
cancel
\n"; + echo "\n
\n"; + } // show_root_login_form($rootnick, $user_nick) + function show_data_form($user_file, $self, $nick, $message, $style, $WB_name, $autorefresh, $pagesize, $use_db = 0, $db_conn = 0) { // TODO !!!!!! @@ -859,7 +883,7 @@ global $frameset; ?>
-
+

Current time is .
@@ -872,9 +896,9 @@ Current time is - + @@ -1009,13 +1033,13 @@ Current time is - +Delete message

"; + echo "\n

Delete message



"; echo "\n
\n
\n"; echo create_hidden_inputs(split_url_vars(link_replace(link_replace(create_link(), "deleteok", 1), "time", $time))); echo "
- NickNick
\n"; @@ -1032,7 +1056,7 @@ Current time is Create new user

"; + echo "\n

Create new user



"; echo "
\n"; echo "\n"; @@ -1235,6 +1259,24 @@ Current time is Fatal Error while deleting: unknown error code!
\n"; break; } - //die(); - header('HTTP/1.0 302 Found'); - header("Location: $abs_self?" . create_link()); die(); } else { show_nonrefresh_head(); @@ -1378,6 +1411,8 @@ Current time is <?echo "$WB_name v$WB_version"?> + + - - -\n"; -?> - - -