Пример #1
0
<?php 
    while (plogger_has_pictures()) {
        plogger_load_picture();
        // Find thumbnail width/height
        $thumb_info = plogger_get_thumbnail_info();
        $thumb_width = $thumb_info['width'];
        // The width of the image. It is integer data type.
        $thumb_height = $thumb_info['height'];
        // The height of the image. It is an integer data type.
        $div_width = $thumb_width + 30;
        // Account for padding/border width
        $div_height = $thumb_height + 75;
        // Account for padding/border width
        // Generate XHTML with thumbnail and link to picture view
        $img_id = "thumb-" . plogger_get_picture_id();
        $imgtag = '<img id="' . $img_id . '" onmouseout="document.getElementById(\'overlay\').style.visibility = \'hidden\';" onmouseover="display_overlay(\'' . $img_id . '\', \'' . plogger_picture_comment_count() . '\')" class="photos" src="' . plogger_get_picture_thumb() . '" width="' . $thumb_width . '" height="' . $thumb_height . '" title="' . plogger_get_picture_caption('clean') . '" alt="' . plogger_get_picture_caption('clean') . '" />';
        ?>
				<li class="thumbnail">
					<div class="tag" style="width: <?php 
        echo $div_width;
        ?>
px; height: <?php 
        echo $div_height;
        ?>
px;">
						<a href="<?php 
        echo plogger_get_picture_url();
        ?>
"><?php 
        echo $imgtag;
        ?>
Пример #2
0
<?php

plogger_get_header();
if (plogger_has_pictures()) {
    while (plogger_has_pictures()) {
        plogger_load_picture();
        print '<div id="inner_wrapper"> <div id="big-picture-container">
			   <div><h2 class="date">' . plogger_get_picture_date() . '</h2></div>';
        $picture_caption = trim(plogger_get_picture_caption());
        if ($picture_caption != '' || !isset($picture_caption)) {
            echo '<div><h2 id="picture_caption">' . $picture_caption . '</h2></div>';
        }
        // generate XHTML with thumbnail and link to picture view.
        $imgtag = '<img class="photos-large" src="' . plogger_get_picture_thumb(THUMB_LARGE) . '" title="' . $capt . '" alt="' . $capt . '" />';
        $detail_link = plogger_get_detail_link();
        $prev_link = plogger_get_prev_picture_link();
        $next_link = plogger_get_next_picture_link();
        print '<div id="nav-link-img-prev">' . $prev_link . '</div>
			   <div id="nav-link-img-next">' . $next_link . '</div>';
        print '<div id="picture-holder">
					<a accesskey="v" href="' . plogger_get_source_picture_url() . '">' . $imgtag . '</a>
			   </div>';
        print '<p id="picture_description">' . plogger_get_picture_description() . '</p>';
        print '
		<div id="exif-toggle-container"><div id="exif_toggle">' . $detail_link . '</div></div>';
        print generate_exif_table(plogger_get_picture_id());
        // display comments for selected picture
        print plogger_display_comments();
        print '</div>';
    }
} else {
Пример #3
0
function plog_picture_manager($id, $from, $limit)
{
    plogger_init_pictures(array('type' => 'album', 'value' => $id, 'from' => $from, 'limit' => $limit));
    // create javascript initiation function for editable elements
    if (plogger_has_pictures()) {
        $output .= '<script type="text/javascript">';
        $output .= "Event.observe(window, 'load', init, false);";
        $output .= "function init() {";
        while (plogger_has_pictures()) {
            plogger_load_picture();
            $output .= "makeEditable('picture-description-" . plogger_get_picture_id() . "'); makeEditable('picture-caption-" . plogger_get_picture_id() . "');";
        }
        $output .= "}";
        $output .= '</script>';
    }
    // reset the picture array
    plogger_init_pictures(array('type' => 'album', 'value' => $id, 'from' => $from, 'limit' => $limit));
    if (plogger_has_pictures()) {
        $output .= '<table style="width: 100%" cellpadding="4">
			   <col style="width: 15px;"/><tr class="header"><td class="table-header-left">&nbsp;</td>';
        $output .= '<td width="65" class="table-header-middle">' . plog_tr('Thumb') . '</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('Filename') . '</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('Caption') . '</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('Description') . '</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('Allow comments') . '</td>';
        $output .= '<td class="table-header-right">' . plog_tr('Actions') . '</td></tr>';
        $counter = 0;
        while (plogger_has_pictures()) {
            if ($counter % 2 == 0) {
                $table_row_color = "color-1";
            } else {
                $table_row_color = "color-2";
            }
            $counter++;
            plogger_load_picture();
            $id = plogger_get_picture_id();
            $output .= "<tr class='{$table_row_color}'>";
            $output .= "<td><input type='checkbox' name='selected[]' value='" . $id . "'/></td>";
            $thumbpath = plogger_get_picture_thumb();
            $imgtag = '<div class="img-shadow"><img src="' . $thumbpath . '" title="' . plogger_get_picture_caption() . '" alt="' . plogger_get_picture_caption() . '" /></div>';
            //$target = 'plog-thumbpopup.php?src='.$id;
            //$java = "javascript:this.ThumbPreviewPopup('$target')";
            $output .= '<td><a href="' . plogger_get_picture_thumb(THUMB_LARGE) . '" rel="lightbox" title="' . plogger_get_picture_caption() . '">' . $imgtag . '</a></td>';
            $output .= "<td><strong><a class='folder' href='?level=comments&amp;id=" . $id . "'>" . basename(plogger_get_source_picture_path()) . "</a></strong></td>";
            $output .= "<td><p id=\"picture-caption-" . plogger_get_picture_id() . "\">" . plogger_get_picture_caption() . "&nbsp;</p></td>";
            $output .= "<td><p id=\"picture-description-" . plogger_get_picture_id() . "\">" . plogger_get_picture_description() . "&nbsp;</p></td>";
            $allow_comments = 1 == plogger_picture_allows_comments() ? "Yes" : "No";
            $output .= "<td>" . $allow_comments . "</td>";
            $output .= '<td><a href="?action=edit-picture&amp;id=' . $id;
            if (isset($_GET["entries_per_page"])) {
                $output .= '&amp;entries_per_page=' . intval($_GET["entries_per_page"]);
            }
            if (isset($_GET["plog_page"])) {
                $output .= '&amp;plog_page=' . intval($_GET["plog_page"]);
            }
            $output .= '"><img style="display:inline" src="../graphics/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '"></a>';
            $parent_id = $_REQUEST["id"];
            $output .= '<a href="?action=1&amp;selected%5B%5D=' . $id . '&amp;level=pictures&amp;delete_checked=1&amp;id=' . $parent_id;
            if (isset($_GET["entries_per_page"])) {
                $output .= '&amp;entries_per_page=' . intval($_GET["entries_per_page"]);
            }
            if (isset($_GET["plog_page"])) {
                $output .= '&amp;plog_page=' . intval($_GET["plog_page"]);
            }
            $output .= '"
		onClick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display:inline" src="../graphics/x.gif" alt="' . plog_tr('Delete') . '" 					title="' . plog_tr('Delete') . '"></a></td>';
            $output .= "</tr>";
        }
        $output .= '<tr class="header"><td colspan="7"></td></tr></table>';
        $output .= "</table>";
    } else {
        $output .= '<p class="actions">' . sprintf(plog_tr('Sadly, there are no pictures yet.  Why don\'t you <a href="%s">upload some?</a>'), 'plog-upload.php') . '</p>';
    }
    return $output;
}
Пример #4
0
		<h2 class="picture-title"><?php 
        echo plogger_get_picture_caption();
        ?>
</h2>
		<h2 class="date"><?php 
        echo plogger_get_picture_date();
        ?>
</h2>

		<div id="picture-holder">
			<a accesskey="v" href="<?php 
        echo plogger_get_source_picture_url();
        ?>
"><img class="photos-large" src="<?php 
        echo plogger_get_picture_thumb(THUMB_LARGE);
        ?>
" width="<?php 
        echo $thumb_width;
        ?>
" height="<?php 
        echo $thumb_height;
        ?>
" title="<?php 
        echo plogger_get_picture_caption('clean');
        ?>
" alt="<?php 
        echo plogger_get_picture_caption('clean');
        ?>
" /></a>
		</div><!-- /picture-holder -->
Пример #5
0
        // Find thumbnail width/height
        $thumb_info = plogger_get_thumbnail_info();
        $thumb_width = $thumb_info['width'];
        // The width of the image. It is integer data type.
        $thumb_height = $thumb_info['height'];
        // The height of the image. It is an integer data type.
        ?>
			<li class="thumbnail">
				<a href="<?php 
        echo plogger_get_picture_url();
        ?>
"><img id="thumb-<?php 
        echo plogger_get_picture_id();
        ?>
" class="photos" src="<?php 
        echo plogger_get_picture_thumb();
        ?>
" width="<?php 
        echo $thumb_width;
        ?>
" height="<?php 
        echo $thumb_height;
        ?>
" title="<?php 
        echo plogger_get_picture_caption('clean');
        ?>
" alt="<?php 
        echo plogger_get_picture_caption('clean');
        ?>
" /></a>
				<div class="checkbox"><?php 
Пример #6
0
<?php

plogger_get_header();
print '<div id="thumbnail_container">';
if (plogger_has_pictures()) {
    print '<div id="inner_wrapper"><div id="big-picture-container">';
    print '<script type="text/javascript">';
    print 'slides = new slideshow("slides");';
    print 'slides.prefetch = 2; slides.timeout = 4000; ';
    while (plogger_has_pictures()) {
        $pic = plogger_load_picture();
        // output a line of javascript for each image
        echo 's = new slide("' . plogger_get_picture_thumb(THUMB_LARGE) . '",
		"' . plogger_get_source_picture_url() . '",
		"' . plogger_get_picture_caption() . '",
		"_self","","","' . basename($pic['path']) . '");
		slides.add_slide(s);';
    }
    print '// --> </script>';
    print '</div></div>';
    print generate_slideshow_interface();
} else {
    print '<div id="no-pictures-msg">No pictures to show.</div>';
}
print '</div>';
function generate_slideshow_interface()
{
    global $config;
    $large_link = '<a accesskey="v" href="javascript:slides.hotlink()" title="View Large Image"><img hspace="1" src="' . $config["gallery_url"] . 'graphics/search.gif" width="16" height="16"></a>';
    $prev_url = '<a accesskey="," title="Previous Image" 
	href="javascript: slides.previous();"><img hspace="1" src="' . $config["gallery_url"] . 'graphics/rewind.gif" 
Пример #7
0
		<div id="inner-wrapper">

			<div id="big-picture-container">
<?php 
if (plogger_has_pictures()) {
    while (plogger_has_pictures()) {
        plogger_load_picture();
        // Equivalent to the WordPress loop
        // Set variables for the picture
        $thumb_info = plogger_get_thumbnail_info();
        $thumb_width = $thumb_info['width'];
        // The width of the image. It is integer data type.
        $thumb_height = $thumb_info['height'];
        // The height of the image. It is an integer data type.
        // Generate XHTML with thumbnail and link to picture view.
        $imgtag = '<img class="photos-large" src="' . plogger_get_picture_thumb(THUMB_LARGE) . '" width="' . $thumb_width . '" height="' . $thumb_height . '" title="' . plogger_get_picture_caption('clean') . '" alt="' . plogger_get_picture_caption('clean') . '" />';
        ?>
				<div><h2 id="picture-caption"><?php 
        echo plogger_get_picture_caption();
        ?>
</h2></div>
				<div><h2 class="date"><?php 
        echo plogger_get_picture_date();
        ?>
</h2></div>

				<div id="nav-link-img-prev"><?php 
        echo plogger_get_prev_picture_link();
        ?>
</div>
				<div id="nav-link-img-next"><?php 
Пример #8
0
<?php

plogger_get_header();
print '<div id="thumbnail_container">';
if (plogger_has_pictures()) {
    print '<div id="overlay">&nbsp;</div>';
    print '<ul class="slides">';
    while (plogger_has_pictures()) {
        plogger_load_picture();
        // display thumbnails within album
        // generate XHTML with thumbnail and link to picture view.
        $capt = plogger_get_picture_caption();
        $img_id = "thumb-" . plogger_get_picture_id();
        $imgtag = '<img id="' . $img_id . '" onmouseout="document.getElementById(\'overlay\').style.visibility = \'hidden\';" 
		onmouseover="display_overlay(\'' . $img_id . '\', \'' . plogger_picture_comment_count() . '\')" class="photos" 
		src="' . plogger_get_picture_thumb() . '" title="' . $capt . '" alt="' . $capt . '" />';
        print '<li class="thumbnail"><div class="tag"><a href="' . plogger_get_picture_url() . '">' . $imgtag . "</a><br />";
        print plogger_download_checkbox(plogger_get_picture_id());
        print '</div></li>';
    }
    print '</ul>';
} else {
    print '<div id="no-pictures-msg">There are no pictures in this album.</div>';
}
print '</div>';
plogger_get_footer();
Пример #9
0
function plogger_get_thumbnail_info()
{
    global $thumbnail_config;
    global $config;
    $thumbpath = '';
    // Make sure we generate the thumbnail before we try to get the image information
    switch ($GLOBALS['plogger_level']) {
        case 'collections':
            $thumbpath = plogger_get_collection_thumb();
            break;
        case 'collection':
            $thumbpath = plogger_get_album_thumb();
            break;
        case 'album':
        case 'search':
            $thumbpath = plogger_get_picture_thumb($size = THUMB_SMALL);
            break;
        case 'picture':
            $thumbpath = plogger_get_picture_thumb($size = THUMB_LARGE);
            break;
    }
    // Get the absolute path instead of the URL
    $thumbpath = str_replace($config['gallery_url'], $config['basedir'], $thumbpath);
    if (!is_readable($thumbpath)) {
        // Again, do we want to support video in the Plogger core?
        // $image_info = getimagesize($config['basedir'].'plog-graphics/thumb-video.gif');
        return false;
    } else {
        $image_info = getimagesize($thumbpath);
        $image_info['width'] = $image_info[0];
        $image_info['height'] = $image_info[1];
    }
    return $image_info;
}
function plog_picture_manager($id, $from, $limit)
{
    global $config, $empty;
    $output = '';
    plogger_init_pictures(array('type' => 'album', 'value' => $id, 'from' => $from, 'limit' => $limit, 'sortby' => !empty($config['default_sortby']) ? $config['default_sortby'] : 'id', 'sortdir' => !empty($config['default_sortdir']) ? $config['default_sortdir'] : 'ASC'));
    // Create javascript initiation function for editable elements
    if (plogger_has_pictures()) {
        $output .= "\n\t\t" . '<script type="text/javascript">';
        $output .= "\n\t\t\t" . 'Event.observe(window, \'load\', init, false);';
        $output .= "\n\t\t\t" . 'function init() {' . "\n";
        while (plogger_has_pictures()) {
            plogger_load_picture();
            $output .= "\t\t\t\tmakeEditable('picture-description-" . plogger_get_picture_id() . "');\n\t\t\t\tmakeEditable('picture-caption-" . plogger_get_picture_id() . "');\n";
        }
        $output .= "\t\t\t" . '}';
        $output .= "\n\t\t" . '</script>';
    }
    // Reset the picture array
    plogger_init_pictures(array('type' => 'album', 'value' => $id, 'from' => $from, 'limit' => $limit, 'sortby' => !empty($config['default_sortby']) ? $config['default_sortby'] : 'id', 'sortdir' => !empty($config['default_sortdir']) ? $config['default_sortdir'] : 'ASC'));
    if (plogger_has_pictures()) {
        $allow_comment = $config['allow_comments'] ? plog_tr('Allow Comments') : '&nbsp;';
        $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0">
			<col style="width: 15px;" />
			<tr class="header">
				<th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkToggle(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('Filename') . '</th>
				<th class="table-header-middle align-left">' . plog_tr('Caption') . '/' . plog_tr('Description') . '</th>
				<th class="table-header-middle align-center width-125">' . $allow_comment . '</th>
				<th class="table-header-right align-center width-100">' . plog_tr('Actions') . '</th>
			</tr>';
        $counter = 0;
        while (plogger_has_pictures()) {
            if ($counter % 2 == 0) {
                $table_row_color = 'color-1';
            } else {
                $table_row_color = 'color-2';
            }
            $counter++;
            plogger_load_picture();
            $id = plogger_get_picture_id();
            $output .= "\n\t\t\t" . '<tr class="' . $table_row_color . '">';
            $output .= "\n\t\t\t\t" . '<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="' . $id . '" /></p></td>';
            $thumbpath = plogger_get_picture_thumb();
            $imgtag = '<img src="' . $thumbpath . '" title="' . plogger_get_picture_caption('clean') . '" alt="' . plogger_get_picture_caption('clean') . '" />';
            $output .= "\n\t\t\t\t" . '<td class="align-center width-150"><div class="img-shadow"><a href="' . plogger_get_picture_thumb(THUMB_LARGE) . '" rel="lightbox" title="' . plogger_get_picture_caption('code') . '">' . $imgtag . '</a></div></td>';
            $output .= "\n\t\t\t\t" . '<td class="align-left width-175"><p class="margin-5"><strong><a href="' . $_SERVER['PHP_SELF'] . '?level=comments&amp;id=' . $id . '">' . basename(plogger_get_source_picture_path()) . '</a></strong><br /><br /><span>' . sprintf(plog_tr('Comments: %d'), plogger_picture_comment_count()) . '</span></p></td>';
            $output .= "\n\t\t\t\t" . '<td class="align-left vertical-top">
					<p class="margin-5 no-margin-bottom"><strong>' . plog_tr('Caption') . ':</strong></p>
					<p class="margin-5 no-margin-top" id="picture-caption-' . plogger_get_picture_id() . '">' . plogger_get_picture_caption() . '</p>
					<p class="margin-5 no-margin-bottom"><strong>' . plog_tr('Description') . ':</strong></p>
					<p class="margin-5 no-margin-top" id="picture-description-' . plogger_get_picture_id() . '">' . plogger_get_picture_description() . '</p>
				</td>';
            if ($config['allow_comments']) {
                $allow_comments = 1 == plogger_picture_allows_comments() ? plog_tr('Yes') : plog_tr('No');
            } else {
                $allow_comments = '&nbsp;';
            }
            $output .= "\n\t\t\t\t" . '<td class="align-center width-125"><p class="margin-5">' . $allow_comments . '</p></td>';
            $output .= "\n\t\t\t\t" . '<td class="align-center width-100"><p class="margin-5"><a href="?action=edit-picture&amp;id=' . $id;
            if (isset($_GET['entries_per_page'])) {
                $output .= '&amp;entries_per_page=' . intval($_GET['entries_per_page']);
            }
            if (isset($_GET['plog_page'])) {
                $output .= '&amp;plog_page=' . intval($_GET['plog_page']);
            }
            $output .= '"><img style="display: inline;" src="' . $config['gallery_url'] . 'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>';
            $parent_id = $_REQUEST['id'];
            $output .= '&nbsp;&nbsp;&nbsp;<a href="?action=move-delete&amp;selected%5B%5D=' . $id . '&amp;level=pictures&amp;delete_checked=1&amp;id=' . $parent_id;
            if (isset($_GET['plog_page'])) {
                $output .= '&amp;plog_page=' . intval($_GET['plog_page']);
            }
            $output .= '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="' . $config['gallery_url'] . 'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></p></td>';
            $output .= "\n\t\t\t" . '</tr>';
        }
        $output .= "\n\t\t\t" . '<tr class="footer">
				<td class="align-left invert-selection" colspan="6"><a href="#" onclick="checkToggle(document.getElementById(\'contentList\')); return false;">' . plog_tr('Toggle Checkbox Selection') . '</a></td>
			</tr>
		</table>' . "\n";
    } else {
        $output .= "\n\n\t\t" . '<p class="actions">' . sprintf(plog_tr('Sadly, there are no pictures yet. Why don\'t you <a title="upload images" href="%s" style="font-weight: bold;">upload some</a>?'), 'plog-upload.php') . '</p>' . "\n";
        $empty = true;
    }
    return $output;
}
Пример #11
0
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('&', '&amp;', $_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 = '&lt;p&gt;&lt;a href="' . $pagelink . '"
		title="' . $title . '"&gt;
		&lt;img src="' . $thumbpath . '" alt="' . $title . '" style="border: 2px solid #000;" /&gt;
		&lt;/a&gt;&lt;/p&gt;&lt;p&gt;' . $title . ' (' . $num . ' ' . $num_pictures . ')&lt;/p&gt;&lt;p&gt;' . htmlspecialchars(plogger_get_album_description()) . '&lt;/p&gt;';
        $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 == '&nbsp;') {
                $caption = plog_tr('New Image (no caption)');
            }
            $caption .= ' - ' . $takendate;
            $descript = '&lt;p&gt;&lt;a href="' . $pagelink . '"
			title="' . $caption . '"&gt;
			&lt;img src="' . $thumbpath . '" alt="' . $caption . '" style="border: 2px solid #000;" /&gt;
			&lt;/a&gt;&lt;/p&gt;&lt;p&gt;' . $caption . '&lt;/p&gt;';
            $descript .= '&lt;p&gt;' . htmlspecialchars(plogger_get_picture_description()) . '&lt;/p&gt;';
            $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;
}
Пример #12
0
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 == "&nbsp;") {
            $caption = "New Photograph (no caption)";
        }
        $discript = '&lt;p&gt;&lt;a href="' . $pagelink . '"  
		title="' . $caption . '"&gt;
		&lt;img src="' . $thumbpath . '" alt="' . $caption . '" style="border: 1px solid #000000;" /&gt;
		&lt;/a&gt;&lt;/p&gt;&lt;p&gt;' . $caption . '&lt;/p&gt;';
        $discript .= '&lt;p&gt;' . htmlspecialchars(plogger_get_picture_description()) . '&lt;/p&gt;';
        $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;
}