Category Archives: Calendars

script of PHP calendar

The  PHP Calendar is a powerful PHP calendar scriptthat is easily integrated into web sites and is simple to customize. This attractive, full-featured calendar is suitable for display on a calendar of events page, home page, or any other page that needs a calendar.mySQL database support.Flat-file database support – No mySQL server required!.Keep your data on your server.Single events, recurring events and floating events plus multiple categories.Complete and easy event and setup administration.Customizable categories and multiple event administrators.Rich event descriptions including font sizes/colors and images and much more.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Easy PHP Calendar - Compatibility Test Script</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.style1 {font-size: 9px}
.style2 {color: #FFFFCC}
.style7 {
font-size: 18px;
font-weight: bold;
}
.style8 {font-size: 12px; }
.style11 {color: #003399}
.style12 {
color: #FFFF00;
font-weight: bold;
}
body {
background-color: #00497B;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style13 {
color: #990000;
font-weight: bold;
}
.style14 {font-size: 16px}
.style15 {
color: #006699;
font-weight: bold;
}
.style16 {color: #FFFF00}
.style17 {color: #990000}
.style18 {font-size: 11px}
.style19 {color: #FFFFFF}
.style21 {color: #FFFFFF; font-weight: bold; }
-->
</style>
</head>
<body>
<div align="center">
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" bgcolor="#0087E3"><a href="index.php"><img src="pageHeader.jpg" alt="Easy PHP Calendar" width="366" height="80" border="0"></a></td>
</tr>
</table>
</div>
<table width="980" border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><p align="center">Server Compatibility Test</p>
<div align="center"></div>
<table width="800" border="0" align="center" cellpadding="10" cellspacing="0">
<tr>
<td bgcolor="#99FF66"><p><strong>ionCube Loader Test Instructions:</strong></p>
<p>1) Click the test link in the red box below to open the ionCube test script.</p>
<p> 2) Review the results on the test page. </p>
<p>&amp;gt; If the results show that ionCube loaders are already installed, follow the instructions on the loader result page (if any), then download and install the ionCube version of the calendar using the links below.</p>
<p><strong>IMPORTANT!</strong> If you see a message to download any loaders for run-time loading, after installing the calendar you need to download/uncompress the loaders and place them in the calendar installation directory on the server in a directory named ioncube (all lower-case).</p>
<p>&amp;gt; If you see any other error messages, please forward the link to this file to your web host provider and/or server administrator. With the instructions on the page, they should be able to enable ionCube loaders for you so you can use the calendar.</p>
<p><a href="http://www.easyphpcalendar.com/support/index.php" target="_blank"><strong>Need Support?</strong> If you need help with any of this, please let us know by clicking this link and Submitting a Support Ticket.</a></p></td>
</tr>
</table>
<br>
<br>
<br>
<table width="800" border="0" align="center" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
<tr>
<td align="center" valign="middle" bgcolor="#274A72">ionCube Loader</td>
<td width="50%" rowspan="2" align="center" valign="middle" bgcolor="#FFFF66"><span>
<p><span>Download the ionCube Loader Trial Version:</span></p>
<?php

// CHECK PHP VERSION
$phpVerCk = explode(".",phpversion());
$phpVerCk = $phpVerCk[0].".".$phpVerCk[1];

if ((float)$phpVerCk < "4.3") {
$phpver = "Fail";
$phpColor = "red";
}
else {
$phpver = "Pass";
$phpColor = "green";
$phpVersion = explode(".",phpversion());
$phpVersion = $phpVersion[0];
}

if ($phpVersion!=5) { ?>
</span>
<table width="325" border="0" cellspacing="1" cellpadding="4">
<tr align="center" bgcolor="#993300">
<td width="33%" align="left" bgcolor="#662100">PHP 4.x</td>
<td width="33%" bgcolor="#D24400"><span>ionCube</span></td>
</tr>
<tr align="center">
<td align="left" bgcolor="#006633"><span>Zip File </span></td>
<td bgcolor="#E6E6E6"><a href="http://www.easyphpcalendar.com/getFile/?file=ic">Download</a></td>
</tr>
<tr align="center">
<td align="left" bgcolor="#005128"><span>Auto-Installer*</span></td>
<td bgcolor="#E6E6E6"><a href="http://www.easyphpcalendar.com/getFile/?file=ia">Download</a></td>
</tr>
</table>
<br>
<?php } else { ?>
<table width="325" border="0" cellspacing="1" cellpadding="4">
<tr align="center" bgcolor="#993300">
<td width="33%" align="left" bgcolor="#662100">PHP 5.x</td>
<td width="33%" bgcolor="#D24400"><span>ionCube</span></td>
</tr>
<tr align="center">
<td align="left" bgcolor="#006633"><span>Zip File </span></td>
<td bgcolor="#E6E6E6"><a href="http://www.easyphpcalendar.com/getFile/?file=ic5">Download</a></td>
</tr>
<tr align="center">
<td align="left" bgcolor="#005128"><span>Auto-Installer*</span></td>
<td bgcolor="#E6E6E6"><a href="http://www.easyphpcalendar.com/getFile/?file=ia5">Download</a></td>
</tr>
</table>
<br>
<?php } ?></td>
</tr>
<tr>
<td width="50%" align="center" valign="middle" bgcolor="#5E0000"><a href="loader-wizard.php" target="_blank"><span>&amp;gt;&amp;gt; Click Here to run the ionCube loader test script &amp;lt;&amp;lt;</span></a></td>
</tr>
<tr>
<td colspan="2" align="center" valign="middle" bgcolor="#ECF5FF"><span>*The <strong>auto-installer</strong> works just like most installers for programs downloaded from the internet. <br>
Simply run the installer then enter your FTP login and server path information (usually www or public_html).<br>
The installer will then upload all of the files in the correct format and set permissions where needed.<br>
No more worrying about binary or ASCII modes or file permissions. The installer does all of the work for you!<br>
The auto-installer can be run on Microsoft Windows and uploaded to any type of web server.</span></td>
</tr>
</table>
<br />
<p align="center">:: Tester Version 2.3 | <a href="http://www.EasyPHPCalendar.com/">Easy PHP Calendar</a> | Copyright 2011 <a href="http://www.nashtech.net/">NashTech, Inc.</a> ::</p></td>
</tr>
</table>
</body>
</html>

Event Calendar script PHP

Web Event Scheduler (PHP) script helps for schedule management in any website.Single Admin with login to manage events.Admin can easily add, update, delete, modify task or schedules.Default sorting of events based on allotted schedule date.Schedules older by 24hrs than current date will be deleted automatically.Easily set any color to calendar header and rows.Calendar size and column size can be dynamically changed.Set header, font size and date format in calendar.php Management and schedule sharing made easy.

 

<?php
/* (c) copyright 2004, HIOX INDIA                 */
/* This  is  a free tool provided by hioxidia.com */
/* visit us at http://www.hscripts.com            */

include "authheader.php";
if($block == false){
?>

<html>
<body style="margin: 0px; font-family: arial, verdana, san-serif; font-size: 14px;">
<style>
.evt{ color: #336644; text-decoration: none; }
</style>
<table width=100% height=100% cellpadding=0 cellspacing=0 bgcolor=#eeeedd valign=top
align=center style="font-family: arial, verdana, san-serif; font-size: 14px;">
<?php include "head.php" ?>
<tr><td height=95% align=center valign=top>
<br><br>

<?php
$upd = $_POST['updat'];

if($upd == "updat")
{
$typae = $_POST['typae'];
$col1 = $_POST['col1'];
$col2 = $_POST['col2'];
$col3 = $_POST['col3'];
$col4 = $_POST['col4'];


$open = fopen("size.php","w");
fwrite($open,"<?php \n\n");
fwrite($open,"$"."type=\"$typae\";\n");
fwrite($open,"$"."col1=\"$col1\";\n");
fwrite($open,"$"."col2=\"$col2\";\n");
fwrite($open,"$"."col3=\"$col3\";\n");
fwrite($open,"$"."col4=\"$col4\";\n");
fwrite($open,"?> \n\n");
echo "Updated size settings";
}
else
{?>
<script language=javascript>
function tyype()
{
var sel = document.colf.typae.value;
document.colf.ee1.value=sel;
document.colf.ee2.value=sel;
document.colf.ee3.value=sel;
document.colf.ee4.value=sel;
}
</script>

<?php
include "size.php";
echo "<div align=center>SIZE of Table</div>";
echo" <table height=40% width=40% cellpadding=0 cellspacing=0 bgcolor=#f4f5eb
align=center border=1 style=\"font-family: arial, verdana, san-serif; font-size: 14px;\">
<tr align=center><td colspan=2><form name=colf method=post action=\"msize.php\">"
;
echo "<input name=typae value=\"px\" type=hidden>";
echo "</td></tr>
<tr align=center><td>
<input type=hidden value=updat name=updat></input>
Column 1 </td><td><input type=text size=4 MAXLENGTH=3 value=\"$col1\" name=col1>
<input type=text name=ee1 size=2 value=\"$type\" readonly></td></tr>
<tr align=center><td>Column 2</td><td><input type=text size=4 MAXLENGTH=3 value=\"$col2\" name=col2>
<input type=text name=ee2 size=2 value=\"$type\" readonly></td></tr>
<tr align=center><td>Column 3</td><td><input type=text size=4 MAXLENGTH=3 value=\"$col3\" name=col3>
<input type=text name=ee3 size=2 value=\"$type\" readonly></td></tr>
<tr align=center><td>Column 4</td><td><input type=text size=4 MAXLENGTH=3 value=\"$col4\" name=col4>
<input type=text name=ee4 size=2 value=\"$type\" readonly></td></tr>
<tr align=center><td colspan=3>
<input style=\"border:1px green solid;\" type=submit value=Update></td></tr>
</table>"
;
}
?>
<br><br>
Enter size of table column in pixels.<br>
If pixel is used scroll bar will be shown for overflow columns.



</td></tr></table>
</body>
</html>
<?php
}
/* (c) copyright 2004, HIOX INDIA                 */
/* This  is  a free tool provided by hioxidia.com */
/* visit us at http://www.hscripts.com            */
?>

PHP Scripts for Free Random Quote

Make your website fun with this cool random quote script, this is a simple PHP random quote script which allows you to add five random text lines or images to display on your website. You could add funny little quotes within the script so every time your visitors refresh the page it will display a random quote.

<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<?php if ($this->user->authorize('com_content', 'edit', 'content', 'all') &amp;&amp; !$this->print) : ?>
    <div class="contentpaneopen_edit<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
        <?php echo JHTML::_('icon.edit', $this->article, $this->params, $this->access); ?>
    </div>
<?php endif; ?>

    <?php if ($this->params->get('show_title') || $this->params->get('show_pdf_icon') || $this->params->get('show_print_icon') || $this->params->get('show_email_icon')) : ?>
    <h2 class="contentheading <?php echo $this->params->get( 'pageclass_sfx' ); ?>">
        <?php if ($this->params->get('link_titles') &amp;&amp; $this->article->readmore_link != '') : ?>
        <a href="<?php echo $this->article->readmore_link; ?>" class="contentpagetitle<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
            <?php echo $this->escape($this->article->title); ?>
        </a>
        <?php else : ?>
            <?php echo $this->escape($this->article->title); ?>
        <?php endif; ?>
    </h2>
    <?php endif; ?>

<?php if ($this->params->get('show_pdf_icon') || $this->params->get('show_print_icon') || $this->params->get('show_email_icon')) : ?>
<div class="buttons">
    <?php if (!$this->print) : ?>
    <?php if ($this->params->get('show_pdf_icon')) : ?>
    <div class="buttonheading">
    <?php echo JHTML::_('icon.pdf',  $this->article, $this->params, $this->access); ?>
    </div>
    <?php endif; ?>

    <?php if ( $this->params->get( 'show_print_icon' )) : ?>
    <div class="buttonheading">
    <?php echo JHTML::_('icon.print_popup',  $this->article, $this->params, $this->access); ?>
    </div>
    <?php endif; ?>

    <?php if ($this->params->get('show_email_icon')) : ?>
    <div class="buttonheading">
    <?php echo JHTML::_('icon.email',  $this->article, $this->params, $this->access); ?>
    </div>
    <?php endif; ?>
    <?php else : ?>
    <div class="buttonheading">
    <?php echo JHTML::_('icon.print_screen',  $this->article, $this->params, $this->access); ?>
    </div>
    <?php endif; ?>
</div>
<?php endif; ?>

<?php  if (!$this->params->get('show_intro')) :
    echo $this->article->event->afterDisplayTitle;
endif; ?>
<?php echo $this->article->event->beforeDisplayContent; ?>
<div class="contentpaneopen <?php echo $this->params->get( 'pageclass_sfx' ); ?>">
<?php if (($this->params->get('show_section') &amp;&amp; $this->article->sectionid) || ($this->params->get('show_category') &amp;&amp; $this->article->catid)) : ?>
<div class="section-category">
        <?php if ($this->params->get('show_section') &amp;&amp; $this->article->sectionid &amp;&amp; isset($this->article->section)) : ?>
        <span>
            <?php if ($this->params->get('link_section')) : ?>
                <?php echo '<a href="'.JRoute::_(ContentHelperRoute::getSectionRoute($this->article->sectionid)).'">'; ?>
            <?php endif; ?>
            <?php echo $this->article->section; ?>
            <?php if ($this->params->get('link_section')) : ?>
                <?php echo '</a>'; ?>
            <?php endif; ?>
                <?php if ($this->params->get('show_category')) : ?>
                <?php echo ' - '; ?>
            <?php endif; ?>
        </span>
        <?php endif; ?>
        <?php if ($this->params->get('show_category') &amp;&amp; $this->article->catid) : ?>
        <span>
            <?php if ($this->params->get('link_category')) : ?>
                <?php echo '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->article->catslug, $this->article->sectionid)).'">'; ?>
            <?php endif; ?>
            <?php echo $this->article->category; ?>
            <?php if ($this->params->get('link_section')) : ?>
                <?php echo '</a>'; ?>
            <?php endif; ?>
        </span>
        <?php endif; ?>
</div><?php endif; ?>
<?php if (($this->params->get('show_author')) &amp;&amp; ($this->article->author != "")) : ?>
<div class="author">
            <?php JText::printf( 'Written by', ($this->article->created_by_alias ? $this->article->created_by_alias : $this->article->author) ); ?>
</div>
<?php endif; ?>

<?php if ($this->params->get('show_create_date')) : ?>
<div class="createdate">
        <?php echo JHTML::_('date', $this->article->created, JText::_('DATE_FORMAT_LC2')) ?>
</div>
<?php endif; ?>

<?php if ($this->params->get('show_url') &amp;&amp; $this->article->urls) : ?>
<div class="url">
        <a href="http://<?php echo $this->article->urls ; ?>" target="_blank">
            <?php echo $this->article->urls; ?></a>
</div>
<?php endif; ?>

<?php if (isset ($this->article->toc)) : ?>
    <?php echo $this->article->toc; ?>
<?php endif; ?>
<?php echo $this->article->text; ?>

<?php if ( intval($this->article->modified) !=0 &amp;&amp; $this->params->get('show_modify_date')) : ?>
<div class="modifydate">
        <?php echo JText::_( 'Last Updated' ); ?> ( <?php echo JHTML::_('date', $this->article->modified, JText::_('DATE_FORMAT_LC2')); ?> )
</div>
<?php endif; ?>
</div>
<span class="article_separator"></span>
<?php echo $this->article->event->afterDisplayContent; ?>

Generate a HTML calendar from PHP

This class can be used to display calendar of a given month in an HTML page. Holidays or other events can be configured to be highlighted in a special way (using CSS styles). The days of the month can rendered with a form checkbox or radio buttons so they can be selected by the user. Rendering of the different calendar elements can be configured using CSS styles. The names of the months and days of the week can be configured, so that they�re displayed in a language other than English.

<?php
 /**
 * This is the IAM_Calendar class. It provides methods for generating HTML code for a 1-month calendar, with various content and styling options
 * @package IAM_Classes
 * @author Iván Melgrati <imelgrat@gmail.com>
 * @version 1.0
 */


 /**
 * This class draws a 1-month calendar, with styling options.
 *
 * The class draws a calendar, with optional checkboxes in each day (to be used in a form, for instance).
 * Each part of the calendar uses a configurable CSS style class, allowing the user to style it according to his/her needs.
 * @package IAM_Classes
 * @subpackage IAM_Calendar
 * @author Iván Melgrati <imelgrat@gmail.com>
 * @version 1.0
 */

 class IAM_Calendar
 {
 /**
 * @access private
 * @var int Keeps the calendar year
 **/

 private $year;

 /**
 * @access private
 * @var int Keeps the calendar month
 **/

 private $month;

 /**
 * @access private
 * @var int Keeps the number of days in current month
 **/

 private $monthDays;

 /**
 * @access private
 * @var Array Keeps holidays. If a day is holiday, it will change the CSS class to distinguish it.
 **/

 private $holidays;

 /**
 * @access private
 * @var Array Keeps the names of days of the week.
 **/

 private $dayNames = array(0=>'Sun', 1=>'Mon', 2=>'Tue', 3=>'Wed',
 4=>'Thu' , 5=>'Fri' , 6=>'Sat');

 /**
 * @access private
 * @var Array keeps the names of months of the year
 **/

 private $monthNames = array(1=>'January', 2=>'February', 3=>'March', 4=>'April' , 5=>'May' , 6=>'June' ,
 7=>'July', 8=>'August', 9=>'September', 10=>'October', 11=>'November' , 12=>'December');

 /**
 * @access private
 * @var Array keeps the style classes for each part of the calendar table. The default values are the names used to identify each part
 **/

 private $styleNames = array ('tableStyle'=>'tableStyle', 'monthHeaderStyle'=>'monthHeaderStyle', 'dayHeaderStyle'=>'dayHeaderStyle',
 'nonMonthStyle'=>'nonMonthStyle', 'weekdayStyle'=>'weekdayStyle', 'weekendStyle'=>'weekendStyle',
 'holidayStyle'=>'holidayStyle', 'inputStyle'=>'inputStyle');

 /**
 * Determine whether the year is a leap year.
 *
 * @param   int $year        The year as a four digit integer
 * @return  boolean          True if the year is a leap year, false otherwise
 */

 private function isLeapYear($year)
 {
 return $year % 4 == 0 &amp;&amp; ($year % 400 == 0 || $year % 100 != 0);
 }

 /**
 * Class constructor
 *
 * Takes year and month as optional parameters.
 *
 * @param int $year Must be an integer greater than 1900. If not given or in case of error, the current year will be used.
 * @param int $month  Must be an integer between 1 and 12. If not given or in case of error, the current month will be used.
 */

 public function IAM_Calendar($year=0, $month=0)
 {
 $this->setYear($year);
 $this->setMonth($month);
 $this->holidays=Array();
 }

 /**
 * Sets the calendar's current year.
 *
 * @param int $year Must be an integer greater than 1900. If not given or in case of error, the current year will be used.
 */

 public function setYear($year)
 {
 $this->year = ($year and is_numeric($year) and $year > 1900) ? $year : date('Y');
 }

 /**
 * Sets the calendar's current month.
 *
 * @param int $month Must be an integer between 1 and 12. If not given or in case of error, the current month will be used.
 */

 public function setMonth($month=0)
 {
 $this->month = ($month and is_numeric($month) and $month >=1 and $month <=12)? $month :  date("n");
 $this->monthDays = $this->numberOfDays($this->year, $month);
 }

 /**
 * Set the CSS class for a calendar element. If the element doesn't exist, it does nothing
 * @param string $element Name of the element to apply the CSS class to
 * @param string $cssClass Name of the CSS class to be applied
 */

 public function setStyle($element, $cssClass)
 {
 if(array_key_exists($element, $this->styleNames))
 {
 $this->styleNames[$element] = $cssClass;
 }
 }

 /**
 * Set the names of the days of the week
 * @param  $days Array Array of 7 strings containing the days of the week (starting from Sunday)
 */

 public function setDayNames($days)
 {
 if(sizeof($days)==7)
 {
 $counter = 0;
 foreach($days as $day)
 {
 $this->dayNames[$counter++]=$day;
 }
 }
 }

 /**
 * Set the names of the months of the year
 * @param  Array Array of 7 strings containing the months of the year (starting from January)
 */

 public function setMonthNames($months)
 {
 if(sizeof($months)==12)
 {
 $counter = 0;
 foreach($months as $month)
 {
 $this->monthNames[$counter++]=$month;
 }
 }
 }

 /**
 * Returns the number of days for the given year and month. It accounts for leap years.
 * @param int $year
 * @param int $month
 */

 public function numberOfDays($year, $month)
 {
 if (in_array($month, array(1, 3, 5, 7, 8, 10, 12)))
 return 31;
 else if (in_array($month, array(4, 6, 9, 11)))
 return 30;
 else
 {
 return ($this->isLeapYear($year) ? 29 : 28);
 }
 }

 /**
 * Add a holiday to the list. This will change the CSS styling and pop the description when placing the mouse over. Only one holiday is allowed per day.
 * @param int $year Year of the event
 * @param int $month Month of the event
 * @param int $day Day of the event
 * @param string $desc Event description
 */

 public function addHoliday($year, $month, $day, $desc='')
 {
 $this->holidays[$year][$month][$day]=$desc;
 }

 /**
 * Generates HTML code for current year and month
 *
 * @param boolean $drawDayHeaders       When set, it generates a header row containing the name of each day (Mon, Tue....)
 * @param boolean $drawMonthHeader      When set, it generates a header row containing the name of the current month
 * @param boolean $drawOtherDays        When set, it shows the day numbers from previous and next months.
 * @param boolean $drawInputControl     When set, it draws a chechbox next to each day. The checkbox's name is of the form yyyy-mm-dd
 * @param boolean $disableMultiple      When set (and if $drawInputControl has been set), it will draw a radiobutton instead of a checkbox
 * @param string  $radioName            Day of the radio group (used when @link $disableMultiple is set). It defaults to 'cal'. Each button's value is of the form yyyy-mm-dd
 */

 public function drawMonth($drawDayHeaders=true, $drawMonthHeader=false, $drawOtherDays=true,
 $drawInputControl=false, $disableMultiple=false, $radioName='calendar')
 {
 // Get index of first and last day of the month
 $startingDay = date("w", mktime(0, 0, 0, $this->month, 1, $this->year));
 $endingDay = date("w", mktime(0, 0, 0, $this->month, $this->monthDays, $this->year));

 //Begin drawing calendar
 $returnCode = '<table>';

 // Draw Table headers containing dayNames (if specified in parameter list)
 if ($drawMonthHeader)
 {
 $returnCode .= '<tr>';
 $returnCode .= '<td colspan="7">'.$this->monthNames[$this->month].'</td>';
 $returnCode .= "</tr>";
 }

 // Draw Table headers containing dayNames (if specified in parameter list)
 if ($drawDayHeaders)
 {
 $returnCode .= '<tr>';
 for ($count = 0; $count < 7; $count++)
 {
 $returnCode .= '<td>'.$this->dayNames[$count].'</td>';
 }
 $returnCode .= "</tr> ";
 }

 $count = 0;
 $returnCode .= "<tr>";

 // Draw days from previous month
 if($startingDay  > 0)
 {
 $prevMonth = $this->month == 1 ? 12 : $this->month - 1;
 $prevYear =  $this->month == 1 ? ($this->year - 1) : ($this->year);
 $prevDays= $this->numberOfDays($prevYear, $prevMonth)-$startingDay+1;

 for ($count = 0; $count < $startingDay; $count++)
 {
 $returnCode .=  '<td>';

 if($drawOtherDays)
 {
 if($drawInputControl)
 {
 if($disableMultiple)
 $returnCode .= '<input type="radio" name="'.$radioName.'" value="'.
 $this->year.'-'.sprintf("%02s", $this->month).'-'.sprintf("%02s", $prevDays).'">';
 else
 $returnCode .= '<input type="checkbox" name="'.
 $this->year.'-'.sprintf("%02s", $this->month).'-'.sprintf("%02s", $prevDays).'">';
 }

 $returnCode .=  sprintf("%02s", $prevDays++).'</td>';
 }
 else
 $returnCode .= '</td>';

 }
 }

 // Print day numbers
 for ($counter = 1; $counter <= $this->monthDays; $counter++, $count++)
 {
 if (($count % 7) == 0 and $count != 0)
 {
 $returnCode .= "</tr><tr>";
 }

 if( (($count % 7) == 0) or (($count % 7) == 6) )
 $returnCode .= "<td>";
 else
 if ($this->holidays[$this->year][$this->month][$counter] !="")
 $returnCode .= "<td title=\"".$this->holidays[$this->year][$this->month][$counter]."\">";
 else
 $returnCode .= "<td>";

 if($drawInputControl)
 {
 if($disableMultiple)
 $returnCode .= '<input type="radio" name="'.$radioName.'" value="'.
 $this->year.'-'.sprintf("%02s",$this->month).'-'.sprintf("%02s",$counter).'">';
 else
 $returnCode .= '<input type="checkbox" name="'.
 $this->year.'-'.sprintf("%02s",$this->month).'-'.sprintf("%02s",$counter).'">';
 }

 $returnCode .= sprintf("%02s",$counter)."</td>";
 }

 // Draw days from next month
 if($endingDay < 6)
 {
 $dayCounter=1;
 for ($count = $endingDay; $count < 6; $count++)
 {
 $returnCode .=  '<td>';

 if($drawOtherDays)
 {
 if($drawInputControl)
 {
 if($disableMultiple)
 $returnCode .= '<input type="radio" name="'.$radioName.'" value="'.
 $this->year.'-'.sprintf("%02s", $this->month).'-'.sprintf("%02s", $dayCounter).'">';
 else
 $returnCode .= '<input type="checkbox" name="'.
 $this->year.'-'.sprintf("%02s", $this->month).'-'.sprintf("%02s", $dayCounter).'">';
 }
 $returnCode .=  sprintf("%02s", $dayCounter++).'</td>';
 }
 else $returnCode .= '</td>';
 }
 }

 $returnCode .= '</tr></table>';

 return $returnCode;
 }
 }

?>

PHP for Anglican Calendar Script

This program has one purpose: to determine and write out the applicable liturgical day under the “traditional” Anglican and Episcopal calendar for the current day (for the server; the viewer might actually be in a different day.) By “traditional” we mean as enumerated in the 1662 (Church of England) and 1928 (Protestant Episcopal Church) prayer books. Both of these prayer books can be downloaded from this website. The program can return up to three results.

 

 

<h3>
 <?php
/*
 ANGLICAN CALENDAR SCRIPT
 Version 0.16
 1 January 2009

 This program has one purpose: to determine and write out the applicable
 liturgical day under the "traditional" Anglican and Episcopal calendar
 for the current day (for the server; the viewer might actually be in a
 different day.)

 By "traditional" we mean as enumerated in the 1662 (Church of England)
 and 1928 (Protestant Episcopal Church) prayer books.  Both of these prayer
 books can be downloaded from http://www.vulcanhammer.org/anglican/.

 The program can return up to three results:

 1. The specific Sunday in the church year, which is repeated during the following week
 unless a major event intervenes (such as Christmas, Epiphany, Ash Wednesday,
 Asension Day, etc.)
 2. The saint's feast or other holy day, such as Holy Innocents, All Saints, etc.  We
 have restricted these days to those days which have collects, epistles and gospels
 for the Holy Communion.
 3. Whether a day is a Rogation or Ember Day.

 We have opted to present these without any rules of precedence, as these vary between the
 two prayer books listed above.

 You can include this script either directly into the web page or as an include, which is
 the way it's done at its home site.  This copy of the script displays the result in "h3" format,
 which can be modified by changing the tags at the start and end of the program.

 Suggestions and error notices can be sent to me by visting the comment page of my
 websites http://www.vulcanhammer.org/ or http://www.vulcanhammer.net/.  Additional copies
 of the script may be downloaded by visiting http://www.vulcanhammer.org/anglican/calendar/.  If you
 modify and/or redistribute this code, we ask that attribution to the original code and
 author be maintained.  Additional terms and conditions are detailed below.

 Copyright (C) 2005-2009 Don C. Warrington

 This program is free software; you can redistribute it and/or modify
 it under the terms of version 2 of the GNU General Public License as published by
 the Free Software Foundation.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 Version History:
 0.1, 21 January 2005: Original Script
 0.11, 30 March 2005: Corrected script for error between Easter Sunday and Ascension Day
 0.12, 31 May 2005: Corrected script for calculation of Advent and Trinity Sundays when Christmas falls on a Sunday
 0.13, 26 December 2005: Corrected script to announce Christmas octave between Christmas and First Sunday after Christmas
 0.14, 19 May 2006: Moved Circumcision to the "Feast Day" list; Added Feasts of St. Barnabas, the Transfiguration, U.S. Independence Day, U.S. Thanksgiving Day
 0.15, 27 December 2008: Corrected problem with next year's Epiphany Sunday being used to compute First Sunday After Christmas
 0.16, 1 January 2009: Added current date callout before announcing liturgical celebration
*/

// Define this day and this year
 $thisyear = date("Y");
 $thisday = unixtojd();
// Define ordinals
 $ordinal = array (
 1 => "First",
 2 => "Second",
 3 => "Third",
 4 => "Fourth",
 5 => "Fifth",
 6 => "Sixth",
 7 => "Seventh",
 8 => "Eighth",
 9 => "Ninth",
 10 => "Tenth",
 11 => "Eleventh",
 12 => "Twelth",
 13 => "Thirteenth",
 14 => "Fourteenth",
 15 => "Fifteenth",
 16 => "Sixteenth",
 17 => "Seventeenth",
 18 => "Eighteenth",
 19 => "Nineteenth",
 20 => "Twentieth",
 21 => "Twenty-First",
 22 => "Twenty-Second",
 23 => "Twenty-Third",
 24 => "Twenty-Fourth",
 25 => "Twenty-Fifth",
 26 => "Twenty-Sixth",
 27 => "Twenty-Seventh"
 );
// Set Chrismas Day--if January, use last years day, otherwise use this years day
 if (date("n") == 1) {
 $christmas[0] = gregoriantojd (12, 25, $thisyear - 1);
 }
 else {
 $christmas[0] = gregoriantojd (12, 25, $thisyear);
 }
// Find out what day of the week Christmas falls on
 $christmasdayweek = jddayofweek ($christmas[0],0);
// Set Fourth Sunday in Advent; then all Sundays back to Sunday Before Advent are set from that
 if ($christmasdayweek == 0) {
 $advent[4] = $christmas[0] - 7;
 }
 else {
 $advent[4] = $christmas[0] - $christmasdayweek;
 }
 $advent[0] = $advent[4] - 28;
 $advent[1] = $advent[4] - 21;
 $advent[2] = $advent[4] - 14;
 $advent[3] = $advent[4] - 7;
// Set Sundays after Christmas, Epiphany and Sundays After Epiphany
 $christmas[1] = $christmas[0] + 7 - $christmasdayweek;
 $christmas[2] = $christmas[1] + 7;
 $epiphany = array (
 0 => gregoriantojd(1,6,$thisyear),
 1 => gregoriantojd(1,6,$thisyear) + 7 - jddayofweek(gregoriantojd(1,6,$thisyear)),
 2 => gregoriantojd(1,6,$thisyear) + 14 - jddayofweek(gregoriantojd(1,6,$thisyear)),
 3 => gregoriantojd(1,6,$thisyear) + 21 - jddayofweek(gregoriantojd(1,6,$thisyear)),
 4 => gregoriantojd(1,6,$thisyear) + 28 - jddayofweek(gregoriantojd(1,6,$thisyear)),
 5 => gregoriantojd(1,6,$thisyear) + 35 - jddayofweek(gregoriantojd(1,6,$thisyear)),
 6 => gregoriantojd(1,6,$thisyear) + 42 - jddayofweek(gregoriantojd(1,6,$thisyear))
 );
// Set Epiphany year forward for calcuation of Sundays after Christmas (override)
 if (date("n") == 12) {
 $epiphany[0] = gregoriantojd(1,6,$thisyear + 1);
 }
// Set Sundays after Easter
 $easter = array (
 0 => unixtojd(easter_date($thisyear)),
 1 => unixtojd(easter_date($thisyear)) + 7,
 2 => unixtojd(easter_date($thisyear)) + 14,
 3 => unixtojd(easter_date($thisyear)) + 21,
 4 => unixtojd(easter_date($thisyear)) + 28,
 5 => unixtojd(easter_date($thisyear)) + 35
 );
// Set Sundays in Lent, including Ash Wednesday
 $lent = array (
 0 => $easter[0] - 46,
 1 => $easter[0] - 42,
 2 => $easter[0] - 35,
 3 => $easter[0] - 28,
 4 => $easter[0] - 21,
 5 => $easter[0] - 14,
 6 => $easter[0] - 7,
 );
// Set Pre-Lent Sundays, Ascension Days and Whitsunday
 $quinquagesima = $easter[0] - 49;
 $sexagesima = $easter[0] - 56;
 $septuagesima = $easter[0] - 63;
 $ascension = $easter[0] + 39;
 $ascensionsunday = $easter[0] + 42;
 $whitsunday = $easter[0] + 49;
// Set Trinity Sunday
 $trinity[0] = $easter[0] + 56;
// Compute Thanksgiving Day (U.S.)
 $allsaints = gregoriantojd (11, 1, $thisyear);
 $allsaintsdayweek = jddayofweek ($allsaints, 0);
 switch ($allsaintsdayweek) {
 case 5:
 $thanksgiving = gregoriantojd (11, 28, $thisyear);
 break;
 case 6:
 $thanksgiving = gregoriantojd (11, 27, $thisyear);
 break;
 default:
 $thanksgiving = $allsaints + 4 - $allsaintsdayweek + 21;
 break;
 }
// Set variable that shows what Sunday (or octave) it actually is
 if (($thisday >= $christmas[0]) AND ($thisday < $christmas[1])) {
 $litday = "Christmas Day or Octave";
 }
 elseif ($thisday == $lent[0]) {
 $litday = "Ash Wednesday";
 }
 elseif ($thisday == $easter[0] - 6) {
 $litday = "Monday before Easter";
 }
 elseif ($thisday == $easter[0] - 5) {
 $litday = "Tuesday before Easter";
 }
 elseif ($thisday == $easter[0] - 4) {
 $litday = "Wednesday before Easter";
 }
 elseif ($thisday == $easter[0] - 3) {
 $litday = "Maundy Thursday";
 }
 elseif ($thisday == $easter[0] - 2) {
 $litday = "Good Friday";
 }
 elseif ($thisday == $easter[0] - 1) {
 $litday = "Easter Even";
 }
 elseif ($thisday == $easter[0] + 1) {
 $litday = "Monday in Easter Week";
 }
 elseif ($thisday == $easter[0] + 2) {
 $litday = "Tuesday in Easter Week";
 }
 elseif (($thisday < $epiphany[0]) AND ($thisday >= $christmas[1])) {
 $numsunday = intval(floor(($thisday - $christmas[1])/7)+1);
 $litday = $ordinal[$numsunday] . " Sunday after Christmas";
 }
 elseif (($thisday < $epiphany[1]) AND ($thisday >= $epiphany[0])) {
 $litday = "Epiphany";
 }
 elseif (($thisday < $septuagesima) AND ($thisday >= $epiphany[1])) {
 $numsunday = intval(floor(($thisday - $epiphany[1])/7)+1);
 $litday = $ordinal[$numsunday] . " Sunday after Epiphany";
 }
 elseif (($thisday < $sexagesima) AND ($thisday >= $septuagesima)) {
 $litday = "Septuagesima";
 }
 elseif (($thisday < $quinquagesima) AND ($thisday >= $sexagesima)) {
 $litday = "Sexagesima";
 }
 elseif (($thisday < $lent[0]) AND ($thisday >= $quinquagesima)) {
 $litday = "Quinquagesima";
 }
 elseif (($thisday < $lent[1]) AND ($thisday > $lent[0])) {
 $litday = "Ash Wednesday";
 }
 elseif (($thisday < $easter[0]) AND ($thisday >= $lent[1])) {
 $numsunday = intval(floor(($thisday - $lent[1])/7)+1);
 if ($numsunday == 6) {
 $litday = "Palm Sunday";
 }
 elseif ($numsunday == 5) {
 $litday = "Passion Sunday";
 }
 else {
 $litday = $ordinal[$numsunday] . " Sunday in Lent";
 }
 }
 elseif (($thisday < $ascension) AND ($thisday >= $easter[0])) {
 $numsunday = intval(floor(($thisday - $easter[0])/7));
 if ($numsunday == 0) {
 $litday = "Easter Sunday";
 }
 else {
 $litday = $ordinal[$numsunday] . " Sunday after Easter";
 }
 }
 elseif (($thisday < $ascensionsunday) AND ($thisday >= $ascension)) {
 $litday = "Ascension Day";
 }
 elseif (($thisday < $whitsunday) AND ($thisday >= $ascensionsunday)) {
 $litday = "Sunday after Ascension";
 }
 elseif (($thisday < $trinity[0]) AND ($thisday >= $whitsunday)) {
 $litday = "Whitsunday";
 }
 elseif (($thisday < $advent[0]) AND ($thisday >= $trinity[0])) {
 $numsunday = intval(floor(($thisday - $trinity[0])/7));
 if ($numsunday == 0) {
 $litday = "Trinity Sunday";
 }
 else {
 $litday = $ordinal[$numsunday] . " Sunday after Trinity";
 }
 }
 elseif (($thisday < $christmas[0]) AND ($thisday >= $advent[0])) {
 $numsunday = intval(floor(($thisday - $advent[0])/7));
 if ($numsunday == 0) {
 $litday = "Sunday before Advent";
 }
 else {
 $litday = $ordinal[$numsunday] . " Sunday in Advent";
 }
 }
// Set Saint or Feast Day
 if ($thisday == gregoriantojd (1,  1, $thisyear)) {
 $feastday = "Circumcision";
 }
 elseif ($thisday == gregoriantojd (1, 25, $thisyear)) {
 $feastday = "Conversion of St. Paul";
 }
 elseif ($thisday == gregoriantojd (2, 2, $thisyear)) {
 $feastday = "Purification of the Virgin Mary";
 }
 elseif ($thisday == gregoriantojd (2, 24, $thisyear)) {
 $feastday = "Feast of St. Mathias";
 }
 elseif ($thisday == gregoriantojd (3, 25, $thisyear)) {
 $feastday = "Annunciation of the Virgin Mary";
 }
 elseif ($thisday == gregoriantojd (4, 25, $thisyear)) {
 $feastday = "Feast of St. Mark";
 }
 elseif ($thisday == gregoriantojd (5, 1, $thisyear)) {
 $feastday = "Feast of St. Phillip and St. James";
 }
 elseif ($thisday == gregoriantojd (6, 11, $thisyear)) {
 $feastday = "Feast of St. Barnabas";
 }
 elseif ($thisday == gregoriantojd (6, 24, $thisyear)) {
 $feastday = "Feast of St. John the Baptist";
 }
 elseif ($thisday == gregoriantojd (6, 29, $thisyear)) {
 $feastday = "Feast of St. Peter";
 }
 elseif ($thisday == gregoriantojd (7, 4, $thisyear)) {
 $feastday = "Independence Day (U.S.)";
 }
 elseif ($thisday == gregoriantojd (7, 25, $thisyear)) {
 $feastday = "Feast of St. James";
 }
 elseif ($thisday == gregoriantojd (8, 6, $thisyear)) {
 $feastday = "Feast of The Transfiguration of Christ";
 }
 elseif ($thisday == gregoriantojd (8, 24, $thisyear)) {
 $feastday = "Feast of St. Bartholomew";
 }
 elseif ($thisday == gregoriantojd (9, 21, $thisyear)) {
 $feastday = "Feast of St. Matthew";
 }
 elseif ($thisday == gregoriantojd (9, 29, $thisyear)) {
 $feastday = "Feast of St. Michael and All Angels";
 }
 elseif ($thisday == gregoriantojd (10, 18, $thisyear)) {
 $feastday = "Feast of St. Luke";
 }
 elseif ($thisday == gregoriantojd (10, 28, $thisyear)) {
 $feastday = "Feast of St. Simon and St. Jude";
 }
 elseif ($thisday == $allsaints) {
 $feastday = "All Saints Day";
 }
 elseif ($thisday == $thanksgiving) {
 $feastday = "Thanksgiving Day (U.S.)";
 }
 elseif ($thisday == gregoriantojd (11, 30, $thisyear)) {
 $feastday = "Feast of St. Andrew";
 }
 elseif ($thisday == gregoriantojd (12, 21, $thisyear)) {
 $feastday = "Feast of St. Thomas";
 }
 elseif ($thisday == gregoriantojd (12, 26, $thisyear)) {
 $feastday = "Feast of St. Stephen";
 }
 elseif ($thisday == gregoriantojd (12, 27, $thisyear)) {
 $feastday = "Feast of St. John the Evangelist";
 }
 elseif ($thisday == gregoriantojd (12, 28, $thisyear)) {
 $feastday = "Holy Innocents Day";
 }
// Set Ember or Rogation Day
 $fallemberstart = gregoriantojd (9, 14, $thisyear);
 for ($i = 0; $i <= 6; $i++) {
 $fallember = $fallemberstart + $i;
 if (jddayofweek ($fallember,0) == 3) break;
 }
 $winteremberstart = gregoriantojd (12, 13, $thisyear);
 for ($i = 0; $i <= 6; $i++) {
 $winterember = $winteremberstart + $i;
 if (jddayofweek ($winterember,0) == 3) break;
 }
 if (($thisday > $easter[5]) AND ($thisday < $ascension)) {
 $emberogation = "Rogation Day";
 }
 elseif ($thisday == $lent[1] + 3) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $lent[1] + 5) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $lent[1] + 6) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $whitsunday + 3) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $whitsunday + 5) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $whitsunday + 6) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $fallember) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $fallember + 2) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $fallember + 3) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $winterember) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $winterember + 2) {
 $emberogation = "Ember Day";
 }
 elseif ($thisday == $winterember + 3) {
 $emberogation = "Ember Day";
 }
 echo date('D jS M Y') . '<hr>';
 if (isset($litday)) {
 echo 'Liturgical Celebration:<br>' . $litday;
 }
 if (isset($feastday)) {
 echo '<br>' . $feastday;
 }
 if (isset($emberogation)) {
 echo '<br>' . $emberogation;
 }
 ?></h3>

