Ejemplo n.º 1
0
		<div id="comment-section">

			<a name="comments"></a>
			<h2 class="comment-heading"><?php 
    echo plog_tr('Comments');
    ?>
:</h2>

<?php 
    if (plogger_picture_has_comments()) {
        ?>
				<ol class="comments">
<?php 
        $counter = 0;
        while (plogger_picture_has_comments()) {
            plogger_load_comment();
            // This code alternates the background color every other comment
            $comment_class = $counter % 2 ? 'comment-alt' : 'comment';
            ?>
					<li class="<?php 
            echo $comment_class;
            ?>
">
						<p><?php 
            echo plogger_get_comment_text();
            ?>
</p>
						<cite><?php 
            echo plog_tr('Comment by');
            ?>
 <?php 
function plog_comment_manager($id, $from, $limit)
{
    global $config, $empty;
    $output = '';
    plogger_init_picture(array('id' => $id, 'from' => $from, 'limit' => $limit));
    // Create javascript initiation function for editable elements
    if (plogger_picture_has_comments()) {
        $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() {';
        while (plogger_picture_has_comments()) {
            plogger_load_comment();
            // makeEditable('picture".plogger_get_picture_id()."');
            $output .= "\n\t\t\t\tmakeEditable('comment-comment-" . plogger_get_comment_id() . "');\n\t\t\t\tmakeEditable('comment-author-" . plogger_get_comment_id() . "');\n\t\t\t\tmakeEditable('comment-url-" . plogger_get_comment_id() . "');\n\t\t\t\tmakeEditable('comment-email-" . plogger_get_comment_id() . "');";
        }
        $output .= "\n\t\t\t" . '}';
        $output .= "\n\t\t" . '</script>';
    }
    plogger_init_picture(array('id' => $id, 'from' => $from, 'limit' => $limit));
    if (plogger_picture_has_comments()) {
        $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0">
			<col style="width: 15px;" />
			<tbody>
				<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-left width-175">' . plog_tr('Author') . '/' . plog_tr('Email') . '/' . plog_tr('Website') . '</th>
					<th class="table-header-middle align-left width-150">' . 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>';
        $counter = 0;
        while (plogger_picture_has_comments()) {
            plogger_load_comment();
            if ($counter % 2 == 0) {
                $table_row_color = 'color-1';
            } else {
                $table_row_color = 'color-2';
            }
            $counter++;
            $id = plogger_get_comment_id();
            $output .= "\n\t\t\t\t" . '<tr class="' . $table_row_color . '">';
            $output .= "\n\t\t\t\t\t" . '<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="' . $id . '" /></p></td>';
            $output .= "\n\t\t\t\t\t" . '<td class="align-left width-175">
						<p class="margin-5 no-margin-bottom"><strong>' . plog_tr('Author') . ':</strong></p>
						<p class="margin-5 no-margin-top" id="comment-author-' . $id . '">' . plogger_get_comment_author() . '</p>
						<p class="margin-5 no-margin-bottom"><strong>' . plog_tr('Email') . ':</strong></p>
						<p class="margin-5 no-margin-top" id="comment-email-' . $id . '">' . plogger_get_comment_email() . '</p>
						<p class="margin-5 no-margin-bottom"><strong>' . plog_tr('Website') . ':</strong></p>
						<p class="margin-5 no-margin-top" id="comment-url-' . $id . '">' . plogger_get_comment_url() . '</p>
					</td>';
            $output .= "\n\t\t\t\t\t" . '<td class="align-left width-150"><p class="margin-5">' . plogger_get_comment_date('n/j/Y g:i a') . '</p></td>';
            $output .= "\n\t\t\t\t\t" . '<td class="align-left vertical-top"><p class="margin-5" id="comment-comment-' . $id . '">' . plogger_get_comment_text() . '</p></td>';
            $output .= "\n\t\t\t\t\t" . '<td class="align-center width-100"><p class="margin-5"><a href="?action=edit-comment&amp;id=' . $id . '"><img style="display: inline;" src="' . $config['gallery_url'] . 'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>';
            $output .= '&nbsp;&nbsp;&nbsp;<a href="?action=delete-comment&amp;id=' . $id . '" 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\t" . '</tr>';
        }
        $output .= "\n\t\t\t\t" . '<tr class="footer">
					<td class="align-left invert-selection" colspan="5"><a href="#" onclick="checkToggle(document.getElementById(\'contentList\')); return false;">' . plog_tr('Toggle Checkbox Selection') . '</a></td>
				</tr>
			</tbody>
		</table>' . "\n";
    } else {
        $output .= "\n\n\t\t" . '<p class="actions">' . plog_tr('This picture has no comments.') . '</p>' . "\n";
        $empty = true;
    }
    return $output;
}
Ejemplo n.º 3
0
function plog_comment_manager($id, $from, $limit)
{
    plogger_init_picture(array('id' => $id));
    // create javascript initiation function for editable elements
    if (plogger_picture_has_comments()) {
        $output .= '<script type="text/javascript">';
        $output .= "Event.observe(window, 'load', init, false);";
        $output .= "function init() {";
        while (plogger_picture_has_comments()) {
            plogger_load_comment();
            // makeEditable('collection-name-".plogger_get_collection_id()."');
            $output .= "makeEditable('comment-comment-" . plogger_get_comment_id() . "');\r\n\t\t\t\t\t\tmakeEditable('comment-author-" . plogger_get_comment_id() . "');\r\n\t\t\t\t\t\tmakeEditable('comment-url-" . plogger_get_comment_id() . "');\r\n\t\t\t\t\t\tmakeEditable('comment-email-" . plogger_get_comment_id() . "');";
        }
        $output .= "}";
        $output .= '</script>';
    }
    plogger_init_picture(array('id' => $id));
    if (plogger_picture_has_comments()) {
        $output .= '<table style="width: 100%" cellpadding="4">
		<col style="width: 15px;"/><tr class="header"><td class="table-header-left">&nbsp;</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('Author') . '</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('E-mail') . '</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('URL') . '</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('Date') . '</td>';
        $output .= '<td class="table-header-middle">' . plog_tr('Comment') . '</td>';
        $output .= '<td class="table-header-right">' . plog_tr('Actions') . '</td></tr>';
        $counter = 0;
        while (plogger_picture_has_comments()) {
            plogger_load_comment();
            if ($counter % 2 == 0) {
                $table_row_color = "color-1";
            } else {
                $table_row_color = "color-2";
            }
            $id = plogger_get_comment_id();
            $output .= "<tr class='{$table_row_color}'>";
            $output .= "<td><input type='checkbox' name='selected[]' value='" . $id . "'/></td>";
            $output .= "<td><p id=\"comment-author-" . $id . "\">" . plogger_get_comment_author() . "&nbsp;</p></td>";
            $email = plogger_get_comment_email();
            $output .= "<td><p id=\"comment-email-" . $id . "\">" . $email . "&nbsp;</p></td>";
            $output .= "<td><p id=\"comment-url-" . $id . "\">" . plogger_get_comment_url() . "&nbsp;</p></td>";
            $output .= "<td>" . plogger_get_comment_date("n.j.Y H:i:s") . "</td>";
            $output .= "<td><p id=\"comment-comment-" . $id . "\">" . plogger_get_comment_text() . "&nbsp;</p></td>";
            $output .= '<td><a href="?action=edit-comment&amp;id=' . $id . '"><img style="display:inline" src="../graphics/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '"></a>';
            $output .= '<a href="?action=delete-comment&amp;id=' . $id . '" 
		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'>" . plog_tr('This picture has no comments on it.') . "</p>";
    }
    return $output;
}
Ejemplo n.º 4
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;
}