function generate_collections_menu() { $collections = get_collections(); $output = '<select class="no-margin-top" tabindex="80" style="width: 80%;" name="collections_menu" id="collections_menu">'; foreach ($collections as $collection) { $output .= "\n\t\t\t\t\t\t" . '<option value="' . $collection['id'] . '">' . SmartStripSlashes($collection['name']) . '</option>'; } $output .= "\n\t\t\t\t\t</select>"; return $output; }
function generate_collections_menu() { $collections = get_collections(); $output = "<select name=\"collections_menu\">"; foreach ($collections as $collection) { $output .= "<option value=\"" . $collection['id'] . "\">" . SmartStripSlashes($collection['name']) . ""; $output .= "</option>"; } $output .= "</select>"; return $output; }
function generate_breadcrumb_admin($level, $id = 0) { switch ($level) { case 'collections': $breadcrumbs = '<strong>' . plog_tr('Collections') . '</strong>'; break; case 'albums': $collection = get_collection_by_id($id); $collection_name = SmartStripSlashes($collection['name']); $breadcrumbs = '<a href="' . $_SERVER['PHP_SELF'] . '">' . plog_tr('Collections') . '</a> » <strong>' . $collection_name . '</strong>'; break; case 'pictures': $album = get_album_by_id($id); $album_link = SmartStripSlashes($album['name']); $collection_link = '<a href="' . $_SERVER['PHP_SELF'] . '?level=albums&id=' . $album['parent_id'] . '">' . SmartStripSlashes($album['collection_name']) . '</a>'; $breadcrumbs = '<a href="' . $_SERVER['PHP_SELF'] . '">' . plog_tr('Collections') . '</a> » ' . $collection_link . ' » ' . '<strong>' . $album_link . '</strong>'; break; case 'comments': $query = "SELECT * FROM `" . PLOGGER_TABLE_PREFIX . "pictures` WHERE `id`='" . $id . "'"; $result = run_query($query); $row = mysql_fetch_assoc($result); $picture_link = '<strong>' . SmartStripSlashes(basename($row['path'])) . '</strong>'; $album_id = $row['parent_album']; $collection_id = $row['parent_collection']; $query = "SELECT * FROM `" . PLOGGER_TABLE_PREFIX . "albums` WHERE `id`='" . $album_id . "'"; $result = run_query($query); $row = mysql_fetch_assoc($result); $album_link = '<a href="' . $_SERVER['PHP_SELF'] . '?level=pictures&id=' . $album_id . '">' . SmartStripSlashes($row['name']) . '</a>'; $query = "SELECT * FROM `" . PLOGGER_TABLE_PREFIX . "collections` WHERE `id`='" . $collection_id . "'"; $result = run_query($query); $row = mysql_fetch_assoc($result); $collection_link = '<a href="' . $_SERVER['PHP_SELF'] . '?level=albums&id=' . $collection_id . '">' . SmartStripSlashes($row['name']) . '</a>'; $breadcrumbs = '<a href="' . $_SERVER['PHP_SELF'] . '">' . plog_tr('Collections') . '</a> » ' . $collection_link . ' » ' . $album_link . ' » ' . $picture_link . ' - ' . '<strong>' . plog_tr('Comments') . ':</strong>'; break; default: $breadcrumbs = '<strong>' . plog_tr('Collections') . '</strong>'; } return "\n\t\t" . '<div id="breadcrumb_links">' . $breadcrumbs . '</div>'; }
function plog_edit_album_form($album_id) { global $thumbnail_config; $album_id = intval($album_id); $album = get_album_by_id($album_id); $auto_graphic = "../graphics/auto.gif"; $output .= '<form class="edit" action="' . $_SERVER["PHP_SELF"] . '?level=albums&id=' . $album["parent_id"] . '" method="post">'; $images = '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url(' . $auto_graphic . '); background-repeat: no-repeat;">' . plog_tr('automatic') . '</option>'; $sql = "SELECT id,caption,path FROM " . TABLE_PREFIX . "pictures p WHERE p.parent_album = '" . $album_id . "'"; $result = run_query($sql); while ($row = mysql_fetch_assoc($result)) { $selected = $row["id"] == $album["thumbnail_id"] ? " selected" : ""; $style = 'class="thumboption" style="padding-left: ' . ($thumbnail_config[THUMB_SMALL]["size"] + 5) . 'px; background-image: url(' . generate_thumb(SmartStripSlashes($row["path"]), $row["id"]) . '); background-repeat: no-repeat;"'; $images .= "<option {$style} value='" . $row["id"] . "'" . $selected . ">"; $images .= !empty($row["caption"]) ? SmartStripSlashes($row["caption"]) : SmartStripSlashes(basename($row["path"])); $images .= "</option>\n"; } $output .= '<label for="name" accesskey="n"><em>N</em>ame:</label><br/><input size="30" name="name" id="name" value="' . SmartStripSlashes($album['name']) . '"><br/> <label for="description" accesskey="d"><em>D</em>escription:</label><br/><input size="80" name="description" id="description" value="' . SmartStripSlashes($album['description']) . '"><br/> Thumbnail:<br/><select name="thumbnail_id" class="thumbselect" id="thumbselect" onchange="updateThumbPreview(this)">' . $images . '</select> <script type="text/javascript">updateThumbPreview(document.getElementById(\'thumbselect\'));</script>'; $output .= '<input type="hidden" name="pid" value="' . $album_id . '"> <input type="hidden" name="action" value="update-album"> <tr><td><button class="submit" type="submit">' . plog_tr('Update') . '</button>'; $output .= '</form>'; return $output; }
$img = '<img src="images/plogger.gif" alt="Plogger" />'; } else { $install_url = 'plog-admin/_install.php'; $upgrade_url = 'plog-admin/_upgrade.php'; $img = '<img src="plog-admin/images/plogger.gif" alt="Plogger" />'; } die($img . "\n" . '<p style="font-family: tahoma, verdana, arial, sans-serif; font-size: 16px; letter-spacing: .25px; margin: 30px;">' . plog_tr('Please run <a href="' . $install_url . '">_install.php</a> to set up Plogger. If you are upgrading from a previous version, please run <a href="' . $upgrade_url . '">_upgrade.php</a>') . '.</p>'); } connect_db(); $query = "SELECT * FROM \"" . PLOGGER_TABLE_PREFIX . "config\""; $result = run_query($query); if ($result->rowCount() == 0) { die(plog_tr('No config information in the database.')); } $config = $result->fetch(); $config['gallery_name'] = SmartStripSlashes($config['gallery_name']); $config['basedir'] = PLOGGER_DIR; // Try to figure out whether we are embedded (for example, running from within WordPress) if (!defined('PLOGGER_EMBEDDED') || PLOGGER_EMBEDDED == '') { // $_SERVER['PATH_TRANSLATED'] is not set in all server environments, so backup with $_SERVER['SCRIPT_FILENAME'] // $_SERVER['SCRIPT_FILENAME'] should produce the same result as __FILE__ if inclusion script in same location as Plogger // In some environments (virtual hosts) $_SERVER['SCRIPT_FILENAME'] is not the correct absolute path, but realpath() seems to clear it up $compare_path = isset($_SERVER['PATH_TRANSLATED']) ? $_SERVER['PATH_TRANSLATED'] : realpath($_SERVER['SCRIPT_FILENAME']); if (dirname(__FILE__) != dirname($compare_path) && strpos($compare_path, 'plog-admin') === false) { $config['embedded'] = 1; // Disable our own cruft-free urls, because the URL has already been processed by WordPress $config['use_mod_rewrite'] = 0; trace('Plogger is embedded'); trace('dirname: ' . dirname(__FILE__)); trace('$_SERVER[\'SCRIPT_FILENAME\']' . ': ' . $_SERVER['SCRIPT_FILENAME']); trace('realpath($_SERVER[\'SCRIPT_FILENAME\'])' . ': ' . realpath($_SERVER['SCRIPT_FILENAME']));
$text = $num_comments_im == 1 ? plog_tr('comment') : plog_tr('comments'); $output .= "\n\n\t\t" . '<div id="comment-count">' . sprintf(plog_tr('You have %s awaiting approval'), '<strong>' . $num_comments_im . '</strong> ' . $text) . '.</div>'; } } $output .= "\n\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0"> <tr class="header"> <th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkAll(document.getElementById(\'contentList\'));" /></th> <th class="table-header-middle align-center width-150">' . plog_tr('Thumb') . '</th> <th class="table-header-middle align-left width-175">' . plog_tr('Author') . '/' . plog_tr('Email') . '/' . plog_tr('Website') . '</th> <th class="table-header-middle align-left width-100">' . plog_tr('Date') . '</th> <th class="table-header-middle align-left">' . plog_tr('Comment') . '</th> <th class="table-header-right align-center width-100">' . plog_tr('Actions') . '</th> </tr>'; } foreach ($row as $key => $value) { $value = SmartStripSlashes(htmlspecialchars($value)); if ($value == '') { $row[$key] = ' '; } } if ($counter % 2 == 0) { $table_row_color = 'color-1'; } else { $table_row_color = 'color-2'; } // Start a new table row (alternating colors) $output .= "\n\t\t\t" . '<tr class="' . $table_row_color . '">'; // Give the row a checkbox $output .= "\n\t\t\t\t" . '<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="' . $row['id'] . '" /></p></td>'; // Give the row a thumbnail, we need to look up the parent picture for the comment $picture = get_picture_by_id($row['parent_id']);
$output .= "\n\t" . '<p class="actions">' . sprintf(plog_tr('Album already exists. Uploading file to existing album %s in collection %s'), '<strong>' . $_REQUEST['new_album_name'] . '</strong>', '<strong>' . $row['name'] . '</strong>') . '</p>' . "\n"; } else { // Error has nothing to do with an existing album, show the returned error $album_id = ''; $output .= "\n\t" . '<p class="errors">' . $result['errors'] . '</p>' . "\n"; } } } else { // Use an existing album $album_id = $_POST['destination']; } if ($album_id) { foreach ($files as $file) { $file_key = md5($file); if (in_array($file_key, $selected)) { $file_name = SmartStripSlashes($file); // fully qualified file name //$fqfn = $config['basedir'].'plog-content/uploads/'.$file_name; $fqfn = $file; if (is_file($fqfn)) { if (in_array($file_key, $allow_comments)) { $allow_comment = 1; } else { $allow_comment = 0; } $result = add_picture($album_id, $fqfn, basename($file_name), $captions[$file_key], $descriptions[$file_key], $allow_comment); if ($result['picture_id'] !== false) { $imported++; // Delete thumbnail file if it exists $thumbpath = $config['basedir'] . 'plog-content/thumbs/uploads/import-' . substr($file_key, 0, 2) . '-' . basename($file_name); if (file_exists($thumbpath) && is_readable($thumbpath)) {
/* Defines the URL of your Plogger gallery */ // $plog_random_images_site_url = 'http://www.yoursite.com/plogger/embedded.php'; $plog_random_images_site_url = $config['gallery_url']; /* How many images do you want to show? */ $plog_random_images_amount = '5'; /* The database query to pull the random images from the database. Comment out if you are pulling images from a specific collection below. */ $plog_random_images_query = "SELECT * FROM " . PLOGGER_TABLE_PREFIX . "pictures ORDER BY RAND() LIMIT {$plog_random_images_amount}"; /* The database query to pull random images from a specific collection. Uncomment and change the X to the ID of the desired collection. */ //$plog_random_images_query = "SELECT * FROM ".PLOGGER_TABLE_PREFIX."pictures WHERE `parent_collection` = X ORDER BY RAND() LIMIT $plog_random_images_amount"; $plog_random_images_result = mysqli_query($GLOBALS["PLOGGER_DBH"], $plog_random_images_query) or die("Could not execute query: {$plog_random_images_query}." . mysqli_error($GLOBALS["PLOGGER_DBH"])); $config['baseurl'] = $plog_random_images_site_url; /* The loop */ while ($row = mysqli_fetch_array($plog_random_images_result)) { $id = $row['id']; $path = $row['path']; $caption = SmartStripSlashes($row['caption']); $name = substr(basename($row['path']), 0, strrpos(basename($row['path']), '.')); $cap_or_name = !empty($caption) ? $caption : $name; ?> <a href="<?php echo generate_url('picture', $id); ?> " title="<?php echo addcslashes($cap_or_name, '"'); ?> "><img class="random-images-thumbnail" src="<?php echo generate_thumb($path, $id); ?> " alt="<?php echo $name; ?>
function plogger_get_album_name() { return htmlspecialchars(SmartStripSlashes($GLOBALS["current_album"]["name"])); }
} else { if (is_valid_url($_POST['url']) == 'nohttp') { $url = 'http://' . $_POST['url']; } else { $url = ''; $errors[] = plog_tr('The website URL you entered does not appear to be valid.'); $error_field[] = 'url'; } } } else { $url = ''; } // Verify the comment if (isset($_POST['comment']) && $_POST['comment'] != '') { // should we strip tags out for now and put limited allowability in later? $comment = strip_tags(SmartStripSlashes($_POST['comment'])); } else { $comment = ''; $errors[] = plog_tr('You forgot to enter a comment.'); $error_field[] = 'comment'; } // If the captcha is required, check it here if (isset($_SESSION['require_captcha']) && $_SESSION['require_captcha'] === true) { if (!isset($_POST['captcha']) || !isset($_SESSION['captcha']) || $_POST['captcha'] != $_SESSION['captcha']) { $errors[] = plog_tr('CAPTCHA check failed.'); $error_field[] = 'captcha'; } } if (empty($errors)) { $rv = add_comment($parent_id, $author, $email, $url, $comment); // We're done with this so empty it out to stop double posts
} // start a new table row (alternating colors) $output .= "<tr class=\"{$table_row_color}\">"; // give the row a checkbox $output .= '<td width="15"><input type="CHECKBOX" name="Selected[]" VALUE="' . $row["id"] . '"></td>'; // give the row a thumbnail, we need to look up the parent picture for the comment $picture = get_picture_by_id($row["parent_id"]); $thumbpath = generate_thumb($picture["path"], $picture["id"], THUMB_SMALL); // generate XHTML with thumbnail and link to picture view. $imgtag = '<div class="img-shadow"><img src="' . $thumbpath . '" title="' . $picture["caption"] . '" alt="' . $picture["caption"] . '" /></div>'; //$target = 'plog-thumbpopup.php?src='.$picture["id"];; //$java = "javascript:this.ThumbPreviewPopup('$target')"; $output .= '<td><a href="' . generate_thumb($picture["path"], $picture["id"], THUMB_LARGE) . '" rel="lightbox" title="' . plogger_get_picture_caption() . '">' . $imgtag . '</a></td>'; foreach ($row as $key => $value) { $value = htmlspecialchars($value); $value = SmartStripSlashes($value); if ($key == "unix_date") { $output .= '<td>' . date($config["date_format"], $value) . '</td>'; } else { if ($key == "allow_comments") { if ($value) { $output .= "<td>" . plog_tr('Yes') . "</td>"; } else { $output .= "<td>" . plog_tr('No') . "</td>"; } } else { if (in_array($key, $allowedCommentKeys)) { $output .= "<td><p id=\"comment-{$key}-" . $row[id] . "\">{$value} </p></td>"; } } }
function plogger_get_album_name($specialchars = false) { if ($specialchars) { return htmlspecialchars(SmartStripSlashes($GLOBALS['current_album']['name']), ENT_QUOTES); } return SmartStripSlashes($GLOBALS['current_album']['name']); }
function plog_edit_album_form($album_id) { global $config, $thumbnail_config; $album_id = intval($album_id); $album = get_album_by_id($album_id); $auto_graphic = $config['gallery_url'] . 'plog-admin/images/auto.gif'; $page = isset($_GET['plog_page']) ? '&plog_page=' . intval($_GET['plog_page']) : ''; $output = "\n\t\t" . '<form class="edit width-700" action="' . $_SERVER['PHP_SELF'] . '?level=albums&id=' . $album['parent_id'] . $page . '" method="post">'; $images = '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url(' . $auto_graphic . ');">' . plog_tr('automatic') . '</option>'; $sql = "SELECT id, caption, path FROM " . PLOGGER_TABLE_PREFIX . "pictures p WHERE p.parent_album = '" . $album_id . "'"; $result = run_query($sql); while ($row = $result->fetch()) { $selected = $row['id'] == $album['thumbnail_id'] ? ' selected="selected"' : ''; $style = 'class="thumboption" style="padding-left: ' . ($thumbnail_config[THUMB_SMALL]['size'] + 5) . 'px; background-image: url(' . generate_thumb(SmartStripSlashes($row['path']), $row['id']) . ');"'; $images .= "\n\t\t\t\t" . '<option ' . $style . ' value="' . $row['id'] . '"' . $selected . '>'; $images .= !empty($row['caption']) ? SmartStripSlashes($row['caption']) : SmartStripSlashes(basename($row['path'])); $images .= "</option>"; } $output .= "\n\t\t\t" . '<div> <div class="strong">' . plog_tr('Edit Album Properties') . '</div> <p> <label class="strong" for="name" accesskey="n">' . plog_tr('<em>N</em>ame') . ':</label><br /> <input size="61" name="name" id="name" value="' . htmlspecialchars(SmartStripSlashes($album['name'])) . '" /> </p> <p> <label class="strong" for="description" accesskey="d">' . plog_tr('<em>D</em>escription') . ':</label><br /> <input size="61" name="description" id="description" value="' . htmlspecialchars(SmartStripSlashes($album['description'])) . '" /> </p> <p> <span class="strong">Thumbnail:</span><br /> <select name="thumbnail_id" class="thumbselect width-450" id="thumbselect" onchange="updateThumbPreview(this)">' . $images . ' </select> <script type="text/javascript">updateThumbPreview(document.getElementById(\'thumbselect\'));</script> </p> <input type="hidden" name="pid" value="' . $album_id . '" /> <input type="hidden" name="action" value="update-album" /> <input class="submit" name="update" value="' . plog_tr('Update') . '" type="submit" /> <input class="submit-cancel" name="cancel" value="' . plog_tr('Cancel') . '" type="submit" /> </div> </form>' . "\n"; return $output; }
function generate_RSS_feed($level, $id, $search = '') { global $config; $config['feed_title'] = SmartStripSlashes($config['feed_title']); // remove plog-rss from the end, if present .. is there a better way to determine the full url? $is_rss = strpos($config['baseurl'], 'plog-rss.php'); if ($is_rss !== false) { $config['baseurl'] = substr($config['baseurl'], 0, $is_rss); } if (!empty($search)) { $level = 'search'; } // Aggregate feed of all albums with collection specified by id if ($level == 'collection') { if ($config['feed_content'] == 0) { plogger_init_albums(array('collection_id' => $id, 'sortby' => 'id', 'sortdir' => 'DESC', 'from' => 0, 'limit' => $config['feed_num_entries'])); } else { plogger_init_pictures(array('type' => 'collection', 'value' => $id, 'limit' => $config['feed_num_entries'], 'sortby' => 'id')); } $collection = get_collection_by_id($id); $config['feed_title'] .= ': ' . $collection['name']; } else { if ($level == 'album') { plogger_init_pictures(array('type' => 'album', 'value' => $id, 'limit' => $config['feed_num_entries'], 'sortby' => 'id')); $album = get_album_by_id($id); $config['feed_title'] .= ': ' . $album['album_name']; } else { if ($level == 'picture') { plogger_init_picture(array('id' => $id, 'comments' => 'DESC')); $picture = get_picture_by_id($id); $config['feed_title'] .= ': ' . basename($picture['path']); } else { if ($level == 'search') { plogger_init_search(array('searchterms' => $search, 'limit' => $config['feed_num_entries'])); } else { if ($level == 'collections' or $level == '') { plogger_init_albums(array('collection_id' => -1, 'sortby' => 'id', 'sortdir' => 'DESC', 'from' => 0, 'limit' => $config['feed_num_entries'])); $config['feed_title'] .= ': ' . plog_tr('Entire Gallery'); } } } } } // generate RSS header $rssFeed = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $rssFeed .= "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:media=\"http://search.yahoo.com/mrss/\">\n"; $rssFeed .= "<channel>\n"; $rssFeed .= "<title>" . $config['feed_title'] . "</title>\n"; $rssFeed .= "<description>" . plog_tr('Plogger RSS Feed') . "</description>\n"; $rssFeed .= "<language>" . $GLOBALS['locale'] . "</language>\n"; $rssFeed .= "<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n"; $rssFeed .= "<generator>Plogger</generator>\n"; $rssFeed .= "<link>" . $config['gallery_url'] . "</link>\n"; $rssFeed .= "<atom:link href=\"http://" . $_SERVER['HTTP_HOST'] . str_replace('&', '&', $_SERVER['REQUEST_URI']) . "\" rel=\"self\" type=\"application/rss+xml\" />\n"; $header = 1; while (plogger_has_albums()) { plogger_load_album(); if ($header) { $submitdate = date('D, d M Y H:i:s O'); $rssFeed .= "<pubDate>" . $submitdate . "</pubDate>\n"; $rssFeed .= "<lastBuildDate>" . $submitdate . "</lastBuildDate>\n"; $header = 0; } $sql = "SELECT UNIX_TIMESTAMP(`date_modified`) AS `pubdate` FROM `" . PLOGGER_TABLE_PREFIX . "pictures` WHERE `parent_album` = '" . plogger_get_album_id() . "' ORDER BY `date_modified` DESC LIMIT 1"; $result = run_query($sql); $row = mysqli_fetch_assoc($result); $pubdate = date('D, d M Y H:i:s O', $row['pubdate']); $title = plogger_get_album_name(); $num = plogger_album_picture_count(); $num_pictures = $num == 1 ? plog_tr('image') : plog_tr('images'); $pagelink = plogger_get_album_url(); $thumbpath = str_replace(array('%2F', '%3A'), array('/', ':'), rawurlencode(plogger_get_album_thumb())); $descript = '<p><a href="' . $pagelink . '" title="' . $title . '"> <img src="' . $thumbpath . '" alt="' . $title . '" style="border: 2px solid #000;" /> </a></p><p>' . $title . ' (' . $num . ' ' . $num_pictures . ')</p><p>' . htmlspecialchars(plogger_get_album_description()) . '</p>'; $rssFeed .= "<item>\n"; $rssFeed .= "\t<pubDate>" . $pubdate . "</pubDate>\n"; $rssFeed .= "\t<title>" . $title . "</title>\n"; $rssFeed .= "\t<link>" . $pagelink . "</link>\n"; $rssFeed .= "\t<description>" . $descript . "</description>\n"; $rssFeed .= "\t<guid isPermaLink=\"false\">" . $thumbpath . "</guid>\n"; $rssFeed .= "\t<media:content url=\"" . $thumbpath . "\" type=\"image/jpeg\" />\n"; $rssFeed .= "\t<media:title>" . $title . "</media:title>\n"; $rssFeed .= "</item>\n"; } while (plogger_has_pictures()) { plogger_load_picture(); // If at picture level, check to make sure it has comments first if ($level != 'picture' || plogger_picture_has_comments()) { if ($header) { $submitdate = plogger_get_picture_date('D, d M Y H:i:s O', 1); $takendate = plogger_get_picture_date(); $rssFeed .= "<pubDate>" . $submitdate . "</pubDate>\n"; $rssFeed .= "<lastBuildDate>" . $submitdate . "</lastBuildDate>\n"; $header = 0; } $rssFeed .= "<item>\n"; if ($config['allow_fullpic']) { $urlPath = str_replace(array('%2F', '%3A'), array('/', ':'), rawurlencode(plogger_get_source_picture_url())); } else { $urlPath = str_replace(array('%2F', '%3A'), array('/', ':'), rawurlencode(plogger_get_picture_thumb(THUMB_LARGE))); } $caption = plogger_get_picture_caption(); $thumbpath = plogger_get_picture_thumb(THUMB_RSS); $pagelink = plogger_get_picture_url(); if ($caption == '' || $caption == ' ') { $caption = plog_tr('New Image (no caption)'); } $caption .= ' - ' . $takendate; $descript = '<p><a href="' . $pagelink . '" title="' . $caption . '"> <img src="' . $thumbpath . '" alt="' . $caption . '" style="border: 2px solid #000;" /> </a></p><p>' . $caption . '</p>'; $descript .= '<p>' . htmlspecialchars(plogger_get_picture_description()) . '</p>'; $rssFeed .= "\t<pubDate>" . $submitdate . "</pubDate>\n"; $rssFeed .= "\t<title>" . $caption . "</title>\n"; $rssFeed .= "\t<link>" . $pagelink . "</link>\n"; $rssFeed .= "\t<description>" . $descript . "</description>\n"; $rssFeed .= "\t<guid isPermaLink=\"false\">" . $thumbpath . "</guid>\n"; $rssFeed .= "\t<media:content url=\"" . $urlPath . "\" type=\"image/jpeg\" />\n"; $rssFeed .= "\t<media:title>" . $caption . "</media:title>\n"; $rssFeed .= "</item>\n"; if ($level == 'picture') { while (plogger_picture_has_comments()) { plogger_load_comment(); $rssFeed .= "<item>\n"; $rssFeed .= "\t<pubDate>" . plogger_get_comment_date('D, d M Y H:i:s O') . "</pubDate>\n"; $rssFeed .= "\t<title>Comment by " . plogger_get_comment_author() . "</title>\n"; $rssFeed .= "\t<link>" . $pagelink . "</link>\n"; $rssFeed .= "\t<description>" . plogger_get_comment_text() . "</description>\n"; $rssFeed .= "\t<guid isPermaLink=\"true\">" . $pagelink . "#Comment-" . plogger_get_comment_id() . "</guid>\n"; $rssFeed .= "</item>\n"; } } } } $rssFeed .= "</channel>\n</rss>"; echo $rssFeed; }
function generate_RSS_feed($level, $id, $search = "") { global $config; $config["feed_title"] = SmartStripSlashes($config["feed_title"]); if (!empty($search)) { $level = "search"; } if ($level == "collection") { // aggregate feed of all albums with collection specified by id plogger_init_pictures(array('type' => 'collection', 'value' => $id, 'limit' => $config['feed_num_entries'], 'sortby' => 'id')); $collection = get_collection_by_id($id); $config["feed_title"] .= ": " . $collection['collection_name'] . "Collection"; } else { if ($level == "album") { plogger_init_pictures(array('type' => 'album', 'value' => $id, 'limit' => $config['feed_num_entries'], 'sortby' => 'id')); $album = get_album_by_id($id); $config["feed_title"] .= ": " . $album['album_name'] . " Album"; } else { if ($level == "search") { plogger_init_search(array('searchterms' => $search, 'limit' => $config['feed_num_entries'])); } else { if ($level == "") { plogger_init_pictures(array('type' => 'latest', 'limit' => $config['feed_num_entries'], 'sortby' => 'id')); $config["feed_title"] .= ": Entire Gallery"; } } } } $header = 1; // generate RSS header $rssFeed = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<rss version=\"2.0\">"; $rssFeed .= "<channel>\n"; $rssFeed .= "<title>" . $config['feed_title'] . "</title>\n"; $rssFeed .= "<description>Plogger RSS Feed</description>\n"; $rssFeed .= "<language>" . $config['feed_language'] . "</language>\n"; $rssFeed .= "<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n"; $rssFeed .= "<generator>Plogger</generator>\n"; $rssFeed .= "<link>" . $config['gallery_url'] . "</link>\n"; while (plogger_has_pictures()) { plogger_load_picture(); $date = plogger_get_picture_date("D, d M Y H:i:s O", 1); if ($header) { $rssFeed .= "<pubDate>" . $date . "</pubDate>\n"; $rssFeed .= "<lastBuildDate>" . $date . "</lastBuildDate>\n"; $header = 0; } $rssFeed .= "<item>\n"; $caption = plogger_get_picture_caption(); $thumbpath = plogger_get_picture_thumb(THUMB_SMALL); $pagelink = plogger_get_picture_url(); if ($caption == "" || $caption == " ") { $caption = "New Photograph (no caption)"; } $discript = '<p><a href="' . $pagelink . '" title="' . $caption . '"> <img src="' . $thumbpath . '" alt="' . $caption . '" style="border: 1px solid #000000;" /> </a></p><p>' . $caption . '</p>'; $discript .= '<p>' . htmlspecialchars(plogger_get_picture_description()) . '</p>'; $rssFeed .= "<pubDate>" . $date . "</pubDate>\n"; $rssFeed .= "<title>" . $caption . "</title>\n"; $rssFeed .= "<link>" . $pagelink . "</link>\n"; $rssFeed .= "<description>" . $discript . "</description>\n"; $rssFeed .= "<guid isPermaLink=\"false\">" . $thumbpath . "</guid>"; $rssFeed .= "</item>\n"; } $rssFeed .= "</channel></rss>"; echo $rssFeed; }