&amp;nbsp;

PHP Scripts for Proverbs Web Calendar

This is a web event calendar developed using PHP and powered by MySQL. The calendar is viewed in month format initially with a detailed view of daily events as each calendar day is clicked on. The calendar is customizable within a single file; allowing changes to the title, color choices, calendar language, starting day of the week, time format(24hr/12hr), time zone display and more.

 

 

<?php
/*  ©2009 Proverbs, LLC. All rights reserved.  */

if (preg_match("/calendar.alt.php/i", $_SERVER['PHP_SELF']))
{
 // redirect to calendar page
 header("Location: calendar.php");
 exit;
}

if(!defined("ALTERNATE_CALENDAR_PAGE"))
{
 define("ALTERNATE_CALENDAR_PAGE", TRUE);

 require ('setup.inc.php');
 require ('language.inc.php');
 require ('calaccess.inc.php');

 class alt_calendar_page
 {
 var $alternate_page;
 var $activemonth;
 var $activeyear;

 // Constructor
 function alt_calendar_page()
 {
 $this->alternate_page = '';
 $this->activemonth = 0;
 $this->activeyear = 0;
 }

 function createpage($current_day, $current_month, $current_year)
 {
 $this->activemonth = $current_month;
 $this->activeyear = $current_year;

 $nextmonth = $current_month + 1;
 $nextyear = $current_year;
 $prevmonth = $current_month - 1;
 $prevyear = $current_year;

 if ($current_month == 1)
 {
 $prevmonth = 12;
 $prevyear = $current_year - 1;
 }
 if ($current_month == 12)
 {
 $nextmonth = 1;
 $nextyear = $current_year + 1;
 }

 // create the setup object
 $conf = new layout_setup;
 // create the language object
 $lang = new language;

 $adjustment = 3600 * $conf->time_adjustment;
 if ($conf->use_dst)
 $adjustment += 3600 * date("I", time() + $adjustment);

 $this->alternate_page .= '<center>
<form method="post" action="calendar.php">
<table bordercolor="#'
.$conf->calendar_border_color.'" cellspacing="0" cellpadding="0" border="1">
<tr>
<td bordercolor="#'
.$conf->html_body_background_color.'" width="100%" height="40" align="center" valign="middle" bgcolor="#'.$conf->html_body_background_color.'" colspan="7">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td nowrap="nowrap" align="left" valign="middle" bgcolor="#'
.$conf->html_body_background_color.'" width="250">
&amp;nbsp;<font size="2" point-size="12" color="#'
.$conf->html_body_text_color.'"><b>'.$lang->word_today_date.': </b>'.$lang->month_long[gmdate("n", time() + $adjustment)].gmdate(" j, Y", time() + $adjustment).'</font>
</td>
<td nowrap="nowrap" align="right" valign="middle" bgcolor="#'
.$conf->html_body_background_color.'" width="450">
<font size="2" point-size="12" color="#'
.$conf->html_body_text_color.'"><b>'.$lang->word_month.': </b>
<select name="month">
'
;
 for ($i = 1; $i <= 12; $i++)
 {
 $this->alternate_page .= '<option value="'.$i.'"';
 if ($i == $current_month)
 $this->alternate_page .= ' selected="selected"';
 $this->alternate_page .= '>'.$lang->month_long[$i].'</option>
'
;
 }

 $this->alternate_page .= '</select>
&amp;nbsp;&amp;nbsp;
<b>'
.$lang->word_year.': </b>
<select name="year">
'
;
 for ($i = (gmdate("Y") - 2); $i <= (gmdate("Y") + 10); $i++)
 {
 $this->alternate_page .= '<option value="'.$i.'"';
 if ($i == $current_year)
 $this->alternate_page .= ' selected="selected"';
 $this->alternate_page .= '>'.$i.'</option>
'
;
 }

 $this->alternate_page .= '</select>&amp;nbsp;&amp;nbsp;
<input type="submit" name="refresh" value="'
.$lang->word_refresh.'" />&amp;nbsp;&amp;nbsp;&amp;nbsp;</font>
<br />
'
;
 if ($conf->show_admin_link)
 $this->alternate_page .= '<a href="caladmin/caladmin.php" target="caladmin"><font size="2" point-size="12" color="#'.$conf->html_body_text_color.'">'.$lang->word_administration.'</font></a>
'
;
 $this->alternate_page .= '
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" align="center" valign="middle" bgcolor="#'
.$conf->calendar_title_background_color.'" colspan="7">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="100%" height="60" align="center" valign="middle" bgcolor="#'
.$conf->calendar_title_background_color.'" colspan="3">
'
;
 if (trim($conf->calendar_title_image) != '')
 $this->alternate_page .= '<img src="'.$conf->calendar_title_image.'" alt="'.$conf->calendar_title_text.'" border="0" />';
 else
 $this->alternate_page .= '<font size="6" point-size="36" color="#'.$conf->calendar_title_text_color.'">'.$conf->calendar_title_text.'</font>';

 $this->alternate_page .= '
</td>
</tr>
<tr>
<td nowrap="nowrap" width="200" height="24" bgcolor="#'
.$conf->calendar_title_background_color.'" valign="middle" align="left">
&amp;nbsp;'
;
 if ($prevyear > 1979 &amp;&amp; $prevyear > (gmdate("Y", time()) - 6))
 $this->alternate_page .= '<a href="calendar.php?month='.$prevmonth.'&amp;amp;year='.$prevyear.'"><font size="2" point-size="12" color="#'.$conf->calendar_title_text_color.'"><b>&amp;lt;&amp;lt; '.$lang->month_long[$prevmonth].' '.$prevyear.'</b></font></a>';

 $this->alternate_page .= '
</td>
<td nowrap="nowrap" width="300" height="24" bgcolor="#'
.$conf->calendar_title_background_color.'" valign="middle" align="center">
<font size="3" point-size="16" color="#'
.$conf->calendar_title_text_color.'"><b>'.$lang->month_long[$current_month].' '.$current_year.'</b></font>
</td>
<td nowrap="nowrap" width="200" height="24" bgcolor="#'
.$conf->calendar_title_background_color.'" valign="middle" align="right">
'
;
 if ($nextyear < (gmdate("Y", time()) + 11))
 $this->alternate_page .= '<a href="calendar.php?month='.$nextmonth.'&amp;amp;year='.$nextyear.'"><font size="2" point-size="12" color="#'.$conf->calendar_title_text_color.'"><b>'.$lang->month_long[$nextmonth].' '.$nextyear.' &amp;gt;&amp;gt;</b></font></a>';
 else
 $this->alternate_page .= '&amp;nbsp;';

 $this->alternate_page .= '
</td>
</tr>
</table>
</td>
</tr>
<tr>
'
;
 if (isset($conf->calendar_start_day) &amp;&amp; $conf->calendar_start_day <= 6 &amp;&amp; $conf->calendar_start_day >= 0)
 $n = $conf->calendar_start_day;
 else
 $n = 0;

 for ($i = 0; $i < 7; $i++)
 {
 if ($n > 6)
 $n = 0;

 $this->alternate_page .= '<td nowrap="nowrap" width="100" height="24" align="center" valign="middle" bgcolor="#'.$conf->calendar_day_background_color.'">
<font size="2" point-size="11" color="#'
.$conf->calendar_day_text_color.'"><b>'.$lang->day_long[$n].'</b></font>
</td>
'
;
 $n++;
 }
 $this->alternate_page .= '</tr>
'
;

 $this->makecalendar($current_month, $current_year, $conf->calendar_start_day);

 $this->alternate_page .= '</table>
</form>
<a href="http://www.iamwhen.com" target="_blank"><font size="1" point-size="10" color="#'
.$conf->html_body_text_color.'">Web Calendar &amp;copy;2009 Proverbs, LLC. All rights reserved.</font></a>
</center>'
;
 return $this->alternate_page;
 }

 function makecalendar($current_month, $current_year, $startweekday)
 {
 // create the setup object
 $tempconf = new layout_setup;

 $firstweekday = gmdate("w", gmmktime(0, 0, 0, $current_month, 1, $current_year));

 $lastday = 28;

 for ($i = $lastday; $i < 32; $i++)
 {
 if (checkdate($current_month, $i, $current_year))
 $lastday = $i;
 }

 $todayday = 0;

 $conf = new layout_setup;
 $adjustment = 3600 * $conf->time_adjustment;
 if ($conf->use_dst)
 $adjustment += 3600 * date("I", time() + $adjustment);

 if ($current_month == gmdate("n", time() + $adjustment) &amp;&amp; $current_year == gmdate("Y", time() + $adjustment))
 $todayday = gmdate("j", time() + $adjustment);

 $calday = 1;
 $calaccess = new caldbaccess;
 while ($calday <= $lastday)
 {
 $this->alternate_page .= '<tr>
'
;
 for ($j = 0; $j < 7; $j++)
 {
 if ($j == 0)
 $n = $startweekday;
 else
 {
 if ($n < 6)
 $n = $n + 1;
 else
 $n = 0;
 }
 if (($calday == 1 &amp;&amp; $firstweekday == $n) || ($calday > 1 &amp;&amp; $calday <= $lastday))
 {
 $linesoftext = Array();
 $itemcount = $calaccess->GetCalendarDateEvents($calday, $current_month, $current_year);
 for ($x = 0; $x < $itemcount; $x++)
 {
 $calaccess->next_record();
 $linesoftext[] = $calaccess->f('short_description');
 }

 $itemcount = $calaccess->GetCalendarDayEvents($calday, $current_month, $current_year);
 for ($x = 0; $x < $itemcount; $x++)
 {
 $calaccess->next_record();
 $linesoftext[] = $calaccess->f('short_description');
 }

 if ($todayday > 0 &amp;&amp; $todayday == $calday)
 $this->addcalday($calday, true, $linesoftext);
 else
 $this->addcalday($calday, false, $linesoftext);
 $calday++;
 }
 else
 $this->alternate_page .= '<td width="100" height="85" bgcolor="#'.$tempconf->calendar_day_background_color.'">
&amp;nbsp;
</td>
'
;
 }
 unset ($caldb);
 $this->alternate_page .= '</tr>
'
;
 }
 }

 function addcalday($curday, $istoday, $textdisplay)
 {
 // create the setup object
 $tempconf = new layout_setup;

 if ($istoday)
 $this->alternate_page .= '<td align="left" valign="top" width="100" height="85" bgcolor="#'.$tempconf->calendar_today_background_color.'">
'
;
 else
 $this->alternate_page .= '<td align="left" valign="top" width="100" height="85" bgcolor="#'.$tempconf->calendar_day_background_color.'">
'
;

 $this->alternate_page .= '<a href="calendar.php?view=schedule&amp;amp;day='.$curday.'&amp;amp;month='.$this->activemonth.'&amp;amp;year='.$this->activeyear.'">
<font size="1" point-size="9" color="#'
.$tempconf->calendar_day_text_color.'">'.$curday.'<br />
'
;
 unset($tempconf);

 // create the language object
 $templang = new language;

 if ($textdisplay != "" &amp;&amp; count($textdisplay) > 0)
 {
 for ($i = 0; $i < count($textdisplay); $i++)
 {
 $displine = '';
 if (strlen(trim($textdisplay[$i])) > 21)
 $displine = trim(substr(trim($textdisplay[$i]), 0, 18)).'...';
 else
 $displine = trim($textdisplay[$i]);
 $displine .= '<br />
'
;
 if ($i < 4)
 $this->alternate_page .= $displine;
 if ($i == 5)
 $this->alternate_page .= '<center>&amp;lt;&amp;lt; '.$templang->word_more.' &amp;gt;&amp;gt;</center>
'
;
 }
 }

 unset($templang);

 $this->alternate_page .= '</font></a>
</td>
'
;
 }
 }
}
?>

