}
                ?>
						</tr>
					</tbody>
					</table>
					<?php 
            } else {
                $NOTICE++;
                $NOTICESTR[] = "<strong>No photos in this gallery.</strong><br /><br />" . (galleries_module_access($RECORD_ID, "add-photo") ? "If you would like to upload a new photo, <a href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=add-photo&id=" . $RECORD_ID . "\">click here</a>." : "Please check back later.");
                echo display_notice();
            }
            ?>
			</div>
			<?php 
            if ($LOGGED_IN) {
                add_statistic("community:" . $COMMUNITY_ID . ":galleries", "gallery_view", "cgallery_id", $RECORD_ID);
            }
        } else {
            if ($ERROR) {
                echo display_error();
            }
            if ($NOTICE) {
                echo display_notice();
            }
        }
    } else {
        application_log("error", "The provided photo gallery id was invalid [" . $RECORD_ID . "] (View Gallery).");
        header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL);
        exit;
    }
} else {
      * Email Notificaions.
      */
     if (isset($_POST["member_notify"])) {
         $PROCESSED["notify"] = $_POST["member_notify"];
     } else {
         $PROCESSED["notify"] = 0;
     }
     if (!$ERROR) {
         $PROCESSED["updated_date"] = time();
         $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
         if ($db->AutoExecute("community_share_comments", $PROCESSED, "UPDATE", "`cscomment_id` = " . $db->qstr($RECORD_ID) . " AND `csfile_id` = " . $db->qstr($comment_record["csfile_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) {
             $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $comment_record["csfile_id"] . "#comment-" . $RECORD_ID;
             $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
             $SUCCESS++;
             $SUCCESSSTR[] = "You have successfully edited your file comment.<br /><br />You will now be redirected back to this file; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
             add_statistic("community:" . $COMMUNITY_ID . ":shares", "comment_edit", "cscomment_id", $RECORD_ID);
             communities_log_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID, "community_history_edit_file_comment", 0, $comment_record["csfile_id"]);
         }
         if (!$SUCCESS) {
             $ERROR++;
             $ERRORSTR[] = "There was a problem editing this file comment. The MEdTech Unit was informed of this error; please try again later.";
             application_log("error", "There was an error editing a file comment. Database said: " . $db->ErrorMsg());
         }
     }
     if ($ERROR) {
         $STEP = 1;
     }
     break;
 case 1:
 default:
     $PROCESSED = $comment_record;
                         $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());
                     }
                 } elseif ((int) $photo_record["gallery_cgphoto_id"] == (int) $RECORD_ID && (!isset($_POST["gallery_cgphoto_id"]) || (int) trim($_POST["gallery_cgphoto_id"]) != 1)) {
                     if (!$db->AutoExecute("community_galleries", array("gallery_cgphoto_id" => 0), "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 unset this photo as the gallery thumbnail; the MEdTech Unit has been informed of this error, please try again later.";
                         application_log("error", "Failed to unset this photo as the gallery thumbnail. Database said: " . $db->ErrorMsg());
                     }
                 }
             }
             $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-photo&id=" . $RECORD_ID;
             $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
             $SUCCESS++;
             $SUCCESSSTR[] = "You have successfully updated this photo.<br /><br />You will now be redirected to this image; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
             add_statistic("community:" . $COMMUNITY_ID . ":galleries", "photo_edit", "cgphoto_id", $RECORD_ID);
             communities_log_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID, "community_history_edit_photo", 1, $photo_record["cgallery_id"]);
         } else {
             $ERROR++;
             $ERRORSTR[] = "Unable to update this photo at this time; the MEdTech Unit has been informed of this error, please try again later.";
             application_log("error", "Failed to update a photo. Database said: " . $db->ErrorMsg());
         }
     }
     if ($ERROR) {
         $STEP = 1;
     }
     break;
 case 1:
 default:
     $PROCESSED = $photo_record;
     break;
         $ERRORSTR[] = "The <strong>Release Start</strong> field is required.";
     }
     if (isset($release_dates["finish"]) && (int) $release_dates["finish"]) {
         $PROCESSED["release_until"] = (int) $release_dates["finish"];
     } else {
         $PROCESSED["release_until"] = 0;
     }
     if (!$ERROR) {
         $PROCESSED["updated_date"] = time();
         $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
         if ($db->AutoExecute("community_shares", $PROCESSED, "UPDATE", "`community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `cpage_id` = " . $db->qstr($PAGE_ID) . " AND `cshare_id` = " . $db->qstr($RECORD_ID))) {
             $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL;
             $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
             $SUCCESS++;
             $SUCCESSSTR[] = "You have successfully updated the <strong>" . html_encode($PROCESSED["folder_title"]) . "</strong> shared folder.<br /><br />You will now be redirected to the index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
             add_statistic("community:" . $COMMUNITY_ID . ":shares", "folder_edit", "cshare_id", $RECORD_ID);
             communities_log_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID, "community_history_edit_share", 1);
         }
         if (!$SUCCESS) {
             $ERROR++;
             $ERRORSTR[] = "There was a problem updating this shared folder in the system. The MEdTech Unit was informed of this error; please try again later.";
             application_log("error", "There was an error updating a shared folder. Database said: " . $db->ErrorMsg());
         }
     }
     if ($ERROR) {
         $STEP = 1;
     }
     break;
 case 1:
 default:
     $PROCESSED = $folder_record;
Beispiel #5
0
 * along with Entrada.  If not, see <http://www.gnu.org/licenses/>.
 *
 * This file displays the edit restricted day interface.
 * 
 * @author Organisation: Queen's University
 * @author Unit: School of Medicine
 * @author Developer: James Ellis <*****@*****.**>
 * @copyright Copyright 2013 Queen's University. All Rights Reserved.
 *
