add('name', THUMBPAGE_TITLE); $propbag->add('description', THUMBPAGE_TITLE_BLAHBLAH); $propbag->add('event_hooks', array( 'entries_header' => true, 'entry_display' => true)); $propbag->add('configuration', array('number')); $propbag->add('stackable', false); $propbag->add('author', 'Cameron MacFarland'); $propbag->add('version', '1.4'); $propbag->add('requirements', array( 'serendipity' => '0.7', 'smarty' => '2.6.7', 'php' => '4.1.0' )); $propbag->add('groups', array('IMAGES')); $this->dependencies = array('serendipity_plugin_photoblog' => 'remove', 'serendipity_event_photoblog' => 'keep'); } function introspect_config_item($name, &$propbag) { switch($name) { case 'number': $propbag->add('type', 'string'); $propbag->add('name', THUMBPAGE_NUMBER); $propbag->add('description', THUMBPAGE_NUMBER_BLAHBLAH); $propbag->add('default', 5); break; default: return false; } return true; } function getPhoto($entryid) { global $serendipity; $q = "SELECT * FROM {$serendipity['dbPrefix']}photoblog WHERE entryid=" . (int)$entryid; $row = serendipity_db_query($q, true); if (!isset($row) || !is_array($row)) { $row = null; } return $row; } function show() { global $serendipity; if ($serendipity['GET']['page'] == 'thumbs') { $title = ''; if (!is_object($serendipity['smarty'])) { serendipity_smarty_init(); } $_ENV['staticpage_pagetitle'] = 'thumbs'; $serendipity['smarty']->assign('staticpage_pagetitle', 'thumbs'); $this->generate_content($title); } } function generate_content(&$title) { global $serendipity; $title = THUMBPAGE_TITLE; if ($serendipity['GET']['page'] != 'thumbs') { return true; } if (!headers_sent()) { header('HTTP/1.0 200'); header('Status: 200 OK'); } $entries = serendipity_db_query("SELECT id, title, timestamp FROM {$serendipity['dbPrefix']}entries WHERE isdraft = 'false' ORDER BY timestamp DESC"); if (isset($entries) && is_array($entries)) { $count = 0; echo '
'; $entryLink = serendipity_archiveURL( $entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']) ); $photo = $this->getPhoto($entry['id']); if (isset($photo)) { $file = serendipity_fetchImageFromDatabase($photo['photoid']); $imgsrc= $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] .'.'. $file['extension']; $thumbbasename = $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension']; $thumbName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $thumbbasename; $thumbsize = @getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $thumbbasename); } echo ''; if (isset($photo)) { echo ''; } else { if (isset($id) && ($id == $entry['id'])) { echo ''; } echo $entry['title']; if (isset($id) && ($id == $entry['id'])) { echo ''; } } echo ' | '; if ($count++ >= $this->get_config('number')-1) { $count = 0; echo "