&amp;nbsp;

 

PHP Event for Calendar Scripts

PHPEventCalendar is a mysq backed application that allows users to post and display events or notes on month-at-a-glance calendar. Because only authorized users can add events or posts, the calendar is perfect for organizations that want to communicate upcoming events to a larger audience. phpEventCalendar comes with a user administration panel, and two user levels. One user type can post events, and add or edit users, while the other user type can only post events.

 

 

<?php
require("config.php");
require("./lang/lang.admin." . LANGUAGE_CODE . ".php");
require("functions.php");

$flag = (isset($HTTP_GET_VARS['flag'])) ? $HTTP_GET_VARS['flag'] : null;
$auth = auth();

if ( $auth == 2 ) {
 switch ( $flag ) {
 case "add":
 editUserForm("Add");
 break;
 case "edit":
 $id = (int) $HTTP_GET_VARS['id'];
 if (!empty($id))
 editUserForm("Edit", $id);
 else
 $lang['accesswarning'];
 break;
 case "insert":
 insertNewUser();
 break;
 case "update":
 updateExistingUser();
 break;
 case "delete":
 $id = (int) $HTTP_GET_VARS['id'];
 if (!empty($id))
 deleteUser($id);
 else
 $lang['accesswarning'];
 break;
 default:
 userList();
 }
} elseif ( $auth == 1 ) {
 switch ( $flag ) {
 case "changepw":
 changePW($flag);
 break;
 case "updatepw":
 updatePassword();
 changePW($flag);
 break;
 default:
 header("location:index.php");
 }
} else {
 echo $lang['accessdenied'];
}

