コード例 #1
0
             $notification["release_time"] = $PROCESSED["release_date"];
             $db->AutoExecute("community_notifications", $notification, "UPDATE", "`cnotification_id` = " . $db->qstr($notification["cnotification_id"]));
         }
     }
     if (isset($notifications) && $notify_record_exists) {
         $db->Execute("UPDATE `community_notify_members` SET `notify_active` = '" . ($notifications ? "1" : "0") . "' WHERE `proxy_id` = " . $db->qstr($ENTRADA_USER->getID()) . " AND `record_id` = " . $db->qstr($RECORD_ID) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `notify_type` = 'photo-comment'");
     } elseif (isset($notifications) && !$notify_record_exists) {
         $db->Execute("INSERT INTO `community_notify_members` (`proxy_id`, `record_id`, `community_id`, `notify_type`, `notify_active`) VALUES (" . $db->qstr($ENTRADA_USER->getID()) . ", " . $db->qstr($RECORD_ID) . ", " . $db->qstr($COMMUNITY_ID) . ", 'photo-comment', '" . ($notifications ? "1" : "0") . "')");
     }
 }
 /**
  * Check if the actual file needs to be updated, if it does
  * process it using the communities_galleries_process_photo function.
  */
 if ($update_photo_file) {
     if (!communities_galleries_process_photo($_FILES["photo_file"]["tmp_name"], $RECORD_ID)) {
         $NOTICE++;
         $NOTICESTR[] = "Unable to store the new photo file on the server or generate a valid thumbnail; the MEdTech Unit has been informed of this error, please try again later.";
         application_log("error", "Failed to replace edited photo image. communities_galleries_process_photo failed.");
     }
 }
 /**
  * Check if the main gallery thumbnail image needs to be changed
  * from it's current state.
  */
 if ((bool) $COMMUNITY_ADMIN) {
     if (isset($_POST["gallery_cgphoto_id"]) && (int) trim($_POST["gallery_cgphoto_id"]) === 1 && (int) $photo_record["gallery_cgphoto_id"] != (int) $RECORD_ID) {
         if (!$db->AutoExecute("community_galleries", array("gallery_cgphoto_id" => $RECORD_ID), "UPDATE", "`community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `cpage_id` = " . $db->qstr($PAGE_ID) . " AND `cgallery_id` = " . $db->qstr($photo_record["cgallery_id"]))) {
             $NOTICE++;
             $NOTICESTR[] = "Unable to set this photo as the gallery thumbnail; the MEdTech Unit has been informed of this error, please try again later.";
             application_log("error", "Failed to set this photo as the gallery thumbnail. Database said: " . $db->ErrorMsg());
コード例 #2
0
     $PROCESSED["release_until"] = 0;
 }
 if (!$error_current) {
     $PROCESSED["cgallery_id"] = $RECORD_ID;
     $PROCESSED["community_id"] = $COMMUNITY_ID;
     $PROCESSED["proxy_id"] = $ENTRADA_USER->getActiveId();
     $PROCESSED["photo_active"] = 1;
     $PROCESSED["updated_date"] = time();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     if ($db->AutoExecute("community_gallery_photos", $PROCESSED, "INSERT")) {
         $photo_id = $db->Insert_Id();
         if (COMMUNITY_NOTIFICATIONS_ACTIVE && $_SESSION["details"]["notifications"]) {
             $db->Execute("INSERT INTO `community_notify_members` (`proxy_id`, `record_id`, `community_id`, `notify_type`, `notify_active`) VALUES (" . $db->qstr($ENTRADA_USER->getID()) . ", " . $db->qstr($photo_id) . ", " . $db->qstr($COMMUNITY_ID) . ", 'photo-comment', '" . (isset($notifications) && $notifications ? "1" : "0") . "')");
         }
         if ($photo_id) {
             if (communities_galleries_process_photo($_FILES["photo_files"]["tmp_name"][$tmp_photo_id], $photo_id)) {
                 if (!(int) $gallery_record["gallery_cgphoto_id"]) {
                     if (!$db->AutoExecute("community_galleries", array("gallery_cgphoto_id" => $photo_id), "UPDATE", "`cgallery_id` = " . $db->qstr($RECORD_ID) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) {
                         application_log("error", "Unable to set the gallery_cgphoto_id to this photo_id when adding the first picture. Database said: " . $db->ErrorMsg());
                     }
                 }
                 if (COMMUNITY_NOTIFICATIONS_ACTIVE) {
                     community_notify($COMMUNITY_ID, $photo_id, "photo", COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-photo&id=" . $photo_id, $RECORD_ID, $PROCESSED["release_date"]);
                 }
                 $SUCCESS++;
                 $SUCCESSSTR[] = "Photo " . $photo_number . " has been successfully uploaded [" . $PROCESSED["photo_title"] . "].";
                 add_statistic("community:" . $COMMUNITY_ID . ":galleries", "photo_add", "cgphoto_id", $photo_id);
                 communities_log_history($COMMUNITY_ID, $PAGE_ID, $photo_id, "community_history_add_photo", 1, $RECORD_ID);
             } else {
                 $query = "DELETE FROM `community_gallery_photos` WHERE `cgphoto_id` = " . $db->qstr($photo_id) . " AND `cgallery_id` = " . $db->qstr($RECORD_ID) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID) . " LIMIT 1";
                 if (!$db->Execute($query)) {