[Wuug-cvs] wuug install.php,NONE,1.1 CHANGELOG,1.5,1.6 config.inc.php,1.9,1.10 database.sql,1.2,1.3
Status: Inactive
Brought to you by:
loginx
From: <lo...@us...> - 2003-02-17 22:23:10
|
Update of /cvsroot/wuug/wuug In directory sc8-pr-cvs1:/tmp/cvs-serv5229 Modified Files: CHANGELOG config.inc.php database.sql index.php links.php wuug.class.php Added Files: install.php Log Message: Read Changelog --- NEW FILE: install.php --- <?php // install.php // Checks if config.inc.php exists and prompts a config // page if it doesn't. // Will also create the database and add the first records in it. if (!file_exists("config.inc.php")) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>COMAS installation script</title> <meta http-equiv="Content-Language" content="en-us"> <link rel="stylesheet" href="stylesheet.css.php" type="text/css" title="WUUG stylesheet"> </head> <body> <table width="100%" height="100%" align="center" border="0"> <tr> <td colspan="2" align="center" bgcolor="#cccccc"><h1>Installation</h1></td> </tr> <tr> <td colspan="2" bgcolor="#dddddd">Hi There. This is the COMAS installation script<br> I have detected that this website hasn't been configured yet and will do just that for you<br> Please answer the questions below to create your first installation<br> Be careful as you will *NOT* (for the moment) be able to change most of these settings later<br> unless you go change them manually in your configuration file.<br> <b>The defaults are only here as an example, they are not suitable unless:<br> - You are running COMAS on a UNIX server<br> - You have root access to the database server<br> - You have directed your *UPTIME crontab to uptime.txt where COMAS is installed<br> - You want COMAS to log in the same directory as it is installed (dangerous)<b></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Your COMAS username:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="username" value="admin"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Desired password:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="password" name="password"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Database Host:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="db_host" value="localhost"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Your database username:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="db_username" value="root"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Your database password:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="db_password"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Database type:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"> <select class="wuug_txtbox" name="db_type"> <option name="mysql">MySQL</option> <option name="pgsql">PostGreSQL</option> <option name="mssql">Microsoft SQL server</option> <option name="ibase">InterBase</option> <option name="msql">Mini-SQL</option> <option name="oci8">Oracle 7/8/8i</option> <option name="sybase">Sybase</option> <option name="odbc">ODBC</option> <option name="ifx">Informix</option> <option name="fbsql">FrontBase</option> </select> </td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>The name of your database:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="db_name" value="COMAS"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Default language:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"> <select class="wuug_txtbox" name="lang"> <option name="en">English</option> <option name="fr">French (mais oui!!)</option> <option name="it">Italian</option> <option name="jp">Japanese</option> <option name="redneck">Redneck</option> </select> </td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Log File:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="logfile" value="<?=dirname(__FILE__) . "/comas.log"?>"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>How many news should I display at a time on the homepage?</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="news_numb" value="5"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>What is my Top-Level URL (address to reach me)<br>(NO TRAILING SLASH)</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="top_level_url" value="http://www.<?=$_SERVER['SERVER_NAME']?>/comas"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Where is my uptime file stored? (read manual - Uptime section)</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="uptime_file" value="<?=dirname(__FILE__) . "/uptime.txt"?>"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Your abbreviated organization/website name:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="abbr_org_name" value="WUUG"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Your abbreviated organization/website name:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="abbr_org_name" value="WUUG"></td> </tr> <tr> <td width="50%" bgcolor="#eeeeee" align="right"><i>Your full organization/website name:</i></td> <td width="50%" bgcolor="#eeeeff" align="center"><input class="wuug_txtbox" type="text" name="org_name" value="The Windsor Unix Users Group"></td> </tr> <tr> <td align="right" width="50"" bgcolor="#eeeeee"> <input type="reset" name="reset" value="-- [ RESET ] --" class="wuug_button" onmouseover="this.className='wuug_buttonover';" onmouseout="this.className='wuug_button';"> </td> <td width="50%" bgcolor="#eeeeff" align="center"> <input type="submit" name="submit" value="-- [ POST ] --" class="wuug_button" onmouseover="this.className='wuug_buttonover';" onmouseout="this.className='wuug_button';"> </td> </tr> </table> <? exit(); } ?> Index: CHANGELOG =================================================================== RCS file: /cvsroot/wuug/wuug/CHANGELOG,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CHANGELOG 14 Jan 2003 20:37:26 -0000 1.5 --- CHANGELOG 17 Feb 2003 22:22:58 -0000 1.6 *************** *** 1,4 **** --- 1,13 ---- CHANGELOG - wuug-engine v0.1-alpha1 + - 17/02/03 - Merged many extensions for the graphics class + - 17/02/03 - Various bugfixes (Xavier) + - 17/02/03 - Started working on install script (Xavier) + - 17/02/03 - New - Lightweight templating engine (no more hardcoded stuff) (Xavier) + - 17/02/03 - New Parser:: class (Xavier) + - 17/02/03 - New - i18n support (need translators) (Xavier) + - 17/02/03 - Updated database script and made it more portable (Xavier) + - 17/02/03 - Links class finished (Xavier) + - 17/02/03 - Various database fixes (Xavier) - 14/01/03 - Basics of Link class (Aaron) - 10/01/03 - GD-based graphs for votes (Xavier) *************** *** 6,9 **** --- 15,19 ---- - 10/01/03 - Graphs for votes (Aaron) - 10/01/03 - New Developer - Aaron Mavrinac + - 10/01/03 - Developer backed off (Brent Deneau) - 09/01/03 - Dozens of little bugfixes - 09/01/03 - Administration class and interface for FAQs ready Index: config.inc.php =================================================================== RCS file: /cvsroot/wuug/wuug/config.inc.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** config.inc.php 15 Feb 2003 19:46:51 -0000 1.9 --- config.inc.php 17 Feb 2003 22:22:58 -0000 1.10 *************** *** 5,8 **** --- 5,11 ---- define("ROOT", dirname(__FILE__)); + // Height of the Logo + $cf[logo_height] = 157; + // App Default language // Possible choices are: *************** *** 72,75 **** --- 75,79 ---- $cf[tables][faq] = "wuug_faqs"; $cf[tables][links] = "wuug_links"; + $cf[tables][links_categories] = "wuug_links_categories"; ///////////////////////////////////////////////////////////////////// Index: database.sql =================================================================== RCS file: /cvsroot/wuug/wuug/database.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** database.sql 8 Jan 2003 00:09:44 -0000 1.2 --- database.sql 17 Feb 2003 22:22:59 -0000 1.3 *************** *** 1,9 **** # Template ! # Connection: linkadmin ! # Host: localhost ! # Saved: 2003-01-05 02:05:55 ! # ! # Host: localhost ! # Database: wuug # Table: 'confirmed_queue' # --- 1,6 ---- # Template ! ! ! # Database: COMAS # Table: 'confirmed_queue' # *************** *** 12,19 **** `queue_id` int(11) NOT NULL default '0', PRIMARY KEY (`row`) ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'join_queue' # --- 9,15 ---- `queue_id` int(11) NOT NULL default '0', PRIMARY KEY (`row`) ! ) ! # Database: COMAS # Table: 'join_queue' # *************** *** 43,50 **** `phone_extension` varchar(100) default '', PRIMARY KEY (`id`) ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'messages' # --- 39,45 ---- `phone_extension` varchar(100) default '', PRIMARY KEY (`id`) ! ) ! # Database: COMAS # Table: 'messages' # *************** *** 61,68 **** `email` varchar(55) default NULL, PRIMARY KEY (`id`) ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'news' # --- 56,62 ---- `email` varchar(55) default NULL, PRIMARY KEY (`id`) ! ) ! # Database: COMAS # Table: 'news' # *************** *** 77,84 **** `category` int(11) default '0', PRIMARY KEY (`id`) ! ) TYPE=MyISAM COMMENT='New'; ! # Host: localhost ! # Database: wuug # Table: 'news_queue' # --- 71,77 ---- `category` int(11) default '0', PRIMARY KEY (`id`) ! ) ! # Database: COMAS # Table: 'news_queue' # *************** *** 91,112 **** `category` int(11) default '0', PRIMARY KEY (`id`) ! ) TYPE=MyISAM; ! ! # Host: localhost ! # Database: wuug ! # Table: 'users' ! # ! CREATE TABLE `users` ( ! `id` int(11) NOT NULL auto_increment, ! `username` varchar(255) NOT NULL default '', ! `email` varchar(255) NOT NULL default '', ! `password` varchar(255) NOT NULL default '', ! `firstname` varchar(255) NOT NULL default '', ! `lastname` varchar(255) default NULL, ! PRIMARY KEY (`id`) ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'wuug_events' # --- 84,90 ---- `category` int(11) default '0', PRIMARY KEY (`id`) ! ) ! # Database: COMAS # Table: 'wuug_events' # *************** *** 121,152 **** `location` varchar(100) default '', PRIMARY KEY (`id`) ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'wuug_faqs' # CREATE TABLE `wuug_faqs` ( ! `id` int(11) NOT NULL default '0', `question` varchar(100) NOT NULL default '', `answer` varchar(100) NOT NULL default '', `priority` int(11) default '0', ! `author` int(11) NOT NULL default '0' ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'wuug_links' # CREATE TABLE `wuug_links` ( ! `id` varchar(100) NOT NULL default '', `uri` varchar(100) NOT NULL default '', `name` varchar(100) NOT NULL default '', `tooltip` varchar(100) NOT NULL default '', ! `category` varchar(100) NOT NULL default '' ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'wuug_news_categories' # --- 99,138 ---- `location` varchar(100) default '', PRIMARY KEY (`id`) ! ) ! # Database: COMAS # Table: 'wuug_faqs' # CREATE TABLE `wuug_faqs` ( ! `id` int(11) NOT NULL auto_increment, `question` varchar(100) NOT NULL default '', `answer` varchar(100) NOT NULL default '', `priority` int(11) default '0', ! `author` int(11) NOT NULL default '0', ! PRIMARY KEY (`id`) ! ) ! # Database: COMAS # Table: 'wuug_links' # CREATE TABLE `wuug_links` ( ! `id` int(11) NOT NULL auto_increment, `uri` varchar(100) NOT NULL default '', `name` varchar(100) NOT NULL default '', `tooltip` varchar(100) NOT NULL default '', ! `category` varchar(100) NOT NULL default '', ! PRIMARY KEY (`id`) ! ) ! # Database: COMAS ! # Table: 'wuug_links_categories' ! # ! CREATE TABLE `wuug_links_categories` ( ! `id` int(11) NOT NULL auto_increment, ! `name` varchar(100) NOT NULL default '', ! PRIMARY KEY (`id`) ! ) ! ! # Database: COMAS # Table: 'wuug_news_categories' # *************** *** 155,162 **** `text` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'wuug_polls' # --- 141,147 ---- `text` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ! ) ! # Database: COMAS # Table: 'wuug_polls' # *************** *** 177,184 **** `c6_votes` varchar(100) default '', PRIMARY KEY (`row_id`) ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'wuug_prefs' # --- 162,168 ---- `c6_votes` varchar(100) default '', PRIMARY KEY (`row_id`) ! ) ! # Database: COMAS # Table: 'wuug_prefs' # *************** *** 190,197 **** `news_alert_type` varchar(100) default '', PRIMARY KEY (`row`) ! ) TYPE=MyISAM; ! # Host: localhost ! # Database: wuug # Table: 'wuug_users' # --- 174,180 ---- `news_alert_type` varchar(100) default '', PRIMARY KEY (`row`) ! ) ! # Database: COMAS # Table: 'wuug_users' # *************** *** 225,228 **** `security_level` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ! ) TYPE=MyISAM COMMENT='WUU'; ! --- 208,210 ---- `security_level` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ! ) \ No newline at end of file Index: index.php =================================================================== RCS file: /cvsroot/wuug/wuug/index.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** index.php 20 Jan 2003 14:51:36 -0000 1.5 --- index.php 17 Feb 2003 22:23:00 -0000 1.6 *************** *** 2,6 **** session_start(); // index.php ! // Handling logon require_once("config.inc.php"); --- 2,7 ---- session_start(); // index.php ! // install stuff ! include "install.php"; // Handling logon require_once("config.inc.php"); *************** *** 104,108 **** <table height="100%" width="100%" border="0" cellpadding="8" cellspacing="0"> <!-- WUUG logo as defined in config file --> ! <tr height="157"> <td colspan="3" align="center"> <a href="<?=$cf[top_level_url]?>"><img src="<?=$cf[logo_path]?>" --- 105,109 ---- <table height="100%" width="100%" border="0" cellpadding="8" cellspacing="0"> <!-- WUUG logo as defined in config file --> ! <tr height="<?=$cf[logo_height]?>"> <td colspan="3" align="center"> <a href="<?=$cf[top_level_url]?>"><img src="<?=$cf[logo_path]?>" Index: links.php =================================================================== RCS file: /cvsroot/wuug/wuug/links.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** links.php 23 Jan 2003 23:03:11 -0000 1.3 --- links.php 17 Feb 2003 22:23:00 -0000 1.4 *************** *** 16,20 **** $ids = $links->getAll(); ! if ($ids) { ?> <ul> <? for ($i = 0; $i < sizeof($ids); $i++) { --- 16,20 ---- $ids = $links->getAll(); ! if (sizeof($ids) > 0) { ?> <ul> <? for ($i = 0; $i < sizeof($ids); $i++) { *************** *** 25,29 **** ?> </ul> <? } else { ! ?> There are currently no links, please check back later <? } --- 25,29 ---- ?> </ul> <? } else { ! ?> There are currently no links, please check back later<br> <? } Index: wuug.class.php =================================================================== RCS file: /cvsroot/wuug/wuug/wuug.class.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** wuug.class.php 15 Feb 2003 20:15:42 -0000 1.20 --- wuug.class.php 17 Feb 2003 22:23:00 -0000 1.21 *************** *** 39,42 **** --- 39,43 ---- $tpl_name = '{' . $var_name . '}'; $this->html = str_replace($tpl_name, $this->vars[$var_name], $this->html); + $this->html = str_replace(strtoupper($tpl_name), $this->vars[$var_name], $this->html); } return $this->html; *************** *** 482,488 **** $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` WHERE " . $a . ".id = " . $id . " --- 483,488 ---- $a = $cf[tables][links]; $b = $cf[tables][links_categories]; $query = " ! SELECT " . $a . ".name, " . $a . ".uri, " . $b . ".name AS category, " . $a . ".tooltip, " . $a . ".id as ID FROM `$a`, `$b` WHERE " . $a . ".id = " . $id . " *************** *** 531,536 **** function linkView($id = null) { if ($id) { $this->pop($id); } ?> ! <acronym title="<?=$this->tooltip?>"><a href="<?=$this->uri?>"><?=$this->name . " (" . $this->uri . ")"?></a></acronym><br> <? } --- 531,537 ---- function linkView($id = null) { if ($id) { $this->pop($id); } + ?> ! <acronym title="<?=$this->tooltip?>"><a href="<?=$this->uri?>"><?=$this->name . "</a> (" . $this->uri . ")"?></acronym><br> <? } *************** *** 644,648 **** $datalink = wuug_dbconnect(); $result = $datalink->query($query); ! $result->fetchInto($values, DB_FETCHMODE_ASSOC); --- 645,649 ---- $datalink = wuug_dbconnect(); $result = $datalink->query($query); ! echo nl2br($query); $result->fetchInto($values, DB_FETCHMODE_ASSOC); *************** *** 900,928 **** $user = array(); ! $query = "SELECT first_name, email_address FROM `" . $cf[tables][users] . "` WHERE id = LAST_INSERT_ID()"; $result = $datalink->query($query); $result->fetchInto($user); ! // $#! This message must be customized ! $message = " Hi " . $user[first_name] . ", ! I have very good news for you. Your request to join the Windsor Unix Users Group ! has been approved, and you may now log in using your username and password. - You will soon have the ability to update your profile as well as many different customization - options such as event alert, news alert, submiting news or events, subscribe/unsubscribe to the - WUUG mailing list, request a shell account, consult your email, etc... - - Please provide all feedback to xa...@wu... - - Thank you, - - The Windsor Unix Users Group - http://www.wuug.org"; mail($user[email_address], $lang[welcome_subject], $message, ! "From: WUUG <ph...@wu...>"); echo "<center><a href=# onClick=\"self.close()\"><b>OK</b></a></center>"; --- 901,921 ---- $user = array(); ! $query = "SELECT first_name, last_name, email_address FROM `" . $cf[tables][users] . "` WHERE id = LAST_INSERT_ID()"; $result = $datalink->query($query); $result->fetchInto($user); ! $template = new Parser; ! $template->set("FIRST_NAME", $user[first_name]); ! $template->set("LAST_NAME", $user[last_name]); ! $template->set("EMAIL_ADDRESS", $user[email_address]); ! ! $message = $template->parse($cf[tpl_dir] . "/mail_accept.tpl"); mail($user[email_address], $lang[welcome_subject], $message, ! "From: COMAS@WUUG <ph...@wu...>"); echo "<center><a href=# onClick=\"self.close()\"><b>OK</b></a></center>"; *************** *** 963,967 **** * @desc Removes user from Queue, cute window. */ ! function deny($id) { require "config.inc.php"; ?> --- 956,960 ---- * @desc Removes user from Queue, cute window. */ ! function deny($id, $reason = null) { require "config.inc.php"; ?> *************** *** 976,980 **** <? ! $query = "DELETE FROM `" . $cf[tables][join_queue] . "` WHERE id = " . $id; $query2 = "DELETE FROM `" . $cf[tables][confirm] . "` WHERE queue_id = " . $id; --- 969,973 ---- <? ! $query1 = "DELETE FROM `" . $cf[tables][join_queue] . "` WHERE id = " . $id; $query2 = "DELETE FROM `" . $cf[tables][confirm] . "` WHERE queue_id = " . $id; *************** *** 982,986 **** --- 975,1000 ---- // eventually we'll see if we send a message to the user to let them know. $datalink = wuug_dbconnect(); + + $user = array(); + $query_get = "SELECT first_name, last_name, email FROM `" . $cf[tables][users] . "` WHERE + id = $id"; $result = $datalink->query($query); + + $result->fetchInto($user); + $template = new Parser; + $template->set("FIRST_NAME", $user[first_name]); + $template->set("LAST_NAME", $user[last_name]); + $template->set("EMAIL_ADDRESS", $user[email]); + $template->set("REASON", $reason); + + $message = $template->parse($cf[tpl_dir] . "/mail_deny.tpl"); + + + mail($user[email], + $lang[denied_subject], + $message, + "From: COMAS@WUUG <ph...@wu...>"); + + $result = $datalink->query($query1); $result = $datalink->query($query2); *************** *** 1225,1261 **** class Graphic { ! var $width; ! var $height; ! var $handle; ! ! function Graphic($width, $height) { ! $this->width = $width; ! $this->height = $height; ! $this->handle = imagecreate($width, $height); ! } ! ! function alloc($colour) { ! $red = hexdec("0x" . substr($colour, 1,2)); ! $green = hexdec("0x" . substr($colour, 3,2)); ! $blue = hexdec("0x" . substr($colour, 5,2)); ! $ret_colour = imagecolorallocate($this->handle, $red, $green, $blue); ! return($ret_colour); ! } ! ! function send_header() { ! header("Content-type: image/png"); ! } ! ! function fillrectangle($x1, $y1, $x2, $y2, $colour) { ! imagefilledrectangle($this->handle, $x1, $y1, $x2, $y2, $colour); ! } ! ! function destroy() { ! imagedestroy($this->handle); ! } ! ! function center_text($text, $color) { ! imagestring($this->handle, 3, (($this->width/2)-imagefontwidth(3)/2), (($this->height/2)-imagefontheight(3)/2), "$text", $color); ! } } --- 1239,1314 ---- class Graphic { ! var $width; ! var $height; ! var $handle; ! ! function Send() { ! imagepng($this->handle); ! } ! ! function Round_rect($x1, $y1, $x2, $y2, $radius, $colour, $fill = null) { ! ! $arcwidth = (2*$radius); ! ! // top left hand corner ! ImageArc($this->handle, $x1+$radius, $y1+$radius, $arcwidth, $arcwidth, 180, 270, $colour); ! // top right hand corner ! ImageArc($this->handle, $x2-$radius, $y1+$radius, $arcwidth, $arcwidth, 270, 360, $colour); ! // bottom right hand corner ! ImageArc($this->handle, $x2-$radius, $y2-$radius, $arcwidth, $arcwidth, 0, 90, $colour); ! // bottom left hand corner ! ImageArc($this->handle, $x1+$radius, $y2-$radius, $arcwidth, $arcwidth, 90, 180, $colour); ! ! // top line ! $this->line($x1+$radius, $y1, $x2-$radius, $y1, $colour); ! // right line ! $this->line($x2, $y1+$radius, $x2, $y2-$radius, $colour); ! // left line ! $this->line($x1, $y1+$radius, $x1, $y2-$radius, $colour); ! // bottom line ! $this->line($x1+$radius, $y2, $x2-$radius, $y2, $colour); ! ! if ($fill) { $this->flood(abs($x1-$x2)/2, abs($y1-$y2)/2, $fill); } ! ! } ! ! function Line($x1, $y1, $x2, $y2, $colour) { ! ImageLine($this->handle, $x1, $y1, $x2, $y2, $colour); ! } ! ! function flood($x, $y, $colour) { ! ImageFill($this->handle, $x, $y, $colour); ! } ! ! function Graphic($width, $height) { ! $this->width = $width; ! $this->height = $height; ! $this->handle = imagecreate($width, $height); ! } ! ! function alloc($colour) { ! $red = hexdec("0x" . substr($colour, 1,2)); ! $green = hexdec("0x" . substr($colour, 3,2)); ! $blue = hexdec("0x" . substr($colour, 5,2)); ! $ret_colour = imagecolorallocate($this->handle, $red, $green, $blue); ! return($ret_colour); ! } ! ! function send_header() { ! header("Content-type: image/png"); ! } ! ! function fillrectangle($x1, $y1, $x2, $y2, $colour) { ! imagefilledrectangle($this->handle, $x1, $y1, $x2, $y2, $colour); ! } ! ! function destroy() { ! imagedestroy($this->handle); ! } ! ! function center_text($text, $color, $font_size = null) { ! if (!$font_size) { $font_size = 3; } ! imagestring($this->handle, $font_size, (($this->width/2)-(imagefontwidth($font_size))*(strlen($text)/2)), (($this->height/2)-imagefontheight($font_size)/2), "$text", $color); ! } } |