/***************************************
******** user admin functions **********
***************************************/


function editUserForm($mode, $id="", $error="")
{
 global $lang, $HTTP_SESSION_VARS, $HTTP_POST_VARS;

 $editorstr = "<option value=\"1\">" . $lang['editoroption'] . "</option>\n";

 if ($mode=="Edit") {
 mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
 mysql_select_db(DB_NAME) or die(mysql_error());

 $sql = "SELECT username, password, fname, lname, userlevel, email ";
 $sql .= "FROM " . DB_TABLE_PREFIX . "users WHERE uid=" . $id;

 $result = mysql_query($sql) or die(mysql_error());
 $row = mysql_fetch_row($result);

 $username    = $row[0];
 $password    = $row[1];
 $fname        = $row[2];
 $lname        = $row[3];
 $userlevel    = $row[4];
 $email        = $row[5];
 $admin      = ($userlevel == 2) ? "selected" : null;
 $header     = $lang['edituser'];
 $formaction = "update";
 $unameinput = "<span class=\"edit_user_label\">" . $username . "</span><input type=\"hidden\" name=\"username\" value=\"" . $username . "\">\n";

 if ($username == $HTTP_SESSION_VARS['authdata']['login']) { $editorstr = ""; }

 } else {
 $username   = null;
 $admin      = null;
 $password   = (isset($HTTP_POST_VARS['pw']))
 ? $HTTP_POST_VARS['pw'] : null;
 $fname         = (isset($HTTP_POST_VARS['fname']))
 ? $HTTP_POST_VARS['fname'] : null;
 $lname         = (isset($HTTP_POST_VARS['lname']))
 ? $HTTP_POST_VARS['lname'] : null;
 $userlevel     = (isset($HTTP_POST_VARS['userlevel']))
 ? $HTTP_POST_VARS['userlevel'] : null;
 $email        = (isset($HTTP_POST_VARS['email']))
 ? $HTTP_POST_VARS['email'] : null;
 $header     = $lang['adduser'];
 $formaction = "insert";
 $unameinput = "<input type=\"text\" name=\"username\" size=\"29\" maxlength=\"20\" value=\"" . $username . "\">";
 }
?>
 <html><head>
 <title>phpEventCalendar:  <?php echo $mode?> Calendar User</title>
 <link rel="stylesheet" type="text/css" href="css/adminpgs.css">

 <script language="JavaScript">

 function validate(f) {
 var regex = /\W+/;
 var un = f.username.value;
 var pw = f.pw.value;

 var str = "";
 if (f.fname.value == "") { str += "\n<?php echo $lang['fnameblank']?>"; }
 if (f.lname.value == "") { str += "\n<?php echo $lang['lnameblank']?>"; }
 if (f.email.value == "") { str += "\n<?php echo $lang['emailblank']?>"; }
 if (un == "") { str += "\n<?php echo $lang['unameblank']?>"; }
 if (un.length < 4) { str += "\n<?php echo $lang['unamelength']?>"; }
 if (regex.test(un)) { str += "\n<?php echo $lang['unameillegal']?>"; }
 if (pw == "") { str += "\n<?php echo $lang['passblank']?>"; }
 if (pw != f.pwconfirm.value) { str += "\n<?php echo $lang['passmatch']?>"; }
 if (pw.length < 4) { str += "\n<?php echo $lang['passlength']?>"; }
 if (regex.test(pw)) { str += "\n<?php echo $lang['passillegal']?>"; }

 if (str == "") {
 f.method = "post";
 f.action = "useradmin.php?flag=<?php echo $formaction ?>";
 f.submit();
 } else {
 alert(str);
 return false;
 }
 }

 </script>
 </head><body>

<?php
 if ( !empty($error) ) {
 echo "<p><span class=\"bad_user_name\">" . $lang['unameinuse'] . "</span></p>";
 }
?>
 <form onSubmit="return validate(this);">
 <table cellpadding="2" cellspacing="2" border="0">
 <tr>
 <td colspan="2"><span><?php echo $header?>:</span></td>
 </tr>
 <tr><td><img src="images/clear.gif" width="1" height="3"></td></tr>
 <tr>
 <td align="right"><span><?php echo $lang['username']?>:</span></td>
 <td><?php echo $unameinput?></td>
 </tr>
 <tr>
 <td align="right"><span><?php echo $lang['password']?>:</span></td>
 <td><input type="password" name="pw" size="29" maxlength="20" value="<?php echo $password?>"></td>
 </tr>
 <tr>
 <td align="right"><span><?php echo $lang['pwconfirm']?>:</span></td>
 <td><input type="password" name="pwconfirm" size="29" maxlength="20" value="<?php echo $password?>"></td>
 </tr>
 <tr>
 <td align="right"><span><?php echo $lang['userlevel']?>:</span></td>
 <td><select name="userlevel">
 <?php echo $editorstr?>
 <option value="2" <?php echo $admin ?>><?php echo $lang['adminoption'] ?></option>
 </select>
 </td>
 </tr>
 <tr>
 <td align="right"><span><?php echo $lang['fname']?>:</span></td>
 <td><input type="text" name="fname" size="29" maxlength="20" value="<?php echo $fname?>"></td>
 </tr>
 <tr>
 <td align="right"><span><?php echo $lang['lname']?>:</span></td>
 <td><input disable type="text" name="lname" size="29" maxlength="30" value="<?php echo $lname?>"></td>
 </tr>
 <tr>
 <td align="right"><span><?php echo $lang['email']?>:</span></td>
 <td><input type="text" name="email" size="29" maxlength="40" value="<?php echo $email?>"></td>
 </tr>

 <tr><td><img src="images/clear.gif" width="1" height="7"></td></tr>
 <tr>
 <td colspan="2" align="right"><input type="submit" value="<?php echo $mode?> User">
 &amp;nbsp;    <input type="button" value="cancel" onClick="location.replace('useradmin.php');">
 </td>
 </tr>
 </table>
 </form>

 </body></html>
<?php
}

