예제 #1
0
function delete_picture($del_id)
{
    global $config;
    $del_id = intval($del_id);
    global $thumbnail_config;
    $picture = get_picture_by_id($del_id);
    if ($picture) {
        $query = "DELETE FROM " . TABLE_PREFIX . "pictures WHERE `id`= '" . $picture['id'] . "'";
        run_query($query);
        // delete all comments for the picture
        $query = "DELETE FROM " . TABLE_PREFIX . "comments WHERE `parent_id`= '" . $picture['id'] . "'";
        run_query($query);
        // make sure that the file is actually located inside our images directory
        $full_path = realpath($config['basedir'] . 'images/' . $picture['path']);
        // also check whether this image is in the correct folder
        $relative_path = substr($full_path, 0, strlen($config['basedir']));
        $basename = basename($picture['path']);
        if ($relative_path == $config['basedir']) {
            foreach ($thumbnail_config as $tkey => $tval) {
                $thumbpath = $config['basedir'] . 'thumbs/' . $tval['filename_prefix'] . $picture['id'] . '-' . $basename;
                if (file_exists($thumbpath) && is_writable($thumbpath)) {
                    //print "deleting $thumbpath<br/>";
                    @chmod($thumbpath, 0777);
                    unlink($thumbpath);
                }
            }
            if (is_file($full_path)) {
                // print "deleting $full_path<br/>";
                @chmod($full_path, 0777);
                if (!unlink($full_path)) {
                    return array('errors' => plog_tr('Could not physically delete file from disk!'));
                }
            }
        } else {
            return array('errors' => plog_tr('Picture has invalid path, ignoring delete request'));
        }
    } else {
        return array('errors' => sprintf(plog_tr('There is no picture with id %d'), $del_id));
    }
}
                $value = SmartStripSlashes(htmlspecialchars($value));
                if ($value == '') {
                    $row[$key] = '&nbsp;';
                }
            }
            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']);
            $thumbpath = generate_thumb($picture['path'], $picture['id'], THUMB_SMALL);
            // Generate XHTML with thumbnail and link to picture view.
            $imgtag = '<img src="' . $thumbpath . '" title="' . htmlspecialchars(strip_tags($picture['caption']), ENT_QUOTES) . '" alt="' . htmlspecialchars(strip_tags($picture['caption']), ENT_QUOTES) . '" />';
            $output .= "\n\t\t\t\t" . '<td class="align-center width-150"><div class="img-shadow"><a href="' . generate_thumb($picture['path'], $picture['id'], THUMB_LARGE) . '" rel="lightbox" title="' . htmlspecialchars($picture['caption'], ENT_QUOTES) . '">' . $imgtag . '</a></div></td>';
            // Author / Email / Website
            $output .= "\n\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-' . $row['id'] . '">' . $row['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-' . $row['id'] . '">' . $row['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-' . $row['id'] . '">' . $row['url'] . '</p>
				</td>';
            // Date
            $output .= "\n\t\t\t\t" . '<td class="align-left width-100"><p class="margin-5">' . date($config['date_format'], $row['date']) . '</p></td>';
                            }
                        }
                        if ($num_items > 0) {
                            $text = $num_items == 1 ? plog_tr('entry') : plog_tr('entries');
                            $output .= "\n\t" . '<p class="success">' . sprintf(plog_tr('You have moved %s successfully'), '<strong>' . $num_items . '</strong> ' . $text) . '.</p>' . "\n";
                        }
                    } else {
                        $output .= "\n\t" . '<p class="errors">' . plog_tr('Nothing selected to move') . '!</p>' . "\n";
                    }
                }
            }
            break;
        case 'edit-picture':
            $level = 'picture';
            // Show the edit picture form
            $photo = get_picture_by_id($id);
            if ($photo['allow_comments'] == 1) {
                $state = 'checked="checked"';
            } else {
                $state = '';
            }
            $output .= "\n\t\t" . '<form class="edit width-700" action="' . $_SERVER['PHP_SELF'] . '?level=pictures&amp;id=' . $photo['parent_album'] . '" method="post">';
            $thumbpath = generate_thumb(SmartStripSlashes($photo['path']), $photo['id'], THUMB_SMALL);
            $output .= "\n\t\t\t" . '<div style="float: right;"><img src="' . $thumbpath . '" alt="" /></div>
			<div>
				<div class="strong">' . plog_tr('Edit Image Properties') . '</div>
				<p>
					<label class="strong" accesskey="c" for="caption">' . plog_tr('<em>C</em>aption') . ':</label><br />
					<input size="62" name="caption" id="caption" value="' . htmlspecialchars(SmartStripSlashes($photo['caption'])) . '" />
				</p>
				<p>
