You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(49) |
Sep
(25) |
Oct
(2) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(24) |
Nov
(50) |
Dec
(4) |
2004 |
Jan
(2) |
Feb
(2) |
Mar
(5) |
Apr
|
May
(10) |
Jun
|
Jul
(10) |
Aug
(22) |
Sep
(10) |
Oct
|
Nov
(57) |
Dec
(5) |
2005 |
Jan
(24) |
Feb
(12) |
Mar
|
Apr
|
May
(3) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
(5) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: <unl...@us...> - 2002-08-17 02:25:16
|
Update of /cvsroot/meshdb/www/deal/docs In directory usw-pr-cvs1:/tmp/cvs-serv21801/deal/docs Log Message: Directory /cvsroot/meshdb/www/deal/docs added to the repository |
From: <unl...@us...> - 2002-08-16 13:17:54
|
Update of /cvsroot/meshdb/www/deal/templates/images In directory usw-pr-cvs1:/tmp/cvs-serv18639/templates/images Log Message: Directory /cvsroot/meshdb/www/deal/templates/images added to the repository |
From: <unl...@us...> - 2002-08-16 13:14:29
|
Update of /cvsroot/meshdb/www/deal/includes In directory usw-pr-cvs1:/tmp/cvs-serv16393/includes Modified Files: page_header.php Log Message: Changes. Finalising design Index: page_header.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/includes/page_header.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- page_header.php 14 Aug 2002 07:57:14 -0000 1.3 +++ page_header.php 16 Aug 2002 13:14:26 -0000 1.4 @@ -34,22 +34,28 @@ array('overall_header' => 'overall_header.tpl') ); -/* + // // The following assigns all _common_ variables that may be used at any point -// in a template. Example +// in a template. // $template->assign_vars(array( - - 'U_REGISTER' => append_sid('profile.'.$phpEx.'?mode=register'), - 'U_PROFILE' => append_sid('profile.'.$phpEx.'?mode=editprofile'), - 'T_SPAN_CLASS2' => $theme['span_class2'], - 'T_SPAN_CLASS3' => $theme['span_class3'], - 'NAV_LINKS' => $nav_links_html) + 'SITE_TITLE' => 'The Brisbane Mesh Wireless Metropolitan Area Network', + 'SITE_IMAGE' => 'templates/images/brismeshlogo_right_top.png', + 'SITE_NAME' => 'BrisMesh', + 'PRICES_DB' => 'Retail Prices & Deals', + 'PRICES_DB_LINK' => 'index.'.$phpEx, + 'PRODUCTS_DB' => 'Products', + 'PRODUCTS_DB_LINK' => 'products.'.$phpEx, + 'VENDORS_DB' => 'Vendors', + 'VENDORS_DB_LINK' => 'vendors.'.$phpEx, + 'HWPOOL_DB' => 'Hardware Pool', + 'HWPOOL_DB_LINK' => 'hwpool.'.$phpEx, + 'SITE_IMAGE' => 'templates/images/brismeshlogo_right_top.png') ); -*/ + $template->pparse('overall_header'); -?> \ No newline at end of file +?> |
From: <unl...@us...> - 2002-08-16 13:14:29
|
Update of /cvsroot/meshdb/www/deal/templates In directory usw-pr-cvs1:/tmp/cvs-serv16393/templates Modified Files: index_page.tpl overall_footer.tpl overall_header.tpl stylesheet.css Log Message: Changes. Finalising design Index: index_page.tpl =================================================================== RCS file: /cvsroot/meshdb/www/deal/templates/index_page.tpl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- index_page.tpl 14 Aug 2002 03:49:18 -0000 1.1 +++ index_page.tpl 16 Aug 2002 13:14:25 -0000 1.2 @@ -1,2 +1,23 @@ +<span class="sectionheader">{SECTION_HEADER}</span><br /> + +<!-- Content // --> +<span class="text"> + +This is a user-contributed database of component prices that people have spotted in Australia. If you know of a great deal, or the price of a component that other people might be interested in, add it! <br /> +See also: <a href="http://www.wireless.org.au/tib/" class="genlink">The Incredible Bulk</a> - bulk orders organised by Melbourne Wireless. +<br /> +The table below is sorted by class, and then by price.<br /> + + +<!-- +<span class="header">Retail prices database</span><br /> +<span class="gentext"> +This is a user-contributed database of component prices that people have spotted in Australia. If you know of a great deal, or the price of a component that other people might be interested in, add it! <br /> +See also: <a href="http://www.wireless.org.au/tib/" class="genlink">The Incredible Bulk</a> - bulk orders organised by Melbourne Wireless +<br /> +The table below is sorted by class, and then by price.<br /> + + {MESSAGE} <br /><br /> -{MESSAGE2} +{MESSAGE2} +--> Index: overall_footer.tpl =================================================================== RCS file: /cvsroot/meshdb/www/deal/templates/overall_footer.tpl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- overall_footer.tpl 14 Aug 2002 03:49:18 -0000 1.1 +++ overall_footer.tpl 16 Aug 2002 13:14:25 -0000 1.2 @@ -1,14 +1,9 @@ <hr> -<p class="minor"> -Technical enquiries about this web site should be directed to -<a href="mailto:david.leonard+meshweb@itee.uq.edu.au">David Leonard</a>. -<br> -Web site kindly hosted by the -<a href="/">Dept of Information Technology & Electrical Engineering, UQ</a>. -<br> -<a href="logo/">Logo</a> designed by Matt Gleeson. -</p> - +<div align="right"><span class="textsmall"> +Technical enquiries about this web site should be directed to <a href="mailto:david.leonard+meshweb@itee.uq.edu.au"">David Leonard</a>. <br /> +Kindly hosted by the <a href="/">Dept of Information Technology & Electrical Engineering, UQ</a>. <br /> +<a href="http://www.itee.uq.edu.au/~mesh/logo/">Logo</a> designed by Matt Gleeson.</span> +</div> </body> </html> Index: overall_header.tpl =================================================================== RCS file: /cvsroot/meshdb/www/deal/templates/overall_header.tpl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- overall_header.tpl 14 Aug 2002 03:49:18 -0000 1.1 +++ overall_header.tpl 16 Aug 2002 13:14:25 -0000 1.2 @@ -1,9 +1,28 @@ <html> <head> +<title>{SITE_TITLE}</title> <link rel="stylesheet" href="templates/stylesheet.css" type="text/css"> -<title>Retail prices database</title> </head> -<body> -<img align=center src="../img/mesh-small.gif" - width=107 height=68 alt="Brisbane Mesh"> -<h1>Retail prices database</h1> +<body bgcolor="#FFFFFF"> +<!-- HTML Design by Grant Bartlett, feel free to contact me with any comments. unleadedis _at_ optusnet.com.au + Logo designed by Matt Gleeson. +// --> + +<!-- Page Header --> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> <td><span class="header">{SITE_NAME}</span><br /><span class="header_subtext">{SITE_TITLE}</span></td> + <td align="right"><img src="{SITE_IMAGE}" alt="{SITE_TITLE}"></td> + </tr> + <tr> <td bgcolor="#DFDFDF" height="1" colspan="2"></td></tr> + + <tr> <td colspan="2" class="text"> + <a href="{PRICES_DB_LINK}" class="text">{PRICES_DB}</a> : + <a href="{PRODUCTS_DB_LINK}" class="text">{PRODUCTS_DB}</a> : + <a href="{VENDORS_DB_LINK}" class="text">{VENDORS_DB}</a> :: + <a href="{HWPOOL_DB_LINK}" class="text">{HWPOOL_DB}</a> + </td> + </tr> + +</table><br /> + +<!-- End Section Header // --> Index: stylesheet.css =================================================================== RCS file: /cvsroot/meshdb/www/deal/templates/stylesheet.css,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- stylesheet.css 14 Aug 2002 03:49:18 -0000 1.1 +++ stylesheet.css 16 Aug 2002 13:14:25 -0000 1.2 @@ -1,4 +1,33 @@ +/* The largest text used in the index page title and toptic title etc. */ +.header { + font-weight: bold; font-size: 26px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; + text-decoration: none; line-height : 120%; color : #000000; +} + +.header_subtext { + font-size: 14px; font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + text-decoration: none; line-height : 150%; color : #000000; +} + +.sectionheader { + font-weight: bold; font-size: 18px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; + text-decoration: none; line-height : 120%; color : #006699; +} + + +.text { font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; } + +.textsmall { font-size: 10px; font-family: Arial, Helvetica, sans-serif; } + + +/* General font families for common tags */ +font,th,td,p { font-family: Verdana, Arial, Helvetica, sans-serif } +a:link,a:active,a:visited { color : #000000; } +a:hover { text-decoration: underline; color : #DD6900; } + + +/* h1 { font-family: Helvetica; } h2 { font-family: Helvetica; } body { background: white; } @@ -59,4 +88,7 @@ td.note { font-style: italic; font-family: Helvetica; font-size: smaller; - text-align: center; } \ No newline at end of file + text-align: center; } + + +*/ |
From: <unl...@us...> - 2002-08-16 09:49:04
|
Update of /cvsroot/meshdb/www/deal In directory usw-pr-cvs1:/tmp/cvs-serv5428 Modified Files: index.php Log Message: Minor changes Index: index.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/index.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- index.php 14 Aug 2002 04:15:12 -0000 1.5 +++ index.php 16 Aug 2002 09:49:01 -0000 1.6 @@ -47,7 +47,7 @@ // Assign variables in template values $template->assign_vars(array( - 'MESSAGE' => 'Welcome to admin via templates', + 'SECTION_HEADER' => 'Retail Price Database', 'MESSAGE2' => 'foo bar!', 'MESSAGE3' => $foo) ); |
From: <le...@us...> - 2002-08-16 00:32:12
|
Update of /cvsroot/meshdb/www/db2 In directory usw-pr-cvs1:/tmp/cvs-serv14837 Modified Files: view.php Log Message: division by zero catch Index: view.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/view.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- view.php 10 Aug 2002 03:34:07 -0000 1.1.1.1 +++ view.php 16 Aug 2002 00:32:05 -0000 1.2 @@ -195,7 +195,8 @@ $zoom = doubleval($_GET["zoom"]); else $zoom = $PREF["viewzoom"]; - if ($peerid != "") { + $mdist = ($peerid == "") ? 0 : max(abs($e-$e2),abs($n-$n2)); + if ($mdist > 0) { $s = $zoom * $w / max(abs($e-$e2),abs($n-$n2)) / 4; } else { $s = $zoom * $w / 20000; /* 20km default span */ |
From: <unl...@us...> - 2002-08-14 07:57:18
|
Update of /cvsroot/meshdb/www/deal/includes In directory usw-pr-cvs1:/tmp/cvs-serv3213/includes Modified Files: page_header.php Log Message: Some minor changes. If any. Index: page_header.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/includes/page_header.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- page_header.php 14 Aug 2002 04:15:12 -0000 1.2 +++ page_header.php 14 Aug 2002 07:57:14 -0000 1.3 @@ -50,10 +50,6 @@ ); */ -header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0'); -header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); -header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); - $template->pparse('overall_header'); -?> +?> \ No newline at end of file |
From: <unl...@us...> - 2002-08-14 04:19:15
|
Update of /cvsroot/meshdb/www/deal/templates In directory usw-pr-cvs1:/tmp/cvs-serv27115/templates Added Files: message_body.tpl Log Message: Template file for general messages. That'll do for today ;) --- NEW FILE: message_body.tpl --- <table width="100%" cellspacing="1" cellpadding="4" border="0" bgcolor="#CCCCCC"> <tr> <th align="center" height="25"><b>{MESSAGE_TITLE}</b></th> </tr> <tr> <td><table width="100%" cellspacing="0" cellpadding="1" border="0"> <tr> <td> </td> </tr> <tr> <td align="center">{MESSAGE_TEXT}</td> </tr> <tr> <td> </td> </tr> </table></td> </tr> </table> <br clear="all" /> |
From: <unl...@us...> - 2002-08-14 04:15:15
|
Update of /cvsroot/meshdb/www/deal In directory usw-pr-cvs1:/tmp/cvs-serv25377 Modified Files: index.php Log Message: Changes made to various files. There was an error in functions.php which would cause a object error when an error message was needing to be displayed. Index: index.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/index.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- index.php 14 Aug 2002 03:39:06 -0000 1.4 +++ index.php 14 Aug 2002 04:15:12 -0000 1.5 @@ -34,7 +34,8 @@ include('./includes/page_header.'.$phpEx); - + // Test messages + // message_die(GENERAL_MESSAGE, "Could not connect to the database"); // // Start Body |
From: <unl...@us...> - 2002-08-14 04:15:15
|
Update of /cvsroot/meshdb/www/deal/includes In directory usw-pr-cvs1:/tmp/cvs-serv25377/includes Modified Files: db.php functions.php page_header.php Log Message: Changes made to various files. There was an error in functions.php which would cause a object error when an error message was needing to be displayed. Index: db.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/includes/db.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- db.php 14 Aug 2002 03:55:15 -0000 1.2 +++ db.php 14 Aug 2002 04:15:12 -0000 1.3 @@ -63,4 +63,4 @@ message_die(CRITICAL_ERROR, "Could not connect to the database"); } -?> +?> \ No newline at end of file Index: functions.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/includes/functions.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- functions.php 14 Aug 2002 03:49:18 -0000 1.1 +++ functions.php 14 Aug 2002 04:15:12 -0000 1.2 @@ -35,7 +35,7 @@ // common.php include and session code, ie. most errors in // pages/functions // -// CRITICAL_MESSAGE : Used when basic config data is available but +// CRITICAL_MESSAGE : Used when basic config data is available but // a session may not exist, eg. banned users // // CRITICAL_ERROR : Used when config data cannot be obtained, eg @@ -43,7 +43,8 @@ // function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') { - + global $db, $template, $phpEx; + $sql_store = $sql; // @@ -78,38 +79,8 @@ // if ( !defined('HEADER_INC') && $msg_code != CRITICAL_ERROR ) { - if ( empty($lang) ) - { - if ( !empty($board_config['default_lang']) ) - { - include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx); - } - else - { - include($phpbb_root_path . 'language/lang_english/lang_main.'.$phpEx); - } - } - - if ( empty($template) ) - { - $template = new Template($phpbb_root_path . 'templates/' . $board_config['board_template']); - } - if ( empty($theme) ) - { - $theme = setup_style($board_config['default_style']); - } + include('./includes/page_header.'.$phpEx); - // - // Load the Page Header - // - if ( !defined('IN_ADMIN') ) - { - include($phpbb_root_path . 'includes/page_header.'.$phpEx); - } - else - { - include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx); - } } switch($msg_code) @@ -131,12 +102,12 @@ case GENERAL_ERROR: if ( $msg_text == '' ) { - $msg_text = 'General Error!'; + $msg_text = 'General Error.'; } if ( $msg_title == '' ) { - $msg_title = $lang['General_Error']; + $msg_title = 'General Error.'; } case CRITICAL_ERROR: @@ -144,16 +115,15 @@ // Critical errors mean we cannot rely on _ANY_ DB information being // available so we're going to dump out a simple echo'd statement // - include($phpbb_root_path . 'language/lang_english/lang_main.'.$phpEx); if ( $msg_text == '' ) { - $msg_text = $lang['A_critical_error']; + $msg_text = 'A critical error has occured!'; } if ( $msg_title == '' ) { - $msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>'; + $msg_title = 'meshDB :'; } break; } @@ -173,38 +143,24 @@ if ( $msg_code != CRITICAL_ERROR ) { - if ( !empty($lang[$msg_text]) ) - { - $msg_text = $lang[$msg_text]; - } + + $template->set_filenames(array( + 'message_body' => 'message_body.tpl') + ); - if ( !defined('IN_ADMIN') ) - { - $template->set_filenames(array( - 'message_body' => 'message_body.tpl') - ); - } - else - { - $template->set_filenames(array( - 'message_body' => 'admin/admin_message_body.tpl') - ); - } $template->assign_vars(array( 'MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text) ); + + $template->pparse('message_body'); + + + // Footer + include('./includes/page_tail.'.$phpEx); - if ( !defined('IN_ADMIN') ) - { - include($phpbb_root_path . 'includes/page_tail.'.$phpEx); - } - else - { - include($phpbb_root_path . 'admin/page_footer_admin.'.$phpEx); - } } else { Index: page_header.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/includes/page_header.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- page_header.php 14 Aug 2002 03:49:18 -0000 1.1 +++ page_header.php 14 Aug 2002 04:15:12 -0000 1.2 @@ -38,7 +38,7 @@ // // The following assigns all _common_ variables that may be used at any point -// in a template. +// in a template. Example // $template->assign_vars(array( |
From: <unl...@us...> - 2002-08-14 03:55:18
|
Update of /cvsroot/meshdb/www/deal/includes In directory usw-pr-cvs1:/tmp/cvs-serv17202 Modified Files: constants.php db.php Log Message: changes. Code reuse with wrong header ;) Index: constants.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/includes/constants.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- constants.php 14 Aug 2002 03:49:18 -0000 1.1 +++ constants.php 14 Aug 2002 03:55:15 -0000 1.2 @@ -3,7 +3,7 @@ * constants.php * ------------------- * begin : Sunday, Jun 24, 2002 - * copyright : (C) 2002 The eXtant Group + * copyright : (C) 2002 The meshDB Group * email : unl...@us... * * $Id$ Index: db.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/includes/db.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- db.php 14 Aug 2002 03:49:18 -0000 1.1 +++ db.php 14 Aug 2002 03:55:15 -0000 1.2 @@ -3,7 +3,7 @@ * db.php * ------------------- * begin : Saturday, June 25, 2002 - * copyright : (C) 2002 The eXtant Group + * copyright : (C) 2002 The meshDB Group * email : unl...@us... * * $Id$ |
From: <unl...@us...> - 2002-08-14 03:49:21
|
Update of /cvsroot/meshdb/www/deal/includes In directory usw-pr-cvs1:/tmp/cvs-serv14497/includes Added Files: constants.php db.php functions.php page_header.php page_tail.php template.php Log Message: OK. This is the new code for the deal system, basically this is the framework of how the system will work, with db abstraction, templating and files broken up to handle each respective bit. The current code does not do anything, it simple prints a header, foo, and footer, but when it does that it is connecting to the DB, loading the templating system. What has to happen now is the functions/system from index-conv.php (the old index) to be re-imploemented in the new framework. --- NEW FILE: constants.php --- <?php /*************************************************************************** * constants.php * ------------------- * begin : Sunday, Jun 24, 2002 * copyright : (C) 2002 The eXtant Group * email : unl...@us... * * $Id: constants.php,v 1.1 2002/08/14 03:49:18 unleaded Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License', or * ('at your option) any later version. * ***************************************************************************/ if ( !defined('IN_MESHDB') ) { die("Hacking attempt"); } // Debug Level define('DEBUG', 1); // Debugging on //define('DEBUG', 0); // Debugging off // SQL codes define('BEGIN_TRANSACTION', 1); define('END_TRANSACTION', 2); // Error codes define('GENERAL_MESSAGE', 200); define('GENERAL_ERROR', 202); define('CRITICAL_MESSAGE', 203); define('CRITICAL_ERROR', 204); // Table names define('DEALS_TABLE', 'deal'); define('DONATIONS_TABLE', 'donation'); define('PRODUCTS_TABLE', 'product'); define('VENDORS_TABLE', 'vendor'); ?> --- NEW FILE: db.php --- <?php /*************************************************************************** * db.php * ------------------- * begin : Saturday, June 25, 2002 * copyright : (C) 2002 The eXtant Group * email : unl...@us... * * $Id: db.php,v 1.1 2002/08/14 03:49:18 unleaded Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if ( !defined('IN_MESHDB') ) { die("Hacking attempt"); } switch($dbms) { case 'mysql': include('./db/mysql.'.$phpEx); break; case 'mysql4': include('./db/mysql4.'.$phpEx); break; case 'postgres': include('./db/postgres7.'.$phpEx); break; case 'mssql': include('./db/mssql.'.$phpEx); break; case 'oracle': include('./db/oracle.'.$phpEx); break; case 'msaccess': include('./db/msaccess.'.$phpEx); break; case 'mssql-odbc': include('./db/mssql-odbc.'.$phpEx); break; } // Make the database connection. $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false); if(!$db->db_connect_id) { message_die(CRITICAL_ERROR, "Could not connect to the database"); } ?> --- NEW FILE: functions.php --- <?php /*************************************************************************** * functions.php * ------------------- * begin : Wednesday, Aug 14, 2002 * copyright : (C) 2002 The meshDB Group * email : unl...@us... * * $Id: functions.php,v 1.1 2002/08/14 03:49:18 unleaded Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * ***************************************************************************/ // // This is general replacement for die(), allows templated // output in users (or default) language, etc. // // $msg_code can be one of these constants: // // GENERAL_MESSAGE : Use for any simple text message, eg. results // of an operation, authorisation failures, etc. // // GENERAL ERROR : Use for any error which occurs _AFTER_ the // common.php include and session code, ie. most errors in // pages/functions // // CRITICAL_MESSAGE : Used when basic config data is available but // a session may not exist, eg. banned users // // CRITICAL_ERROR : Used when config data cannot be obtained, eg // no database connection. Should _not_ be used in 99.5% of cases // function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') { $sql_store = $sql; // // Get SQL error if we are debugging. Do this as soon as possible to prevent // subsequent queries from overwriting the status of sql_error() // if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) ) { $sql_error = $db->sql_error(); $debug_text = ''; if ( $sql_error['message'] != '' ) { $debug_text .= '<br /><br />SQL Error : ' . $sql_error['code'] . ' ' . $sql_error['message']; } if ( $sql_store != '' ) { $debug_text .= "<br /><br />$sql_store"; } if ( $err_line != '' && $err_file != '' ) { $debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file; } } // // If the header hasn't been output then do it // if ( !defined('HEADER_INC') && $msg_code != CRITICAL_ERROR ) { if ( empty($lang) ) { if ( !empty($board_config['default_lang']) ) { include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx); } else { include($phpbb_root_path . 'language/lang_english/lang_main.'.$phpEx); } } if ( empty($template) ) { $template = new Template($phpbb_root_path . 'templates/' . $board_config['board_template']); } if ( empty($theme) ) { $theme = setup_style($board_config['default_style']); } // // Load the Page Header // if ( !defined('IN_ADMIN') ) { include($phpbb_root_path . 'includes/page_header.'.$phpEx); } else { include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx); } } switch($msg_code) { case GENERAL_MESSAGE: if ( $msg_title == '' ) { $msg_title = 'General Message'; } break; case CRITICAL_MESSAGE: if ( $msg_title == '' ) { $msg_title = 'Important Message'; } break; case GENERAL_ERROR: if ( $msg_text == '' ) { $msg_text = 'General Error!'; } if ( $msg_title == '' ) { $msg_title = $lang['General_Error']; } case CRITICAL_ERROR: // // Critical errors mean we cannot rely on _ANY_ DB information being // available so we're going to dump out a simple echo'd statement // include($phpbb_root_path . 'language/lang_english/lang_main.'.$phpEx); if ( $msg_text == '' ) { $msg_text = $lang['A_critical_error']; } if ( $msg_title == '' ) { $msg_title = 'phpBB : <b>' . $lang['Critical_Error'] . '</b>'; } break; } // // Add on DEBUG info if we've enabled debug mode and this is an error. This // prevents debug info being output for general messages should DEBUG be // set TRUE by accident (preventing confusion for the end user!) // if ( DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) ) { if ( $debug_text != '' ) { $msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text; } } if ( $msg_code != CRITICAL_ERROR ) { if ( !empty($lang[$msg_text]) ) { $msg_text = $lang[$msg_text]; } if ( !defined('IN_ADMIN') ) { $template->set_filenames(array( 'message_body' => 'message_body.tpl') ); } else { $template->set_filenames(array( 'message_body' => 'admin/admin_message_body.tpl') ); } $template->assign_vars(array( 'MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text) ); $template->pparse('message_body'); if ( !defined('IN_ADMIN') ) { include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } else { include($phpbb_root_path . 'admin/page_footer_admin.'.$phpEx); } } else { echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>"; } exit; } ?> --- NEW FILE: page_header.php --- <?php /*************************************************************************** * page_header.php * ------------------- * begin : Tuesday, Aug 13, 2002 * copyright : (C) 2002 The meshDB Group * email : unl...@us... * * $Id: page_header.php,v 1.1 2002/08/14 03:49:18 unleaded Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if ( !defined('IN_MESHDB') ) { die("Hacking attempt"); } define('HEADER_INC', TRUE); // // Parse and show the overall header. // $template->set_filenames( array('overall_header' => 'overall_header.tpl') ); /* // // The following assigns all _common_ variables that may be used at any point // in a template. // $template->assign_vars(array( 'U_REGISTER' => append_sid('profile.'.$phpEx.'?mode=register'), 'U_PROFILE' => append_sid('profile.'.$phpEx.'?mode=editprofile'), 'T_SPAN_CLASS2' => $theme['span_class2'], 'T_SPAN_CLASS3' => $theme['span_class3'], 'NAV_LINKS' => $nav_links_html) ); */ header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0'); header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); $template->pparse('overall_header'); ?> --- NEW FILE: page_tail.php --- <?php /*************************************************************************** * page_tail.php * ------------------- * begin : Tuesday, Aug 13, 2002 * copyright : (C) 2002 The meshDB Group * email : unl...@us... * * $Id: page_tail.php,v 1.1 2002/08/14 03:49:18 unleaded Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if ( !defined('IN_MESHDB') ) { die("Hacking attempt"); } // // Show the overall footer. // $template->set_filenames(array( 'overall_footer' => 'overall_footer.tpl') ); $template->assign_vars(array( "MESHDB_VERSION" => '1.5') ); $template->pparse("overall_footer"); // // Output page creation time // $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); echo '<br /><center><font size="-2">Created this page in '. $totaltime .' seconds : ' . $db->num_queries . ' queries executed.</font></center>'; // // Close our DB connection. // $db->sql_close(); // // Leave Script // exit; ?> --- NEW FILE: template.php --- <?php /*************************************************************************** * template.php * ------------------- * begin : Saturday, Feb 13, 2001 * copyright : (C) 2001 The phpBB Group * email : su...@ph... * * $Id: template.php,v 1.1 2002/08/14 03:49:18 unleaded Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ /** * Template class. By Nathan Codding of the phpBB group. * The interface was originally inspired by PHPLib templates, * and the template file formats are quite similar. * */ class Template { var $classname = "Template"; // variable that holds all the data we'll be substituting into // the compiled templates. // ... // This will end up being a multi-dimensional array like this: // $this->_tpldata[block.][iteration#][child.][iteration#][child2.][iteration#][variablename] == value // if it's a root-level variable, it'll be like this: // $this->_tpldata[.][0][varname] == value var $_tpldata = array(); // Hash of filenames for each template handle. var $files = array(); // Root template directory. var $root = ""; // this will hash handle names to the compiled code for that handle. var $compiled_code = array(); // This will hold the uncompiled code for that handle. var $uncompiled_code = array(); /** * Constructor. Simply sets the root dir. * */ function Template($root = ".") { $this->set_rootdir($root); } /** * Destroys this template object. Should be called when you're done with it, in order * to clear out the template data so you can load/parse a new template set. */ function destroy() { $this->_tpldata = array(); } /** * Sets the template root directory for this Template object. */ function set_rootdir($dir) { if (!is_dir($dir)) { return false; } $this->root = $dir; return true; } /** * Sets the template filenames for handles. $filename_array * should be a hash of handle => filename pairs. */ function set_filenames($filename_array) { if (!is_array($filename_array)) { return false; } reset($filename_array); while(list($handle, $filename) = each($filename_array)) { $this->files[$handle] = $this->make_filename($filename); } return true; } /** * Load the file for the handle, compile the file, * and run the compiled code. This will print out * the results of executing the template. */ function pparse($handle) { if (!$this->loadfile($handle)) { die("Template->pparse(): Couldn't load template file for handle $handle"); } // actually compile the template now. if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle])) { // Actually compile the code now. $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]); } // Run the compiled code. eval($this->compiled_code[$handle]); return true; } /** * Inserts the uncompiled code for $handle as the * value of $varname in the root-level. This can be used * to effectively include a template in the middle of another * template. * Note that all desired assignments to the variables in $handle should be done * BEFORE calling this function. */ function assign_var_from_handle($varname, $handle) { if (!$this->loadfile($handle)) { die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle"); } // Compile it, with the "no echo statements" option on. $_str = ""; $code = $this->compile($this->uncompiled_code[$handle], true, '_str'); // evaluate the variable assignment. eval($code); // assign the value of the generated variable to the given varname. $this->assign_var($varname, $_str); return true; } /** * Block-level variable assignment. Adds a new block iteration with the given * variable assignments. Note that this should only be called once per block * iteration. */ function assign_block_vars($blockname, $vararray) { if (strstr($blockname, '.')) { // Nested block. $blocks = explode('.', $blockname); $blockcount = sizeof($blocks) - 1; $str = '$this->_tpldata'; for ($i = 0; $i < $blockcount; $i++) { $str .= '[\'' . $blocks[$i] . '.\']'; eval('$lastiteration = sizeof(' . $str . ') - 1;'); $str .= '[' . $lastiteration . ']'; } // Now we add the block that we're actually assigning to. // We're adding a new iteration to this block with the given // variable assignments. $str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;'; // Now we evaluate this assignment we've built up. eval($str); } else { // Top-level block. // Add a new iteration to this block with the variable assignments // we were given. $this->_tpldata[$blockname . '.'][] = $vararray; } return true; } /** * Root-level variable assignment. Adds to current assignments, overriding * any existing variable assignment with the same name. */ function assign_vars($vararray) { reset ($vararray); while (list($key, $val) = each($vararray)) { $this->_tpldata['.'][0][$key] = $val; } return true; } /** * Root-level variable assignment. Adds to current assignments, overriding * any existing variable assignment with the same name. */ function assign_var($varname, $varval) { $this->_tpldata['.'][0][$varname] = $varval; return true; } /** * Generates a full path+filename for the given filename, which can either * be an absolute name, or a name relative to the rootdir for this Template * object. */ function make_filename($filename) { // Check if it's an absolute or relative path. if (substr($filename, 0, 1) != '/') { $filename = $this->root . '/' . $filename; } if (!file_exists($filename)) { die("Template->make_filename(): Error - file $filename does not exist"); } return $filename; } /** * If not already done, load the file for the given handle and populate * the uncompiled_code[] hash with its code. Do not compile. */ function loadfile($handle) { // If the file for this handle is already loaded and compiled, do nothing. if (isset($this->uncompiled_code[$handle]) && !empty($this->uncompiled_code[$handle])) { return true; } // If we don't have a file assigned to this handle, die. if (!isset($this->files[$handle])) { die("Template->loadfile(): No file specified for handle $handle"); } $filename = $this->files[$handle]; $str = implode("", @file($filename)); if (empty($str)) { die("Template->loadfile(): File $filename for handle $handle is empty"); } $this->uncompiled_code[$handle] = $str; return true; } /** * Compiles the given string of code, and returns * the result in a string. * If "do_not_echo" is true, the returned code will not be directly * executable, but can be used as part of a variable assignment * for use in assign_code_from_handle(). */ function compile($code, $do_not_echo = false, $retvar = '') { // replace \ with \\ and then ' with \'. $code = str_replace('\\', '\\\\', $code); $code = str_replace('\'', '\\\'', $code); // change template varrefs into PHP varrefs // This one will handle varrefs WITH namespaces $varrefs = array(); preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs); $varcount = sizeof($varrefs[1]); for ($i = 0; $i < $varcount; $i++) { $namespace = $varrefs[1][$i]; $varname = $varrefs[3][$i]; $new = $this->generate_block_varref($namespace, $varname); $code = str_replace($varrefs[0][$i], $new, $code); } // This will handle the remaining root-level varrefs $code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . ( ( isset($this->_tpldata[\'.\'][0][\'\1\']) ) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\' ) . \'', $code); // Break it up into lines. $code_lines = explode("\n", $code); $block_nesting_level = 0; $block_names = array(); $block_names[0] = "."; // Second: prepend echo ', append ' . "\n"; to each line. $line_count = sizeof($code_lines); for ($i = 0; $i < $line_count; $i++) { $code_lines[$i] = chop($code_lines[$i]); if (preg_match('#<!-- BEGIN (.*?) -->#', $code_lines[$i], $m)) { $n[0] = $m[0]; $n[1] = $m[1]; // Added: dougk_ff7-Keeps templates from bombing if begin is on the same line as end.. I think. :) if ( preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $n) ) { $block_nesting_level++; $block_names[$block_nesting_level] = $m[1]; if ($block_nesting_level < 2) { // Block is not nested. $code_lines[$i] = '$_' . $a[1] . '_count = ( isset($this->_tpldata[\'' . $n[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $n[1] . '.\']) : 0;'; $code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)'; $code_lines[$i] .= "\n" . '{'; } else { // This block is nested. // Generate a namespace string for this block. $namespace = implode('.', $block_names); // strip leading period from root level.. $namespace = substr($namespace, 2); // Get a reference to the data array for this block that depends on the // current indices of all parent blocks. $varref = $this->generate_block_data_ref($namespace, false); // Create the for loop code to iterate over this block. $code_lines[$i] = '$_' . $a[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;'; $code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)'; $code_lines[$i] .= "\n" . '{'; } // We have the end of a block. unset($block_names[$block_nesting_level]); $block_nesting_level--; $code_lines[$i] .= '} // END ' . $n[1]; $m[0] = $n[0]; $m[1] = $n[1]; } else { // We have the start of a block. $block_nesting_level++; $block_names[$block_nesting_level] = $m[1]; if ($block_nesting_level < 2) { // Block is not nested. $code_lines[$i] = '$_' . $m[1] . '_count = ( isset($this->_tpldata[\'' . $m[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $m[1] . '.\']) : 0;'; $code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)'; $code_lines[$i] .= "\n" . '{'; } else { // This block is nested. // Generate a namespace string for this block. $namespace = implode('.', $block_names); // strip leading period from root level.. $namespace = substr($namespace, 2); // Get a reference to the data array for this block that depends on the // current indices of all parent blocks. $varref = $this->generate_block_data_ref($namespace, false); // Create the for loop code to iterate over this block. $code_lines[$i] = '$_' . $m[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;'; $code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)'; $code_lines[$i] .= "\n" . '{'; } } } else if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $m)) { // We have the end of a block. unset($block_names[$block_nesting_level]); $block_nesting_level--; $code_lines[$i] = '} // END ' . $m[1]; } else { // We have an ordinary line of code. if (!$do_not_echo) { $code_lines[$i] = 'echo \'' . $code_lines[$i] . '\' . "\\n";'; } else { $code_lines[$i] = '$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";'; } } } // Bring it back into a single string of lines of code. $code = implode("\n", $code_lines); return $code ; } /** * Generates a reference to the given variable inside the given (possibly nested) * block namespace. This is a string of the form: * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' * It's ready to be inserted into an "echo" line in one of the templates. * NOTE: expects a trailing "." on the namespace. */ function generate_block_varref($namespace, $varname) { // Strip the trailing period. $namespace = substr($namespace, 0, strlen($namespace) - 1); // Get a reference to the data block for this namespace. $varref = $this->generate_block_data_ref($namespace, true); // Prepend the necessary code to stick this in an echo line. // Append the variable reference. $varref .= '[\'' . $varname . '\']'; $varref = '\' . ( ( isset(' . $varref . ') ) ? ' . $varref . ' : \'\' ) . \''; return $varref; } /** * Generates a reference to the array of data values for the given * (possibly nested) block namespace. This is a string of the form: * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] * * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. * NOTE: does not expect a trailing "." on the blockname. */ function generate_block_data_ref($blockname, $include_last_iterator) { // Get an array of the blocks involved. $blocks = explode(".", $blockname); $blockcount = sizeof($blocks) - 1; $varref = '$this->_tpldata'; // Build up the string with everything but the last child. for ($i = 0; $i < $blockcount; $i++) { $varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]'; } // Add the block reference for the last child. $varref .= '[\'' . $blocks[$blockcount] . '.\']'; // Add the iterator for the last child if requried. if ($include_last_iterator) { $varref .= '[$_' . $blocks[$blockcount] . '_i]'; } return $varref; } } ?> |
From: <unl...@us...> - 2002-08-14 03:49:21
|
Update of /cvsroot/meshdb/www/deal/templates In directory usw-pr-cvs1:/tmp/cvs-serv14497/templates Added Files: index_page.tpl overall_footer.tpl overall_header.tpl stylesheet.css Log Message: OK. This is the new code for the deal system, basically this is the framework of how the system will work, with db abstraction, templating and files broken up to handle each respective bit. The current code does not do anything, it simple prints a header, foo, and footer, but when it does that it is connecting to the DB, loading the templating system. What has to happen now is the functions/system from index-conv.php (the old index) to be re-imploemented in the new framework. --- NEW FILE: index_page.tpl --- {MESSAGE} <br /><br /> {MESSAGE2} --- NEW FILE: overall_footer.tpl --- <hr> <p class="minor"> Technical enquiries about this web site should be directed to <a href="mailto:david.leonard+meshweb@itee.uq.edu.au">David Leonard</a>. <br> Web site kindly hosted by the <a href="/">Dept of Information Technology & Electrical Engineering, UQ</a>. <br> <a href="logo/">Logo</a> designed by Matt Gleeson. </p> </body> </html> --- NEW FILE: overall_header.tpl --- <html> <head> <link rel="stylesheet" href="templates/stylesheet.css" type="text/css"> <title>Retail prices database</title> </head> <body> <img align=center src="../img/mesh-small.gif" width=107 height=68 alt="Brisbane Mesh"> <h1>Retail prices database</h1> --- NEW FILE: stylesheet.css --- h1 { font-family: Helvetica; } h2 { font-family: Helvetica; } body { background: white; } table { border-style: hidden } td.figure { text-align: center; } td.caption { font-size: smaller; font-family: Helvetica; text-align: center; } td.desc { font-style: italic; font-family: Helvetica; font-size: smaller; text-align: center; } th { text-align: left; } th.major { font-weight: bold; font-family: Helvetica; background: yellow; } th.minor { font-weight: bold; font-family: Helvetica; font-size: smaller; background: silver; } table.figure { border: solid; float: right; caption-side: bottom; } table.figure caption { font-size: smaller; font-style: italic; } td[status="full"] { foreground: green; } td[status="test"] { foreground: lime; } td[status="build"] { foreground: maroon; } td[status="gather"] { foreground: brown; } td[status="waiting"] { foreground: black; } td[status="interest"] { foreground: gray; } span.tbd { font-style: italic; font-size: smaller; color: gray; } table.aside { width: 50%; float: right; } table.aside td { background: rgb(95%, 95%, 95%); } table.aside p { font-size: smaller; } strong.matched { background: yellow; } p.minor { font-size: smaller; color: gray; } td.minqty { text-align: right; } td.unitprice { text-align: right; font-weight: bold; } td.expires { text-align: center; } td.delete { text-align: center; } td.delete a { color: red; } td.note { font-style: italic; font-family: Helvetica; font-size: smaller; text-align: center; } |
From: <unl...@us...> - 2002-08-14 03:49:21
|
Update of /cvsroot/meshdb/www/deal/db/schema In directory usw-pr-cvs1:/tmp/cvs-serv14497/db/schema Added Files: deal.sql Log Message: OK. This is the new code for the deal system, basically this is the framework of how the system will work, with db abstraction, templating and files broken up to handle each respective bit. The current code does not do anything, it simple prints a header, foo, and footer, but when it does that it is connecting to the DB, loading the templating system. What has to happen now is the functions/system from index-conv.php (the old index) to be re-imploemented in the new framework. --- NEW FILE: deal.sql --- # Host: localhost # Generation Time: Aug 11, 2002 at 04:32 # Server version: 3.23.49 # PHP Version: 4.1.2 # Database : `meshdb` # -------------------------------------------------------- # # Table structure for table `deal` # DROP TABLE IF EXISTS deal; CREATE TABLE deal ( deal_id mediumint(9) NOT NULL auto_increment, vendor_id mediumint(9) NOT NULL default '0', product_id mediumint(9) NOT NULL default '0', deal_minimum_quantity smallint(6) NOT NULL default '0', deal_unit_price float NOT NULL default '0', deal_spotted int(11) unsigned NOT NULL default '0', deal_expires int(11) unsigned NOT NULL default '0', deal_spotter varchar(255) default NULL, deal_description text, deal_key varchar(16) NOT NULL default '', deal_url varchar(255) default NULL, deal_status tinyint(1) NOT NULL default '1', PRIMARY KEY (deal_id) ) TYPE=MyISAM; # -------------------------------------------------------- # # Table structure for table `donation` # DROP TABLE IF EXISTS donation; CREATE TABLE donation ( donation_id mediumint(9) NOT NULL auto_increment, donation_class varchar(255) default NULL, donation_description text, donation_description_url varchar(255) default NULL, donation_donator varchar(255) default NULL, donation_donator_email varchar(255) default NULL, donation_donator_url varchar(255) default NULL, donation_donated_when int(11) unsigned NOT NULL default '0', donation_user varchar(255) default NULL, donation_user_email varchar(255) default NULL, donation_user_url varchar(255) default NULL, donation_user_used int(11) unsigned NOT NULL default '0', donation_user_lost int(11) unsigned NOT NULL default '0', donation_status tinyint(1) NOT NULL default '1', PRIMARY KEY (donation_id) ) TYPE=MyISAM; # -------------------------------------------------------- # # Table structure for table `product` # DROP TABLE IF EXISTS product; CREATE TABLE product ( product_id mediumint(9) NOT NULL auto_increment, product_class varchar(255) default NULL, product_name varchar(255) default NULL, product_url varchar(255) default NULL, product_manufacturer varchar(255) default NULL, product_description text, PRIMARY KEY (product_id) ) TYPE=MyISAM; # -------------------------------------------------------- # # Table structure for table `vendor` # DROP TABLE IF EXISTS vendor; CREATE TABLE vendor ( vendor_id mediumint(9) NOT NULL auto_increment, vendor_name varchar(255) default NULL, vendor_url varchar(255) default NULL, PRIMARY KEY (vendor_id) ) TYPE=MyISAM; |
From: <unl...@us...> - 2002-08-14 03:49:21
|
Update of /cvsroot/meshdb/www/deal In directory usw-pr-cvs1:/tmp/cvs-serv14497 Added Files: common.php config.php extension.inc index-conv.php Log Message: OK. This is the new code for the deal system, basically this is the framework of how the system will work, with db abstraction, templating and files broken up to handle each respective bit. The current code does not do anything, it simple prints a header, foo, and footer, but when it does that it is connecting to the DB, loading the templating system. What has to happen now is the functions/system from index-conv.php (the old index) to be re-imploemented in the new framework. --- NEW FILE: common.php --- <?php /*************************************************************************** * common.php * ------------------- * begin : Sunday, Jun 24, 2002 * copyright : (C) 2002 The meshDB Group * email : unl...@us... * * $Id: common.php,v 1.1 2002/08/14 03:49:17 unleaded Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if ( !defined('IN_MESHDB') ) { die("Hacking attempt"); } error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables set_magic_quotes_runtime(0); // Disable magic_quotes_runtime // // addslashes to vars if magic_quotes_gpc is off // this is a security precaution to prevent someone // trying to break out of a SQL statement. // if( !get_magic_quotes_gpc() ) { if( is_array($_GET) ) { while( list($k, $v) = each($_GET) ) { if( is_array($_GET[$k]) ) { while( list($k2, $v2) = each($_GET[$k]) ) { $_GET[$k][$k2] = addslashes($v2); } @reset($_GET[$k]); } else { $_GET[$k] = addslashes($v); } } @reset($_GET); } if( is_array($_POST) ) { while( list($k, $v) = each($_POST) ) { if( is_array($_POST[$k]) ) { while( list($k2, $v2) = each($_POST[$k]) ) { $_POST[$k][$k2] = addslashes($v2); } @reset($_POST[$k]); } else { $_POST[$k] = addslashes($v); } } @reset($_POST); } if( is_array($_COOKIE) ) { while( list($k, $v) = each($_COOKIE) ) { if( is_array($_COOKIE[$k]) ) { while( list($k2, $v2) = each($_COOKIE[$k]) ) { $_COOKIE[$k][$k2] = addslashes($v2); } @reset($_COOKIE[$k]); } else { $_COOKIE[$k] = addslashes($v); } } @reset($_COOKIE); } } // // Include system configuration // @include('./config.'.$phpEx); include('./includes/constants.'.$phpEx); // System constants include('./includes/template.'.$phpEx); // Templating Code include('./includes/functions.'.$phpEx); // Gen functions include('./includes/db.'.$phpEx); // Connection to DB // // Create new template // $template = new Template('./templates/', $db); ?> --- NEW FILE: config.php --- <?php // // Configuration file. // Make necessary changes here. // // // DBMS Selection for abstraction: // // Choices available are (in exact case); // mysql // mysql4 // postgres // mssql // oracle // msaccess // mssql-odbc $dbms = "mysql"; $dbhost = "localhost"; $dbname = "meshdb"; $dbuser = "root"; $dbpasswd = ""; ?> --- NEW FILE: extension.inc --- <?php /*************************************************************************** * extension.inc * ------------------- * begin : Sunday, Jun 24, 2002 * copyright : (C) 2002 The meshDB Group * email : unl...@us... * * $Id: extension.inc,v 1.1 2002/08/14 03:49:17 unleaded Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ // // Change this if your extension is not .php! // $phpEx = "php"; // // For debug timing // $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; ?> --- NEW FILE: index-conv.php --- <? include "../db2/config.php"; #CVS comment function quote($s) { if ($s == "") return "null"; else return "'".mysql_escape_string($s)."'"; } /* * This is the crypt of a special password that allows * any entry to be deleted */ $override = quote("WBd2KrCxDrnRU"); if ($op == "deletedeal" && !isset($PHP_AUTH_USER)) { $id = intval($id); Header("WWW-Authenticate: Basic realm=\"MeshRetailPricesDelete$id\""); Header("HTTP/1.0 401 Unauthorized"); echo "<html><body><p>Enter the password stored when the deal entry was created, or the special override password. The username is ignored.</p></body></html>\n"; exit; } $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); mysql_select_db($MYSQLDB, $db) or die(mysql_error($db)); if ($op == "deletedeal") { $id = intval($id); if ($password == "null") { $result = mysql_query("DELETE FROM deal" ." WHERE id = $id AND keypass is null" , $db) or die(mysql_error($db)); } else { $password = quote($PHP_AUTH_PW); $result = mysql_query("DELETE FROM deal" ." WHERE id = $id AND (keypass = encrypt($password, keypass) OR $override = encrypt($password, $override))" , $db) or die(mysql_error($db)); } if (mysql_affected_rows($db) == 0) { Header("WWW-Authenticate: Basic realm=\"MeshRetailPricesDelete$id\""); Header("HTTP/1.0 401 Unauthorized"); echo "<html><body><h1>Password incorrect</h1><p>Enter the password stored when deal number $id was created, or the special override password. The username is ignored.</p></body></html>\n"; exit; } } ?> <html> <head> <link rel="stylesheet" href="../style.css" type="text/css"> <title>Retail prices database</title> <style type="text/css"> td.minqty { text-align: right; } td.unitprice { text-align: right; font-weight: bold; } td.expires { text-align: center; } td.delete { text-align: center; } td.delete a { color: red; } td.note { font-style: italic; font-family: Helvetica; font-size: smaller; text-align: center; } </style> </head> <body> <img align=center src="../img/mesh-small.gif" width=107 height=68 alt="Brisbane Mesh"> <h1>Retail prices database</h1> <? if ($op == "newdeal") { $vendorid = intval($vendorid); $productid = intval($productid); $minqty = intval($minqty); $unitprice = doubleval($unitprice); $expirein = intval($expirein); $note = quote($note); $spotter = quote($spotter); $password = quote($password); $url = quote($url); $result = mysql_query("SELECT count(*) FROM vendor WHERE id=$vendorid", $db) or die(mysql_error($db)); $row = mysql_fetch_row($result); if (intval($row[0]) != 1) die("invalid vendorid $vendorid"); $result = mysql_query("SELECT count(*) FROM product WHERE id=$productid", $db) or die(mysql_error($db)); $row = mysql_fetch_row($result); if (intval($row[0]) != 1) die("invalid productid $productid"); if ($spotter == "null") die("spotter name cannot be empty"); if ($unitprice <= 0) die("unitprice must be a positive number"); if ($minqty <= 0) die("minqty must be a positive integer"); if ($expirein <= 0) die("expirein must be a positive integer"); if ($expirein > 365) $expirein = 365; if ($url != "null" && !parse_url($url)) die("invalid url"); $result = mysql_query("INSERT INTO deal SET" ." vendorid=$vendorid" .", productid=$productid" .", minqty=$minqty" .", unitprice=$unitprice" .", spotted=NOW()" .", expires=DATE_ADD(NOW(), INTERVAL $expirein DAY)" .", spotter=$spotter" .", note=$note" .", url=$url" .($password == "null" ? "" : ", keypass=encrypt($password)") , $db) or die(mysql_error($db)); } if ($op == "newvendor") { $nameh = htmlspecialchars($name); $name = quote($name); $url = quote($url); if ($name == "null") die("vendor name cannot be empty"); if ($url == "null" || $url == "'http://'") die("vendor url cannot be empty"); $result = mysql_query("SELECT * FROM vendor WHERE" ." name=$name"); if (mysql_num_rows($result) > 0) die("Already a vendor with that name!"); $result = mysql_query("INSERT INTO vendor SET" ." name=$name, url=$url" , $db) or die(mysql_error($db)); echo "<p>New vendor $nameh added</p>"; } if ($op == "newproduct") { $nameh = htmlspecialchars($name); $class = quote($class); $name = quote($name); $url = quote($url); $manuf = quote($manuf); $description = quote($description); if ($class == "null") die("product class cannot be empty"); if ($name == "null") die("product name cannot be empty"); if ($url == "null" || $url == "'http://'") die("product url cannot be empty"); if ($manuf == "null") die("manufacturer cannot be empty"); $result = mysql_query("SELECT * FROM product WHERE" ." name=$name AND class=$class AND manuf=$manuf"); if (mysql_num_rows($result) > 0) die("Already a product with that name, class and manufacturer!"); $result = mysql_query("INSERT INTO product SET" ." name=$name, url=$url, class=$class, manuf=$manuf" .", description=$description" , $db) or die(mysql_error($db)); echo "<p>New product $nameh added</p>"; } ?> <p> This is a user-contributed database of component prices that people have spotted in Australia. If you know of a great deal, or the price of a component that other people might be interested in, add it! </p> <p>See also: <ul> <li><a href="http://www.wireless.org.au/tib/">The Incredible Bulk</a> - bulk orders organised by Melbourne Wireless </ul> </p> <p> The table below is sorted by class, and then by price. </p> <table> <tr><th class="major" colspan=10>Current Deals</th></tr> <tr> <? $cols = array("class","item","oem","unitprice","minqty","vendor", "spotter","expires","note"); foreach ($cols as $col) { ?> <th class="minor"><?=$col?></th> <? } ?> <th class="minor">delete</th> </tr> <? $result = mysql_query("SELECT " ." deal.id AS id" .", product.class AS class" .", product.name AS item" .", product.url AS producturl" .", product.manuf AS oem" .", unitprice" .", minqty" .", vendor.name AS vendor" .", vendor.url AS vendorurl" .", spotter" .", DATE_FORMAT(expires, '%e %b') AS expires" .", note" .", deal.url AS url" .", TO_DAYS(deal.expires - NOW()) AS days_left" ." FROM product, vendor, deal" ." WHERE product.id = deal.productid" .(!$noexpire?" AND deal.expires > NOW()": "") ." AND vendor.id = deal.vendorid" ." ORDER BY class, unitprice, expires" , $db) or die(mysql_error($db)); $lastclass = ""; while ($row = mysql_fetch_assoc($result)) { ?> <tr> <? foreach($cols as $col) { ?> <td class="<?=$col?>"><? $v = htmlspecialchars($row[$col]); if ($col == "unitprice") { $v = sprintf("$%.2f", $row[$col]); if ($row["url"]) $v = "<a href=\"".$row["url"]."\">".$v."</a>"; } if ($col == "item") { $u = htmlspecialchars($row["producturl"]); ?> <a href="<?=$u?>"><?=$v?></a> <? } else if ($col == "vendor") { $u = htmlspecialchars($row["vendorurl"]); ?> <a href="<?=$u?>"><?=$v?></a> <? } else if ($col == "class") { if ($v != $lastclass) { $lastclass = $v; echo $v; } else { echo """; } } else if ($col == "expires" && $row["days_left"] <= 0) { echo "<font color=\"red\">$v</font>"; } else { echo $v; } ?></td> <? } ?> <td class="delete"><a href="index.php?op=deletedeal&id=<?=$row["id"]?>">x</a></td> </tr> <? } ?> </table> <? if (!$noexpire) { ?> <p><a href="?noexpire=1">Show expired deals as well</a>.</p> <? } ?> <h2>Add a new deal</h2> <form method=post> <p> So, you've spotted a deal that's not in the table above. Please enter all the details into the form below. When you submit, it will appear above. </p> <table> <tr><th>Vendor:</th> <td><select name="vendorid"> <option value=""></option> <? $result = mysql_query("SELECT id, name FROM vendor WHERE url IS NOT NULL ORDER BY name", $db) or die(mysql_error($db)); while ($row = mysql_fetch_assoc($result)) { ?> <option value="<?=$row["id"]?>"><?=$row["name"]?></option> <? } ?> </select> (<a href="#addvendor">Add vendor to list</a>)</td></tr> <tr><th>Product:</th> <td><select name="productid"> <option value=""></option> <? $curclass = ""; $result = mysql_query("SELECT id, class, manuf, name FROM product WHERE url IS NOT NULL ORDER BY class, manuf, name", $db) or die(mysql_error($db)); while ($row = mysql_fetch_assoc($result)) { if ($curclass != $row["class"]) { $curclass = $row["class"]; ?> <option value="class">=== <?=$curclass?> ===</option> <? } ?> <option value="<?=$row["id"]?>"><?=htmlspecialchars($row["manuf"].' '.$row["name"])?></option> <? } ?> </select> (<a href="#addproduct">Add product to list</a>)</td></tr> <tr><th>Unit price (AUD$):</th> <td><input name="unitprice"> <br><i>include GST and estimated shipping cost!</i></td></tr> <tr><th>Minimum Qty:</th> <td><input name="minqty" value="1"></td></tr> <tr><th>Spotter (you):</th> <td><input name="spotter"></td></tr> <tr><th>Expires:</th> <td><select name="expirein"> <option value="1">tomorrow</option> <option value="7">in 1 week</option> <option value="14">in 2 weeks</option> <option value="21">in 3 weeks</option> <option value="31" selected>in 1 month</option> <option value="62">in 2 months</option> <option value="182">in 6 months</option> <option value="365">in 1 year (are you sure?)</option> </select></td></tr> <tr><th>URL:</th> <td><input name="note"> <br><i> an optional URL to a web page describing the sale offer </i></td></tr> <tr><th>Special notes:</th> <td><input name="note"></td></tr> <tr><th>Password:</th> <td><input name="password" type=password><br> <i>(used when deleting)</i></td></tr> <tr><td></td> <td><input type=hidden name="op" value="newdeal"> <input type=submit value="Create deal"></td> </table> </form> <hr> <h2><a name="addvendor">Add vendor</a></h2> <form method=post> <p> A vendor is someone who sells things to the public. (Some people call them retailers.) Use this form to add to the list of known vendors. </p> <table> <tr><th>Vendor's short name:</th> <td><input name="name"></td></tr> <tr><th>URL to vendor's details:</th> <td><input name="url" value="http://"><br> <i>This URL should show contact details for the vendor</i> </td></tr> <tr><td></td> <td><input type=hidden name="op" value="newvendor"> <input type=submit value="Add vendor"></td> </table> </form> <table><tr><th class="major">Known vendors</th></tr> <tr><th class="minor">name</th></tr> <? $result = mysql_query("SELECT name, url FROM vendor WHERE url IS NOT NULL ORDER BY name", $db) or die(mysql_error($db)); $comma = ""; while ($row = mysql_fetch_assoc($result)) { ?> <tr><td><a href="<?=htmlspecialchars($row["url"])?>"><?=htmlspecialchars($row["name"])?></a></td></tr> <? } ?> </table> <hr> <h2><a name="addproduct">Add product</a></h2> <form method=post> <p> Use this form to add to the list of known products. Please only add gear to do with low-cost wireless networking activities. (i.e. I cull entries regarding CPUs, digital cameras etc.) </p> <table> <tr><th>Product class:</th> <td><select name="class"> <? $classes = array("card", "AP", "adaptor", "periph", "cable", "antenna", "diy", "other"); foreach ($classes as $class) { ?> <option value="<?=$class?>"><?=$class?></option> <? } ?> </select></td></tr> <tr><th>Manufacturer (OEM):</th> <td><input name="manuf"><br> <i>Try to use a single word for the OEM/manufacturer (eg IBM)</i> </td></tr> <tr><th>Product short name:</th> <td><input name="name"><br> <i>Try to use the manufacturer's unique product code (eg MA401)</i> </td></tr> <tr><th>Product long name:</th> <td><input name="description"><br> <i>Product's packaging name, without manufacturer name (eg NetBlaster II)</i> </td></tr> <tr><th>URL to product details:</th> <td><input name="url" value="http://"><br> <i>This URL should show the original manufacturer's technical specs on the actual device</i> </td></tr> <tr><td></td> <td><input type=hidden name="op" value="newproduct"> <input type=submit value="Add product"></td> </table></form> <table><tr><th class="major" colspan=4>Known products</th></tr> <tr><th class="minor">class</th> <th class="minor">oem</th> <th class="minor">name</th> <th class="minor">description</th> </tr> <? $result = mysql_query("SELECT id, name, manuf, url, class, description FROM product WHERE url IS NOT NULL ORDER BY class, manuf, name", $db) or die(mysql_error($db)); $lastclass = "?"; while ($row = mysql_fetch_assoc($result)) { $class = htmlspecialchars($row["class"]); $oem = htmlspecialchars($row["manuf"]); $url = htmlspecialchars($row["url"]); $name = htmlspecialchars($row["name"]); $desc = htmlspecialchars($row["description"]); if ($class == $lastclass) $class = " "; else $lastclass = $class; ?> <tr><td><?=$class?></td> <td><?=$oem?></td> <td><a href="<?=$row["url"]?>"><?=$row["name"]?></a></td> <td><?=$desc?></td> </tr> <? } if ($class != "") { echo "</p>\n"; } ?> </table> <hr> <p> <a href="..">Brisbane Mesh</a> <br> Any questions? Did you stuff something up? Is something wrong? Contact <a href="mailto:d+meshretail@itee.uq.edu.au">David Leonard</a>. Periodically, he goes through this page and tidies up anyway, but is happier if you send him a note when you notice something's gone awry. </p> </body> </html> |
From: <unl...@us...> - 2002-08-14 03:44:34
|
Update of /cvsroot/meshdb/www/deal/db/schema In directory usw-pr-cvs1:/tmp/cvs-serv13132/db/schema Log Message: Directory /cvsroot/meshdb/www/deal/db/schema added to the repository |
From: <unl...@us...> - 2002-08-14 03:43:40
|
Update of /cvsroot/meshdb/www/deal/templates In directory usw-pr-cvs1:/tmp/cvs-serv12798/templates Log Message: Directory /cvsroot/meshdb/www/deal/templates added to the repository |
From: <unl...@us...> - 2002-08-14 03:43:40
|
Update of /cvsroot/meshdb/www/deal/includes In directory usw-pr-cvs1:/tmp/cvs-serv12798/includes Log Message: Directory /cvsroot/meshdb/www/deal/includes added to the repository |
From: <unl...@us...> - 2002-08-14 03:43:40
|
Update of /cvsroot/meshdb/www/deal/db In directory usw-pr-cvs1:/tmp/cvs-serv12798/db Log Message: Directory /cvsroot/meshdb/www/deal/db added to the repository |
From: <unl...@us...> - 2002-08-14 03:39:09
|
Update of /cvsroot/meshdb/www/deal In directory usw-pr-cvs1:/tmp/cvs-serv11076 Modified Files: index.php Log Message: Commit the NEW code layout, base system for the to-be re-written deal system. Some major changes here. Database Abstraction Templating, etc.. The system is broken up into multiple files. Index: index.php =================================================================== RCS file: /cvsroot/meshdb/www/deal/index.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- index.php 10 Aug 2002 14:10:59 -0000 1.3 +++ index.php 14 Aug 2002 03:39:06 -0000 1.4 @@ -1,467 +1,65 @@ -<? - include "../db2/config.php"; - - #CVS comment - function quote($s) { - if ($s == "") return "null"; - else return "'".mysql_escape_string($s)."'"; - } - - /* - * This is the crypt of a special password that allows - * any entry to be deleted - */ - $override = quote("WBd2KrCxDrnRU"); - - if ($op == "deletedeal" && !isset($PHP_AUTH_USER)) { - $id = intval($id); - Header("WWW-Authenticate: Basic realm=\"MeshRetailPricesDelete$id\""); - Header("HTTP/1.0 401 Unauthorized"); - echo "<html><body><p>Enter the password stored when the deal entry was created, or the special override password. The username is ignored.</p></body></html>\n"; - exit; - } - - $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); - mysql_select_db($MYSQLDB, $db) or die(mysql_error($db)); - - if ($op == "deletedeal") { - $id = intval($id); - if ($password == "null") { - $result = mysql_query("DELETE FROM deal" - ." WHERE id = $id AND keypass is null" - , $db) - or die(mysql_error($db)); - } else { - $password = quote($PHP_AUTH_PW); - $result = mysql_query("DELETE FROM deal" - ." WHERE id = $id AND (keypass = encrypt($password, keypass) OR $override = encrypt($password, $override))" - , $db) - or die(mysql_error($db)); - } - if (mysql_affected_rows($db) == 0) { - Header("WWW-Authenticate: Basic realm=\"MeshRetailPricesDelete$id\""); - Header("HTTP/1.0 401 Unauthorized"); - echo "<html><body><h1>Password incorrect</h1><p>Enter the password stored when deal number $id was created, or the special override password. The username is ignored.</p></body></html>\n"; - exit; - } - } - -?> - -<html> -<head> -<link rel="stylesheet" href="../style.css" type="text/css"> -<title>Retail prices database</title> -<style type="text/css"> - td.minqty { text-align: right; } - td.unitprice { text-align: right; - font-weight: bold; } - td.expires { text-align: center; } - td.delete { text-align: center; } - td.delete a { color: red; } - td.note { font-style: italic; - font-family: Helvetica; - font-size: smaller; - text-align: center; } -</style> -</head> -<body> -<img align=center src="../img/mesh-small.gif" - width=107 height=68 alt="Brisbane Mesh"> -<h1>Retail prices database</h1> - -<? - - if ($op == "newdeal") { - $vendorid = intval($vendorid); - $productid = intval($productid); - $minqty = intval($minqty); - $unitprice = doubleval($unitprice); - $expirein = intval($expirein); - $note = quote($note); - $spotter = quote($spotter); - $password = quote($password); - $url = quote($url); - - $result = mysql_query("SELECT count(*) FROM vendor WHERE id=$vendorid", $db) or die(mysql_error($db)); - $row = mysql_fetch_row($result); - if (intval($row[0]) != 1) - die("invalid vendorid $vendorid"); - - $result = mysql_query("SELECT count(*) FROM product WHERE id=$productid", $db) or die(mysql_error($db)); - $row = mysql_fetch_row($result); - if (intval($row[0]) != 1) - die("invalid productid $productid"); - - if ($spotter == "null") - die("spotter name cannot be empty"); - - if ($unitprice <= 0) - die("unitprice must be a positive number"); - if ($minqty <= 0) - die("minqty must be a positive integer"); - if ($expirein <= 0) - die("expirein must be a positive integer"); - if ($expirein > 365) - $expirein = 365; - if ($url != "null" && !parse_url($url)) - die("invalid url"); - - $result = mysql_query("INSERT INTO deal SET" - ." vendorid=$vendorid" - .", productid=$productid" - .", minqty=$minqty" - .", unitprice=$unitprice" - .", spotted=NOW()" - .", expires=DATE_ADD(NOW(), INTERVAL $expirein DAY)" - .", spotter=$spotter" - .", note=$note" - .", url=$url" - .($password == "null" - ? "" - : ", keypass=encrypt($password)") - , $db) or die(mysql_error($db)); - } - - if ($op == "newvendor") { - $nameh = htmlspecialchars($name); - $name = quote($name); - $url = quote($url); - if ($name == "null") - die("vendor name cannot be empty"); - if ($url == "null" || $url == "'http://'") - die("vendor url cannot be empty"); - - $result = mysql_query("SELECT * FROM vendor WHERE" - ." name=$name"); - if (mysql_num_rows($result) > 0) - die("Already a vendor with that name!"); - - $result = mysql_query("INSERT INTO vendor SET" - ." name=$name, url=$url" - , $db) or die(mysql_error($db)); - - echo "<p>New vendor $nameh added</p>"; - } - - if ($op == "newproduct") { - $nameh = htmlspecialchars($name); - $class = quote($class); - $name = quote($name); - $url = quote($url); - $manuf = quote($manuf); - $description = quote($description); - if ($class == "null") - die("product class cannot be empty"); - if ($name == "null") - die("product name cannot be empty"); - if ($url == "null" || $url == "'http://'") - die("product url cannot be empty"); - if ($manuf == "null") - die("manufacturer cannot be empty"); - - $result = mysql_query("SELECT * FROM product WHERE" - ." name=$name AND class=$class AND manuf=$manuf"); - if (mysql_num_rows($result) > 0) - die("Already a product with that name, class and manufacturer!"); - - $result = mysql_query("INSERT INTO product SET" - ." name=$name, url=$url, class=$class, manuf=$manuf" - .", description=$description" - , $db) or die(mysql_error($db)); - - echo "<p>New product $nameh added</p>"; - } -?> - -<p> -This is a user-contributed database of component prices that people have -spotted in Australia. -If you know of a great deal, or the price of a -component that other people might be interested in, add it! -</p> - -<p>See also: -<ul> -<li><a href="http://www.wireless.org.au/tib/">The Incredible Bulk</a> - - bulk orders organised by Melbourne Wireless -</ul> -</p> - -<p> -The table below is sorted by class, and then by price. -</p> - -<table> -<tr><th class="major" colspan=10>Current Deals</th></tr> -<tr> -<? $cols = array("class","item","oem","unitprice","minqty","vendor", - "spotter","expires","note"); - foreach ($cols as $col) { ?> - <th class="minor"><?=$col?></th> -<? } ?> - <th class="minor">delete</th> - </tr> -<? - $result = mysql_query("SELECT " - ." deal.id AS id" - .", product.class AS class" - .", product.name AS item" - .", product.url AS producturl" - .", product.manuf AS oem" - .", unitprice" - .", minqty" - .", vendor.name AS vendor" - .", vendor.url AS vendorurl" - .", spotter" - .", DATE_FORMAT(expires, '%e %b') AS expires" - .", note" - .", deal.url AS url" - .", TO_DAYS(deal.expires - NOW()) AS days_left" - ." FROM product, vendor, deal" - ." WHERE product.id = deal.productid" - .(!$noexpire?" AND deal.expires > NOW()": "") - ." AND vendor.id = deal.vendorid" - ." ORDER BY class, unitprice, expires" - , $db) or die(mysql_error($db)); - $lastclass = ""; - while ($row = mysql_fetch_assoc($result)) { ?> - <tr> -<? - foreach($cols as $col) { ?> -<td class="<?=$col?>"><? - $v = htmlspecialchars($row[$col]); - if ($col == "unitprice") { - $v = sprintf("$%.2f", $row[$col]); - if ($row["url"]) - $v = "<a href=\"".$row["url"]."\">".$v."</a>"; - } - if ($col == "item") { - $u = htmlspecialchars($row["producturl"]); ?> - <a href="<?=$u?>"><?=$v?></a> -<? } - else if ($col == "vendor") { - $u = htmlspecialchars($row["vendorurl"]); ?> - <a href="<?=$u?>"><?=$v?></a> -<? } - else if ($col == "class") { - if ($v != $lastclass) { - $lastclass = $v; - echo $v; - } else { - echo """; - } - } - else if ($col == "expires" && $row["days_left"] <= 0) { - echo "<font color=\"red\">$v</font>"; - } - else { - echo $v; - } ?></td> -<? } ?> - <td class="delete"><a href="index.php?op=deletedeal&id=<?=$row["id"]?>">x</a></td> - </tr> -<? } ?> -</table> - -<? if (!$noexpire) { ?> -<p><a href="?noexpire=1">Show expired deals as well</a>.</p> -<? } ?> - -<h2>Add a new deal</h2> - -<form method=post> - -<p> -So, you've spotted a deal that's not in the table above. -Please enter all the details into the form below. -When you submit, it will appear above. -</p> - -<table> - - <tr><th>Vendor:</th> - <td><select name="vendorid"> - <option value=""></option> -<? - $result = mysql_query("SELECT id, name FROM vendor WHERE url IS NOT NULL ORDER BY name", $db) - or die(mysql_error($db)); - while ($row = mysql_fetch_assoc($result)) { ?> - <option value="<?=$row["id"]?>"><?=$row["name"]?></option> -<? } ?> - </select> (<a href="#addvendor">Add vendor to list</a>)</td></tr> - - <tr><th>Product:</th> - <td><select name="productid"> - <option value=""></option> -<? - $curclass = ""; - $result = mysql_query("SELECT id, class, manuf, name FROM product WHERE url IS NOT NULL ORDER BY class, manuf, name", $db) - or die(mysql_error($db)); - while ($row = mysql_fetch_assoc($result)) { - if ($curclass != $row["class"]) { - $curclass = $row["class"]; ?> - <option value="class">=== <?=$curclass?> ===</option> -<? } ?> - <option value="<?=$row["id"]?>"><?=htmlspecialchars($row["manuf"].' '.$row["name"])?></option> -<? } ?> - </select> (<a href="#addproduct">Add product to list</a>)</td></tr> - - <tr><th>Unit price (AUD$):</th> - <td><input name="unitprice"> - <br><i>include GST and estimated shipping cost!</i></td></tr> +<?php +/*************************************************************************** + * index.php + * ------------------- + * begin : Sunday, Jun 24, 2002 + * copyright : (C) 2002 The meshDB Group + * email : unl...@us... + * notes : Deals with index page. + * + * $Id$ + * + * + ***************************************************************************/ - <tr><th>Minimum Qty:</th> - <td><input name="minqty" value="1"></td></tr> +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ - <tr><th>Spotter (you):</th> - <td><input name="spotter"></td></tr> +// Page Init +define('IN_MESHDB', true); - <tr><th>Expires:</th> - <td><select name="expirein"> - <option value="1">tomorrow</option> - <option value="7">in 1 week</option> - <option value="14">in 2 weeks</option> - <option value="21">in 3 weeks</option> - <option value="31" selected>in 1 month</option> - <option value="62">in 2 months</option> - <option value="182">in 6 months</option> - <option value="365">in 1 year (are you sure?)</option> - </select></td></tr> +include('./extension.inc'); +include('./common.'.$phpEx); - <tr><th>URL:</th> - <td><input name="note"> - <br><i> - an optional URL to a web page describing the sale offer - </i></td></tr> - <tr><th>Special notes:</th> - <td><input name="note"></td></tr> +// +// Include Header +// +include('./includes/page_header.'.$phpEx); - <tr><th>Password:</th> - <td><input name="password" type=password><br> - <i>(used when deleting)</i></td></tr> - <tr><td></td> - <td><input type=hidden name="op" value="newdeal"> - <input type=submit value="Create deal"></td> - </table> -</form> -<hr> + // + // Start Body + // + $template->set_filenames(array( + 'index' => 'index_page.tpl') + ); + -<h2><a name="addvendor">Add vendor</a></h2> -<form method=post> -<p> -A vendor is someone who sells things to the public. (Some people call them retailers.) -Use this form to add to the list of known vendors. -</p> -<table> - <tr><th>Vendor's short name:</th> - <td><input name="name"></td></tr> - <tr><th>URL to vendor's details:</th> - <td><input name="url" value="http://"><br> - <i>This URL should show contact details for the vendor</i> - </td></tr> - <tr><td></td> - <td><input type=hidden name="op" value="newvendor"> - <input type=submit value="Add vendor"></td> -</table> -</form> + // Assign variables in template values + $template->assign_vars(array( + 'MESSAGE' => 'Welcome to admin via templates', + 'MESSAGE2' => 'foo bar!', + 'MESSAGE3' => $foo) + ); -<table><tr><th class="major">Known vendors</th></tr> - <tr><th class="minor">name</th></tr> -<? - $result = mysql_query("SELECT name, url FROM vendor WHERE url IS NOT NULL ORDER BY name", $db) - or die(mysql_error($db)); - $comma = ""; - while ($row = mysql_fetch_assoc($result)) { ?> -<tr><td><a href="<?=htmlspecialchars($row["url"])?>"><?=htmlspecialchars($row["name"])?></a></td></tr> -<? } ?> -</table> -<hr> + // End Body + $template->pparse('index'); -<h2><a name="addproduct">Add product</a></h2> -<form method=post> -<p> -Use this form to add to the list of known products. -Please only add gear to do with low-cost wireless networking activities. -(i.e. I cull entries regarding CPUs, digital cameras etc.) -</p> -<table> - <tr><th>Product class:</th> - <td><select name="class"> -<? - $classes = array("card", "AP", "adaptor", "periph", "cable", "antenna", "diy", "other"); - foreach ($classes as $class) { ?> - <option value="<?=$class?>"><?=$class?></option> -<? } ?> - </select></td></tr> - <tr><th>Manufacturer (OEM):</th> - <td><input name="manuf"><br> - <i>Try to use a single word for the OEM/manufacturer (eg IBM)</i> - </td></tr> - <tr><th>Product short name:</th> - <td><input name="name"><br> - <i>Try to use the manufacturer's unique product code (eg MA401)</i> - </td></tr> - <tr><th>Product long name:</th> - <td><input name="description"><br> - <i>Product's packaging name, without manufacturer name (eg NetBlaster II)</i> - </td></tr> - <tr><th>URL to product details:</th> - <td><input name="url" value="http://"><br> - <i>This URL should show the original manufacturer's technical - specs on the actual device</i> - </td></tr> - <tr><td></td> - <td><input type=hidden name="op" value="newproduct"> - <input type=submit value="Add product"></td> - </table></form> + +// +// Include Footer +// +include('./includes/page_tail.'.$phpEx); -<table><tr><th class="major" colspan=4>Known products</th></tr> -<tr><th class="minor">class</th> - <th class="minor">oem</th> - <th class="minor">name</th> - <th class="minor">description</th> -</tr> -<? - $result = mysql_query("SELECT id, name, manuf, url, class, description FROM product WHERE url IS NOT NULL ORDER BY class, manuf, name", $db) - or die(mysql_error($db)); - $lastclass = "?"; - while ($row = mysql_fetch_assoc($result)) { - $class = htmlspecialchars($row["class"]); - $oem = htmlspecialchars($row["manuf"]); - $url = htmlspecialchars($row["url"]); - $name = htmlspecialchars($row["name"]); - $desc = htmlspecialchars($row["description"]); - if ($class == $lastclass) - $class = " "; - else - $lastclass = $class; - ?> - <tr><td><?=$class?></td> - <td><?=$oem?></td> - <td><a href="<?=$row["url"]?>"><?=$row["name"]?></a></td> - <td><?=$desc?></td> - </tr> -<? } - if ($class != "") { echo "</p>\n"; } ?> -</table> - -<hr> -<p> -<a href="..">Brisbane Mesh</a> -<br> -Any questions? Did you stuff something up? Is something wrong? -Contact <a href="mailto:d+meshretail@itee.uq.edu.au">David Leonard</a>. -Periodically, he goes through this page and tidies up anyway, but -is happier if you send him a note when you notice something's gone awry. -</p> - -</body> -</html> |
From: <unl...@us...> - 2002-08-14 03:30:05
|
Update of /cvsroot/meshdb/www/deal In directory usw-pr-cvs1:/tmp/cvs-serv9048 Removed Files: deal.sql Log Message: Removed the file from the CVS. Damn I love KDE's inbuilt CVS, only discovered it a few minutes ago :) --- deal.sql DELETED --- |
From: <yo...@us...> - 2002-08-13 14:51:17
|
Update of /cvsroot/meshdb/www/db2 In directory usw-pr-cvs1:/tmp/cvs-serv14535 Modified Files: style.css Log Message: and back to normal Index: style.css =================================================================== RCS file: /cvsroot/meshdb/www/db2/style.css,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- style.css 13 Aug 2002 14:48:29 -0000 1.2 +++ style.css 13 Aug 2002 14:51:13 -0000 1.3 @@ -32,4 +32,3 @@ input.delete { background: #ffc0c0; } input.update { background: #c0ffc0; } - .yob { color: blue; } |
From: <yo...@us...> - 2002-08-13 14:48:34
|
Update of /cvsroot/meshdb/www/db2 In directory usw-pr-cvs1:/tmp/cvs-serv12905 Modified Files: style.css Log Message: testing my commit skills. CVS is scary if you've never used it :-) Index: style.css =================================================================== RCS file: /cvsroot/meshdb/www/db2/style.css,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- style.css 10 Aug 2002 03:34:07 -0000 1.1.1.1 +++ style.css 13 Aug 2002 14:48:29 -0000 1.2 @@ -31,3 +31,5 @@ input.delete { background: #ffc0c0; } input.update { background: #c0ffc0; } + + .yob { color: blue; } |
From: <unl...@us...> - 2002-08-11 06:45:24
|
Update of /cvsroot/meshdb/www/deal In directory usw-pr-cvs1:/tmp/cvs-serv5823 Modified Files: deal.sql Log Message: oops forgot drop table conditions Index: deal.sql =================================================================== RCS file: /cvsroot/meshdb/www/deal/deal.sql,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- deal.sql 11 Aug 2002 06:42:24 -0000 1.3 +++ deal.sql 11 Aug 2002 06:45:21 -0000 1.4 @@ -8,7 +8,7 @@ # # Table structure for table `deal` # - +DROP TABLE IF EXISTS deal; CREATE TABLE deal ( deal_id mediumint(9) NOT NULL auto_increment, vendor_id mediumint(9) NOT NULL default '0', @@ -29,7 +29,7 @@ # # Table structure for table `donation` # - +DROP TABLE IF EXISTS donation; CREATE TABLE donation ( donation_id mediumint(9) NOT NULL auto_increment, donation_class varchar(255) default NULL, @@ -52,7 +52,7 @@ # # Table structure for table `product` # - +DROP TABLE IF EXISTS product; CREATE TABLE product ( product_id mediumint(9) NOT NULL auto_increment, product_class varchar(255) default NULL, @@ -67,7 +67,7 @@ # # Table structure for table `vendor` # - +DROP TABLE IF EXISTS vendor; CREATE TABLE vendor ( vendor_id mediumint(9) NOT NULL auto_increment, vendor_name varchar(255) default NULL, |
From: <unl...@us...> - 2002-08-11 06:42:28
|
Update of /cvsroot/meshdb/www/deal In directory usw-pr-cvs1:/tmp/cvs-serv5172 Modified Files: deal.sql Log Message: Changes to the deal and donations database schema. Table attributes have been updated to reflect. The main difference is the ability via the deal_status for a person to disable eenable a deal. The other changes are purely for efficeny and schema readability. The next step the the PHP. Index: deal.sql =================================================================== RCS file: /cvsroot/meshdb/www/deal/deal.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- deal.sql 10 Aug 2002 11:57:18 -0000 1.2 +++ deal.sql 11 Aug 2002 06:42:24 -0000 1.3 @@ -1,75 +1,77 @@ -# MySQL dump 8.12 -# -# Host: bo Database: mesh -#-------------------------------------------------------- -# Server version 3.23.39-log +# Host: localhost +# Generation Time: Aug 11, 2002 at 04:32 +# Server version: 3.23.49 +# PHP Version: 4.1.2 +# Database : `meshdb` +# -------------------------------------------------------- # -# Table structure for table 'rhp' +# Table structure for table `deal` # -DROP TABLE IF EXISTS rhp; -CREATE TABLE rhp ( - id int(11) NOT NULL auto_increment, - status tinytext, - class tinytext, - description mediumtext, - descriptionurl mediumtext, - donator mediumtext, - donatedwhen datetime default NULL, - donatorurl mediumtext, - user mediumtext, - usedwhen datetime default NULL, - userurl mediumtext, - lostwhen datetime default NULL, - comment text, - PRIMARY KEY (id) +CREATE TABLE deal ( + deal_id mediumint(9) NOT NULL auto_increment, + vendor_id mediumint(9) NOT NULL default '0', + product_id mediumint(9) NOT NULL default '0', + deal_minimum_quantity smallint(6) NOT NULL default '0', + deal_unit_price float NOT NULL default '0', + deal_spotted int(11) unsigned NOT NULL default '0', + deal_expires int(11) unsigned NOT NULL default '0', + deal_spotter varchar(255) default NULL, + deal_description text, + deal_key varchar(16) NOT NULL default '', + deal_url varchar(255) default NULL, + deal_status tinyint(1) NOT NULL default '1', + PRIMARY KEY (deal_id) ) TYPE=MyISAM; +# -------------------------------------------------------- # -# Table structure for table 'vendor' +# Table structure for table `donation` # -DROP TABLE IF EXISTS vendor; -CREATE TABLE vendor ( - id int(11) NOT NULL auto_increment, - name tinytext, - url mediumtext, - PRIMARY KEY (id) +CREATE TABLE donation ( + donation_id mediumint(9) NOT NULL auto_increment, + donation_class varchar(255) default NULL, + donation_description text, + donation_description_url varchar(255) default NULL, + donation_donator varchar(255) default NULL, + donation_donator_email varchar(255) default NULL, + donation_donator_url varchar(255) default NULL, + donation_donated_when int(11) unsigned NOT NULL default '0', + donation_user varchar(255) default NULL, + donation_user_email varchar(255) default NULL, + donation_user_url varchar(255) default NULL, + donation_user_used int(11) unsigned NOT NULL default '0', + donation_user_lost int(11) unsigned NOT NULL default '0', + donation_status tinyint(1) NOT NULL default '1', + PRIMARY KEY (donation_id) ) TYPE=MyISAM; +# -------------------------------------------------------- # -# Table structure for table 'deal' +# Table structure for table `product` # -DROP TABLE IF EXISTS deal; -CREATE TABLE deal ( - id int(11) NOT NULL auto_increment, - vendorid int(11) default NULL, - productid int(11) default NULL, - minqty int(11) default NULL, - unitprice float default NULL, - spotted datetime default NULL, - expires datetime default NULL, - spotter mediumtext, - note mediumtext, - keypass varchar(64) default NULL, - url mediumtext, - PRIMARY KEY (id) +CREATE TABLE product ( + product_id mediumint(9) NOT NULL auto_increment, + product_class varchar(255) default NULL, + product_name varchar(255) default NULL, + product_url varchar(255) default NULL, + product_manufacturer varchar(255) default NULL, + product_description text, + PRIMARY KEY (product_id) ) TYPE=MyISAM; +# -------------------------------------------------------- # -# Table structure for table 'product' +# Table structure for table `vendor` # -DROP TABLE IF EXISTS product; -CREATE TABLE product ( - id int(11) NOT NULL auto_increment, - class tinytext, - name mediumtext, - url mediumtext, - manuf tinytext, - description mediumtext, - PRIMARY KEY (id) +CREATE TABLE vendor ( + vendor_id mediumint(9) NOT NULL auto_increment, + vendor_name varchar(255) default NULL, + vendor_url varchar(255) default NULL, + PRIMARY KEY (vendor_id) ) TYPE=MyISAM; |