function insertNewUser()
{
 global $HTTP_POST_VARS;
 $uname    = $HTTP_POST_VARS['username'];
 $pw     = $HTTP_POST_VARS['pw'];
 $ulevel = $HTTP_POST_VARS['userlevel'];
 $fname     = $HTTP_POST_VARS['fname'];
 $lname     = $HTTP_POST_VARS['lname'];
 $email     = $HTTP_POST_VARS['email'];

 mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
 mysql_select_db(DB_NAME) or die(mysql_error());

 $sql = "SELECT * FROM " . DB_TABLE_PREFIX . "users WHERE username='$uname'";

 $result = mysql_query($sql) or die(mysql_error());
 $row = mysql_fetch_row($result);

 if ( is_array($row) ) {
 editUserForm("Add", "", $uname);
 } else {
 $sql = "INSERT INTO " . DB_TABLE_PREFIX . "users SET ";
 $sql .= "username='$uname', password='$pw', fname='$fname', lname='$lname', ";
 $sql .= "userlevel='$ulevel', email='$email'";
 mysql_query($sql) or die(mysql_error());

 header("location:useradmin.php");
 }
}

function updateExistingUser()
{
 global $HTTP_SESSION_VARS, $HTTP_POST_VARS;
 $uname    = $HTTP_POST_VARS['username'];
 $pw     = $HTTP_POST_VARS['pw'];
 $ulevel    = $HTTP_POST_VARS['userlevel'];
 $fname     = $HTTP_POST_VARS['fname'];
 $lname    = $HTTP_POST_VARS['lname'];
 $email    = $HTTP_POST_VARS['email'];

 mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
 mysql_select_db(DB_NAME) or die(mysql_error());

 $sql = "UPDATE " . DB_TABLE_PREFIX . "users SET password='$pw', fname='$fname', ";
 $sql .= "lname='$lname', userlevel='$ulevel', email='$email' WHERE username='$uname'";
 mysql_query($sql) or die(mysql_error());

 if ( $uname==$HTTP_SESSION_VARS['authdata']['login'] )
 $HTTP_SESSION_VARS['authdata']['password'] = $pw;

 header("location:useradmin.php");
}

