rendered paste body<?phpclass artofthemonth{ var $art; var $date; var $unxdate; var $times = 0; function artofthemonth ($date = false) { if (! $date) { $this->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 = '<h2>'.$month.' Artwork "'.$this->art['title'].'" chosen by '.$this->art['name'].'</h2> <img src="' . $FRAMEWORK_SETTINGS['site']['url'] . '/resources/images/artofthemonth/th_' . $this->art['artId'] . '.' . $this->art['ext'] . '"/> <p><img alt="Enlarge" src="resources/images/enlarge.gif"><a href="'.$link.'" '.($directlink ? 'target="_blank"' : null).'>'.($directlink ? 'Enlarge image' : 'More Information').'</a></p>'; return $return; } function showFrontImage () { $link = '?page=artofthemonth/index.html'; $month = date('F',$this->unxdate); $return = '<h2>'.$month.' Artwork "'.$this->art['title'].'" chosen by '.$this->art['name'].'</h2><p><img alt="Enlarge" src="resources/images/enlarge.gif"><a href="'.$link.'">'.($directlink ? 'Enlarge image' : 'More Information').'</a></p>'; $return2 = '<a href="'.$link.'"><img src="' . $FRAMEWORK_SETTINGS['site']['url'] . '/resources/images/artofthemonth/th2_' . $this->art['artId'] . '.' . $this->art['ext'] . '"/></a>'; return $return2; } function showDescription () { return '<p>' . $this->art['description'] . '</p>'; } 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 '<img src="' . $FRAMEWORK_SETTINGS['site']['url'] . '/resources/images/artofthemonth/choosers/th_' . $id . '.' . $this->art['ext'] . '" class="imgLeft"/>'; } function showProfileText () { return '<p>' . $this->art['profileText'] . '</p>'; }}?>