Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, April 19, 2024

Diff for wolboard/wolboard.php between version 1.8 and 1.9

version 1.8, 2002/04/13 22:49:49 version 1.9, 2002/04/25 08:42:46
Line 3 
Line 3 
         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:   24.04.2002
         Mail:   wolcano@pobox.sk          Mail:   wolcano@pobox.sk
         Version:        v5.1          Version:        v5.2
         License:        not chosen yet - this file is strictly private,          License:        not chosen yet - this file is strictly private,
                 you may not copy/change/distribute it without authors                  you may not copy/change/distribute it without authors
                 explicit premission.                  explicit premission.
         Description:    Simple message-board. Can store data in files or          Description:    Simple message-board. Can store data in files or
                 PEAR-compliant DB (not fully implemented yet)                  PEAR-compliant DB (not fully implemented yet)
           Copyright: Platon SDG     http://www.platon.sk
   
         TODO: (see TODO file)          TODO: (see TODO file)
   
Line 24 
Line 25 
                 <user_line> :== <username>:<email>:<md5sum_of_password>                  <user_line> :== <username>:<email>:<md5sum_of_password>
   
         Database specification:          Database specification:
         create table messages <unknown for now>                  See "sql/" files.
   
         create table users <unknown>  
   
   
         Input parameters:          Input parameters:
                 $pagesize       - # of messages  per page                  $pagesize       - # of messages  per page
                 $page           - #th page                  $page           - #th page
Line 56 
Line 54 
                 $archive        - archive file prefix                  $archive        - archive file prefix
                 $archive_no     - index of archived file                  $archive_no     - index of archived file
                 $submit_type    - submit button type                  $submit_type    - submit button type
                   $reply_to       - index of message you want to reply (inserts quoted message)
   
                 CHANGE LOG:                  CHANGE LOG:
                   * 5.2   - added "reply" link
                 * 5.1   - updated SQL queries                  * 5.1   - updated SQL queries
                                    - sprtinf()-ed and quote()-ed all SQL queries                                     - sprtinf()-ed and quote()-ed all SQL queries
                         - some bug fixes                          - some bug fixes
Line 78 
Line 78 
   
   
         // IMPORTANT CONSTANTS (change if needed)          // IMPORTANT CONSTANTS (change if needed)
         $WB_version = "5.1";          $WB_version = "5.2";
         $WB_name = "Wol's Message Board";          $WB_name = "Wol's Message Board";
         $strip_slashes = 0;          $strip_slashes = 0;
         $DEFAULT_HEAD_FRAME = "";          $DEFAULT_HEAD_FRAME = "";
Line 97 
Line 97 
         $min_msgs_in_board = 50;          $min_msgs_in_board = 50;
   
         // Database defaults          // Database defaults
         $use_db = 1;          $use_db = 0;
         $db_message_table = "wolboard_messages";          $db_message_table = "wolboard_messages";
         $db_user_table = "wolboard_users";          $db_user_table = "wolboard_users";
         //$db_host = "db.host.sk";          //$db_host = "db.host.sk";