function deleteUser($id)
{
 global $authdata;

 if ($authdata['uid'] != $id) {
 mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
 mysql_select_db(DB_NAME) or die(mysql_error());

 $sql = "DELETE FROM " . DB_TABLE_PREFIX . "users WHERE uid='$id'";
 mysql_query($sql) or die(mysql_error());
 }

 header("location:useradmin.php");
}

function userList()
{
 global $lang, $HTTP_SESSION_VARS;
?>
 <html><head><title>phpEventCalendar User List</title>
 <link rel="stylesheet" type="text/css" href="css/adminpgs.css">

 <script language="JavaScript">
 function deleteConfirm(user, uid) {
 var msg = "<?php echo $lang['deleteconf']?>: \"" + user + "\"?";

 if (user == "<?php echo $HTTP_SESSION_VARS['authdata']['login'] ?>") {
 alert("<?php echo $lang['deleteown']?>");
 return;
 } else if (confirm(msg)) {
 location.replace("useradmin.php?flag=delete&amp;id=" + uid);
 } else {
 return;
 }
 }
 </script>
 </head>

 <body>
 <table cellpadding="0" cellspacing="0" border="0" width="600">
 <tr>
 <td><span><?php echo $lang['ulistheader']?></span></td>
 <td align="right" valign="bottom"><span>[ <a href="useradmin.php?flag=add"><?php echo $lang['adduser']?></a> | <a href="index.php"><?php echo $lang['return']?></a> ]</span></td>
 </tr>
 <tr><td><img src="images/clear.gif" width="1" height="5"></td></tr>
 </table>

 <table cellpadding="0" cellspacing="0" border="0" width="600" bgcolor="#000000">
 <tr><td>

 <table cellspacing="1" cellpadding="3" border="0" width="100%">
 <tr bgcolor="#666666">
 <td><span><?php echo $lang['username']?></span></td>
 <td><span><?php echo $lang['name']?></span></td>
 <td><span><?php echo $lang['email']?></span></td>
 <td><span><?php echo $lang['userlevel']?></span></td>
 <td><span><?php echo $lang['edit']?></span></td>
 <td><span><?php echo $lang['delete']?></span></td>
 </tr>

<?php
 mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
 mysql_select_db(DB_NAME) or die(mysql_error());

 $sql = "SELECT * FROM " . DB_TABLE_PREFIX . "users";
 $result = mysql_query($sql) or die(mysql_error());

 $bgcolor = "#ffffff";

 while( $row = mysql_fetch_array($result) ) {
 $userlevel = ($row[5] == 2) ? $lang['admin'] : $lang['editor'];

 echo "<tr bgcolor=\"$bgcolor\">\n";
 echo "    <td><span class=\"user_table_txt\">" . $row[1] . "</span></td>\n";
 echo "    <td><span class=\"user_table_txt\">" . $row[3] . " " . $row[4] . "</span></td>\n";
 echo "    <td><span class=\"user_table_txt\">" . $row[6] . "</span></td>\n";
 echo "    <td><span class=\"user_table_txt\">" . $userlevel . "</span></td>\n";
 echo "    <td><span class=\"user_table_txt\"><a href=\"useradmin.php?flag=edit&amp;id=" . $row[0] . "\">" . $lang['edit'] . "</a></span></td>\n";
 echo "    <td><span class=\"user_table_txt\"><a href=\"#\" onClick=\"deleteConfirm('" . $row[1] . "', '" . $row[0] . "');\">" . $lang['delete'] . "</a></span></td>\n";
 echo "</tr>\n";

 if ( $bgcolor == "#ffffff" )
 $bgcolor = "#dddddd";
 else
 $bgcolor = "#ffffff";
 }

 echo "</table></td></tr></table>";
}

function changePW($flag)
{
 global $lang, $HTTP_SESSION_VARS;

 $username = $HTTP_SESSION_VARS['authdata']['login'];
 $id = $HTTP_SESSION_VARS['authdata']['uid'];
?>
 <html><head>
 <title><?php echo $lang['changepw']?></title>
 <link rel="stylesheet" type="text/css" href="css/adminpgs.css">
 <script language="JavaScript">
 function validate(f) {
 var regex = /\W+/;
 var pw = f.pw.value;
 var str = "";
 if (pw == "") { str += "\n<?php echo $lang['passblank']?>"; }
 if (pw != f.pwconfirm.value) { str += "\n<?php echo $lang['passmatch']?>"; }
 if (pw.length < 4) { str += "\n<?php echo $lang['passlength']?>"; }
 if (regex.test(pw)) { str += "\n<?php echo $lang['passillegal']?>"; }

 if (str == "") {
 f.method = "post";
 f.action = "useradmin.php?flag=updatepw";
 f.submit();
 } else {
 alert(str);
 return false;
 }
 }
 </script>
 </head></body>

<?php
 if ( $flag=="changepw" ) {
?>

 <form onSubmit="return validate(this);">
 <input type="hidden" name="un" value="<?php echo $username ?>">
 <table cellpadding="2" cellspacing="2" border="0">
 <tr>
 <td colspan="2"><span><?php echo $lang['changepw']?></span></td>
 </tr>
 <tr><td><img src="images/clear.gif" width="1" height="3"></td></tr>
 <tr>
 <td align="right"><span><?php echo $lang['username']?>:</span></td>
 <td><span><?php echo $username?></span></td>
 </tr>
 <tr>
 <td align="right"><span><?php echo $lang['password']?>:</span></td>
 <td><input type="password" name="pw" size="29" maxlength="25" value=""></td>
 </tr>
 <tr>
 <td align="right"><span><?php echo $lang['pwconfirm']?>:</span></td>
 <td><input type="password" name="pwconfirm" size="29" maxlength="25" value=""></td>
 </tr>
 <tr><td><img src="images/clear.gif" width="1" height="7"></td></tr>
 <tr>
 <td colspan="2" align="right"><input type="submit" value="<?php echo $lang['changepw']?>">
 &amp;nbsp;    <input type="button" value="<?php echo $lang['cancel']?>" onClick="location.replace('index.php');">
 </td>
 </tr>
 </table>
 </form>

<?php
 } elseif ( $flag=="updatepw" ) {
?>

 <span><?php echo $lang['pwchanged']?> &amp;nbsp;"<?php echo $username?>"</span>
 <p>
 <span>[ <a href="index.php"><?php echo $lang['return']?></a> ]</span>

<?php
 } else {
 echo $lang['accessdenied'] . "<p>";
 echo "<span class=\"user_list_options\">[ <a href=\"index.php\">" . $lang['return'] . "</a> ]</span>";
 }
?>
 </body>
 </html>
<?php
}

function updatePassword()
{
 global $HTTP_POST_VARS, $HTTP_SESSION_VARS;

 $pw = (isset($HTTP_POST_VARS['pw'])) ? $HTTP_POST_VARS['pw'] : null;
 $id = (isset($HTTP_SESSION_VARS['authdata']['uid']))
 ? $HTTP_SESSION_VARS['authdata']['uid'] : null;

 if (!empty($pw) &amp;&amp; !empty($id)) {
 mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
 mysql_select_db(DB_NAME) or die(mysql_error());

 $sql = "
 UPDATE "
. DB_TABLE_PREFIX . "users SET password='$pw'
 WHERE uid='$id'"
;
 $result = mysql_query($sql) or die(mysql_error());

 $HTTP_SESSION_VARS['authdata']['password'] = $pw;
 }
}
?>