*/
if (!defined("PARENT_INCLUDED") || !defined("IN_CONFIGURATION")) {
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    header("Location: " . ENTRADA_URL);
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed('configuration', 'read')) {
    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)";
    $ERROR++;
    $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
    echo display_error();
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
    if (isset($_GET["day_id"]) && ($tmp_input = clean_input($_GET["day_id"], "numeric"))) {
        $day_id = $tmp_input;
    }
    add_statistic("restricted_day", "edit", "orday_id", $day_id, $ENTRADA_USER->getID());
    $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "&section=edit&day_id=" . $day_id, "title" => "Edit Restricted Day");
    echo "<h1>Edit Restricted Day</h1>";
    define("EDIT_RESTRICTED_DAY", true);
    require_once "form.inc.php";
}
         $PROCESSED["cdiscussion_id"] = $RECORD_ID;
         $PROCESSED["community_id"] = $COMMUNITY_ID;
         $PROCESSED["proxy_id"] = $ENTRADA_USER->getActiveId();
         $PROCESSED["topic_active"] = 1;
         $PROCESSED["updated_date"] = time();
         $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
         if ($db->AutoExecute("community_discussion_topics", $PROCESSED, "INSERT")) {
             if ($TOPIC_ID = $db->Insert_Id()) {
                 if (isset($notifications) && 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($PROCESSED["proxy_id"]) . ", " . $db->qstr($TOPIC_ID) . ", " . $db->qstr($COMMUNITY_ID) . ", 'reply', '" . ($notifications ? "1" : "0") . "')");
                 }
                 $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-post&id=" . $TOPIC_ID;
                 $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
                 $SUCCESS++;
                 $SUCCESSSTR[] = "You have successfully created a new discussion post.<br /><br />You will now be redirected to this thread; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
                 add_statistic("community:" . $COMMUNITY_ID . ":discussions", "post_add", "cdtopic_id", $TOPIC_ID);
                 communities_log_history($COMMUNITY_ID, $PAGE_ID, $TOPIC_ID, "community_history_add_post", 1, $RECORD_ID);
             }
         }
         if (!$SUCCESS) {
             $ERROR++;
             $ERRORSTR[] = "There was a problem inserting this discussion post into the system. The MEdTech Unit was informed of this error; please try again later.";
             application_log("error", "There was an error inserting a discussion forum post. Database said: " . $db->ErrorMsg());
         }
     }
     if ($ERROR) {
         $STEP = 1;
     }
     break;
 case 1:
 default:
                         header("Expires: 0");
                         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                         header("Content-Type: application/force-download");
                         header("Content-Type: application/octet-stream");
                         header("Content-Type: " . $result["file_type"] . "");
                         header("Content-Disposition: attachment; filename=\"" . $result["file_name"] . "\"");
                         header("Content-Length: " . $filesize);
                         header("Content-Transfer-Encoding: binary");
                         break;
                 }
                 while (!feof($fc)) {
                     echo fread($fc, 10240);
                 }
                 fclose($fc);
                 $db->Execute("UPDATE `course_files` SET `accesses` = '" . ($accesses + 1) . "' WHERE `id` = " . $db->qstr($FILE_ID));
                 add_statistic("courses", "file_download", "file_id", $FILE_ID);
                 exit;
             } else {
                 $TITLE = "Not Found: " . html_encode($result["file_name"]);
                 $BODY = display_notice(array("The file that you are trying to download (<strong>" . html_encode($result["file_name"]) . "</strong>) does not exist in the filesystem.<br /><br />Please contact a system administrator or the course directory listed on the <a href=\"" . ENTRADA_URL . "/courses?id=" . $result["course_id"] . "\" style=\"font-weight: bold\">course website</a>."));
                 $template_html = fetch_template("global/external");
                 if ($template_html) {
                     echo str_replace(array("%DEFAULT_CHARSET%", "%ENTRADA_URL%", "%TITLE%", "%BODY%"), array(DEFAULT_CHARSET, ENTRADA_URL, $TITLE, $BODY), $template_html);
                 }
                 exit;
             }
         }
     }
 } else {
     $TITLE = "Not Authorized";
     $BODY = display_notice(array("The file that you are trying to access is only accessible by authorized users."));
                     $MEMBERS["proxy_id"] = $memberValue;
                     if ($db->AutoExecute("community_polls_access", $MEMBERS, "INSERT")) {
                         $SUCCESS = TRUE;
                     }
                 }
                 if (!$SUCCESS) {
                     $ERROR++;
                     $ERRORSTR[] = "There was a problem inserting the specific member permissions for this " . $terminology . " into the system. The MEdTech Unit was informed of this error; please try again later.";
                     application_log("error", "There was an error inserting the specific member permissions to a poll (ID: " . $RECORD_ID . "). Database said: " . $db->ErrorMsg());
                 }
             }
             $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL;
             $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
             $SUCCESS++;
             $SUCCESSSTR[] = "You have successfully updated a " . $terminology . " to the community.<br /><br />You will now be redirected to the index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
             add_statistic("community_polling", "poll_edit", "cpolls_id", $RECORD_ID);
             communities_log_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID, "community_history_edit_poll", 0);
         }
         if (!$SUCCESS) {
             $ERROR++;
             $ERRORSTR[] = "There was a problem editing this " . $terminology . " in the system. The MEdTech Unit was informed of this error; please try again later.";
             application_log("error", "There was an error editing a poll. Database said: " . $db->ErrorMsg());
         }
     }
     if ($ERROR) {
         $STEP = 1;
     }
     break;
 case 1:
 default:
     $PROCESSED = $poll_record;
      */
     if (isset($_POST["member_notify"])) {
         $PROCESSED["notify"] = $_POST["member_notify"];
     } else {
         $PROCESSED["notify"] = 0;
     }
     if (!$ERROR) {
         $PROCESSED["updated_date"] = time();
         $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
         if ($db->AutoExecute("assignment_comments", $PROCESSED, "UPDATE", "`acomment_id` = " . $db->qstr($RECORD_ID) . " AND `assignment_id` = " . $db->qstr($ASSIGNMENT_ID))) {
             //$url			= ENTRADA_URL."/profile/gradebook/assignments?section=view&assignment_id=".$ASSIGNMENT_ID.(isset($assignment_contact) && $assignment_contact?"&amp;pid=".$comment_record["file_owner"]:"")."#comment-".$RECORD_ID;
             $url = ENTRADA_URL . "/profile/gradebook/assignments?section=view&assignment_id=" . $ASSIGNMENT_ID . (isset($assignment_contact) && $assignment_contact ? "&pid=" . $comment_record["file_owner"] : "") . "#comment-" . $RECORD_ID;
             $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
             $SUCCESS++;
             $SUCCESSSTR[] = "You have successfully edited your file comment.<br /><br />You will now be redirected back to this file; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
             add_statistic("assignment:" . $ASSIGNMENT_ID, "comment_edit", "acomment_id", $RECORD_ID);
         }
         if (!$SUCCESS) {
             $ERROR++;
             $ERRORSTR[] = "There was a problem editing this file comment. The MEdTech Unit was informed of this error; please try again later.";
             application_log("error", "There was an error editing a file comment. Database said: " . $db->ErrorMsg());
         }
     }
     if ($ERROR) {
         $STEP = 1;
     }
     break;
 case 1:
 default:
     $PROCESSED = $comment_record;
     break;
    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;
 $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
 if ($db->AutoExecute("assignment_files", $PROCESSED, "INSERT")) {
     if ($FILE_ID = $db->Insert_Id()) {
         $PROCESSED["afile_id"] = $FILE_ID;
         if ($db->AutoExecute("assignment_file_versions", $PROCESSED, "INSERT")) {
             if ($VERSION_ID = $db->Insert_Id()) {
                 if (assignments_process_file($_FILES["uploaded_file"]["tmp_name"], $VERSION_ID)) {
                     $url = ENTRADA_URL . "/profile/gradebook/assignments?section=view&assignment_id=" . $RECORD_ID;
                     $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
                     $SUCCESS++;
                     if (!DEMO_MODE) {
                         $SUCCESSSTR[] = "You have successfully uploaded " . html_encode($PROCESSED["file_filename"]) . " (version 1).<br /><br />You will now be redirected to this files page; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
                     } else {
                         $SUCCESSSTR[] = "Entrada is in demo mode therefore the Entrada demo assignment file was used for this import instead of the file you attempted to upload.<br /><br />You will now be redirected to this files page; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
                     }
                     add_statistic("assignment:" . $RECORD_ID, "file_add", "afile_id", $FILE_ID);
                 }
             }
         }
     }
 }
 if (!$SUCCESS) {
     /**
      * Because there was no success, check if the file_id was set... if it
      * was we need to delete the database record :( In the future this will
      * be handled with transactions like it's supposed to be.
      */
     if ($FILE_ID) {
         $query = "DELETE FROM `assignment_files` WHERE `afile_id` = " . $db->qstr($FILE_ID) . " AND `assignment_id` = " . $db->qstr($RECORD_ID) . " AND LIMIT 1";
         @$db->Execute($query);
         /**
Beispiel #12
0
         if (!$ERROR) {
             $PROCESSED["proxy_id"] = $ENTRADA_USER->getID();
             $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
             $PROCESSED["updated_date"] = time();
             if (defined("EDIT_ENTRY") && EDIT_ENTRY) {
                 if ($entry->fromArray($PROCESSED)->update()) {
                     add_success("The entry has successfully been updated. You will be redirected to the logbook index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/logbook\">click here</a> if you do not wish to wait.");
                     add_statistic("encounter_tracking", "update", "lentry_id", $PROCESSED["lentry_id"], $ENTRADA_USER->getID());
                 } else {
                     add_error("An error occurred when attempting to update a logbook entry [" . $PROCESSED["lentry_id"] . "], an administrator has been informed, please try again later.");
                     application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
                 }
             } else {
                 if ($entry->fromArray($PROCESSED)->insert()) {
                     add_success("The entry has successfully been updated. You will be redirected to the logbook index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/logbook\">click here</a> if you do not wish to wait.");
                     add_statistic("encounter_tracking", "insert", "lentry_id", $db->Insert_ID(), $ENTRADA_USER->getID());
                 } else {
                     add_error("An error occurred when attempting to create a new logbook entry, an administrator has been informed, please try again later.");
                     application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
                 }
             }
         } else {
             $entry = new Models_Logbook_Entry();
             $entry->fromArray($PROCESSED);
             $STEP = 1;
         }
         break;
     default:
         break;
 }
 switch ($STEP) {
	<?php 
    $query = "\tSELECT a.*, b.`course_name`, b.`course_code`, b.`organisation_id`\n\t\t\t\tFROM `events` AS a\n\t\t\t\tLEFT JOIN `courses` AS b\n\t\t\t\tON b.`course_id` = a.`course_id`\n\t\t\t\tWHERE a.`event_id` = " . $db->qstr($event_id);
    $event_info = $db->GetRow($query);
    if ($event_info) {
        $LASTUPDATED = $event_info["updated_date"];
        if ($event_info["release_date"] && $event_info["release_date"] > time()) {
            $ERROR++;
            $ERRORSTR[] = "The event you are trying to view is not yet available. Please try again after " . date("r", $event_info["release_date"]);
            echo display_error();
        } elseif ($event_info["release_until"] && $event_info["release_until"] < time()) {
            $ERROR++;
            $ERRORSTR[] = "The event you are trying to view is no longer available; it expired " . date("r", $event_info["release_until"]);
            echo display_error($errorstr);
        } else {
            if ($ENTRADA_ACL->amIAllowed(new EventResource($event_id, $event_info["course_id"], $event_info["organisation_id"]), "read")) {
                add_statistic("events", "view", "event_id", $event_id);
                $event_resources = events_fetch_event_resources($event_id, "all");
                $event_files = is_array($event_resources["files"]) ? count($event_resources["files"]) : 0;
                $event_links = is_array($event_resources["links"]) ? count($event_resources["links"]) : 0;
                $event_quizzes = is_array($event_resources["quizzes"]) ? count($event_resources["quizzes"]) : 0;
                $event_discussions = is_array($event_resources["discussions"]) ? count($event_resources["discussions"]) : 0;
                ?>
				<div id="eventToolTip">
					<div class="colLeft">
						<table style="width: 100%" cellspacing="1" cellpadding="1" border="0">
						<tr>
							<td colspan="2" style="padding-bottom: 5px"><a href="<?php 
                echo ENTRADA_URL;
                ?>
/courses?id=<?php 
                echo $event_info["course_id"];
                     case 0:
                     default:
                         header("Pragma: public");
                         header("Expires: 0");
                         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                         header("Content-Type: application/force-download");
                         header("Content-Type: application/octet-stream");
                         header("Content-Type: " . $result["file_type"] . "");
                         header("Content-Disposition: attachment; filename=\"" . $result["file_name"] . "\"");
                         header("Content-Length: " . @filesize(FILE_STORAGE_PATH . "/" . $EFILE_ID));
                         header("Content-Transfer-Encoding: binary");
                         break;
                 }
                 echo file_get_contents(FILE_STORAGE_PATH . "/" . $EFILE_ID, FILE_BINARY);
                 $db->Execute("UPDATE `event_files` SET `accesses` = '" . ($accesses + 1) . "' WHERE `efile_id` = " . $db->qstr($EFILE_ID));
                 add_statistic("events", "file_download", "file_id", $EFILE_ID);
                 exit;
             } else {
                 $TITLE = "Not Found: " . html_encode($result["file_name"]);
                 $BODY = display_notice(array("The file that you are trying to download (<strong>" . html_encode($result["file_name"]) . "</strong>) does not exist in the filesystem.<br /><br />Please contact a system administrator or a teacher listed on the <a href=\"" . ENTRADA_URL . "/events?id=" . $result["event_id"] . "\" style=\"font-weight: bold\">event page</a>."));
                 $template_html = fetch_template("global/external");
                 if ($template_html) {
                     echo str_replace(array("%DEFAULT_CHARSET%", "%ENTRADA_URL%", "%TITLE%", "%BODY%"), array(DEFAULT_CHARSET, ENTRADA_URL, $TITLE, $BODY), $template_html);
                 }
                 exit;
             }
         }
     }
 } else {
     $TITLE = "Not Authorized";
     $BODY = display_notice(array("The file that you are trying to access is only accessible by authorized users."));
Beispiel #15
0
 * along with Entrada.  If not, see <http://www.gnu.org/licenses/>.
 *
 * This file displays the edit entry interface.
 * 
 * @author Organisation: Queen's University
 * @author Unit: School of Medicine
 * @author Developer: James Ellis <*****@*****.**>
 * @copyright Copyright 2013 Queen's University. All Rights Reserved.
 *
*/
if (!defined("PARENT_INCLUDED") || !defined("IN_ENCOUNTER_TRACKING")) {
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    header("Location: " . ENTRADA_URL);
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed('encounter_tracking', 'read')) {
    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)";
    $ERROR++;
    $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
    echo display_error();
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
    if (isset($_GET["entry_id"]) && ($tmp_input = clean_input($_GET["entry_id"], "numeric"))) {
        $entry_id = $tmp_input;
    }
    add_statistic("encounter_tracking", "edit", "lentry_id", $entry_id, $ENTRADA_USER->getID());
    $BREADCRUMB[] = array("url" => ENTRADA_URL . "/logbook?section=edit&entry_id=" . $entry_id, "title" => "Edit Encounter");
    echo "<h1>Edit Encounter</h1>";
    define("EDIT_ENTRY", true);
    require_once "form.inc.php";
}
 * @copyright Copyright 2012 Queen's University. All Rights Reserved.
 * 
*/
if (!defined("COMMUNITY_INCLUDED") || !defined("IN_SHARES")) {
    exit;
} elseif (!$COMMUNITY_LOAD) {
    exit;
}
if ($RECORD_ID) {
    $query = "\n\t\t\t\t\tSELECT a.*, b.`file_title`, b.`file_active` AS `parent_file_active`\n\t\t\t\t\tFROM `community_share_file_versions` AS a\n\t\t\t\t\tLEFT JOIN `community_share_files` AS b\n\t\t\t\t\tON a.`csfile_id` = b.`csfile_id`\n\t\t\t\t\tLEFT JOIN `community_shares` AS c\n\t\t\t\t\tON a.`cshare_id` = c.`cshare_id`\n\t\t\t\t\tWHERE a.`csfversion_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.`community_id` = " . $db->qstr($COMMUNITY_ID);
    $file_record = $db->GetRow($query);
    if ($file_record) {
        if ((int) $file_record["file_active"] && (int) $file_record["parent_file_active"]) {
            if (shares_file_module_access($file_record["csfile_id"], "delete-revision")) {
                if ($db->AutoExecute("community_share_file_versions", array("file_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`csfversion_id` = " . $db->qstr($RECORD_ID) . " AND `csfile_id` = " . $db->qstr($file_record["csfile_id"]) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) {
                    add_statistic("community:" . $COMMUNITY_ID . ":shares", "revision_delete", "csfversion_id", $RECORD_ID);
                    communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID);
                } else {
                    application_log("error", "Failed to deactivate [" . $RECORD_ID . "] file version from community. Database said: " . $db->ErrorMsg());
                }
            }
        } else {
            application_log("error", "The provided file revision id [" . $RECORD_ID . "] is already deactivated.");
        }
        header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $file_record["csfile_id"]);
        exit;
    } else {
        application_log("error", "The provided file revision id [" . $RECORD_ID . "] was invalid.");
    }
} else {
    application_log("error", "No file revision id was provided for deactivation.");
Beispiel #17
0
         }
     }
 }
 if (isset($PROCESSED["course_report_ids"]) && count($PROCESSED["course_report_ids"]) > 0) {
     //remove existing course_reports for this course before adding the new set of course reports.
     $query = "DELETE FROM `course_reports` WHERE `course_id` = " . $db->qstr($COURSE_ID);
     if (!$db->Execute($query)) {
         add_error("An error occurred while editing course reports.  The system administrator was informed of this error; please try again later.");
         application_log("error", "Error inserting course reports for course id: " . $COURSE_ID);
     }
     if (!has_error()) {
         foreach ($PROCESSED["course_report_ids"] as $index => $course_report_id) {
             $PROCESSED["course_report_id"] = $course_report_id;
             $PROCESSED["course_id"] = $COURSE_ID;
             if ($db->AutoExecute("course_reports", $PROCESSED, "INSERT")) {
                 add_statistic("Course Edit", "edit", "course_reports.course_report_id", $PROCESSED["course_report_id"], $ENTRADA_USER->getID());
             } else {
                 add_error("An error occurred while editing course reports.  The system administrator was informed of this error; please try again later.");
                 application_log("error", "Error inserting course reports for course id: " . $COURSE_ID);
             }
         }
     }
 } else {
     //No course reports for this course.
     $query = "DELETE FROM `course_reports` WHERE `course_id` = " . $db->qstr($COURSE_ID);
     $db->Execute($query);
 }
 $query = "\tDELETE FROM `course_audience` WHERE `course_id` = " . $db->qstr($COURSE_ID) . (isset($period_list) ? " AND `cperiod_id` NOT IN (" . implode(",", $period_list) . ")" : "");
 $db->Execute($query);
 if (isset($PROCESSED["periods"]) && is_array($PROCESSED["periods"]) && $PROCESSED["periods"]) {
     foreach ($PROCESSED["periods"] as $period_id => $period) {
                } else {
                    $description .= "<li>To Be Announced</li>";
                }
                $description .= "</ol><br /><br />";
                $description .= "Cohort: " . html_encode(groups_get_name($result["event_cohort"])) . "<br />";
                $description .= "Phase: " . strtoupper($result["event_phase"]) . "<br />";
                $description .= "Event Date/Time: " . date(DEFAULT_DATE_FORMAT, $result["event_start"]) . "<br />";
                $description .= "Event Duration: " . ($result["event_duration"] ? $result["event_duration"] . " minutes" : "Not provided") . "<br />";
                $description .= "Event Location: " . ($result["event_location"] ? $result["event_location"] : "Not provided") . "<br />";
                $description .= "<br />Podcast Description / Details:<br />";
                $description .= html_encode($result["event_message"]);
                $item = new FeedItem();
                $item->title = $result["event_title"] . ": " . $result["file_title"];
                $item->link = ENTRADA_URL . "/events?id=" . $result["event_id"];
                $item->date = date("r", $result["event_start"]);
                $item->description = $description;
                $item->descriptionHtmlSyndicated = true;
                $item->podcast = new PodcastItem();
                $item->podcast->block = "yes";
                $item->podcast->author = $primary_contact["fullname"];
                $item->podcast->duration = $result["event_duration"] * 60;
                $item->podcast->enclosure_url = ENTRADA_URL . "/podcasts/download/" . $result["efile_id"] . "/" . $result["file_name"];
                $item->podcast->enclosure_length = $result["file_size"];
                $item->podcast->enclosure_type = $result["file_type"];
                $rss->addItem($item);
            }
        }
        echo $rss->createFeed("PODCAST");
        add_statistic("podcasts", "view", "proxy_id", $USER_PROXY_ID, $USER_PROXY_ID);
        break;
}
                     if ($notification) {
                         $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 && COMMUNITY_NOTIFICATIONS_ACTIVE && $_SESSION["details"]["notifications"] && COMMUNITY_NOTIFICATIONS_ACTIVE) {
                     $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($topic_record["cdtopic_parent"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `notify_type` = 'reply'");
                 } elseif (isset($notifications) && !$notify_record_exists && 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($topic_record["cdtopic_parent"]) . ", " . $db->qstr($COMMUNITY_ID) . ", 'reply', '" . ($notifications ? "1" : "0") . "')");
                 }
             }
             $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-post&id=" . $topic_record["cdtopic_parent"] . "#post-" . $RECORD_ID;
             $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
             $SUCCESS++;
             $SUCCESSSTR[] = "You have successfully updated your discussion post reply.<br /><br />You will now be redirected to this thread; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
             add_statistic("community:" . $COMMUNITY_ID . ":discussions", "post_edit", "cdtopic_id", $RECORD_ID);
             communities_log_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID, "community_history_edit_reply", 0, $topic_record["cdtopic_parent"]);
         }
         if (!$SUCCESS) {
             $ERROR++;
             $ERRORSTR[] = "There was a problem updating this discussion post reply, perhaps there were no changes?. The MEdTech Unit was informed of this error; please try again later.";
             application_log("error", "There was an error updating a discussion post reply. Database said: " . $db->ErrorMsg());
         }
     }
     if ($ERROR) {
         $STEP = 1;
     }
     break;
 case 1:
 default:
     $PROCESSED = $topic_record;
