cvs: php-gtk-web /include cvs-auth.inc email-validation.inc prepend.php shared-manual.inc

[email protected] ("Colin Viebrock") Thu, 09 Aug 2001 18:09:51 -0000
Newsgroups php.gtk
Message-ID <cvscmv997380591@cvsserver>
cmv		Thu Aug  9 14:09:51 2001 EDT

  Added files:                 
    /php-gtk-web/include	cvs-auth.inc email-validation.inc 

  Modified files:              
    /php-gtk-web/include	prepend.php shared-manual.inc 
  Log:
  need two files, plus remove trailing ?> tags
  
  
  
Index: php-gtk-web/include/prepend.php
diff -u php-gtk-web/include/prepend.php:1.1 php-gtk-web/include/prepend.php:1.2
--- php-gtk-web/include/prepend.php:1.1	Thu May  3 14:49:35 2001
+++ php-gtk-web/include/prepend.php	Thu Aug  9 14:09:51 2001
@@ -2,4 +2,4 @@
 
 require_once 'layout.php';
 
-?>
+
Index: php-gtk-web/include/shared-manual.inc
diff -u php-gtk-web/include/shared-manual.inc:1.11 php-gtk-web/include/shared-manual.inc:1.12
--- php-gtk-web/include/shared-manual.inc:1.11	Thu Aug  9 11:57:50 2001
+++ php-gtk-web/include/shared-manual.inc	Thu Aug  9 14:09:51 2001
@@ -147,9 +147,15 @@
 }
 
 
+function makeTitle($title) {
+	echo '<tr bgcolor="#d0d0d0" valign="top">';
+	echo '<td colspan="2"><b>' . $title . '</b><br></td>';
+	echo "</tr>\n";
+}
+
 
 function makeEntry($date,$name,$blurb,$id=0) {
-	global $MAGIC_COOKIE;
+	global $MAGIC_COOKIE, $NOTE_ADMIN_MODE;
 
 	echo '<tr valign="top">';
 	echo '<td bgcolor="#e0e0e0" colspan="2">';
@@ -167,20 +173,38 @@
 	echo '<br></td>';
 	echo '<td align="right">';
 	if (isset($MAGIC_COOKIE) && $id) {
-		print_link('/manual/admin-notes.php?action=edit+' . $id . '&brief=1',
-			make_image('notes-edit.gif', 'edit note'),
-			'admin'
-		);
-		echo '&nbsp';
-		print_link('/manual/admin-notes.php?action=reject+' . $id . '&brief=1&popup=1',
-			make_image('notes-reject.gif', 'reject note'),
-			'admin'
-		);
-		echo '&nbsp';
-		print_link('/manual/admin-notes.php?action=delete+' . $id . '&brief=1&popup=1',
-			make_image('notes-delete.gif', 'delete note'),
-			'admin'
-		);
+
+		if ($NOTE_ADMIN_MODE=='submit') {
+
+			$button = make_submit('notes-edit.gif', 'edit note '.$id);
+			echo substr($button, 0, -1) . ' NAME="action" VALUE="edit ' . $id . '">';
+			echo '&nbsp;';
+
+			$button = make_submit('notes-reject.gif', 'reject note '.$id);
+			echo substr($button, 0, -1) . ' NAME="action" VALUE="reject ' . $id . '">';
+			echo '&nbsp;';
+
+			$button = make_submit('notes-delete.gif', 'delete note '.$id);
+			echo substr($button, 0, -1) . ' NAME="action" VALUE="delete ' . $id . '">';
+			echo '&nbsp;';
+
+		} else {
+
+			print_link('/manual/admin-notes.php?action=edit+' . $id . '&brief=1',
+				make_image('notes-edit.gif', 'edit note'),
+				'admin'
+			);
+			echo '&nbsp';
+			print_link('/manual/admin-notes.php?action=reject+' . $id . '&brief=1&popup=1',
+				make_image('notes-reject.gif', 'reject note'),
+				'admin'
+			);
+			echo '&nbsp';
+			print_link('/manual/admin-notes.php?action=delete+' . $id . '&brief=1&popup=1',
+				make_image('notes-delete.gif', 'delete note'),
+				'admin'
+			);
+		}
 	}
 
 	echo '<br></td>';

Index: php-gtk-web/include/cvs-auth.inc
+++ php-gtk-web/include/cvs-auth.inc
<?php
/* $Id: cvs-auth.inc,v 1.1 2001/08/09 18:09:51 cmv Exp $ */

$ignore_password = false;
$passwd_file = "/repository/CVSROOT/passwd";

function find_password($user) {
	global $passwd_file, $ignore_password;
	if ($ignore_password) return " "; // can't be ""
	$fp=fopen($passwd_file,"r");
	while(!feof($fp)) {
		$line=fgets($fp,120);
		list($luser,$passwd,$junk) = explode(":",$line);
		if($user==$luser) {
			fclose($fp);
			return($passwd);
		}
	}
	fclose($fp);
	return("");
}

function verify_password($user, $pass) {
	global $ignore_password;
	$psw = find_password($user);
	if (strlen($psw) > 0) {
		if ($ignore_password || crypt($pass,substr($psw,0,2)) == $psw) {
			return true;
		}
	}
	return false;
}



Index: php-gtk-web/include/email-validation.inc
+++ php-gtk-web/include/email-validation.inc
<?php

/*
 * email_validation.inc
 * $Id: email-validation.inc,v 1.1 2001/08/09 18:09:51 cmv Exp $
 */

// checks that is an *outside* host, and tries to remove anti-SPAM bits
function clean_AntiSPAM ($email) {
	$remove_spam = "[-_]?(NO|I[-_]?HATE|DELETE|REMOVE)[-_]?(THIS)?(ME|SPAM)?[-_]?";
	return eregi_replace($remove_spam,"",trim($email));
}

function is_emailable_address( $email) {
	$hosts_regex="lists\.php\.net|chek.*\.com";
	$excluded_hosts = ereg($hosts_regex,$email);
	$email_regex="^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~ ])+@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~ ]+\\.)+[a-zA-Z]{2,4}\$";
	if (!$excluded_hosts && $email != "") {
		return eregi($email_regex, $email);
	} else {
		return false;
	}
}