&amp;nbsp;

PHP Scrpts for myEvent Calenders

MyEvent 1.6, a Dynamic Calendar based Events Management system with admin panel for adding events, edit & delete. Display today’s event & future events links on the calendar, Event will be displayed in 3 mode eg : pop-up, new windows & on same screen once link is clicked. There is also a mouse-over tool tip to display the events Template based & Simple easily intergrated to any websites.

 

 

<?php
##########################################################################
#  Please refer to the README file for licensing and contact information.
#
#  This file has been updated for version 0.8.20071118
#
#  If you like this application, do support me in its development
#  by sending any contributions at www.calendarix.com.
#
#
#  Copyright © 2002-2007 Vincent Hor
##########################################################################

include_once ('cal_header.inc.php');
include_once ("search_func.php");
include_once ("cal_utils.php") ;

calHeaderFunc();

if (!isset($_GET['sort']))
 $sort = '';
else
 $sort = $_GET['sort'];

/************************/
/* view events listing  */
/************************/

function evlist($date,$catcolor,$secondcatcolor,$sort){
global $EVENTS_TB,$CAT_TB,$USER_TB,$mth,$week,$m,$d,$y,$searchweekok,$popupevent,$popupeventwidth,$popupeventheight,$weekstartday,$calstartyear,$caladvanceyear,$allowsearch,$addeventok,$userid,$userview,$userlogin,$shortdesclen,$catview,$uname,$ugroup,$showuserentry,$publicview,$dayview_w,$notimeentry,$viewevlistok,$limitrow,$eventcatfilter;

if ($viewevlistok==1){

if (!$date){
$year = $y;
$month = $m;
$day = $d;
}
else{
$year = substr($date,0,4);
$month = substr($date,5,2);
$day = substr($date,8,2);
}


if (!isset($_GET['catmonth']))
 $catmonth = '';
else
 $catmonth = $_GET['catmonth'];
if (!isset($_GET['limit']))
 $limit = 0 ;
else
 $limit = $_GET['limit'] ;

$qstr = " id,description,title,cat,day,month,year,starttime,endtime,cat_name " ;
$query = " from ".$EVENTS_TB." left join ".$CAT_TB." on ".$EVENTS_TB.".cat=".$CAT_TB.".cat_id where approved='1' ";
$query .= " and ((year>'$y')||(month>'$m' and year='$y')||(day>=$d and month='$m' and year='$y'))" ;

if (($userview==1)&amp;&amp;($userlogin==1)&amp;&amp;($uname!="")) {
 if ($ugroup!=0) {
 // Generate the query
 $qstr = " $EVENTS_TB.id, $EVENTS_TB.description, $EVENTS_TB.title, $EVENTS_TB.cat, $EVENTS_TB.starttime, $EVENTS_TB.endtime, $EVENTS_TB.user, $EVENTS_TB.day, $EVENTS_TB.month, $EVENTS_TB.year, $CAT_TB.cat_name, $USER_TB.username, $USER_TB.user_id " ;
 $query = " from ".$EVENTS_TB.", ".$USER_TB." left join ".$CAT_TB." on ".$EVENTS_TB.".cat=".$CAT_TB.".cat_id where approved='1' ";
 $query .= " and ((year>'$y')||(month>'$m' and year='$y')||(day>=$d and month='$m' and year='$y'))" ;
 $query .= " and ".$EVENTS_TB.".user=".$USER_TB.".username and ".$USER_TB.".user_id=".$userid ;
 }
}

if (($eventcatfilter==1)&amp;&amp;($catview!=0)) $query .= " and cat_id=$catview";

if (($sort)&amp;&amp;($sort==1))
 $query = $query . " order by title ASC, year ASC, month ASC, day ASC";
else
 $query = $query . " order by year ASC, month ASC, day ASC, title ASC";

$tquery = "select count(*) ".$query ;
$tresult = mysql_query($tquery);
$trow = mysql_fetch_array($tresult);
$totalrows = $trow[0] ;

if ($limit>$totalrows) $limit = 0 ;
$query .= " LIMIT ".$limit.",".$limitrow ;

$query = "select ".$qstr.$query ;
$result = mysql_query($query);
$rowname = mysql_fetch_object($result);
$rows = mysql_num_rows($result);

// this is for the category sort order redirection javascript
echo "<script language=\"JavaScript\" type=\"text/JavaScript\">\n" ;
echo "\tfunction sortev(order) {\n" ;
echo "\t\tswitch (order) { \n" ;
echo "case 1 : { window.location.href='cal_list.php?op=evlist&amp;sort=1&amp;catview=$catview&amp;limit=$limit' ; break ;} \n" ;
echo "case 2 : { window.location.href='cal_list.php?op=evlist&amp;sort=2&amp;catview=$catview&amp;limit=$limit' ; break ;} \n" ;
echo "default : { window.location.href='cal_list.php?op=evlist&amp;sort=2&amp;catview=$catview&amp;limit=$limit' ; break;} \n" ;
echo "\t\t}\n" ;
echo "\t}\n" ;
echo "</script>" ;

echo "<form action=POST>\n";
echo "<table width=$dayview_w border=0 cellspacing=0><tr><td align=left valign=top width='40%'>" ;
echo "<div>".translate("Events from ").$d." ".ucfirst($mth[$m])." ".$y."</div>" ;
echo "</td><td valign=top width='30%' align=left>" ;

// previous and next row set
echo "<div><input type='button' value='&amp;nbsp;&amp;lt;&amp;nbsp;' title='".translate("Previous")."' onclick=\"Javascript:window.location.href='cal_list.php?op=evlist&amp;sort=$sort&amp;catview=$catview&amp;limit=".($limit-$limitrow)."' ;\" " ;
if ($limit==0)  echo " disabled " ;
echo "> &amp;nbsp; \n" ;
echo "<b> &amp;nbsp; ".($limit+1)." - ";
if (($limit+$limitrow)<$totalrows) echo ($limit+$limitrow) ;
else echo $totalrows ;
echo "/".$totalrows ;
echo " ".translate("events")." &amp;nbsp; " ;
echo "</b> &amp;nbsp; \n" ;
echo "<input type='button' value='&amp;nbsp;&amp;gt;&amp;nbsp;' title='".translate('Next')."' onclick=\"Javascript:window.location.href='cal_list.php?op=evlist&amp;sort=$sort&amp;catview=$catview&amp;limit=".($limit+$limitrow)."' ;\" " ;
if (($limit+$limitrow)>=$totalrows) echo " disabled " ;
echo "></div>\n" ;
echo "</td><td align=right valign=top width='30%'><div><b>".translate("Sort by").": </b>" ;
echo " &amp;nbsp; &amp;nbsp; <a href='#' onclick=\"Javascript:sortev(1);\"><img src='images/sort1.gif' border=0 alt='".translate("Sort by events")."'/></a>" ;
echo " &amp;nbsp;<a href='#' onclick=\"Javascript:sortev(2);\"><img src='images/sort2.gif' border=0 alt='".translate("Sort by date")."'/></a>" ;
echo " &amp;nbsp;</div></td></tr></table>\n";

if (!$rows)
 echo "<br/><div>".translate("No events").".</div><br/>\n";
else
{
 $result = mysql_query($query);
 $foo = '';
 while ($row = mysql_fetch_object($result))
 {
 $foo++ % 2 ? $color=$catcolor : $color=$secondcatcolor;
 echo "<table border=0 bgcolor=$color cellspacing=0 cellpadding=4 width=$dayview_w>\n";
 echo "<tr><td>" ;

 echo "<div><li>";
 $weekday = date ("w", mktime(12,0,0,$row->month,$row->day,$row->year));
 echo stripslashes($row->title)." (".ucfirst($week[++$weekday]).", ".$row->day." ".$mth[$row->month]." ".$row->year.")</li></div>";
 echo "<div>";
 echo "<b>".translate("Category")." : </b>".stripslashes($row->cat_name);
 if ($notimeentry==0) showtime($row->starttime,$row->endtime,2);
 echo "</div>";
 $de = $row->description;

 echo "<div>".substr(stripslashes($de),0,$shortdesclen)." ...</div>\n" ;
 if ($popupevent == 1)
 echo "<div><a href=\"Javascript:void(0);\" onclick=\"Javascript:popup(".$row->id.");\">";
 else
 echo "<div><a href='cal_event.php?id=".$row->id."' >";
 echo translate("Read more")."</a></div>" ;
 echo "</td></tr>\n";
 echo "</table>\n";
 }
}
echo "</form>\n";

// display form functions
echo "<table border=0 width=$dayview_w><tr>" ;
echo "<td align=left valign=top width='50%'>\n" ;
echo "&amp;nbsp;</td>" ;
echo "<td align=right valign=middle width='50%'>" ;
if ($allowsearch==1) search();
echo "</td></tr></table>" ;

 }
else
 echo "<br/><div>".translate("disabled").".</div>" ;
}

switch ($op){

 // view per week
 case "evlist":{
 if (!isset($_GET['sort']))
 $sort = 2;
 else
 $sort = $_GET['sort'];
 evlist($date,$catcolor,$secondcatcolor,$sort);
 break;
 }

 // default:
 default:{
 $sort = 2;
 evlist($date,$catcolor,$secondcatcolor,$sort);
 break;
 }
}

include ('cal_functions.inc.php');
include ('cal_footer.inc.php');

?>

&amp;nbsp;

PHP Scripts for Calendarix

Calendarix is a powerful and easy to use web-based calendar that runs on PHP and MySQL. Calendar can be viewed in various ways – yearly, monthly, weekly, daily and by categories. Event views can be filtered by categories. Event approval management available. Separate administration module available to manage calendar, historical events, categories and user accounts. Mini-calendar also available. Advanced text editing can be provided with optional integration of FCKeditor. RSS 2.0 feeds from channels can be retrieved into calendar. Now available in more than 24 languages.

 

 

<?php
##########################################################################
#  Please refer to the README file for licensing and contact information.
#
#  This file has been updated for version 0.8.20071118
#
#  If you like this application, do support me in its development
#  by sending any contributions at www.calendarix.com.
#
#
#  Copyright © 2002-2007 Vincent Hor
##########################################################################

include_once ('cal_header.inc.php');
include_once ("search_func.php");
include_once ("cal_utils.php") ;


calHeaderFunc();


/***********************/
/* view events per day */
/***********************/