예제 #4
0
/**
 * @author derek@plogger.org
 * @return string html list of thumbnails
 */
function plogger_get_thumbnail_nav()
{
    global $config;
    if (empty($config["enable_thumb_nav"])) {
        return '';
    }
    // return if thumbnail nav turned off
    $image_list = $GLOBALS["image_list"];
    $array_length = count($image_list);
    // store array length
    $curr = $GLOBALS["current_picture"];
    $pos_array = array_keys($image_list, $curr["id"]);
    $curr_pos = $pos_array[0];
    $range = isset($config["thumb_nav_range"]) ? $config["thumb_nav_range"] : 0;
    if ($range == 0) {
        // if length is 0, use all thumbs
        // get_picture_by_id modified to take arrays, so pass the whole array
        $thumb_pic_array = get_picture_by_id($image_list);
    } else {
        // else, add a thumb each side of current for each value of $config['thumb_nav_range']
        $thumb_nav_array = array($curr['id']);
        for ($i = 1; $i < $range + 1; $i++) {
            // use unshift() to add to the beginning, push() to add to the end
            // check that we haven't run out of images below: that (current image - offset) >= 0
            if ($curr_pos - $i >= 0) {
                unset($newpic);
                // php has problems with reassigning via iteration
                $newpic = $image_list[$curr_pos - $i];
                if (!empty($newpic)) {
                    array_unshift($thumb_nav_array, $newpic);
                }
            } else {
                // grab from the end of the array
                unset($newpic);
                // php has problems with reassigning via iteration
                $newpic = $image_list[$array_length + ($curr_pos - $i)];
                // adding a negative value, don't fret
                if (!empty($newpic)) {
                    array_unshift($thumb_nav_array, $newpic);
                }
            }
            // check that we haven't run out of images above: (current image + offset) <= (total images)
            if ($array_length - 1 >= $curr_pos + $i) {
                unset($newpic);
                // php has problems with reassigning via iteration
                $newpic = $image_list[$curr_pos + $i];
                if (!empty($newpic)) {
                    array_push($thumb_nav_array, $newpic);
                }
            } else {
                // grab from the beginning of the array
                unset($newpic);
                // php has problems with reassigning via iteration
                $newpic = $image_list[$curr_pos + $i - $array_length];
                if (!empty($newpic)) {
                    array_push($thumb_nav_array, $newpic);
                }
            }
        }
        $thumb_pic_array = array();
        foreach ($thumb_nav_array as $thumb_nav_value) {
            array_push($thumb_pic_array, get_picture_by_id($thumb_nav_value));
        }
    }
    return plogger_format_thumb_nav($thumb_pic_array);
}
예제 #5
0
             break;
         }
         $total++;
     }
     $album["thumb_path"] = "plog-thumb.php?id=" . $album["thumbnail_id"];
     $xml .= '<album';
     foreach ($album as $var => $val) {
         $xml .= ' ' . $var . '="' . htmlspecialchars($val) . '"';
     }
     $xml .= '>';
 }
 if (isset($_GET["pictures"])) {
     $pictures = get_pictures($album["album_id"], "mod", "DESC");
 } else {
     if (isset($_GET["picture_id"])) {
         $pic = get_picture_by_id($_GET["picture_id"], $album["album_id"]);
         if ($pic) {
             $pictures = array($pic);
         } else {
             $pictures = array();
         }
     } else {
         if (isset($_GET["comments"]) || isset($_GET["comment_id"])) {
             $pictures = get_picture_ids($album["album_id"], "mod", "DESC");
         } else {
             $pictures = array();
         }
     }
 }
 foreach ($pictures as $picture) {
     if (isset($_GET["album_id"]) && $_GET["album_id"] == $picture["parent_album"] || !isset($_GET["album_id"])) {
예제 #6
0
        if (preg_match("/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,}\$/i", $email)) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
// Set up our error arrays
$errors = array();
$error_field = array();
// Set up all the necessary variables
$parent_id = intval($_POST['parent']);
$author = $email = $url = $comment = '';
$pic = get_picture_by_id($parent_id);
// Check for a redirect, referrer, or default back to the generic Plogger URL
if (isset($_POST['redirect'])) {
    $redirect = $_POST['redirect'];
} else {
    if (isset($_SERVER['HTTP_REFERRER']) && !empty($_SERVER['HTTP_REFERRER'])) {
        $redirect = $_SERVER['HTTP_REFERRER'];
    } else {
        $redirect = generate_url('picture', $parent_id);
    }
}
if ($config['allow_comments'] && $pic['allow_comments']) {
    if (isset($_POST['plogger-token']) && isset($_SESSION['plogger-token']) && $_POST['plogger-token'] === $_SESSION['plogger-token']) {
        // Verify the author / name
        if (isset($_POST['author']) && $_POST['author'] != '') {
            $author = strip_tags(SmartStripSlashes($_POST['author']));
예제 #7
0
<?php 
require_once "plog-admin.php";
require_once "../plog-load_config.php";
// load configuration variables from database
require_once "../plog-functions.php";
// this script will just show a small preview of the thumbnail in admin view if
// you can't differentiate the small pics.
echo '<html><head>

<body>';
$src = $_REQUEST['src'];
$picture = get_picture_by_id($src);
$id = $picture["id"];
$thumbpath = generate_thumb($picture["path"], $picture["id"], THUMB_LARGE);
$thumbdir = $config["basedir"] . "thumbs/lrg-{$id}-" . basename($picture["path"]);
list($width, $height, $type, $attr) = getimagesize($thumbdir);
// print $thumbdir;
echo '
<script language="JavaScript">
<!--
this.resizeTo(' . $width . '+25,' . $height . '+70);
this.moveTo((screen.width-' . $width . ')/2, (screen.height-' . $height . ')/2);
-->
</script>';
// generate XHTML with thumbnail and link to picture view.
$imgtag = '<img class="photos" src="' . $thumbpath . '" alt="' . $src . '"/>';
$output = $imgtag;
?>

<html>
예제 #8
0
<?php

include "plog-functions.php";
include "plog-globals.php";
include "plog-load_config.php";
$picture = get_picture_by_id($_GET['id']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<body onload="window.print();">
		<img src="<?php 
echo $picture["url"];
?>
" alt="<?php 
echo $picture["caption"];
?>
" />
	</body>
</html>
$plog_lc_comment_trim = '100';
/* The database query to pull the latest comments from the database */
$plog_lc_query = "SELECT * FROM " . PLOGGER_TABLE_PREFIX . "comments WHERE `approved` = 1 ORDER BY `id` DESC LIMIT {$plog_lc_amount}";
$plog_lc_result = mysql_query($plog_lc_query) or die("Could not execute query: {$plog_lc_query}." . mysql_error());
/* Start html output */
if (mysql_num_rows($plog_lc_result) > 0) {
    echo "\n\t" . '<ul class="latest-comments">';
    $config['baseurl'] = $plog_lc_site_url;
    /* The latest comments loop */
    while ($row = mysql_fetch_array($plog_lc_result)) {
        $id = $row['id'];
        $parent_id = $row['parent_id'];
        $author = $row['author'];
        $date = $row['date'];
        $comment_length = intval($plog_lc_comment_trim);
        $comment = $comment_length !== 0 && $comment_length < strlen($row['comment']) ? substr($row['comment'], 0, intval($plog_lc_comment_trim)) . ' ...' : $row['comment'];
        $number = strrpos($path, '/');
        $number = $number + 1;
        $url = substr($path, $number);
        $plog_lc_picture = get_picture_by_id($parent_id);
        $cap_or_name = !empty($plog_lc_picture['caption']) ? stripslashes($plog_lc_picture['caption']) : ucfirst(substr(basename($plog_lc_picture['path']), 0, strrpos(basename($plog_lc_picture['path']), '.')));
        $plog_lc_comment = '<strong>' . $author . '</strong> on <a title="' . addcslashes($cap_or_name, '"') . '" href="' . generate_url('picture', $plog_lc_picture['id']) . '"><strong>' . $cap_or_name . '</strong></a><br />' . $comment;
        /* List the comments */
        echo "\n\t\t" . '<li class="latest-comments">' . $plog_lc_comment . '</li>';
    }
    /* End latest comments loop */
    echo "\n\t" . '</ul>' . "\n";
    /* End html output */
} else {
    echo "\n\t" . '<p>' . plog_tr('No comments yet') . '</p>' . "\n";
}
예제 #10
0
/**
* @author derek@plogger.org
* @return string html list of thumbnails
*/
function plogger_get_thumbnail_nav()
{
    global $config, $thumbnail_config;
    if ($thumbnail_config[THUMB_NAV]['disabled'] == 1) {
        return '';
    }
    // Return if thumbnail nav disabled
    $thumb_pic_array = array();
    $image_list = $GLOBALS['image_list'];
    $array_length = count($image_list);
    // Store array length
    $curr = $GLOBALS['current_picture'];
    $curr_pos = array_search($curr['id'], $image_list);
    $range = isset($config['thumb_nav_range']) ? $config['thumb_nav_range'] : 0;
    // If length is 0, use all thumbs
    if ($range == 0) {
        // get_picture_by_id modified to take arrays, so pass the whole array
        $thumb_nav_array = $image_list;
        // Else, add a thumb each side of current for each value of $config['thumb_nav_range']
    } else {
        $thumb_nav_array = array($curr['id']);
        $count = 1;
        for ($i = 1; $i < $range; $i++) {
            // If we're at or over our range, break the loop
            if ($count >= $range) {
                break;
            }
            // Use unshift() to add to the beginning, push() to add to the end
            // Check that we have images on each side
            if ($curr_pos - $i >= 0) {
                // Add a previous picture
                if (!empty($image_list[$curr_pos - $i])) {
                    array_unshift($thumb_nav_array, $image_list[$curr_pos - $i]);
                }
                $count++;
            }
            if ($array_length - 1 >= $curr_pos + $i) {
                // Add a next picture
                if (!empty($image_list[$curr_pos + $i])) {
                    array_push($thumb_nav_array, $image_list[$curr_pos + $i]);
                }
                $count++;
            }
        }
        // Check our range again and use array_shift to remove a single previous picture
        // Should only be a single digit over in case of odd numbered range
        if (count($thumb_nav_array) > $range) {
            array_shift($thumb_nav_array);
        }
    }
    foreach ($thumb_nav_array as $thumb_nav_value) {
        $thumb_pic_array[] = get_picture_by_id($thumb_nav_value);
    }
    return plogger_format_thumb_nav($thumb_pic_array);
}
예제 #11
0
             $output .= "<td class=\"table-header-middle\">" . $name . "</td>";
         }
     }
     $output .= '<td class="table-header-right">Actions</td></tr>';
 }
 if ($counter % 2 == 0) {
     $table_row_color = "color-1";
 } else {
     $table_row_color = "color-2";
 }
 // 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>";
function plog_edit_comment_form($comment_id)
{
    $output = '';
    $comment_id = intval($comment_id);
    $sql = "SELECT * FROM " . PLOGGER_TABLE_PREFIX . "comments c WHERE c.id = '{$comment_id}'";
    $result = run_query($sql);
    $comment = $result->fetch();
    if (!is_array($comment)) {
        // XXX: return an error message instead
        return false;
    }
    $query = '';
    if (strpos($_SERVER['PHP_SELF'], 'plog-manage') !== false) {
        $query = '?level=comments&amp;id=' . $comment['parent_id'];
    }
    $output .= "\n\t" . '<form class="edit width-700" action="' . $_SERVER['PHP_SELF'] . $query . '" method="post">';
    // Get the thumbnail
    $photo = get_picture_by_id($comment['parent_id']);
    $thumbpath = generate_thumb(SmartStripSlashes($photo['path']), $photo['id'], THUMB_SMALL);
    $output .= "\n\t\t" . '<div style="float: right;"><img src="' . $thumbpath . '" alt="" /></div>
		<div>
			<div class="strong">' . plog_tr('Edit Comment') . '</div>
			<p>
				<label class="strong" accesskey="a" for="author">' . plog_tr('Author') . ':</label><br />
				<input size="65" name="author" id="author" value="' . SmartStripSlashes($comment['author']) . '" />
			</p>
			<p>
				<label class="strong" accesskey="e" for="email">' . plog_tr('Email') . ':</label><br />
				<input size="65" name="email" id="email" value="' . SmartStripSlashes($comment['email']) . '" />
			</p>
			<p>
				<label class="strong" accesskey="u" for="url">' . plog_tr('Website') . ':</label><br />
				<input size="65" name="url" id="url" value="' . SmartStripSlashes($comment['url']) . '" />
			</p>
			<p>
				<label class="strong" accesskey="c" for="comment">' . plog_tr('Comment') . ':</label><br />
				<textarea cols="62" rows="4" name="comment" id="comment">' . SmartStripSlashes($comment['comment']) . '</textarea>
			</p>
			<input type="hidden" name="pid" value="' . $comment['id'] . '" />
			<input type="hidden" name="action" value="update-comment" />
			<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;
}
예제 #13
0
         }
         $total++;
     }
     $album['album_path'] = sanitize_filename($album['collection_name']) . '/' . sanitize_filename($album['album_name']) . '/';
     $album['thumb_path'] = 'plog-thumb.php?id=' . $album['thumbnail_id'];
     $xml .= '<album';
     foreach ($album as $var => $val) {
         $xml .= ' ' . $var . '="' . htmlspecialchars($val) . '"';
     }
     $xml .= '>';
 }
 if (isset($_GET['pictures'])) {
     $pictures = get_pictures($album['album_id'], 'mod', 'DESC');
 } else {
     if (isset($_GET['picture_id'])) {
         $pic = get_picture_by_id($_GET['picture_id'], $album['album_id']);
         if ($pic) {
             $pictures = array($pic);
         } else {
             $pictures = array();
         }
     } else {
         if (isset($_GET['comments']) || isset($_GET['comment_id'])) {
             $pictures = get_picture_ids($album['album_id'], 'mod', 'DESC');
         } else {
             $pictures = array();
         }
     }
 }
 foreach ($pictures as $picture) {
     if (isset($_GET['album_id']) && $_GET['album_id'] == $picture['parent_album'] || !isset($_GET['album_id'])) {
예제 #14
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;
}
예제 #15
0
                     } else {
                         $output .= '<p class="errors">' . $result['errors'] . '</p>';
                     }
                 }
             }
         }
         $output .= "<p class=\"actions\">" . sprintf(plog_tr('You have moved %d entry(s) successfully.'), $num_items) . "</p>";
     } else {
         $output .= "<p class=\"errors\">" . plog_tr('Nothing selected to move!') . "</p>";
     }
 } else {
     if (!empty($_GET["action"])) {
         if ($_GET["action"] == "edit-picture") {
             $level = 'picture';
             // show the edit form
             $photo = get_picture_by_id($_REQUEST["id"]);
             if ($photo['allow_comments'] == 1) {
                 $state = "checked";
             } else {
                 $state = "";
             }
             $output .= '<form class="edit" action="' . $_SERVER["PHP_SELF"] . '?level=pictures&amp;id=' . $photo["parent_album"];
             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 .= '" method="post">';
             $thumbpath = generate_thumb(SmartStripSlashes($photo['path']), $photo['id'], THUMB_SMALL);
             $output .= "<div style='float:right'><img src='{$thumbpath}'/></div>";
예제 #16
0
<?php

/* This file handles the generation of print image page. */
include dirname(__FILE__) . '/plog-load-config.php';
$picture = get_picture_by_id(intval($_GET['id']));
$GLOBALS['plogger_level'] = 'picture';
$GLOBALS['plogger_id'] = intval($_GET['id']);
$GLOBALS['plogger_mode'] = 'print';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="<?php 
echo $language;
?>
" lang="<?php 
echo $language;
?>
" xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<title><?php 
echo get_head_title();
?>
</title>
</head>

<body onload="window.print();">

<div><img src="<?php 
echo $picture['url'];
?>
" alt="<?php