*/
             $topic_ids = array();
             $topic_ids[] = $RECORD_ID;
             $query = "SELECT `cdtopic_id` FROM `community_discussion_topics` WHERE `cdtopic_parent` = " . $db->qstr($RECORD_ID) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID);
             $results = $db->GetAll($query);
             if ($results) {
                 foreach ($results as $result) {
                     if ($topic_id = (int) $result["cdtopic_id"]) {
                         $topic_ids[] = $topic_id;
                     }
                 }
             }
             if ($db->AutoExecute("community_discussion_topics", array("topic_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "(`cdtopic_id` = " . $db->qstr($RECORD_ID) . " OR `cdtopic_parent` = " . $db->qstr($RECORD_ID) . ") AND `community_id` = " . $db->qstr($COMMUNITY_ID))) {
                 communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID);
                 add_statistic("community:" . $COMMUNITY_ID . ":discussions", "post_delete", "cdtopic_id", $RECORD_ID);
                 delete_notifications("discussion:discuss_reply:{$RECORD_ID}");
             } else {
                 application_log("error", "Failed to deactivate [" . $RECORD_ID . "] discussion forum from community. Database said: " . $db->ErrorMsg());
             }
         }
     } else {
         application_log("error", "The provided discussion post id [" . $RECORD_ID . "] is already deactivated.");
     }
     if ((int) $topic_record["cdtopic_parent"]) {
         header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-post&id=" . $topic_record["cdtopic_parent"]);
     } else {
         header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-forum&id=" . $topic_record["cdiscussion_id"]);
     }
     exit;
 } else {
     application_log("error", "The provided discussion post id [" . $RECORD_ID . "] was invalid.");
Esempio n. 2
0
    exit;
} elseif (!$COMMUNITY_LOAD) {
    exit;
}
if ($RECORD_ID) {
    /**
     * Check if pv variable is set and see if it's a valid page, other wise page 1 it is.
     */
    if (isset($_GET["pv"])) {
        $PAGE_CURRENT = (int) trim($_GET["pv"]);
    } else {
        $PAGE_CURRENT = 0;
    }
    $query = "\tSELECT * FROM `community_events` \n\t\t\t\t\t\tWHERE `community_id` = " . $db->qstr($COMMUNITY_ID) . " \n\t\t\t\t\t\tAND `cpage_id` = " . $db->qstr($PAGE_ID) . " \n\t\t\t\t\t\tAND `event_active` = '1'\n\t\t\t\t\t\tAND `cevent_id` = " . $db->qstr($RECORD_ID);
    $event_record = $db->GetRow($query);
    if ($event_record) {
        if ($db->AutoExecute("community_events", array("event_active" => 0), "UPDATE", "`community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `cpage_id` = " . $db->qstr($PAGE_ID) . " AND `event_active` = '1' AND `cevent_id` = " . $db->qstr($RECORD_ID))) {
            communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID);
            delete_notifications("event:" . $event_record["cevent_id"]);
            add_statistic("community:" . $COMMUNITY_ID . ":events", "delete", "cevent_id", $RECORD_ID);
        } else {
            application_log("error", "Failed to delete [" . $RECORD_ID . "] event from community. Database said: " . $db->ErrorMsg());
        }
    } else {
        application_log("error", "The provided event record [" . $RECORD_ID . "] was invalid.");
    }
} else {
    application_log("error", "No event record was provided for deletion.");
}
header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . ($PAGE_CURRENT ? "?pv=" . $PAGE_CURRENT : ""));
exit;
 * 