function day($ask,$date){
global $EVENTS_TB,$CAT_TB,$USER_TB,$mth,$week,$m,$d,$y,$viewweekok,$viewcalok,$viewdayok,$allowsearch,$searchdayok,$popupevent,$popupeventwidth,$popupeventheight,$calstartyear,$caladvanceyear,$addeventok,$userview,$userlogin,$userid,$addeventwin_w,$addeventwin_h,$shortdesclen,$catview,$ugroup,$uname,$showuserentry,$publicview,$dayview_w,$notimeentry ;

if (!isset($yda))
 $yda = '';

if ($viewdayok==1){

if (!$date){
 $year = $y;
 $month = $m;
 $day = $d;
 }
else{
 $year = substr($date,0,4);
 $month = substr($date,5,2);
 $day = substr($date,8,2);
 }

$we = mktime(0,0,0,$month,$day,$year);
$we = strftime("%w",$we);
$we++;

// variables with exact digit without the leading 0 used for query and accessing array
$vdm = $month;
if (substr($vdm,0,1) == "0"){
 $vdm = str_replace("0","",$vdm);
 }
$vda = $day;
if (substr($vda,0,1) == "0"){
 $vda = str_replace("0","",$vda);
 }

$weeknumber = weekNumber($day,$month,$year);
if ($year>($y+$caladvanceyear)) $weeknumber = 53 ;    // to ensure weeks cannot go beyond restricted dates
if ($year<($calstartyear)) $weeknumber = 1 ;    // to ensure weeks cannot go beyond restricted dates

echo "<table border=0 width=$dayview_w cellspacing=0 align=center><tr><td align=left>".translate("Events for day");
echo ": ".$week[$we]." ".$day." " ;
if (($year<=($y+$caladvanceyear))&amp;&amp;($year>=($calstartyear))) {
 if ($viewcalok==1) echo "<a href='calendar.php?op=cal&amp;month=".$vdm."&amp;year=".$year."&amp;catview=$catview'>" ;
 }
echo $mth[$vdm];
if (($year<=($y+$caladvanceyear))&amp;&amp;($year>=($calstartyear))) {
 if ($viewcalok==1) echo "</a>" ;
 }
echo " ".$year." &amp;nbsp; &amp;nbsp; " ;
if ($viewweekok==1) echo "<a href='cal_week.php?op=week&amp;date=".date("Y-m-d", mktime(0,0,0,$month,$day,$year))."&amp;catview=$catview'><img src=\"images/week.gif\" border=0 alt='".translate("View week")." $weeknumber"."' width=16 height=16/></a>" ;

 $weekday = date ("w", mktime(12,0,0,$vdm,$vda,$year));
 $weekday++;

if ((($publicview==1)&amp;&amp;($uname!=""))||($publicview==0)) {
 if ($addeventok==1){
 echo " &amp;nbsp; <a href='#$week[$weekday]' onclick=\"Javascript:wopen('cal_addevent.php?op=eventform&amp;add_day=$day&amp;add_month=$month&amp;add_year=$year&amp;catview=$catview','popupwin',".$addeventwin_w.",".$addeventwin_h.",'yes');\"><img src='images/plus.gif' border=0 valign=middle alt='".translate("Add Event")."' width=11 height=11/></a>" ;
 }
}

echo "</td>" ;
echo "<td align=right><div>" ;

// display previous day and next day navigation
if (($year > $calstartyear) || (($vdm > 1)&amp;&amp;($year == $calstartyear)) || (($vdm == 1)&amp;&amp;($year == $calstartyear)&amp;&amp;($vda>1))) {
 echo "<a href=\"cal_day.php?op=day&amp;date=".date("Y-m-d", mktime(0,0,0,$month,$day-1,$year))."&amp;catview=$catview
\"><< "
.translate("Previous day")."</a> &amp;nbsp; " ;
}
else echo "&amp;nbsp;" ;
$calendyear = $y + $caladvanceyear ;
if (($year < $calendyear) || (($vdm < 12)&amp;&amp;($year == $calendyear)) || (($vdm == 12)&amp;&amp;($year == $calendyear)&amp;&amp;($vda<31))) {
 echo "<a href=\"cal_day.php?op=day&amp;date=".date("Y-m-d", mktime(0,0,0,$month,$day+1,$year))."&amp;catview=$catview\">".translate("Next day")." >></a> &amp;nbsp; <br/>";
}
else echo "&amp;nbsp;" ;
echo "</div></td></tr></table>";

$query = "select id,user,title,description,url,email,cat_name,starttime,endtime,day,month,year from ".$EVENTS_TB." left join ".$CAT_TB." on ".$EVENTS_TB.".cat=".$CAT_TB.".cat_id where day='$vda' and month='$vdm' and year='$year' and approved='1'";

if ($catview!=0)  $query = $query." and ".$EVENTS_TB.".cat=$catview";

if (($userview==1)&amp;&amp;($userlogin==1)) {  // user view user specific events only
 if ($ugroup!=0) {
 $query = $query. " and user='".$uname."'" ;
 }
 }

$query = $query." order by starttime,title ASC" ;
$result = mysql_query($query);
echo "<table width=$dayview_w cellspacing=0 align=center><tr><td align=left>" ;
if (mysql_num_rows($result)!=0) {
 while ($row = mysql_fetch_object($result)){
 if ($notimeentry==0) {
 if ($row->starttime=='') echo "<li>" ;
 else showtime($row->starttime,$row->endtime,0);
 }
 else echo "<li>";
 echo "<b>" ;
 echo stripslashes($row->title) ;
 if (($showuserentry==1)&amp;&amp;($uname!="")) echo " &amp;nbsp;&amp;lt;".$row->user."&amp;gt;" ;
 echo "</b>";
 if (($notimeentry==1)||($row->starttime=='')) echo "</li>";
 else echo "<br/>";
 echo translate("Category")." : ".stripslashes($row->cat_name)."<br/>";
 $de = $row->description;
//    $de = str_replace("<br />","",$row->description);
 echo substr(stripslashes($de),0,$shortdesclen) ;
 if (($row->email!="")||($row->url!="")||(strlen($de)>$shortdesclen)) echo " ...\n";
 else echo "\n" ;
 echo "<br/>";
 if ($popupevent == 1)
 echo "<div><a href=\"Javascript:void(0);\" onclick=\"Javascript:popup(".$row->id.");\">" ;
 else
 echo "<div><a href=cal_event.php?id=".$row->id.">";
 echo translate("Read more")."</a></div>";
 echo "<hr/>";
 }
}
else echo "&amp;nbsp;<br/>" ;
echo "</td></tr></table>" ;


// this is for the goto day redirection javascript
echo "<script language=\"JavaScript\" type=\"text/JavaScript\">\n" ;
echo "\tfunction gotoday(selectopt) {\n" ;
echo "var geti = '1' ;\n" ;
echo "for (i=0;i<selectopt.options.length;i++) {\n" ;
echo "\tif (selectopt.options[i].selected) {\n" ;
echo "\t\tgeti = selectopt.options[i].value ;\n" ;
echo "\t\tbreak ;\n" ;
echo "\t}\n" ;
echo "}\n\n" ;
echo "\t\tswitch (geti) { \n" ;
$dateinmonth = date("t", mktime(0,0,0,$month,$day,$year)) ;
for ($i=1;$i<=$dateinmonth;++$i) {
 echo "case \"".$i."\" : { window.location.href='cal_day.php?op=day&amp;date=" ;
 echo date("Y-m-d", mktime(0,0,0,$month,$i,$year)) ;
 echo "&amp;catview=$catview' ; break ;} \n" ;
}
echo "default : { window.location.href='cal_day.php?op=day&amp;date=".date("Y-m-d", mktime(0,0,0,$month,$day,$year))."&amp;catview=$catview' ; break;} \n" ;
echo "\t\t}\n" ;
echo "\t}\n" ;
echo "</script>" ;


// display form functions
echo "<table border=0 width=$dayview_w align=center><tr><td align=left width=34%>&amp;nbsp;</td>" ;
echo "<td align=center valign=middle width=33%>" ;
echo "<form><div>\n";
echo "<b>".translate("Go to day")." </b>" ;
// get week number
echo "<select name=goday onchange=\"javascript:gotoday(this);\"" ;
if (($year>($y+$caladvanceyear))||($year<($calstartyear))) echo " disabled" ;
echo ">\n";
for($i=1;$i<=$dateinmonth;$i++){
 echo "\t<option value=".$i ;
 if ($day==$i) echo " selected " ;
 echo ">".$i."\n";
}
echo "</select>\n";

if ($viewweekok==1) {
 echo "<b>".translate("or week")." </b>" ;
 // get week number
 echo "<select name=goweek onchange=\"javascript:gotoweek(this);\">\n";
 for($i=1;$i<53;$i++){
 echo "\t<option value=".$i ;
 if ($weeknumber==$i) echo " selected " ;
 echo ">".$i."\n";
 }

if (showWeek53($year)>52)
 {
 for($i=53;$i<=showWeek53($year);$i++){
 echo "\t<option value=".$i ;
 if ($weeknumber==$i) echo " selected " ;
 echo ">".$i."\n";
 }
 }
echo "</select>&amp;nbsp;&amp;nbsp;\n";
}
echo "</div></form>" ;
echo "</td>" ;
echo "<td align=right valign=middle width=33%>" ;
if (($allowsearch==1)&amp;&amp;($searchdayok == 1)) search();
echo "</td></tr></table>" ;

}
else  {
 echo "<br/><div>".translate("disabled").".</div>" ;
 }
}

switch ($op){

 // view per day
 case"day":{
 day($ask,$date);
 break;
 }


 // default:
 default:{
 day($ask,$date);
 break;
 }
}

include ('cal_functions.inc.php');
include ('cal_footer.inc.php');

?>

&amp;nbsp;

Easy PHP Event Calendar Class Scripts

The EasyPhpEventCalendar class allows you to display a clean, easy to integrate, easy to use and easy to navigate event calendar for your website. It will display events up to 12 months in the future. The event calendar is cross-browser compatible and has been tested with IE6/7, safari and Firefox.

 

 

<?php

/**

EasyPhpEventCalendar Class version 1.0.2

Copyright (c) 2009-2011 JF Nutbroek <jfnutbroek@gmail.com>
For more information visit http://wwww.mywebmymail.com

Permission to use, copy, modify, and/or distribute this software for any
purpose without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

*/


// Include the Class
include_once('inc/easyphpeventcalendar.class.php');

// Initialize the Class
$calendar = new easyphpeventcalendar;

// Path to the background images - use full URL if required
$calendar -> Gfxurl = 'gfx';

// Optional: Hide the days from the previous month and next month in the display
$calendar -> Hide = false;

// Optional: Override the English language by providing the days and months in another language
// $calendar -> Days   = array('Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag');
// $calendar -> Months = array('Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December');

// Adding Events
// Format single day   : $calendar -> Events[] = array('YYYYMMDD','Event as text with optional html markup')
// Format multiple days: $calendar -> Events[] = array('YYYYMMDDYYYYMMDD','Event period as text with optional html markup')

// Method 1: Add events manually in PHP code
$calendar -> Events[] = array(date('Y'). '1225','<b>Christmasday</b><br /><br />Merry X-mas!!');
$calendar -> Events[] = array(date('Y'). '0601','<div style="text-align: center;padding: 50px 10px;"><b>1st of June!!</b></div>');
// An example for an event period spanning multiple days
$calendar -> Events[] = array(date('Y'). '0401' . date('Y'). '0405','<div style="text-align: center;padding: 50px 10px;"><b>This demonstrates<br />an event of 5 days</b></div>');
$calendar -> Events[] = array(date('Y'). '1231' . (date('Y')+1). '0101','<div style="text-align: center;padding: 50px 10px;"><b>2 day New Years Party!!</div>');

// Method 2: Add events from textfiles
// Provide the path/location to your directory with events stored in textfiles with filenames 'YYYYMMDD.txt' or 'YYYYMMDDYYYYMMDD.txt'
$eventslocation = getcwd() . '/events';
if ($dir = opendir($eventslocation)) {
 while ($file = readdir($dir)) {
 if (strtolower(substr($file, -3)) == 'txt') {
 if ($fp = fopen("$eventslocation/" . $file, 'r+')) {
 $text = fread($fp, filesize("$eventslocation/" . $file));
 fclose($fp);
 if (strlen($file) == 20)
 $calendar -> Events[] = array(substr($file, 0, 16), $text);
 else
 $calendar -> Events[] = array(substr($file, 0, 8), $text);
 }
 }
 }
}

// Method 3: Add events from a database
// Place your custom code here ...

// Create HTML page
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n";
echo "<head><title>EasyPhpEventcalendar Example</title>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n";

// Insert Event Calendar CSS Styles a
// Note if you use a CMS try to integrate this in your CSS template
$calendar -> CreateEventCalendarCSS();

// Insert the JavaScript
// Note if you use a CMS try to integrate this in your JS codebase
echo "<script type=\"text/javascript\" src=\"inc/eventcalendar.js\"></script>";
echo "</head><body>\n";

// Print the Event Calendar
// You can position it anywhere on a page using a <div>
$calendar -> CreateEventCalendar();

// Close the HTML Page
echo "</body></html>\n";

?>

&amp;nbsp;