<?php
include('functions.php');
if (array_key_exists('showsource', $_GET))
{
$content = show_source('cdayphp.php', true);
html_show($content, "CDAY PHP");
exit();
}
$content = "
<div style=\"float:right; width:20%; background:#e0e0e0; margin: 2em;\">";
// CDAY stuff
include_once('db.php');
include_once('cday_cfg.php');
include_once('cday_global.php');
// date is always today
$month = intval(date('n'));
$day = intval(date('j'));
$year = intval(date('Y'));
$today = mktime(0,0,0,$month,$day,$year);
// connect to MySQL database
$mydb = new DbMySql($cfg['mysql_host'], $cfg['mysql_user'], $cfg['mysql_pass'], $cfg['mysql_file']);
$content .= "<P>Today is ".date("l, F j, Y",$today). ".</P>\n";
if (FALSE != $mydb->get_error())
{
$content .= $mydb->get_error() . "\n";
}
else
{
if (!$mydb->look($month,$day,$year))
{
$content .= "<P>Error: Cannot find events: ".$mydb->get_error()."</P>\n";
}
$events_birthdays = $events_events = $events_reminders = $events_holidays = 0;
while (FALSE != ($event = $mydb->get_event('H')))
{
if (0 == $events_holidays)
{
$content .= "<H3>".gettext("Holidays")."</H3>\n";
}
$events_holidays++;
$content .= "<P>".$event['message']." </P>\n";
}
if ($events_holidays > 0)
{
$content .= "</P>\n";
}
$mydb->rewind();
while (FALSE != ($event = $mydb->get_event('B')))
{
if (0 == $events_birthdays)
{
$content .= "<H3>".gettext("Birthdays")."</H3>\n";
$content .= "<P>";
}
if ($events_birthdays > 0)
{
$content .= "<BR/>";
}
$events_birthdays++;
if (strpos($event['message'],',',0))
{
$name = find_name($event['message']);
$description = substr($event['message'], strlen($name));
}
else
{
$name = $event['message'];
$description = FALSE;
}
$content .= $event['year'] . " ";
$content .= make_link_more_information($name);
if (strlen($description)>1)
{
$content .= $description;
}
$content .= "\n";
}
if ($events_birthdays > 0)
{
$content .= "</P>\n";
}
$mydb->rewind();
while (FALSE != ($event = $mydb->get_event('S')))
{
if (0 == $events_events)
{
$content .= "<H3>".gettext("Events")."</H3>\n";
$content .= "<P>";
}
elseif ($events_events > 0)
{
$content .= "<BR/>";
}
$events_events++;
$content .= $event['year']." ".$event['message']."\n";
}
if ($events_events > 0)
{
$content .= "</P>\n";
}
$mydb->rewind();
while (FALSE != ($event = $mydb->get_event('R')))
{
if (0 == $events_reminders)
{
$content .= "<H3>".gettext("Reminders")."</H3>\n";
}
$events_reminders++;
$content .= "<P>" . $event['message'] . " </P>\n";
}
}
$content .= "<P>" . gettext("That's all for today.") . "</P>\n";
$content .= "<P><A href=\"cdayphp.php?showsource=1\">[Reveal PHP source]</A></P>\n";
$content .= "
</div>
<H1>CDAY PHP</H1>
<P>What happened on this day in history? What happened on your
birthday? Web-based CDAY, an almanac for web servers, reports events,
birthdays, and holidays, and supports RSS (XML). </P>
<P>Webmasters: Install CDAY on your web site to add value and attract
visitors. This might work especially well with original data for a
specific subject (e.g. baseball).</P>
<H2 style=\"clear:none\">Demonstration</H2>
<P>See the embedded demonstration on the right-hand of the page. You may
also see a <A href=\"cday.php\">fuller demo</A> with features such as date
navigation and RSS.</P>
<H2 style=\"clear:none\">Requirements</H2>
<UL>
<LI><A target =\"_blank\" href=\"http://www.php.net\">PHP</A> 4+, web scripting language</LI>
<LI>Web server, such as <A target =\"_blank\" href=\"http://www.apache.org\">Apache</A></LI>
<LI><A target =\"_blank\" href=\"http://www.mysql.org\">MySQL</A> or <A href=\"http://www.postgresql.org\">PostgreSQL</A> database highly recommended</LI>
</UL>
<H2 style=\"clear:none\">Download program</H2>
<P>Your rights to use and distribute CDAY are licensed to you under the <A href=\"http://www.gnu.org/licenses/gpl.html\">GNU General Public License</A>.</P>
<UL>
<LI><A href=\"http://prdownloads.sourceforge.net/cday/cday-php-0.54.tar.gz?download\">CDAY PHP v0.54</A> (.tar.gz, 21k)</LI>
<LI><A href=\"http://prdownloads.sourceforge.net/cday/cday-php-0.54.zip?download\">CDAY PHP v0.54</A> (.zip, 31k)</LI>
</UL>
<P>Don't forget to download <A href=\"cdaylib.php\">libraries</A>, which are separate.</P>
<p>Monitor new releases using your <a
href=\"http://sourceforge.net/project/filemodule_monitor.php?filemodule_id=86356\">SourceForge.net</a>
or <a
href=\"http://freshmeat.net/subscribe/38706/?url=%2Fprojects%2Fcday\">Freshmeat.net</a>
account.</p>
<H2 style=\"clear:none\">Installation</H2>
<P>For best results start with these instructions to test the program.
Then embed PHP into your existing web pages and customize library data
for your audience.</P>
<UL>
<LI>Download the program.</LI>
<LI>Download <A href=\"cdaylib.php\">libraries</A> separately.</LI>
<LI>Unpack the archives to your web server directory (e.g., <SPAN class=\"pathnametext\">/var/www/html/cday</SPAN>).</LI>
<LI>Modify <SPAN class=\"pathnametext\">cday_cfg.php</SPAN> as needed using any text editor. Be sure to specify
your database (type, host name, user name, password).</LI>
<LI>If you don't have shell access to your web server, modify cday_import.php
to allow remote use. Upload libraries and PHP files to web server now.
<LI>Run the <SPAN class=\"pathnametext\">cday_import.php</SPAN> script.
It copies library data to MySQL or PostgreSQL.
<LI>Test CDAY using a web browser.</LI>
<LI>When finished you may delete or disable the <SPAN class=\"pathnametext\">cday_import.php</SPAN>.</LI>
</UL>
<H2 style=\"clear:none\">Ideas</H2>
<ul>
<li>Use only SQLite for back-end storage (to replace MySQL and Postgresql). (I would still use the
text as an interchange format.)
<li><a href=\"helpwanted.php\">Replace Kincaid format with XML</a>.
</ul>
<H2 style=\"clear:none\">Users</H2>
<UL>
<LI><A href=\"http://www.clan-uke.co.uk\">Clan Uke</A>: notice integration and customized look</LI>
<LI><A href=\"http://www.gunplot.net/cday/cday.php\">Royal Australian Navy - Gun Plot</A>
<li><a href=\"http://www.baseballfiles.com/flashback/\">Ballpark Flashblack</a>
</UL>
";
html_show($content, "CDAY PHP");
?>
© 2003-2008 by Andrew Ziem. All rights reserved. Design by Andreas Viklund.