[Wuug-cvs] wuug CHANGELOG,1.4,1.5 TODO,1.2,1.3 admin.php,1.7,1.8 links.php,1.1.1.1,1.2 news.php,1.3,
Status: Inactive
Brought to you by:
loginx
From: <dj...@us...> - 2003-01-14 20:37:37
|
Update of /cvsroot/wuug/wuug In directory sc8-pr-cvs1:/tmp/cvs-serv21355/wuug Modified Files: CHANGELOG TODO admin.php links.php news.php wuug.class.php Log Message: Added basic Link stuff Index: CHANGELOG =================================================================== RCS file: /cvsroot/wuug/wuug/CHANGELOG,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CHANGELOG 11 Jan 2003 08:05:31 -0000 1.4 --- CHANGELOG 14 Jan 2003 20:37:26 -0000 1.5 *************** *** 1,8 **** CHANGELOG - wuug-engine v0.1-alpha1 - 10/01/03 - GD-based graphs for votes (Xavier) - 10/01/03 - New Graphics manipulation class (Xavier) - 10/01/03 - Graphs for votes (Aaron) ! - 10/01/03 - New Developer - Aaron Mavrignac - 09/01/03 - Dozens of little bugfixes - 09/01/03 - Administration class and interface for FAQs ready --- 1,9 ---- CHANGELOG - wuug-engine v0.1-alpha1 + - 14/01/03 - Basics of Link class (Aaron) - 10/01/03 - GD-based graphs for votes (Xavier) - 10/01/03 - New Graphics manipulation class (Xavier) - 10/01/03 - Graphs for votes (Aaron) ! - 10/01/03 - New Developer - Aaron Mavrinac - 09/01/03 - Dozens of little bugfixes - 09/01/03 - Administration class and interface for FAQs ready Index: TODO =================================================================== RCS file: /cvsroot/wuug/wuug/TODO,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TODO 11 Jan 2003 08:03:20 -0000 1.2 --- TODO 14 Jan 2003 20:37:26 -0000 1.3 *************** *** 7,11 **** - Implement administration section ! - Admin for Links QA --- 7,13 ---- - Implement administration section ! - Add edit/delete functions ! ! - Categorized links page QA Index: admin.php =================================================================== RCS file: /cvsroot/wuug/wuug/admin.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** admin.php 14 Jan 2003 02:26:47 -0000 1.7 --- admin.php 14 Jan 2003 20:37:26 -0000 1.8 *************** *** 158,161 **** } ! if (($_GET[section] == "links") || ($_GET[section] == "all")) { ; } ! } \ No newline at end of file --- 158,195 ---- } ! if (($_GET[section] == "links") || ($_GET[section] == "all")) { ! ! $link = new Link; ! ! if ($_GET[action] = "add") { ! if (!$_POST[link_submit]) { ! $link->skel(); ! } else { ! $link->uri = $_POST[link_uri]; ! $link->name = $_POST[link_name]; ! $link->tooltip = $_POST[link_tooltip]; ! $link->category = $_POST[link_category]; ! ! $link->commit(); ! $link->reset(); ! $link->skel(); ! } ! } elseif ($_GET[action] = "del") { ! $link->delete($_GET[id]); ! } elseif ($_GET[action] = "edit") { ! if (!$_POST[link_submit]) { ! if ($_GET[id]) { ! $link->list_edit(); ! } else { ! $link->edit($_GET[id]); ! } ! } else { ! $link->uri = $_POST[link_uri]; ! $link->name = $_POST[link_name]; ! $link->tooltip = $_POST[link_tooltip]; ! $link->category = $_POST[link_category]; ! $link->update($id); ! } ! } ! } ! } Index: links.php =================================================================== RCS file: /cvsroot/wuug/wuug/links.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** links.php 7 Jan 2003 02:19:14 -0000 1.1.1.1 --- links.php 14 Jan 2003 20:37:27 -0000 1.2 *************** *** 4,68 **** ?> <table><tr> ! <td><p>This page contains links to various Unix ! resources for different variants. A very comprehensive Unix information site can be found at <a href="http://www.unixpower.org">UnixPower.Org</a>.</p></td></tr> ! <tr><td><center><font size="+1" color="#000099">Linux</font></center></td></tr> ! <tr><td> ! <ul> ! <li><a href="http://slashdot.org" target="top">Slashdot.org</a> ! </li><li><a href="http://www.linuxtoday.com" target="top">Linux Today</a> ! </li><li><a href="http://freshmeat.net" target="top">Freshmeat.net Software Archive</a> ! </li><li><a href="http://rufus.w3.org/linux/RPM" target="top">Rufus RPM Archive</a> ! ! </li><li><a href="http://www.cyber.bc.ca" target="top">Cyberstation</a> ! </li><li><a href="http://www.themes.org" target="top">Themes.org</a> ! </li><li><a href="http://webwatcher.org" target="top">Linux WebWatcher</a> ! </li><li><a href="http://daily.daemonnews.org/" target="top">The Daily BSD News</a> ! </li><li><a href="http://www.sysadmin.com/" target="top">Sys Admin Magazine</a> ! </li></ul> ! </td></tr> ! ! <tr><td><center><font size="+1" color="#000099">FreeBSD</font></center></td></tr> ! <tr><td> ! <ul> ! ! <li><a href="http://www.freebsd.org" target="top">FreeBSD Official Site</a> ! </li><li><a href="http://www.freebsdforums.org/" target="top">FreeBSD Forums</a> ! </li><li><a href="http://freebsd.unixhelp.org" target="top">FreeBSD Online</a> ! </li><li><a href="http://www.freebsdrocks.com" target="top">FreeBSD Rocks!</a> ! </li><li><a href="http://www.freebsddiary.com/freebsd" target="top">FreeBSD Diary</a> ! </li><li><a href="http://www.daemonnews.org" target="top">Daemon News</a> ! </li><li><a href="http://www.freebsdmall.com" target="top">The FreeBSD Mall</a> ! </li></ul> ! </td></tr> ! <tr><td><center><font size="+1" color="#000099">Solaris</font></center></td></tr> ! <tr><td> ! <ul> ! <li><a href="http://www.sun.com" target="top">Sun Microsystems</a> ! </li><li><a href="http://www.sun.com/solaris" target="top">Official Solaris Site</a> ! </li><li><a href="http://www.solariscentral.org" target="top">Solaris Central</a> ! </li><li><a href="http://oak.ece.ul.ie/%7Egriffini/solaris.html" target="top">Solaris WWW Resources</a> ! </li><li><a href="http://sun.icsnet.com" target="top">Unofficial Guide to Solaris</a> ! </li><li><a href="http://www.sunfreeware.com" target="top">Solaris FreeWare</a> ! </li><li><a href="http://www.zdtips.com/sun/sun-f.htm" target="top">Solaris Tip of the Week</a> ! </li></ul> ! </td></tr> ! <tr><td><center><font size="+1" color="#000099">IRIX</font></center></td></tr> ! <tr><td> ! <ul> ! <li><a href="http://www.sgi.com" target="top">Silicon Graphics Inc.</a> ! </li><li><a href="http://www.sgi.com/developers/technology/irix653.html" target="top">IRIX 6.5.3 Information</a> ! </li></ul> </td></tr> ! ! <tr><td><center><font size="+1" color="#000099">Miscellaneous</font></center></td></tr> ! <tr><td> ! ! <ul> ! <li><a href="http://www.unixpower.org" target="top">UnixPower.Org</a> ! </table> \ No newline at end of file --- 4,32 ---- ?> + <!--Hardcoded garbage--> <table><tr> ! <td><p>This page contains links to various UNIX ! resources for different variants. A very comprehensive UNIX information site can be found at <a href="http://www.unixpower.org">UnixPower.Org</a>.</p></td></tr> ! <?php ! require "config.inc.php"; ! $links = new Link(); ! $ids = $links->getAll(); ! if ($ids) { ! ?> <ul> <? ! for ($i = 0; $i < sizeof($ids); $i++) { ! echo "<li>"; ! $link->linkView($ids[$i][id]); ! echo "</li>"; ! } ! ?> </ul> <? ! } else { ! ?> There are currently no links, please check back later <? ! } ! ?> </td></tr> ! </table> Index: news.php =================================================================== RCS file: /cvsroot/wuug/wuug/news.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** news.php 7 Jan 2003 23:10:14 -0000 1.3 --- news.php 14 Jan 2003 20:37:28 -0000 1.4 *************** *** 9,16 **** <!-- This is hardcoded, we'll get rid of it... --> <b><center>Welcome to the Windsor Unix Users Group</center></b><br> ! <!-- For more information about us, <a href="?content=faqs">click here</a><br> --> ! If you would like to join, <a href="?content=join">click here</a><br> Our meetings usually take place on the second wednesday of the month<br> ! at our usual location at University of Windsor (Essex Hall)<br> <center><img src="news.png" align="center" border="0" align="news"></center><br> --- 9,16 ---- <!-- This is hardcoded, we'll get rid of it... --> <b><center>Welcome to the Windsor Unix Users Group</center></b><br> ! For more information about us, <a href="?content=faqs">click here</a>.<br> ! If you would like to join, <a href="?content=join">click here</a>.<br> Our meetings usually take place on the second wednesday of the month<br> ! at our usual location at University of Windsor (Essex Hall).<br> <center><img src="news.png" align="center" border="0" align="news"></center><br> Index: wuug.class.php =================================================================== RCS file: /cvsroot/wuug/wuug/wuug.class.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wuug.class.php 11 Jan 2003 08:03:23 -0000 1.11 --- wuug.class.php 14 Jan 2003 20:37:28 -0000 1.12 *************** *** 365,368 **** --- 365,515 ---- } + class Link { + + var $id; + var $uri; + var $name; + var $tooltip; + var $category; + + /** + * @return array + * @desc Return an associative array filled with link IDs + */ + function getAll() { + require "config.inc.php"; + + $query = "SELECT id FROM `" . $cf[tables][links] . "` ORDER BY " . $cf[tables][links] . ".category DESC"; + $datalink = wuug_dbconnect(); + $result = $datalink->getAll($query, DB_FETCHMODE_ASSOC); + $datalink->disconnect(); + return($result) + } + + /** + * @return void + * @desc Prints a skeleton form to create new links. + */ + function skel() { + require "config.inc.php"; + ?> + <form method="POST" action="<?=$cf[top_level_url]?>/?content=admin§ion=links"> + <table cellpadding="2" cellspacing="0" border="0" width="75%" align="center"> + <tr> + <td colspan="2" align="center" bgcolor="#505050"><b><font color="#ffffff">Add a Link</font></b></td> + </tr> + <tr> + <td align="right"><i>Link Name:</td> + <td align="center"><input type="text" name="link_name" class="wuug_txtbox" size="50"> + </tr> + <tr> + <td align="right"><i>URL:</td> + <td align="center"><input type="text" name="link_uri" class="wuug_txtbox" size="50"> + </tr> + <tr> + <td align="right"><i>ToolTip:</td> + <td align="center"><input type="text" name="link_tooltip" class="wuug_txtbox" size="50"> + </tr> + <tr> + <td align="right"><i>Category:</td> + <td align="center"><select name="link_category" class="wuug_txtbox"> + <?php + $datalink = wuug_dbonnect(); + $result = $datalink->query("SELECT text, id FROM `" . $cf[tables][links_categories] . "`"); + + while ($result->fetchInto($text, DB_FETCHMODE_ASSOC)) { + echo "\n<option value=\"" . $text[id] . "\">" . $text[text] . "</option>"; + } + echo "\n</select>\n</td>\n"; + $datalink->disconnect(); + ?> + </tr> + <tr> + <td colspan="2" align="center"><input type="submit" name="links_submit" value="-- [ POST ] --" + class="wuug_button" onmouseover="this.className='wuug_buttonover';" onmouseout="this.className='wuug_button';"></td> + </tr> + </table> + </form> + <? + } + + /** + * @return void + * @param id int + * @desc Fills object's properties with the values from the table associated with link #id + */ + function pop($id) { + require "config.inc.php"; + $values = array(); + + $a = $cf[tables][links]; + $b = $cf[tables][links_categories]; + + $query = " + SELECT " . $a . ".name, " . $a . ".uri, " . $b . ".text AS category, " . $a . ".id as ID + FROM `$a`, `$b`, `$c` + WHERE " . $a . ".id = " . $id . " + AND " . $b . ".id = " . $a . ".category + ORDER BY " . $a . ".category DESC"; + $datalink = wuug_dbconnect(); + $result = $datalink->query($query); + + $result->fetchInto($values, DB_FETCHMODE_ASSOC); + + foreach (array_keys($values) as $key) { + if ($values[$key] == "") { $values[$key] = "N/A"; } + } + + $this->id = $values[ID]; + $this->name = stripslashes($values[name]); + $this->uri = stripslashes($values[uri]); + $this->category = $values[category]; + $this->tooltip = stripslashes($values[tooltip]); + + $datalink->disconnect; + + } + + /** + * @return void + * @desc Commits the link stored in object's properties to the database. + */ + function commit() { + require "config.inc.php"; + + $query = "INSERT INTO `" . $cf[tables][links] . "` + (uri, name, tooltip, category) + VALUES('" . $this->uri . "', '" . $this->name . "', '" . $this->tooltip . "', '" . $this->category . "')"; + + $datalink = wuug_dbconnect(); + $datalink->query($query); + $datalink->disconnect(); + } + + /** + * @return void + * @param id = null int + * @desc Displays individual links + */ + function linkView($id = null) { + if ($id) { $this->pop($id); } + ?> + <a href="<?=$this->uri?>"><?=$this->name?></a> - <?=$this->tooltip?><br> + <? + } + + /** + * @return void + * @desc Resets all the current class' instance's properties to NULL values + */ + function reset() { + unset($this->id); + unset($this->name); + unset($this->uri); + unset($this->category); + unset($this->tooltip); + } + } + class NewsClass { *************** *** 387,391 **** require "config.inc.php"; ! $query = "SELECT id FROM `" . $cf[tables][news]. "`"; $datalink = wuug_dbconnect(); $result = $datalink->getAll($query, DB_FETCHMODE_ASSOC); --- 534,538 ---- require "config.inc.php"; ! $query = "SELECT id FROM `" . $cf[tables][news] . "`"; $datalink = wuug_dbconnect(); $result = $datalink->getAll($query, DB_FETCHMODE_ASSOC); *************** *** 404,408 **** <table cellpadding="2" cellspacing="0" border="0" width="75%" align="center"> <tr> ! <td colspan="2" align="center" bgcolor="#505050"><b><font color="#ffffff">Post news</font></b></td> </tr> <tr> --- 551,555 ---- <table cellpadding="2" cellspacing="0" border="0" width="75%" align="center"> <tr> ! <td colspan="2" align="center" bgcolor="#505050"><b><font color="#ffffff">Post News</font></b></td> </tr> <tr> *************** *** 564,568 **** function commit() { require "config.inc.php"; ! require "config.inc.php"; $query = "INSERT INTO " . $cf[tables][news] . "(author_id, title, text, timestamp, category, display_flag) VALUES('" . $this->author_id . "', '" . addslashes($this->title) . "', '" . --- 711,715 ---- function commit() { require "config.inc.php"; ! $query = "INSERT INTO " . $cf[tables][news] . "(author_id, title, text, timestamp, category, display_flag) VALUES('" . $this->author_id . "', '" . addslashes($this->title) . "', '" . |