echo "<h1>Edit Photo</h1>\n"; if ($RECORD_ID) { $query = "\n\t\t\t\t\tSELECT a.*, b.`gallery_title`, b.`gallery_cgphoto_id`, b.`admin_notifications`, c.`notify_active`\n\t\t\t\t\tFROM `community_gallery_photos` AS a\n\t\t\t\t\tLEFT JOIN `community_galleries` AS b\n\t\t\t\t\tON a.`cgallery_id` = b.`cgallery_id`\n\t\t\t\t\tLEFT JOIN `community_notify_members` AS c\n\t\t\t\t\tON a.`cgphoto_id` = c.`record_id`\n\t\t\t\t\tAND c.`community_id` = a.`community_id`\n\t\t\t\t\tAND c.`notify_type` = 'photo-comment'\n\t\t\t\t\tAND c.`proxy_id` = " . $db->qstr($ENTRADA_USER->getID()) . "\n\t\t\t\t\tWHERE a.`community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\tAND a.`cgphoto_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\tAND a.`photo_active` = '1'\n\t\t\t\t\tAND b.`cpage_id` = " . $db->qstr($PAGE_ID) . " \n\t\t\t\t\tAND b.`gallery_active` = '1'"; $photo_record = $db->GetRow($query); if ($photo_record) { if (isset($photo_record["notify_active"])) { $notifications = $photo_record["notify_active"] ? true : false; if ($photo_record["notify_active"] != null) { $notify_record_exists = true; } } else { $notifications = false; $notify_record_exists = false; } if ((int) $photo_record["photo_active"]) { if (galleries_photo_module_access($RECORD_ID, "edit-photo")) { $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-gallery&id=" . $photo_record["cgallery_id"], "title" => limit_chars($photo_record["gallery_title"], 32)); $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-photo&id=" . $RECORD_ID, "title" => limit_chars($photo_record["photo_title"], 32)); $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit-photo&id=" . $RECORD_ID, "title" => "Edit Photo"); /** * Whether or not to process an updated photo. */ $update_photo_file = false; // Error Checking switch ($STEP) { case 2: /** * Not-Required (for edit) field "photo_file" / Select Local Photo. */ if (isset($_FILES["photo_file"])) { switch ($_FILES["photo_file"]["error"]) {
* @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 = "\n\t\t\t\t\tSELECT a.*, b.`gallery_cgphoto_id`\n\t\t\t\t\tFROM `community_gallery_photos` AS a\n\t\t\t\t\tLEFT JOIN `community_galleries` AS b\n\t\t\t\t\tON a.`cgallery_id` = b.`cgallery_id`\n\t\t\t\t\tWHERE a.`cgphoto_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\tAND b.`cpage_id` = " . $db->qstr($PAGE_ID) . " \n\t\t\t\t\tAND a.`community_id` = " . $db->qstr($COMMUNITY_ID); $photo_record = $db->GetRow($query); if ($photo_record) { if ((int) $photo_record["photo_active"]) { if (galleries_photo_module_access($RECORD_ID, "delete-photo")) { if ($db->AutoExecute("community_gallery_photos", array("photo_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`cgphoto_id` = " . $db->qstr($RECORD_ID) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) { if ($photo_record["gallery_cgphoto_id"] == $RECORD_ID) { if (!$db->AutoExecute("community_galleries", array("gallery_cgphoto_id" => 0), "UPDATE", "`cgallery_id` = " . $db->qstr($photo_record["cgallery_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `cpage_id` = " . $db->qstr($PAGE_ID) . " AND `gallery_cgphoto_id` = " . $db->qstr($RECORD_ID))) { application_log("error", "Failed to remove the gallery hilite image [" . $RECORD_ID . "] photo from community [" . $COMMUNITY_ID . "]. Database said: " . $db->ErrorMsg()); } } add_statistic("community:" . $COMMUNITY_ID . ":galleries", "photo_delete", "cgphoto_id", $RECORD_ID); communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID); } else { application_log("error", "Failed to deactivate [" . $RECORD_ID . "] photo from community. Database said: " . $db->ErrorMsg()); } } } else { application_log("error", "The provided photo id [" . $RECORD_ID . "] is already deactivated."); }
<?php foreach ($results as $progress => $result) { $column++; $accessible = true; if ($result["release_date"] && $result["release_date"] > time() || $result["release_until"] && $result["release_until"] < time()) { $accessible = false; } echo "<td" . (!$accessible ? " class=\"na\"" : "") . " style=\"vertical-align: top; text-align: center\">"; echo "\t<a href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-photo&id=" . $result["cgphoto_id"] . "\">" . communities_galleries_fetch_thumbnail($result["cgphoto_id"]) . "</a>"; echo "\t<div class=\"content-small\">\n"; echo "\t<strong id=\"photo-" . $result["cgphoto_id"] . "-title\">" . html_encode(limit_chars($result["photo_title"], 26)) . "</strong>"; echo "\t<br />"; echo galleries_photo_module_access($result["cgphoto_id"], "edit-photo") ? " (<a class=\"action\" href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit-photo&id=" . $result["cgphoto_id"] . "\">edit</a>)" : ""; echo galleries_photo_module_access($result["cgphoto_id"], "delete-photo") ? " (<a class=\"action\" href=\"javascript:photoDelete('" . $result["cgphoto_id"] . "')\">delete</a>)" : ""; if ($community_galleries_select != "") { echo galleries_photo_module_access($result["cgphoto_id"], "move-photo") ? " (<a class=\"action\" href=\"javascript:photoMove('" . $result["cgphoto_id"] . "')\">move</a>)" : ""; } echo "\t</div>"; echo "</td>"; if ($progress + 1 == $total_photos && $column != 3) { echo "<td colspan=\"" . (3 - $column) . "\"> </td>\n"; } elseif ($column == 3) { $column = 0; echo "</tr>\n"; echo "<tr>\n"; } } ?> </tr> </tbody> </table>
echo html_encode($photo_record["uploader_fullname"]); ?> </a></td> <td> <div style="float: left"> <span class="content-small"><strong>Uploaded:</strong> <?php echo date(DEFAULT_DATE_FORMAT, $photo_record["updated_date"]); ?> </span> </div> <div style="float: right"> <?php echo galleries_photo_module_access($RECORD_ID, "edit-photo") ? " (<a class=\"action\" href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit-photo&id=" . $RECORD_ID . "\">edit</a>)" : ""; echo galleries_photo_module_access($RECORD_ID, "delete-photo") ? " (<a class=\"action\" href=\"javascript:photoDelete('" . $RECORD_ID . "')\">delete</a>)" : ""; if ($community_galleries_select != "") { echo galleries_photo_module_access($RECORD_ID, "move-photo") ? " (<a class=\"action\" href=\"javascript:photoMove('" . $RECORD_ID . "')\">move</a>)" : ""; } ?> </div> </td> </tr> </tbody> </table> <?php $query = "\tSELECT a.*, CONCAT_WS(' ', b.`firstname`, b.`lastname`) AS `commenter_fullname`, b.`username` AS `commenter_username`\n\t\t\t\t\t\t\t\t\t\tFROM `community_gallery_comments` AS a\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_data` AS b\n\t\t\t\t\t\t\t\t\t\tON a.`proxy_id` = b.`id`\n\t\t\t\t\t\t\t\t\t\tWHERE a.`proxy_id` = b.`id`\n\t\t\t\t\t\t\t\t\t\tAND a.`cgphoto_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\t\t\t\t\t\tAND a.`cgallery_id` = " . $db->qstr($photo_record["cgallery_id"]) . "\n\t\t\t\t\t\t\t\t\t\tAND a.`community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\t\t\t\t\t\tAND a.`comment_active` = '1'\n\t\t\t\t\t\t\t\t\t\tORDER BY a.`release_date` ASC"; $results = $db->GetAll($query); $comments = 0; if ($results) { if ($ADD_COMMENT) { ?>