Line 206 
Line 206 
                 );                  );
         } // create_link()          } // create_link()
   
           function create_reply($msg_arr) {
                   /*
                    $msg_arr keys: time, name, message, email
                   */
                   $quote_string = "&gt; ";
                   $ret = $msg_arr["name"] .
                           " (" .
                           format_time($msg_arr["time"]) .
                           ")<br>\n$quote_string" .
                           eregi_replace("\n", "\n$quote_string", $msg_arr["message"]) .
                           "<br>";
                   return $ret;
           } // create_reply($msg_arr)
   
         function wait_read_lock($f, $max_wait = 9999) {          function wait_read_lock($f, $max_wait = 9999) {
                 $start = time();                  $start = time();
                 while ((!flock($f, 1)) && ($start + $max_wait < time()))                  while ((!flock($f, 1)) && ($start + $max_wait < time()))
Line 309 
Line 323 
         } // get_time($str)          } // get_time($str)
   
         function get_pass($str) {          function get_pass($str) {
                 return rawurldecode(trim(strtr(strrchr($str, ":"), ":", ";")));                  return rawurldecode(trim(strtr(strrchr($str, ":"), ":", " ")));
         } // get_pass($str)          } // get_pass($str)
   
         function get_email($str) {          function get_email($str) {
Line 805 
Line 819 
                 }                  }
         }          }
   
         function show_data_form($user_file, $self, $nick,          function show_data_form($user_file, $self, $nick, $message,
                 $style, $WB_name, $autorefresh, $pagesize, $use_db = 0, $db_conn = 0) {                  $style, $WB_name, $autorefresh, $pagesize, $use_db = 0, $db_conn = 0) {
                 // TODO !!!!!!                  // TODO !!!!!!
                 global $headframe;                  global $headframe;
Line 827  Current time is <?echo format_time(time(
Line 841  Current time is <?echo format_time(time(
 ?>" target="<?echo $bodyframe?>">  ?>" target="<?echo $bodyframe?>">
 <tr>  <tr>
         <td align=center valign=middle rowspan=3>          <td align=center valign=middle rowspan=3>
                 <textarea name="message" cols=30 rows=5></textarea></td>                  <textarea name="message" cols=30 rows=<?
           echo (sizeof(explode("\n",$message)) + 5)?>><?echo $message?></textarea></td>
         <td align=center valign=middle><font face="Arial" color=#ffcc00 size=3>Nick</font></td>          <td align=center valign=middle><font face="Arial" color=#ffcc00 size=3>Nick</font></td>
         <td align=left valign=middle>          <td align=left valign=middle>
                 <select name="nick">                  <select name="nick">
Line 849  Current time is <?echo format_time(time(
Line 864  Current time is <?echo format_time(time(
         </td>          </td>
 </tr>  </tr>
 <tr>  <tr>
         <td valign=middle align=center colspan=2 rowspan=1><input type=submit name=submit_type value="Send"<?          <td valign=middle align=center colspan=1 rowspan=1><input type=submit name=submit_type value="Send"<?
                 // TODO redo the JS inline function (it doesn't clear the memo now)                  // TODO redo the JS inline function (it doesn't clear the memo now)
                 if (!$show_body)                  if (!$show_body)
                         echo " onClick=\"javascript:submit();message.value=''\"";                          echo " onClick=\"javascript:submit();message.value=''\"";
   
 ?>></td>  ?>></td>
 </tr>  
 <tr></tr>  
 <tr>  
         <td align=center>          <td align=center>
                 <a href="<?echo $self . "?" . link_replace(create_link(), "createuser", "1")?>">New nick</a>                  <a href="<?echo $self . "?" . link_replace(create_link(), "createuser", "1")?>">New nick</a>
         </td>          </td>
   </tr>
   <tr></tr>
   <tr>
         <td align=right><?          <td align=right><?
                 if (!$style)                  if (!$style)
                         echo "Board\t /</td><td><a href=$self?" .                          echo "Board\t /</td><td><a href=$self?" .
Line 1004  Current time is <?echo format_time(time(
Line 1019  Current time is <?echo format_time(time(
   
         function show_message($message, $style = 0) {          function show_message($message, $style = 0) {
                 global $self;                  global $self;
                   global $headframe;
                 switch($style) {                  switch($style) {
                         case 1:                          case 1:
                         // Chat message line                          // Chat message line
Line 1026  Current time is <?echo format_time(time(
Line 1042  Current time is <?echo format_time(time(
                                 break;                                  break;
                         default:                          default:
                         // Board message style                          // Board message style
                                 // remark this /* so the modes switch                                  // remark this /* to a //* and the modes will switch
                                 /*                                  /*
                                 echo "<tr><td valign=top class=email>";                                  echo "<tr><td valign=top class=email>";
                                 if ($message["email"] != "")                                  if ($message["email"] != "")
Line 1058  Current time is <?echo format_time(time(
Line 1074  Current time is <?echo format_time(time(
                                                 "nick",                                                  "nick",
                                                 $message["name"]) .                                                  $message["name"]) .
                                         ">delete</a>\n";                                          ">delete</a>\n";
                                   echo "<a href=$self?" .
                                           link_replace(
                                                   create_link(),
                                                   "reply_to",
                                                   rawurlencode($message["name"]."#".$message["time"])
                                           ) .
                                           " target=$headframe>reply</a>\n";
                                 echo "</td></tr><tr><td>";                                  echo "</td></tr><tr><td>";
                                 echo "\t" . $message["message"] . "\n";                                  echo "\t" . $message["message"] . "\n";
                                 echo "</td></tr>\n";                                  echo "</td></tr>\n";
Line 1186  Current time is <?echo format_time(time(
Line 1209  Current time is <?echo format_time(time(
         if (good($archive_no) && !$use_db)          if (good($archive_no) && !$use_db)
                 $message_file = $old_messages_folder . $hist_file_prefix . $archive_no;                  $message_file = $old_messages_folder . $hist_file_prefix . $archive_no;
   
           // check for superuser view
           if (($nick == $root_name) && (md5($pass) == $root_md5_password))
                   $superuser = 1;
           else
                   $superuser = 0;
   
         //header ("Cache-Control: no-cache, must-revalidate");          //header ("Cache-Control: no-cache, must-revalidate");
         //header ("Pragma: no-cache");          //header ("Pragma: no-cache");
   
Line 1206  Current time is <?echo format_time(time(
Line 1235  Current time is <?echo format_time(time(
                         $message_file = $db_message_table;                          $message_file = $db_message_table;
                 }                  }
         }          }
   
           // Insert quoted REPLY TO message
           if (good($reply_to)) {
                   $pivot = strrpos($reply_to, "#");
                   if (!($pivot === false)) {
                           $tmp_name = substr($reply_to, 0, $pivot);
                           $tmp_time = substr($reply_to, $pivot + 1);
                           $messages = read_messages($message_file, $user_file, $superuser,
                                   $use_db, $db_conn);
                           for ($i = 0; $i < sizeof($messages); $i++) {
                                   if (($messages[$i]["time"] == $tmp_time) &&
                                           ($messages[$i]["name"] == $tmp_name)){
                                           $found = true;
                                           break;
                                   }
                           }
                           if ($found) {
                                   $tmp_msg = create_reply($messages[$i]);
                                   if (good($message)) {
                                           $tmp_msg .= $message;
                                   }
                                   $message = $tmp_msg;
                           $message = strip_tags($message);
                           }
                   }
           }
   
         // CREATE NEW USER          // CREATE NEW USER
         if ($createuser) {          if ($createuser) {
                 $mails = get_emails($user_file, $use_db, $db_handle);                  $mails = get_emails($user_file, $use_db, $db_handle);
Line 1226  Current time is <?echo format_time(time(
Line 1282  Current time is <?echo format_time(time(
         }          }
   
         // WRITE MESSAGE TO DB          // WRITE MESSAGE TO DB
         if (good($message) && good($submit_type)) {          if (good($message) && good($submit_type) && $submit_type == "Send") {
                 if (write_message($message_file, $user_file, $nick, $message, 0,                  if (write_message($message_file, $user_file, $nick, $message, 0,
                         $old_messages_folder, $max_msgs_in_one_file, $min_msgs_in_board,                          $old_messages_folder, $max_msgs_in_one_file, $min_msgs_in_board,
                         $hist_file_prefix, $allowed_tags, $use_db, $db_handle))                          $hist_file_prefix, $allowed_tags, $use_db, $db_handle))
                         ; // something failed, ignoring for now                          ; // something failed, ignoring for now
                   $message = "";
         }          }
   
         // DELETE MESSAGE FROM DB          // DELETE MESSAGE FROM DB
Line 1262  Current time is <?echo format_time(time(
Line 1319  Current time is <?echo format_time(time(
                 }                  }
         }          }
   
         // 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          // We don't want to show body, when other form is shown
   
Line 1306  Current time is <?echo format_time(time(
Line 1358  Current time is <?echo format_time(time(
 </head>  </head>
 <body bgcolor=black text=#C0C0C0 link=#888ff alink=#888ff vlink=#888ff>  <body bgcolor=black text=#C0C0C0 link=#888ff alink=#888ff vlink=#888ff>
 <?  <?
                 show_data_form($user_file, $self, $nick, $style, $WB_name,                  show_data_form($user_file, $self, $nick, $message, $style,
                         $autorefresh, $pagesize, $use_db, $db_handle);                          $WB_name, $autorefresh, $pagesize, $use_db, $db_handle);
         }          }
   
         if ($show_body) {          if ($show_body) {

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top