*/
if (!defined("COMMUNITY_INCLUDED") || !defined("IN_SHARES")) {
    exit;
} elseif (!$COMMUNITY_LOAD) {
    exit;
}
if ($RECORD_ID) {
    $query = "\tSELECT * FROM `community_share_comments` as a\n\t\t\t\t\t\tLEFT JOIN `community_shares` as b\n\t\t\t\t\t\tON a.`cshare_id` = b.`cshare_id`\n\t \t\t\t\t\tWHERE a.`cscomment_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 (shares_comment_module_access($RECORD_ID, "delete-comment")) {
                if ($db->AutoExecute("community_share_comments", array("comment_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`cscomment_id` = " . $db->qstr($RECORD_ID) . " AND `csfile_id` = " . $db->qstr($comment_record["csfile_id"]) . " AND `cshare_id` = " . $db->qstr($comment_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) {
                    communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID);
                    delete_notifications("shares:file_comment:{$RECORD_ID}");
                    add_statistic("community:" . $COMMUNITY_ID . ":shares", "comment_delete", "cscomment_id", $RECORD_ID);
                } else {
                    application_log("error", "Failed to deactivate [" . $RECORD_ID . "] file comment from community. Database said: " . $db->ErrorMsg());
                }
            }
        } else {
            application_log("error", "The provided file comment id [" . $RECORD_ID . "] is already deactivated.");
        }
        header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $comment_record["csfile_id"]);
        exit;
    } else {
        application_log("error", "The provided file comment id [" . $RECORD_ID . "] was invalid.");
    }
} else {
    application_log("error", "No file comment id was provided for deactivation.");
} elseif (!$COMMUNITY_LOAD) {
    exit;
}
if ($RECORD_ID) {
    $query = "SELECT * FROM `community_polls` WHERE `cpolls_id` = " . $db->qstr($RECORD_ID) . " AND `cpage_id` = " . $db->qstr($PAGE_ID) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID);
    $poll_record = $db->GetRow($query);
    if ($poll_record) {
        if ((int) $poll_record["poll_active"]) {
            if (polls_module_access($RECORD_ID, "delete-poll")) {
                if ($db->AutoExecute("community_polls", array("poll_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`cpolls_id` = " . $db->qstr($RECORD_ID) . " AND `cpage_id` = " . $db->qstr($PAGE_ID) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) {
                    communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID);
                    add_statistic("community_polling", "poll_delete", "cpolls_id", $RECORD_ID);
                    $db->AutoExecute("community_history", array("history_display" => 0), "UPDATE", "`community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `module_id` = " . $db->qstr($MODULE_ID));
                    if ($poll_record[poll_notifications]) {
                        // Delete pending notifications
                        delete_notifications('polls:' . $poll_record["cpolls_id"]);
                    }
                } else {
                    application_log("error", "Failed to deactivate [" . $RECORD_ID . "] poll from community. Database said: " . $db->ErrorMsg());
                }
            }
        } else {
            application_log("error", "The provided poll id [" . $RECORD_ID . "] is already deactivated.");
        }
        header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL);
        exit;
    } else {
        application_log("error", "The provided poll id [" . $RECORD_ID . "] was invalid.");
    }
} else {
    application_log("error", "No poll id was provided for deactivation.");
Esempio n. 5
0
} elseif (!$COMMUNITY_LOAD) {
    exit;
}
if ($RECORD_ID) {
    /**
     * Check if pv variable is set and see if it's a valid page, other wise page 1 it is.
     */
    if (isset($_GET["pv"])) {
        $PAGE_CURRENT = (int) trim($_GET["pv"]);
    } else {
        $PAGE_CURRENT = 0;
    }
    $query = "\tSELECT * FROM `community_announcements` \n\t\t\t\t\t\t\t\tWHERE `community_id` = " . $db->qstr($COMMUNITY_ID) . " \n\t\t\t\t\t\t\t\tAND `cpage_id` = " . $db->qstr($PAGE_ID) . " \n\t\t\t\t\t\t\t\tAND `announcement_active` = '1'\n\t\t\t\t\t\t\t\tAND `cannouncement_id` = " . $db->qstr($RECORD_ID);
    $announcement_record = $db->GetRow($query);
    if ($announcement_record) {
        $query = "\tUPDATE `community_announcements`\n\t\t\t\t\tSET `announcement_active` = 0\n\t\t\t\t\tWHERE `community_id` = " . $db->qstr($COMMUNITY_ID) . " \n\t\t\t\t\tAND `cpage_id` = " . $db->qstr($PAGE_ID) . " \n\t\t\t\t\tAND `cannouncement_id` = " . $db->qstr($RECORD_ID) . " LIMIT 1";
        if ($db->Execute($query)) {
            communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID);
            add_statistic("community:" . $COMMUNITY_ID . ":announcements", "delete", "cannouncement_id", $RECORD_ID);
            delete_notifications('announcement:' . $announcement_record["cannouncement_id"]);
        } else {
            application_log("error", "Failed to delete [" . $RECORD_ID . "] announcement from community. Database said: " . $db->ErrorMsg());
        }
    } else {
        application_log("error", "The provided announcement record [" . $RECORD_ID . "] was invalid.");
    }
} else {
    application_log("error", "No announcement record was provided for deletion.");
}
header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . ($PAGE_CURRENT ? "?pv=" . $PAGE_CURRENT : ""));
exit;
}
if (isset($_GET["acomment_id"]) && ($tmp_input = clean_input($_GET["acomment_id"], array("nows", "int")))) {
    $ACOMMENT_ID = $tmp_input;
} else {
    $ACOMMENT_ID = 0;
}
$ASSIGNMENT_ID = false;
if ($ACOMMENT_ID) {
    $query = "SELECT a.*, b.`course_id` FROM `assignment_comments` AS a\n\t                    JOIN `assignments` AS b\n\t                    ON a.`assignment_id` = b.`assignment_id`\n\t                    WHERE a.`acomment_id` = " . $db->qstr($ACOMMENT_ID) . "\n\t                    AND a.`proxy_id` = " . $db->qstr($ENTRADA_USER->getID()) . "\n\t                    AND b.`assignment_active` = '1'";
    $comment_record = $db->GetRow($query);
    if ($comment_record) {
        $ASSIGNMENT_ID = $comment_record["assignment_id"];
        if ((int) $comment_record["comment_active"]) {
            if ($comment_record["proxy_id"] === $ENTRADA_USER->getID()) {
                if ($db->AutoExecute("assignment_comments", array("comment_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`acomment_id` = " . $db->qstr($ACOMMENT_ID))) {
                    delete_notifications("assignments:assignment_comment:{$ACOMMENT_ID}");
                    add_statistic("assignment:" . $comment_record["assignment_id"], "comment_delete", "acomment_id", $ACOMMENT_ID);
                } else {
                    application_log("error", "Failed to deactivate [" . $ACOMMENT_ID . "] comment from assignment. Database said: " . $db->ErrorMsg());
                }
            }
        } else {
            application_log("error", "The provided assignment comment id [" . $ACOMMENT_ID . "] is already deactivated.");
        }
        if (isset($_GET["returnto"]) && ($return = clean_input($_GET["returnto"], array("trim", "notags")))) {
            switch ($return) {
                case 'grade':
                    header("Location: " . ENTRADA_URL . "/admin/gradebook/assignments?section=grade&id=" . $comment_record["course_id"] . "&assignment_id=" . $ASSIGNMENT_ID);
                    exit;
            }
        } else {
 * 
*/
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.");
    }
} else {
    application_log("error", "No photo comment id was provided for deactivation.");