WebCalendar is written in PHP. Although originally written for PHP3, only PHP4 is officially supported. (It should also work on PHP5, but testing has not been completed yet.)
The following tools will be helpful in WebCalendar development:
docs
directory. The “make” command is standard on Linux if you install certain development packages. If you are using Windows, make is included as part of the cygwin package.TIP If you are developing on a Windows system, the Cygwin package will provide command line tools that include perl, make, patch, diff and cvs.
You should always be using the latest code in CVS. You can obtain the latest code using anonymous CVS. (You do not need to be an authorized WebCalendar developer). Use the following commands to checkout the latest code from CVS:
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/webcalendar login cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/webcalendar co webcalendar
This will create a webcalendar
directory. You should run these commands from one of the directories that your web server is configured to use. For example, on some Linux systems, the Apache document root is configured to be /var/www/html
. So, you would change directories to that directories before checking the code out of CVS.
You only need to perform this checkout once. After the initial checkout, you can update your code with the following command (run this command from inside the toplevel WebCalendar directory):
cvs update -d
If you have modified any of the WebCalendar files, CVS will attempt to merge your changes with any changes to the same file in the new code from CVS.
For example, if you modified the includes/functions.php
file on your system and a WebCalendar developer also modified this file in CVS, then when you perform the CVS update, the changes will be merged. If the merge fails, you will see a file with a .rej
extension and another with .orig
.
The following conventions have been adopted by WebCalendar (although they have not been 100% enforced, so you will see exceptions):
The following coding standards have been adopted by WebCalendar (although they have not been 100% implemented).
if ( foo == 1 ) { bar = true; } else { bar = false; } or bar = ( foo == 1 )? true : false ;
Declaration: function getGetValue ( $name ) { Call: bar = getGetValue ( $name );
TODO
When adding or modifying WebCalendar code, all displayed text should be translatable. The following tips will ensure new text can be translated quickly and efficiently.
http://us3.php.net/manual/en/function.htmlentities.php
Why aren't you using PHP sessions?
We are still considering using PHP4 sessions. In fact, the install/index.php
page does use PHP sessions. The cookie-based solution that WebCalendar uses is simple, and it will work with all versions of PHP.
Why aren't you using ADODB for database access?
Again, this would be overkill for what we need. ADODB is a fairly large project, so I'm partial to my leaner php-dbi.php solution.
Why aren't you using the PEAR database functions?
WebCalendar pre-dates the PEAR database functions. There does not seem to be sufficient reason to switch from our existing code at this point.
Why aren't you using a template engine like smarty?
WebCalendar pre-dates most of the template engines out there. We are currently evaluating some of the templating options and may consider moving to one of the template systems in the future.
How do I install a patch?
Different patches are applied differently. Some patches just contain an updated file. In that case, you should be able to use replace the old file with the new (assuming the new file and your install are based on the same version of WebCalendar). Others are patch files, which usually have a .diff
or .patch
file extension. In order to use one of these files, you need the GNU patch program. (This should be installed on all Linux systems and you can get a version for Windows. I use the patch program that comes with cygwin on windows.) I would recommend testing the patch on your install first using the –dry-run
option. For example, if the patch file is called calmods.diff
, then you would use:
patch --dry-run < calmods.diff
If the program says it cannot determine which file to patch, try adding -p1:
patch --dry-run -p1 < calmods.diff
If it goes through all the changes successfully, do the same command without the –dry-run
option to install the patch. If it says “hunk failed”, then the patch cannot be applied without hand-merging files. This essentially means that the patch was based on a version of WebCalendar that is too different than the version that you have installed, so it was unable to determine how to apply some of the changes in the patch file.
The following resources may be helpful: