Diff for /cdn/www/annotate.html between versions 1.3 and 1.45

version 1.3, 2003/03/23 17:34:15 version 1.45, 2003/03/25 09:56:17
Line 1 Line 1
 <?php  <?php
   
 $author = 'tsetse@chrisneale.co.uk';  
 $post_to_list = 0;  $post_to_list = 0;
   
 // $Id$  // $Id$
Line 8  $post_to_list = 0; Line 7  $post_to_list = 0;
 function cleanse ($message, $name = false) {  function cleanse ($message, $name = false) {
   
 // censor before sending to author/NG  // censor before sending to author/NG
   
    if ( ! $name )     if ( ! $name )
    {     {
      $message = str_replace("\r\n", "[r[n ", $message); // kludge around       $message = str_replace("\r\n", "[r[n ", $message); // kludge around
    }     }
   
    $message = ' ' . $message;     $message = ' ' . $message;
    $replacements = array('"', "'", '*', '#', '&', '$', '', '?', '%', '@', '+', 'X', 'x', );     $replacements = array('"', "'", '*', '#', '&', '$', '', '?', '%', '@', '+', 'X', 'x', );
    srand ((float)microtime()*1000000);     srand ((float)microtime()*1000000);
    shuffle($replacements);     shuffle($replacements);
   
    $cursed = array("m[0ou]th[3e]r[\ ]?f[cu]+[c]?k[3e]r",     $cursed = array("m[0ou]th[3e]r[\ ]?f[cu]+[c]?k[3e]r",
                    "f[\ \.]*[cu]+[\ \.]*[c]?[\ \.]*k",                     "f[\ \.]*[cu]+[\ \.]*[c]?[\ \.]*k",
                    "[4a]+[5s$]+[5s$]hole",                     "[4a]+[5s$]+[5s$]hole",
Line 35  function cleanse ($message, $name = fals Line 34  function cleanse ($message, $name = fals
   // too indiscriminant /Documents goes to /Do*#&amp;$%ents    // too indiscriminant /Documents goes to /Do*#&amp;$%ents
   
   for ($i=0; $cursed[$i] != ''; $i++) {    for ($i=0; $cursed[$i] != ''; $i++) {
   
     // whitespace, however currently turns '\n' to ' '      // whitespace, however currently turns '\n' to ' '
    $cursed[$i] = '[\ ]+' . $cursed[$i];     $cursed[$i] = '[\ ]+' . $cursed[$i];
 
     shuffle($replacements);      shuffle($replacements);
    $repstring = $replacements[0] . $replacements[2] . $replacements[5] .     $repstring = $replacements[0] . $replacements[2] . $replacements[5] .
                  $replacements[1] . $replacements[3];                   $replacements[1] . $replacements[3];
   
     if ($i == 0)      if ($i == 0)
Line 60  function cleanse ($message, $name = fals Line 61  function cleanse ($message, $name = fals
     $message = str_replace("[r[n ", "\r\n", $message); // losing \r\n to [\ ] or [[:space:]]      $message = str_replace("[r[n ", "\r\n", $message); // losing \r\n to [\ ] or [[:space:]]
   
   }    }
  
   return $message;    return $message;
   
 }  }
Line 90  function findBugs($text) Line 91  function findBugs($text)
   
 function slash($_page)  function slash($_page)
 {  {
  
// if no leading slash - add one  // if no leading slash - add one
   
   if ( !ereg('^/', $_page) )    if ( !ereg('^/', $_page) )
   {    {
Line 128  function findLinks($text) Line 129  function findLinks($text)
   
 // find and 'linkify' links  // find and 'linkify' links
   
  $text    = eregi_replace("((http|https|ftp):\/\/[^[:space:]<>]{1,})",   $text    = eregi_replace("((http|https|ftp):\/\/[^[:space:]<>]{1,})",
                            "<a href=\"\\1\">\\1</a>",$text);                             "<a href=\"\\1\">\\1</a>",$text);
 /*  /*
   
Line 140  $regExp = "^[\+\&_\.0-9a-z-]+@([0-9a-z]+ Line 141  $regExp = "^[\+\&_\.0-9a-z-]+@([0-9a-z]+
   
 */  */
   
  $text    = eregi_replace("(mailto:[^[:space:]<>]{1,})",   $text    = eregi_replace("(mailto:[^[:space:]<>]{1,})",
                            "<a href=\"\\1\">\\1</a>",$text);                             "<a href=\"\\1\">\\1</a>",$text);
   
 // tidy email references  // tidy email references
   $text = str_replace('>mailto:', '>', $text);    $text = str_replace('>mailto:', '>', $text);
  
   return $text;    return $text;
   
 }  }
Line 154  $regExp = "^[\+\&_\.0-9a-z-]+@([0-9a-z]+ Line 155  $regExp = "^[\+\&_\.0-9a-z-]+@([0-9a-z]+
 function htmlise($text)  function htmlise($text)
 {  {
   
  $text = htmlspecialchars(str_replace("\\", "", $text));    $text = htmlspecialchars(str_replace("\\", "", $text));
   
   $text = findLinks($text);    $text = findLinks($text);
   
Line 165  function htmlise($text) Line 166  function htmlise($text)
   $text = ereg_replace("\r\n\r\n", "\n<p/>", $text);    $text = ereg_replace("\r\n\r\n", "\n<p/>", $text);
   
   $text = ereg_replace("\r\n", "\n<br/>", $text);    $text = ereg_replace("\r\n", "\n<br/>", $text);
  
   
   return $text;    return $text;
 }  }
  
 ?><!-- ********************* START NOTES ******************** -->  ?><!-- ********************* START NOTES ******************** -->
   
 <div id="NOTESheader"><a name="NOTES"><strong>User Notes:</strong></a> <a href="http://<?php echo HOST; ?>/docs/notes.html">[?]</a></div>  <div id="NOTESheader"><a name="NOTES"><strong>User Notes:</strong></a> <a href="http://<?php echo HOST; ?>/docs/notes.html">[?]</a></div>
Line 177  function htmlise($text) Line 178  function htmlise($text)
 <div id="NOTESnotes"><acronym class="cdn" title="HyperText Markup Language">HTML</acronym> is not allowed in posts.<br/>  <div id="NOTESnotes"><acronym class="cdn" title="HyperText Markup Language">HTML</acronym> is not allowed in posts.<br/>
 <acronym class="cdn" title="Uniform Resource Locator">URL</acronym>s in the text that use mailto:, https://, http:// and ftp:// will be converted into hyperlinks.</div>  <acronym class="cdn" title="Uniform Resource Locator">URL</acronym>s in the text that use mailto:, https://, http:// and ftp:// will be converted into hyperlinks.</div>
   
<p id="NOTESdisclaimer">If you do not get a response to a question posted in this forum, please try sending a message to the project's <a href="http://www.<?php echo HOST; ?>/mailman/listinfo/<?php echo PROJECT_DIR; <p id="NOTESdisclaimer">If you do not get a response to a question posted in this forum, please try sending a message to the project's <a href="http://www.<?php echo HOST; ?>/mailman/listinfo/<?php echo PROJECT_DIR;
 ?>">mailing list</a> or to the <a href="http://www.<?php echo HOST; ?>/contact.html">project owner</a> directly.</p>  ?>">mailing list</a> or to the <a href="http://www.<?php echo HOST; ?>/contact.html">project owner</a> directly.</p>
   
 <p />  <p />
Line 198  define ('THIS_PAGE', 'http://' . PROJECT Line 199  define ('THIS_PAGE', 'http://' . PROJECT
 if ( $_POST['message'] && $_POST['name'] && !$hide_text_control )  if ( $_POST['message'] && $_POST['name'] && !$hide_text_control )
 {  {
         // censor name to be on safe side          // censor name to be on safe side
        $name = trim( cleanse($name), true );        $name = trim( cleanse(' ' . $name), true );
   
   
         // censor message text          // censor message text
Line 217  if ( $_POST['message'] && $_POST['name'] Line 218  if ( $_POST['message'] && $_POST['name']
           $file = implode('', file($readfile));            $file = implode('', file($readfile));
         }          }
   
        // count NOTEheader instances in file         $_parts = explode('>[', $file);
         $noOfNotes = substr_count($file, 'NOTEheader');
          $_strap = array_reverse($_parts);
   
        // find the last #n entry ...         $_parts = explode(']<', $_strap[0]);
         $_Notes_ = strrpos($file, '<a name="'); 
   
         $NOTE_date_ = substr($file, $_Notes);         $NOTE_date =  intval($_parts[0]);
         $NOTE_date = substr($file, strpos($NOTE_date_, '['), strpos($NOTE_date_, ']')); 
   
         // increment count          // increment count
        // $NOTE_date = $noOfNotes + 1;         $NOTE_date += 1;
        // $NOTE_date = (int)$NOTE_date; // + 1; 
   
          $author_prepend .= THIS_PAGE . $NOTE_date;           $author_prepend .= THIS_PAGE . $NOTE_date;
   
Line 241  if ( $_POST['message'] && $_POST['name'] Line 240  if ( $_POST['message'] && $_POST['name']
   
           if ( isset($author) )            if ( isset($author) )
           {            {
            $extra = 'Bcc: ' . base64_decode($author) . "\n";            $extra = 'Bcc: ' . base64_decode($_POST['author']) . "\n";
           }            }
         }          }
         elseif ( isset($author) )          elseif ( isset($author) )
         {          {
          $mailto = base64_decode($author);          $mailto = base64_decode($_POST['author']);
         }          }
   
   
Line 270  if ( $_POST['message'] && $_POST['name'] Line 269  if ( $_POST['message'] && $_POST['name']
         if ( !empty($target_page) ): $target_page = ' [' . $target_page . ']'; endif;          if ( !empty($target_page) ): $target_page = ' [' . $target_page . ']'; endif;
   
   
   //      $name = ereg_replace('^\ ', '', $name);
           $name = ereg_replace('<[^>]+>', '', $name);
   
         // pre-process name          // pre-process name
         $name_html  = htmlspecialchars($name);          $name_html  = htmlspecialchars($name);
   
Line 329  if ( $_POST['message'] && $_POST['name'] Line 331  if ( $_POST['message'] && $_POST['name']
         // trying to prevent reload from adding (yet) another post/email/NG post          // trying to prevent reload from adding (yet) another post/email/NG post
         $already_posted = false;          $already_posted = false;
   
        $already_posted = ereg( $head . $message_html . $end, $file);        $already_posted = strstr($file, $head . $message_html . $end);
   
   
         if( ($post_to_list || isset($author) ) && !empty($name) && !empty($message) && !$already_posted)          if( ($post_to_list || isset($author) ) && !empty($name) && !empty($message) && !$already_posted)
Line 454  if (!$hide_text_control) Line 456  if (!$hide_text_control)
   
 </form>  </form>
 </div>  </div>
<?php } <?php }
   
 clearstatcache();  clearstatcache();
   

Removed from v.1.3  
changed lines
  Added in v.1.45


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>