* @copyright Copyright 2010 Queen's University. All Rights Reserved.
 * 
*/
if (!defined("COMMUNITY_INCLUDED") || !defined("IN_GALLERIES")) {
    exit;
} elseif (!$COMMUNITY_LOAD) {
    exit;
}
$HEAD[] = "<script type=\"text/javascript\" src=\"" . COMMUNITY_URL . "/javascript/galleries.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>";
echo "<h1>Edit Photo Comment</h1>\n";
if ($RECORD_ID) {
    $query = "\n\t\t\t\t\tSELECT a.*, b.`photo_title`, c.`gallery_title`, c.`admin_notifications`\n\t\t\t\t\tFROM `community_gallery_comments` AS a\n\t\t\t\t\tLEFT JOIN `community_gallery_photos` AS b\n\t\t\t\t\tON a.`cgallery_id` = b.`cgallery_id`\n\t\t\t\t\tLEFT JOIN `community_galleries` AS c\n\t\t\t\t\tON a.`cgallery_id` = c.`cgallery_id`\n\t\t\t\t\tWHERE a.`community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\tAND a.`cgcomment_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\tAND c.`cpage_id` = " . $db->qstr($PAGE_ID) . " \n\t\t\t\t\tAND a.`comment_active` = '1'\n\t\t\t\t\tAND b.`photo_active` = '1'\n\t\t\t\t\tAND c.`gallery_active` = '1'";
    $comment_record = $db->GetRow($query);
    if ($comment_record) {
        if ((int) $comment_record["comment_active"]) {
            if (galleries_comment_module_access($RECORD_ID, "edit-comment")) {
                $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-gallery&id=" . $comment_record["cgallery_id"], "title" => limit_chars($comment_record["gallery_title"], 32));
                $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-photo&id=" . $comment_record["cgphoto_id"], "title" => limit_chars($comment_record["photo_title"], 32));
                $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit-comment&amp;id=" . $RECORD_ID, "title" => "Edit Photo Comment");
                communities_load_rte();
                // Error Checking
                switch ($STEP) {
                    case 2:
                        /**
                         * Required field "title" / Comment Title.
                         */
                        if (isset($_POST["comment_title"]) && ($title = clean_input($_POST["comment_title"], array("notags", "trim")))) {
                            $PROCESSED["comment_title"] = $title;
                        } else {
                            $PROCESSED["comment_title"] = "";
                        }
                            ?>
" style="font-size: 10px"><?php 
                            echo html_encode($result["commenter_fullname"]);
                            ?>
</a></td>
									<td style="border-bottom: none">
										<div style="float: left">
											<span class="content-small"><strong>Commented:</strong> <?php 
                            echo date(DEFAULT_DATE_FORMAT, $result["updated_date"]);
                            ?>
</span>
										</div>
										<div style="float: right">
										<?php 
                            echo galleries_comment_module_access($result["cgcomment_id"], "edit-comment") ? " (<a class=\"action\" href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit-comment&amp;id=" . $result["cgcomment_id"] . "\">edit</a>)" : "";
                            echo galleries_comment_module_access($result["cgcomment_id"], "delete-comment") ? " (<a class=\"action\" href=\"javascript:commentDelete('" . $result["cgcomment_id"] . "')\">delete</a>)" : "";
                            ?>
										</div>
									</td>
								</tr>
								<tr>
									<td colspan="2" class="content">
									<a name="comment-<?php 
                            echo (int) $result["cgcomment_id"];
                            ?>
"></a>
									<?php 
                            echo trim($result["comment_title"]) ? "<div style=\"font-weight: bold\">" . html_encode(trim($result["comment_title"])) . "</div>" : "";
                            echo $result["comment_description"];
                            if ($result["release_date"] != $result["updated_date"]) {
                                echo "<div class=\"content-small\" style=\"margin-top: 15px\">\n";
 * @author Developer: Matt Simpson <*****@*****.**>
 * @author Developer: James Ellis <*****@*****.**>
 * @copyright Copyright 2010 Queen's University. All Rights Reserved.
 * 
*/
if (!defined("COMMUNITY_INCLUDED") || !defined("IN_GALLERIES")) {
    exit;
} elseif (!$COMMUNITY_LOAD) {
    exit;
}
if ($RECORD_ID) {
    $query = "\tSELECT * FROM `community_gallery_comments` as a\n\t\t\t\t\t\tLEFT JOIN `community_galleries` as b\n\t\t\t\t\t\tON a.`cgallery_id` = b.`cgallery_id`\n\t\t\t\t\t\tWHERE a.`cgcomment_id` = " . $db->qstr($RECORD_ID) . " \n\t\t\t\t\t\tAND a.`community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\t\tAND b.`cpage_id` = " . $db->qstr($PAGE_ID);
    $comment_record = $db->GetRow($query);
    if ($comment_record) {
        if ((int) $comment_record["comment_active"]) {
            if (galleries_comment_module_access($RECORD_ID, "delete-comment")) {
                if ($db->AutoExecute("community_gallery_comments", array("comment_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`cgcomment_id` = " . $db->qstr($RECORD_ID) . " AND `cgphoto_id` = " . $db->qstr($comment_record["cgphoto_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) {
                    communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID);
                    delete_notifications("gallery:photo_comment:{$RECORD_ID}");
                    add_statistic("community:" . $COMMUNITY_ID . ":galleries", "comment_delete", "cgcomment_id", $RECORD_ID);
                } else {
                    application_log("error", "Failed to deactivate [" . $RECORD_ID . "] photo comment from community. Database said: " . $db->ErrorMsg());
                }
            }
        } else {
            application_log("error", "The provided photo comment id [" . $RECORD_ID . "] is already deactivated.");
        }
        header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-photo&id=" . $comment_record["cgphoto_id"]);
        exit;
    } else {
        application_log("error", "The provided photo comment id [" . $RECORD_ID . "] was invalid.");