Beispiel #20
0
                echo "\n<br /><br />Location: " . $result["event_location"];
            }
            $RECORD_AUTHOR = $result["proxy_id"];
            echo "\t</td>\n";
            echo "\t<td style=\"padding-bottom: 15px\">\n";
            echo "\t\t<a href=\"" . COMMUNITY_RELATIVE . $COMMUNITY_URL . ":" . $PAGE_URL . "?id=" . $result["cevent_id"] . "\" id=\"event-" . $result["cevent_id"] . "-title\">" . html_encode($result["event_title"]) . "</a>\n";
            echo communities_module_access($COMMUNITY_ID, $MODULE_ID, "edit") ? " (<a class=\"action\" href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit&amp;id=" . $result["cevent_id"] . "\">edit</a>)" : "";
            echo communities_module_access($COMMUNITY_ID, $MODULE_ID, "delete") ? " (<a class=\"action\" href=\"javascript:eventDelete('" . $result["cevent_id"] . "')\">delete</a>)" : "";
            echo "\t\t<div class=\"content-small\">" . limit_chars(strip_tags(str_replace("<br />", " ", $result["event_description"])), 150) . "</div>";
            echo "\t</td>\n";
            echo "</tr>\n";
        }
        echo "</tbody>\n";
        echo "</table>\n";
        if ($LOGGED_IN) {
            add_statistic("community:" . $COMMUNITY_ID . ":events", "view", "community_id", $COMMUNITY_ID);
        }
    } else {
        $NOTICE++;
        $NOTICESTR[] = "<strong>No Events Available</strong><br />There are no calendar events on this page that take place from <strong>" . date(DEFAULT_DATE_FORMAT, $display_duration["start"]) . "</strong> until <strong>" . date(DEFAULT_DATE_FORMAT, $display_duration["end"]) . "</strong>.<br /><br />You may want to view a different " . $_SESSION[APPLICATION_IDENTIFIER][$MODULE]["dtype"] . " or check back later.";
        echo display_notice();
    }
}
?>
</div>
<form action="#" method="get">
	<input type="hidden" id="dstamp" name="dstamp" value="<?php 
