Index
» This day in Tech : Blob f19281 / joomla / joomla_content_plugin_2.5 / tdit / tdit_functions.php
<?php // function tdit($action) // returns a string with This Day in Tech Quote(s). // Specify 'all' or 'random' as the $action parameter to print all entries for // today, or just a single random one repectively. function tdit($action) { date_default_timezone_set('Europe/London'); $year=date("Y"); $month=date("m"); $day=date("d"); $results='<ul class="tdit_list">'; if ($db = new SQLite3(JPATH_PLUGINS.'/content/tdit/tdit/tdit.db')) { $res=$db->query("SELECT * FROM 'tdit' WHERE day = \"$day\" AND month = \"$month\""); $i=0; if (is_object($res)) { $r=array(); while ($row = $res->fetchArray()) { array_push($r,"<li>On this day in ".$row['year']." - ".htmlentities($row['event']."\n", ENT_IGNORE,'UTF-8').'</li>'); } if ($action!="single") { foreach($r as $ln) $results.=$ln; } else { $rnd=rand(0,count($r)-1); $results=$r[$rnd]; } return($results."</ul>"); $db->close(); } else return("Error querying database"); } } ?>