date = date('Y-m-d'); } else if ( !$this->date ) { $this->date = $date; } $this->getArt(); } function getArt () { $datez = explode('-', $this->date); $this->unxdate = mktime(0,0,0,$datez[1],$datez[2],$datez[0]); $query = 'SELECT *,`monthlyArts`.`id` AS artId FROM `monthlyArts` LEFT JOIN `monthlyArtsChoosers` ON `monthlyArts`.`chooserId` = `monthlyArtsChoosers`.`id` WHERE `monthlyArts`.`startDate` < \'' . mysql_real_escape_string($this->date) . '\' AND `monthlyArts`.`endDate` > \'' . mysql_real_escape_string($this->date) . '\' LIMIT 1'; $result = mysql_query($query); if(mysql_num_rows($result) < 1) { if($this->times > 25 ) { print( "Cannot find art - searched $this->times times and none found." ); } else { $date = $this->unxdate; $date = $date - 2505600; $this->date = date( 'Y-m-d', $date ); $this->times++; $this->getArt(); } } else { $this->art = mysql_fetch_assoc($result); } } function showImage ($directlink = false) { if ($directlink) { $link = $FRAMEWORK_SETTINGS['site']['url'] . '/resources/images/artofthemonth/' . $this->art['artId'] . '.' . $this->art['ext']; } else { $link = '?page=artofthemonth/index.html'; } $month = date('F',$this->unxdate); $return = '
'.($directlink ? 'Enlarge image' : 'More Information').'
'.($directlink ? 'Enlarge image' : 'More Information').'
' . $this->art['description'] . '
'; } function showChooserPortrait ($id = false, $directlink = false) { if (! $id) { $id = $this->art['id']; } else { $id = mysql_real_escape_string($id); } if ($directlink) { $link = $FRAMEWORK_SETTINGS['site']['url'] . '/resources/images/artofthemonth/choosers/' . $id . '.' . $this->art['ext']; } else { $link = '?page=artofthemonth/chooser.html&id=' . $id; } return '' . $this->art['profileText'] . '
'; } } ?>