echo html_encode($_SESSION[APPLICATION_IDENTIFIER]["tmp"]["dstamp"]);
?>
" />
</form>
							<li><a href="javascript:fileMove(<?php 
                        echo $RECORD_ID;
                        ?>
)" class="btn btn-success"><i class="icon-plus-sign icon-white"></i> Move File</a></li>
							<?php 
                    }
                    ?>
							<li class="top"><a href="#top">Top Of Page</a></li>
						</ul>
						<?php 
                }
                ?>
				</div>
				<?php 
                if ($LOGGED_IN) {
                    add_statistic("community:" . $COMMUNITY_ID . ":shares", "file_view", "csfile_id", $RECORD_ID);
                }
            } else {
                if ($ERROR) {
                    echo display_error();
                }
                if ($NOTICE) {
                    echo display_notice();
                }
            }
        }
    } else {
        application_log("error", "The provided file id was invalid [" . $RECORD_ID . "] (View File).");
        header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL);
        exit;
    }
 if (isset($_POST["delete"])) {
     foreach ($_POST["delete"] as $descriptor_id) {
         if ($tmp_input = clean_input($descriptor_id, "numeric")) {
             $PROCESSED["delete"][] = $tmp_input;
             $descriptors[] = Models_Evaluation_ResponseDescriptor::fetchByID($tmp_input);
         }
     }
 }
 switch ($STEP) {
     case 2:
         if (is_array($descriptors)) {
             foreach ($descriptors as $descriptor) {
                 $descriptor_data = $descriptor->toArray();
                 $descriptor_data["active"] = 0;
                 if ($descriptor->fromArray($descriptor_data)->update()) {
                     add_statistic("evaluation_response_descriptor", "delete", "erdescriptor_id", $descriptor->getID(), $ENTRADA_USER->getID());
                     if (!$ERROR) {
                         add_success("Successfully deleted a Evaluation Response Descriptor [<strong>" . $descriptor->getDescriptor() . "</strong>]. You will now be redirected to the Evaluation Response Descriptors index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue.");
                     }
                 } else {
                     add_error("Failed to delete a Evaluation Response Descriptor [<strong>" . $descriptor->getDescriptor() . "</strong>], an Administrator has been informed, please try again later. You will now be redirected to the Evaluation Response Descriptors index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue.");
                     application_log("error", "Failed to delete Evaluation Response Descriptor, DB said: " . $db->ErrorMsg());
                 }
             }
         } else {
             add_success("No Evaluation Response Descriptors were selected, so no Evaluation Response Descriptors were deleted. You will now be redirected to the Evaluation Response Descriptors index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/descriptors?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue.");
         }
         break;
 }
 switch ($STEP) {
     case 2:
Beispiel #23
0
             $PROCESSED["proxy_id"] = $ENTRADA_USER->getID();
             $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
             $PROCESSED["updated_date"] = time();
             if (defined("EDIT_RESTRICTED_DAY") && EDIT_RESTRICTED_DAY) {
                 if ($day->fromArray($PROCESSED)->update()) {
                     add_success("The restricted day has successfully been updated. You will be redirected to the restricted days index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\">click here</a> if you do not wish to wait.");
                     add_statistic("restricted_day", "update", "orday_id", $PROCESSED["orday_id"], $ENTRADA_USER->getID());
                 } else {
                     add_error("An error occurred when attempting to update a restricted day [" . $PROCESSED["orday_id"] . "], an administrator has been informed, please try again later.");
                     application_log("error", "Error occurred when updating restricted day, DB said: " . $db->ErrorMsg());
                 }
             } else {
                 $PROCESSED["organisation_id"] = $ORGANISATION_ID;
                 if ($day->fromArray($PROCESSED)->insert()) {
                     add_success("The restricted day has successfully been updated. You will be redirected to the restricted days index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\">click here</a> if you do not wish to wait.");
                     add_statistic("restricted_day", "insert", "orday_id", $db->Insert_ID(), $ENTRADA_USER->getID());
                 } else {
                     add_error("An error occurred when attempting to create a new restricted day, an administrator has been informed, please try again later.");
                     application_log("error", "Error occurred when updating a restricted day, DB said: " . $db->ErrorMsg());
                 }
             }
         } else {
             $day = new Models_RestrictedDays();
             $day->fromArray($PROCESSED);
             $STEP = 1;
         }
         break;
     default:
         break;
 }
 switch ($STEP) {
         $course_ids = array();
         $query = "SELECT `course_id` FROM `" . CLERKSHIP_DATABASE . "`.`global_lu_rotations`\n\t\t\t\t\tWHERE `course_id` <> " . $db->qstr($course_id) . "\n\t\t\t\t\tAND `course_id` <> 0";
         $course_ids_array = $db->GetAll($query);
         foreach ($course_ids_array as $id) {
             $course_ids[] = $id;
         }
         foreach ($learning_events["events"] as $key => $event) {
             if (array_search($event["course_id"], $course_ids) !== false) {
                 unset($learning_events["events"][$key]);
             }
         }
     }
 }
 switch ($calendar_type) {
     case "ics":
         add_statistic("calendar.api", "view", "type", "ics");
         require_once "Entrada/icalendar/class.ical.inc.php";
         $ical = new iCal("-//" . html_encode($_SERVER["HTTP_HOST"]) . "//iCal " . APPLICATION_NAME . " Calendar MIMEDIR//EN", 1, ENTRADA_ABSOLUTE . "/calendars/", $user_username);
         if (!empty($learning_events["events"])) {
             foreach ($learning_events["events"] as $event) {
                 $ical->addEvent(array(), (int) $event["event_start"], (int) $event["event_finish"], $event["event_location"] ? $event["event_location"] : "To Be Announced", 1, array(), strip_tags($event["event_message"]), strip_tags($event["event_title"]), 1, array(), 5, 0, 0, 0, array(), 1, "", 0, 1, str_replace("http://", "https://", ENTRADA_URL) . "/events?id=" . (int) $event["event_id"], "en", md5((int) $event["event_id"]));
             }
         }
         $ical->outputFile();
         break;
     case "json":
     default:
         $events = array();
         if (!empty($learning_events["events"])) {
             foreach ($learning_events["events"] as $drid => $event) {
                 $cal_type = 1;
Beispiel #25
0
        foreach ($results as $result) {
            $accessible = true;
            if ($result["release_date"] && $result["release_date"] > time() || $result["release_until"] && $result["release_until"] < time()) {
                $accessible = false;
            }
            $RECORD_AUTHOR = $result["proxy_id"];
            echo "<div id=\"announcement-" . (int) $result["cannouncement_id"] . "\" class=\"announcement" . (!$accessible ? " na" : "") . "\">\n";
            echo "\t<a name=\"announcement-" . (int) $result["cannouncement_id"] . "\"></a>\n";
            echo "\t<a href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?id=" . $result["cannouncement_id"] . "\" id=\"announcement-" . (int) $result["cannouncement_id"] . "-title\" class=\"title\">" . html_encode($result["announcement_title"]) . "</a>\n";
            echo "<div>\n";
            echo "\t<div class=\"tagline\">\n";
            echo "\t\tReleased " . date("F dS, Y", $result["release_date"]) . " by <strong>" . html_encode($result["fullname"]) . "</strong>";
            echo communities_module_access($COMMUNITY_ID, $MODULE_ID, "edit") ? " (<a class=\"action\" href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit&amp;id=" . $result["cannouncement_id"] . "\">edit</a>)" : "";
            echo communities_module_access($COMMUNITY_ID, $MODULE_ID, "delete") ? " (<a class=\"action\" href=\"javascript:announcementDelete('" . $result["cannouncement_id"] . "')\">delete</a>)" : "";
            echo "\t</div>\n";
            echo strip_tags($result["announcement_description"], $ALLOWED_HTML_TAGS);
            echo "</div>\n";
            echo "</div>";
            if ($LOGGED_IN) {
                add_statistic("community:" . $COMMUNITY_ID . ":announcements", "view", "cannouncement_id", $result["cannouncement_id"]);
            }
        }
    } else {
        $NOTICE++;
        $NOTICESTR[] = "<strong>No Announcements Available</strong><br />There have been no announcements posted by the administrators of this community, please check again later.";
        echo display_notice();
    }
}
?>
	
</div>
                         $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $RECORD_ID;
                     } elseif ($file_record["allow_member_upload"] == 1) {
                         $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL;
                     }
                 } else {
                     if ($file_record["allow_troll_read"] == 1) {
                         $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $RECORD_ID;
                     } elseif ($file_record["allow_member_upload"] == 1) {
                         $url = COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL;
                     }
                 }
             }
             $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
             $SUCCESS++;
             $SUCCESSSTR[] = "You have successfully added a new revision to " . html_encode($file_record["file_title"]) . " (version " . $PROCESSED["file_version"] . ").<br /><br />You will now be redirected to this files page; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
             add_statistic("community:" . $COMMUNITY_ID . ":shares", "revision_add", "csfversion_id", $VERSION_ID);
             communities_log_history($COMMUNITY_ID, $PAGE_ID, $VERSION_ID, "community_history_add_file_revision", 1, $RECORD_ID);
         }
     }
 }
 if (!$SUCCESS) {
     /**
      * Because there was no success, check if the file_id was set... if it
      * was we need to delete the database record :( In the future this will
      * be handled with transactions like it's supposed to be.
      */
     if ($VERSION_ID) {
         $query = "DELETE FROM `community_share_file_versions` WHERE `csfversion_id` = " . $db->qstr($VERSION_ID) . " AND `csfile_id` = " . $db->qstr($RECORD_ID) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID) . " LIMIT 1";
         @$db->Execute($query);
     }
     $ERROR++;
