cvs: php-master-web / note.sql users.sql /manage notes-alert.php

From: Date: Fri, 19 Oct 2001 21:07:55 +0000
Subject: cvs: php-master-web / note.sql users.sql /manage notes-alert.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-7098@lists.php.net to get a copy of this message
jimw Fri Oct 19 17:07:55 2001 EDT Added files: /php-master-web note.sql Modified files: /php-master-web users.sql /php-master-web/manage notes-alert.php Log: schema and notes for the note table Index: php-master-web/users.sql diff -u php-master-web/users.sql:1.1 php-master-web/users.sql:1.2 --- php-master-web/users.sql:1.1 Fri Oct 19 16:19:29 2001 +++ php-master-web/users.sql Fri Oct 19 17:07:55 2001 @@ -1,5 +1,12 @@ /* user-related tables */ +/* various things that may hang off the users table in the future: + * ownership of bugs and bug comments + * 'subscription' to bugs + * 'subscription' to notes updates of manual sections + * cvs acls +*/ + /* the users table is the main one. it contains the name, email, and crypted password for each user. the password is crypted using the standard unix DES-based crypt (for interop with cvs) */ @@ -9,9 +16,9 @@ their account if they know the password. */ CREATE TABLE IF NOT EXISTS users ( userid INT NOT NULL AUTO_INCREMENT, - name varchar(255) NOT NULL default '', - email varchar(255) NOT NULL default '', - passwd varchar(16) NOT NULL default '', + name VARCHAR(255) NOT NULL DEFAULT '', + email VARCHAR(255) NOT NULL DEFAULT '', + passwd VARCHAR(16) NOT NULL DEFAULT '', PRIMARY KEY(userid), UNIQUE (email), FULLTEXT (name,email) @@ -23,8 +30,8 @@ /* this probably could be merged back into the main users table. */ CREATE TABLE IF NOT EXISTS users_cvs ( userid INT NOT NULL, - cvsuser char(16) NOT NULL, - approved INT(1) NOT NULL default 0, + cvsuser CHAR(16) NOT NULL, + approved INT(1) NOT NULL DEFAULT 0, PRIMARY KEY(userid), UNIQUE (cvsuser) ); Index: php-master-web/manage/notes-alert.php diff -u php-master-web/manage/notes-alert.php:1.3 php-master-web/manage/notes-alert.php:1.4 --- php-master-web/manage/notes-alert.php:1.3 Wed Oct 3 22:41:06 2001 +++ php-master-web/manage/notes-alert.php Fri Oct 19 17:07:55 2001 @@ -1,51 +1,13 @@ <?php -require_once "cvs-auth.inc"; +require_once "login.inc"; +require_once "functions.inc"; require_once "alert_lib.inc"; -if($user && $pass) { - setcookie("MAGIC_COOKIE",base64_encode("$user:$pass"),time()+3600*24*12,'/','.php.net'); -} - -if (!$user && isset($MAGIC_COOKIE)) { - list($user, $pass) = explode(":", base64_decode($MAGIC_COOKIE)); -} - -if (!$user || !$pass || !verify_password($user,$pass)) { - head(); ?> -<p> -<b>You need to login first</b> -</p> -<form method="post" action="<?php echo $PHP_SELF;?>"> -<input type="hidden" name="sect" value="<?php echo clean($sect);?>" /> -<input type="hidden" name="alert_action" value="<?php echo clean($alert_action);?>" /> -<table> - <tr> - <th align="right">CVS username:</th> - <td><input type="text" name="user" value="<?php echo clean($user);?>" size="10" maxlength="32" /></td> - </tr> - <tr> - <th align="right">CVS password:</th> - <td><input type="password" name="pass" value="<?php echo clean($pass);?>" size="10" maxlength="32" /></td> - </tr> - <tr> - <td align="center" colspan="2"> - <input type="submit" value="Log in" /> - </td> - </tr> -</table> -</form> - -</p> -<?php - foot(); - exit; -} - head(); switch ($alert_action) { case "add_alert" : - $sql = "insert into alerts values ('$user', '$sect', now())"; + $sql = "INSERT INTO alerts VALUES ('$user', '$sect', NOW())"; if (has_alert($user, $sect)) echo "<b>You already have an alert for this page</b><br />\n"; else @@ -72,29 +34,3 @@ print_alerts($user); foot(); - -// functions "borrowed" from user-notes.php - -function head() {?> -<html> -<head> - <title>Notes Alert system</title> - <link rel="stylesheet" type="text/css" href="http://www.php.net/style.css" /> -</head> -<body class="popup"> -<?php -} - -function foot() {?> -<hr> -<a href="javascript:self.close();">Close Window</a> -</body> -</html> -<?php -} - -function clean($var) { - return htmlspecialchars(get_magic_quotes_gpc() ? stripslashes($var) : $var); -} - -?> Index: php-master-web/note.sql +++ php-master-web/note.sql /* the note table holds notes for the php manual. */ /* TODO: there is a similar table for php-gtk's manual. it should probably be merged with this one. */ /* TODO: the user stuff should be linked to the users table so people could edit their own notes. */ /* TODO: lang should probably be linked to a languages table of some sort. but we're not really using it yet, so maybe we don't want it at all. */ /* TODO: the 'removed' thing is pretty lame. it would probably be okay to simplify the database-to-flat-file code to not bother with incremental updates (and perhaps just short-circuit when there are no updates at all), especially once voting is fully implemented. */ /* used by: master.php.net/entry/user-note.php master.php.net/fetch/user-notes.php master.php.net/manage/user-notes.php */ CREATE TABLE IF NOT EXISTS note ( id INT NOT NULL AUTO_INCREMENT, sect VARCHAR(80) NOT NULL DEFAULT '', user VARCHAR(80) DEFAULT NULL, note TEXT, ts DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', status VARCHAR(16) DEFAULT NULL, lang VARCHAR(16) DEFAULT NULL, votes INT NOT NULL DEFAULT '0', rating INT NOT NULL DEFAULT '0', updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', removed INT(1) NOT NULL DEFAULT '0', PRIMARY KEY (id), KEY (sect) ) TYPE=MyISAM PACK_KEYS=1;

« previous php.mirrors (#7098) next »