Beispiel #27
0
 if ($COURSE_ID) {
     $query = "\tSELECT b.`community_url` FROM `community_courses` AS a\n\t\t\t\t\tJOIN `communities` AS b\n\t\t\t\t\tON a.`community_id` = b.`community_id`\n\t\t\t\t\tWHERE a.`course_id` = " . $db->qstr($COURSE_ID);
     $course_community = $db->GetOne($query);
     if ($course_community) {
         header("Location: " . ENTRADA_URL . "/community" . $course_community);
         exit;
     }
     $query = "\tSELECT * FROM `courses`\n\t\t\t\t\tWHERE `course_id` = " . $db->qstr($COURSE_ID) . "\n\t\t\t\t\tAND `course_active` = '1'";
     $course_details = USE_CACHE ? $db->CacheGetRow(CACHE_TIMEOUT, $query) : $db->GetRow($query);
     if (!$course_details) {
         $ERROR++;
         $ERRORSTR[] = "The course identifier that was presented to this page currently does not exist in the system.";
         echo display_error();
     } else {
         if ($ENTRADA_ACL->amIAllowed(new CourseResource($COURSE_ID, $ENTRADA_USER->getActiveOrganisation), "read")) {
             add_statistic($MODULE, "view", "course_id", $COURSE_ID);
             $BREADCRUMB[] = array("url" => ENTRADA_URL . "/" . $MODULE . "?" . replace_query(array("id" => $course_details["course_id"])), "title" => $course_details["course_name"] . ($course_details["course_code"] ? ": " . $course_details["course_code"] : ""));
             $OTHER_DIRECTORS = array();
             $sub_query = "SELECT `proxy_id` FROM `course_contacts` WHERE `course_contacts`.`course_id`=" . $db->qstr($COURSE_ID) . " AND `course_contacts`.`contact_type` = 'director' ORDER BY `contact_order` ASC";
             $sub_results = $db->GetAll($sub_query);
             if ($sub_results) {
                 foreach ($sub_results as $sub_result) {
                     $OTHER_DIRECTORS[] = $sub_result["proxy_id"];
                 }
             }
             // Meta information for this page.
             $PAGE_META["title"] = $course_details["course_name"] . ($course_details["course_code"] ? ": " . $course_details["course_code"] : "") . " - " . APPLICATION_NAME;
             $PAGE_META["description"] = trim(str_replace(array("\t", "\n", "\r"), " ", html_encode(strip_tags($course_details["course_description"]))));
             $PAGE_META["keywords"] = "";
             $course_details_section = true;
             $course_description_section = false;
 echo "<h1>Delete Restricted Days</h1>";
 if (isset($_POST["remove_ids"])) {
     foreach ($_POST["remove_ids"] as $day_id) {
         if ($tmp_input = clean_input($day_id, "numeric")) {
             $PROCESSED["delete"][] = $tmp_input;
             $days[] = Models_RestrictedDays::fetchRow($tmp_input);
         }
     }
 }
 switch ($STEP) {
     case 2:
         foreach ($days as $day) {
             $day_data = $day->toArray();
             $day_data["day_active"] = 0;
             if ($day->fromArray($day_data)->update()) {
                 add_statistic("restricted_days", "delete", "orday_id", $day->getID(), $ENTRADA_USER->getID());
                 if (!$ERROR) {
                     add_success("Successfully deleted the restricted day '<strong>" . $day->getName() . "</strong>'. You will now be redirected to the restricted days index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue.");
                 }
             } else {
                 add_error("Failed to delete the restricted day '<strong>" . $day->getName() . "</strong>', an Administrator has been informed, please try again later. You will now be redirected to the restricted days index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue.");
                 application_log("Failed to delete restricted day, DB said: " . $db->ErrorMsg());
             }
         }
         break;
 }
 switch ($STEP) {
     case 2:
         if ($ERROR) {
             echo display_error();
         }
     }
     $sidebar_html .= "</ul>\n";
     new_sidebar_item("My Communities", $sidebar_html, "my-communities", "open");
 } else {
     $sidebar_html = "<div style=\"text-align: center\">\n";
     $sidebar_html .= "\t<a href=\"" . ENTRADA_RELATIVE . "/podcasts\"><img src=\"" . ENTRADA_RELATIVE . "/images/podcast-dashboard-image.jpg\" width=\"149\" height=\"99\" alt=\"MEdTech Podcasts\" title=\"Subscribe to our Podcast feed.\" border=\"0\"></a><br />\n";
     $sidebar_html .= "\t<a href=\"" . ENTRADA_RELATIVE . "/podcasts\" style=\"color: #557CA3; font-size: 14px\">Podcasts Available</a>";
     $sidebar_html .= "</div>\n";
     new_sidebar_item("Podcasts in iTunes", $sidebar_html, "podcast-bar", "open");
 }
 switch ($ACTION) {
     case "read":
         if (isset($_POST["mark_read"]) && is_array($_POST["mark_read"])) {
             foreach ($_POST["mark_read"] as $notice_id) {
                 if ($notice_id = (int) $notice_id) {
                     add_statistic("notices", "read", "notice_id", $notice_id);
                 }
             }
         }
         $_SERVER["QUERY_STRING"] = replace_query(array("action" => false));
         break;
     default:
         continue;
         break;
 }
 switch ($ENTRADA_USER->getActiveGroup()) {
     case "alumni":
         $poll_where_clause = "(a.`poll_target` = 'all' OR a.`poll_target` = 'alumni')";
         break;
     case "faculty":
         $poll_where_clause = "(a.`poll_target` = 'all' OR a.`poll_target` = 'faculty')";
             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)) {
                         application_log("error", "Failed to remove a newly uploaded photo [" . $photo_id . "] from the community_gallery_photos table in community [" . $COMMUNITY_ID . "]. Database said: " . $db->ErrorMsg());
                     }
                     $error_current++;
                     $ERROR++;
                     $ERRORSTR[] = "Photo " . $photo_number . ": Unable to store the new photo file on the server; the system administrator has been informed of this error, please try again later.";
                     application_log("error", "Failed to move the uploaded Community photo to the storage directory [" . COMMUNITY_STORAGE_GALLERIES . "/" . $photo_id . "].");
                 }
             }
         }
     }
 }