Example #1
0
 private function edit()
 {
     $this->Db->table($this->table);
     $this->Db->values("Title = '{$this->title}', Type = '{$this->type}', State = '{$this->state}'");
     $this->Db->save($this->ID);
     $this->Db->table("polls_answers");
     $this->Db->deleteBySQL("ID_Poll = '{$this->ID}'");
     $this->Db->table("polls_answers", "ID_Poll, Answer");
     foreach ($this->answers as $key => $answer) {
         if ($answer !== "") {
             $this->Db->values("'{$this->ID}', '{$answer}'");
             $this->Db->save();
         }
     }
     return getAlert("The poll has been edit correctly", "success");
 }
Example #2
0
 public function send()
 {
     if (!POST("name")) {
         return getAlert("You need to write your name");
     } elseif (!isEmail(POST("email"))) {
         return getAlert("Invalid E-Mail");
     } elseif (!POST("message")) {
         return getAlert("You need to write a message");
     }
     $values = array("Name" => POST("name"), "Email" => POST("email"), "Company" => "", "Phone" => "", "Subject" => "", "Message" => POST("message", "decode", FALSE), "Start_Date" => now(4), "Text_Date" => now(2));
     $insert = $this->Db->insert($this->table, $values);
     if (!$insert) {
         return getAlert("Insert error");
     }
     $this->sendMail();
     $this->sendResponse();
     return getAlert("Your message has been sent successfully, we will contact you as soon as possible, thank you very much!", "success");
 }
Example #3
0
 private function edit()
 {
     $query = "updateImage({$this->ID}, {$this->category}, '{$this->title}', '{$this->nice}', '{$this->description}', '{$this->small}', ";
     $query .= "'{$this->medium}', '{$this->original}', '{$this->Situation}')";
     $data = $this->Db->call($query);
     if (isset($data[0]["Image_Not_Exists"])) {
         return getAlert("This image not exists");
     }
     return getAlert("The image has been edit correctly", "success");
 }
Example #4
0
 private function edit()
 {
     $data = $this->Db->call("updateForum('{$this->ID}', '{$this->title}', '{$this->nice}', '{$this->description}', '{$this->situation}')");
     if (isset($data[0]["FALSE"])) {
         return getAlert("An ocurred error");
     } elseif (isset($data[0]["Forum_Exists"])) {
         return getAlert("This forum already exists");
     }
     return getAlert("The forum has been edited correctly", "success");
 }
Example #5
0
if (isCo()) {
    ?>
        <li class="<?php 
    if ($page == 'deconnexion') {
        echo 'active';
    }
    ?>
"><a href="<?php 
    echo WEBROOT;
    ?>
logout">Deconnexion</a></li>
      <?php 
}
?>
      </ul>
    </div>
  </div>
</nav>
<div class="container"/>
	<body>
    <?php 
echo getAlert();
?>
		<!-- Body  	-->
		<?php 
echo $content_for_layout;
?>
		<!-- Footer -->
	</body>
</div>
</html>
     print "<u><i>" . _('Details') . "</i></u>: " . $rowForm["longTermMedicationDetails"] . "<br/>";
     print "</td>";
     print "</tr>";
 }
 //Conditions
 $condCount = 1;
 try {
     $dataConditions = array("gibbonPersonMedicalID" => $rowForm["gibbonPersonMedicalID"]);
     $sqlConditions = "SELECT * FROM gibbonPersonMedicalCondition WHERE gibbonPersonMedicalID=:gibbonPersonMedicalID";
     $resultConditions = $connection2->prepare($sqlConditions);
     $resultConditions->execute($dataConditions);
 } catch (PDOException $e) {
     print "<div class='error'>" . $e->getMessage() . "</div>";
 }
 while ($rowConditions = $resultConditions->fetch()) {
     $alert = getAlert($connection2, $rowConditions["gibbonAlertLevelID"]);
     if ($alert != FALSE) {
         $conditionStyle = "style='border-top: 2px solid #" . $alert["color"] . "'";
         print "<tr class={$rowNum}>";
         print "<td></td>";
         print "<td colspan=4 {$conditionStyle}>";
         print "<b><i>" . _('Condition') . " {$condCount}</i></b>: " . _($rowConditions["name"]) . "<br/>";
         print "<u><i>" . _('Risk') . "</i></u>: <span style='color: #" . $alert["color"] . "; font-weight: bold'>" . _($alert["name"]) . "</span><br/>";
         if ($rowConditions["triggers"] != "") {
             print "<u><i>" . _('Triggers') . "</i></u>: " . $rowConditions["triggers"] . "<br/>";
         }
         if ($rowConditions["reaction"] != "") {
             print "<u><i>" . _('Reaction') . "</i></u>: " . $rowConditions["reaction"] . "<br/>";
         }
         if ($rowConditions["response"] != "") {
             print "<u><i>" . _('Response') . "</i></u>: " . $rowConditions["response"] . "<br/>";
Example #7
0
 public function editProfile()
 {
     if (POST("edit")) {
         if (POST("website")) {
             if (POST("website") !== "http://") {
                 if (!ping(POST("website"))) {
                     $alert = getAlert("Invalid URL");
                 }
             } else {
                 $website = "";
             }
         }
         $ID = POST("ID_User");
         if (isset($alert)) {
             $website = "";
         } else {
             if (POST("website") !== "http://") {
                 $website = POST("website", "decode", "escape");
             }
         }
         $name = POST("name", "decode", "escape");
         $gender = POST("gender", "decode", "escape");
         $birthday = POST("birthday", "decode", "escape");
         $company = POST("company", "decode", "escape");
         $country = POST("country", "decode", "escape");
         $district = POST("district", "decode", "escape");
         $town = POST("town", "decode", "escape");
         $twitter = POST("twitter", "decode", "escape");
         $facebook = POST("facebook", "decode", "escape");
         $linkedin = POST("linkedin", "decode", "escape");
         $google = POST("google", "decode", "escape");
         $phone = POST("telephone", "decode", "escape");
         $sign = POST("sign", "decode", FALSE);
         if (!POST("userTwitter")) {
             $actualAvatar = $this->Db->find($ID, $this->table);
             if (FILES("file", "name") !== "") {
                 $this->Files = $this->core("Files");
                 $this->Files->filename = FILES("file", "name");
                 $this->Files->fileType = FILES("file", "type");
                 $this->Files->fileSize = FILES("file", "size");
                 $this->Files->fileError = FILES("file", "error");
                 $this->Files->fileTmp = FILES("file", "tmp_name");
                 $dir = "www/lib/files/images/users/";
                 if (!file_exists($dir)) {
                     mkdir($dir, 0777);
                 }
                 if ($actualAvatar[0]["Avatar"] !== "") {
                     @unlink($actualAvatar[0]["Avatar"]);
                 }
                 $upload = $this->Files->upload($dir);
                 if ($upload["upload"]) {
                     $this->Images = $this->core("Images");
                     $avatar = $this->Images->getResize("mini", $dir, $upload["filename"], _minOriginal, _maxOriginal);
                     @unlink($dir . $upload["filename"]);
                 } else {
                     $alert2 = getAlert($upload["message"]);
                 }
             } else {
                 $avatar = "";
             }
             if (isset($alert2)) {
                 $avatar = "";
             }
         } else {
             $avatar = "";
         }
         if ($avatar === "") {
             $this->Db->update($this->table, array("Website" => $website, "Sign" => $sign), $ID);
             if ($update) {
                 $data[0] = $this->Db->find($ID, $this->table);
             } else {
                 return FALSE;
             }
         } else {
             $this->Db->update($this->table, array("Website" => $website, "Sign" => $sign, "Avatar" => $avatar), $ID);
             if ($update) {
                 $data[0] = $this->Db->find($ID, $this->table);
             } else {
                 return FALSE;
             }
         }
         $userInfo = $this->Db->findBySQL("ID_User = '******'", "users_information");
         $ID2 = $userinfo[0]["ID_User"];
         $data = array("Name" => $name, "Phone" => $phone, "Company" => $company, "Gender" => $gender, "Birthday" => $birthday, "Country" => $country, "District" => $district, "Town" => $town, "Facebook" => $facebook, "Twitter" => $twitter, "Linkedin" => $linkedin, "Google" => $google);
         $update = $this->Db->update("users_information", $data, $ID2);
         if ($update) {
             $data[1] = $this->Db->find($ID2, "users_information");
         } else {
             return FALSE;
         }
         if ($data) {
             $success = TRUE;
             if (isset($alert)) {
                 $data[2][] = $alert;
                 $success = FALSE;
             }
             if (isset($alert2)) {
                 $data[2][] = $alert2;
                 $success = FALSE;
             }
             if ($success === TRUE) {
                 $data[2][0] = getAlert("Your profile has been edited correctly", "success");
             }
             return $data;
         } else {
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }
Example #8
0
 private function edit()
 {
     $this->update("url", array("URL" => $this->URL), POST("ID_URL"));
     $this->Db->update($this->table, $this->data, POST("ID"));
     $purge = $this->Db->deleteBySQL("ID_Record = '" . POST("ID") . "'", "re_categories_records");
     if (is_array($this->categories)) {
         foreach ($this->categories as $category) {
             $categories[] = $this->Db->findBy("ID_Category", $category, "re_categories_applications");
         }
         foreach ($categories as $category) {
             $category = $category[0]["ID_Category2Application"];
             $exist = $this->Db->findBySQL("ID_Category2Application = '{$category}' AND ID_Record = '" . POST("ID") . "'", "re_categories_records");
             if (!$exist) {
                 $data = array("ID_Category2Application" => $category, "ID_Record" => POST("ID"));
                 $insert = $this->Db->insert($this->table, $data);
             }
         }
     }
     $this->Tags_Model = $this->model("Tags_Model");
     $this->Tags_Model->setTagsByRecord(3, $this->tags, POST("ID"));
     if (!is_array($this->mural) and !$this->muralExist) {
         $values = array("ID_Post" => POST("ID"), "Title" => $this->data["Title"], "URL" => $this->URL, "Image" => $this->mural);
         $this->Db->insert("mural", $values);
     } elseif (!is_array($this->mural) and $this->muralExist) {
         unlink($this->muralExist);
         $this->Db->deleteBy("ID_Post", POST("ID"), "mural");
         $values = array("ID_Post" => POST("ID"), "Title" => $this->title, "URL" => $this->URL, "Image" => $this->mural);
         $this->Db->insert("mural", $values);
     }
     return getAlert("The post has been edited correctly", "success", $this->URL);
 }
Example #9
0
 public function proccess($data = NULL, $validations = FALSE)
 {
     if (is_array($validations)) {
         foreach ($validations as $field => $validation) {
             if ($validation === "required") {
                 if (!POST($field)) {
                     $field = $this->rename($field);
                     return array("error" => getAlert("{$field} is required"));
                 }
             } elseif ($validation === "email?") {
                 if (!isEmail(POST($field))) {
                     return array("error" => getAlert("{$field} is not a valid email"));
                 }
             } elseif ($validation === "injection?") {
                 if (isInjection(POST($field))) {
                     return array("error" => getAlert("SQL/HTML injection attempt blocked"));
                 }
             } elseif ($validation === "spam?") {
                 if (isSPAM(POST($field))) {
                     return array("error" => getAlert("SPAM prohibited"));
                 }
             } elseif ($validation === "vulgar?") {
                 if (isVulgar(POST($field))) {
                     return array("error" => getAlert("Your {$field} is very vulgar"));
                 }
             } elseif ($validation === "ping") {
                 if (!ping(POST($field))) {
                     return array("error" => getAlert("Invalid URL"));
                 }
             } elseif (is_string($validation) and substr($validation, 0, 6) === "length") {
                 $count = (int) substr($validation, 7, 8);
                 $count = $count > 0 ? $count : 6;
                 if (strlen(POST($field)) < $count) {
                     return array("error" => getAlert("{$field} must have at least {$count} characters"));
                 }
             } elseif (isset($field["exists"]) and isset($this->table) and POST("save")) {
                 if (is_array($validation)) {
                     $exists = $this->Db->findBy($validation);
                     if ($exists) {
                         return array("error" => getAlert("The record already exists"));
                     }
                 }
             }
         }
     }
     if (is_null($data)) {
         $data = array();
     }
     $POST = POST(TRUE);
     foreach ($POST as $field => $value) {
         if (!in_array($field, $this->ignore)) {
             if (!isset($data[$this->rename($field)])) {
                 $data[$this->rename($field)] = decode(filter($value, "escape"));
             }
         }
     }
     return $data;
 }
Example #10
0
<?php

defined('IN_MOBIQUO') or exit;
$totalAlert = 0;
$alertData = getAlert();
function getAlert()
{
    global $db, $request_params, $user, $config, $table_prefix, $totalAlert;
    $push_table = $table_prefix . "tapatalk_push_data";
    $lang = array('reply_to_you' => "%s replied to \"%s\"", 'quote_to_you' => '%s quoted your post in thread "%s"', 'tag_to_you' => '%s mentioned you in thread "%s"', 'post_new_topic' => '%s started a new thread "%s"', 'like_your_thread' => '%s liked your post in thread "%s"', 'pm_to_you' => '%s sent you a message "%s"');
    $alertData = array();
    if (!$user->data['is_registered']) {
        trigger_error('No auth to get alert data');
    }
    if (!push_data_table_exists()) {
        trigger_error('Push data table not exist');
    }
    $page = !empty($request_params[0]) ? $request_params[0] : 1;
    $per_page = !empty($request_params[1]) ? $request_params[1] : 20;
    $nowtime = time();
    $monthtime = 30 * 24 * 60 * 60;
    $preMonthtime = $nowtime - $monthtime;
    $startNum = ($page - 1) * $per_page;
    $sql = 'DELETE FROM ' . $push_table . ' WHERE create_time < ' . $preMonthtime . ' and user_id = ' . $user->data['user_id'];
    $db->sql_query($sql);
    $sql_select = "SELECT p.* FROM " . $push_table . " p \r\r\n    WHERE p.user_id = " . $user->data['user_id'] . "\r\r\n    ORDER BY create_time DESC LIMIT {$startNum},{$per_page} ";
    $query = $db->sql_query($sql_select);
    $total_sql = "SELECT count(*) as total FROM " . $push_table . " p \r\r\n    WHERE p.user_id = " . $user->data['user_id'];
    $query_total = $db->sql_query($total_sql);
    $total_data = $db->sql_fetchrow($query_total);
    $totalAlert = $total_data['total'];
Example #11
0
function getInternalAssessmentRecord($guid, $connection2, $gibbonPersonID, $role = "teacher")
{
    $output = "";
    //Get alternative header names
    $attainmentAlternativeName = getSettingByScope($connection2, "Markbook", "attainmentAlternativeName");
    $attainmentAlternativeNameAbrev = getSettingByScope($connection2, "Markbook", "attainmentAlternativeNameAbrev");
    $effortAlternativeName = getSettingByScope($connection2, "Markbook", "effortAlternativeName");
    $effortAlternativeNameAbrev = getSettingByScope($connection2, "Markbook", "effortAlternativeNameAbrev");
    $alert = getAlert($connection2, 02);
    //Get school years in reverse order
    try {
        $dataYears = array("gibbonPersonID" => $gibbonPersonID);
        $sqlYears = "SELECT * FROM gibbonSchoolYear JOIN gibbonStudentEnrolment ON (gibbonStudentEnrolment.gibbonSchoolYearID=gibbonSchoolYear.gibbonSchoolYearID) WHERE (status='Current' OR status='Past') AND gibbonPersonID=:gibbonPersonID ORDER BY sequenceNumber DESC";
        $resultYears = $connection2->prepare($sqlYears);
        $resultYears->execute($dataYears);
    } catch (PDOException $e) {
        $output .= "<div class='error'>" . $e->getMessage() . "</div>";
    }
    if ($resultYears->rowCount() < 1) {
        $output .= "<div class='error'>";
        $output .= _("There are no records to display.");
        $output .= "</div>";
    } else {
        $results = FALSE;
        while ($rowYears = $resultYears->fetch()) {
            //Get and output Internal Assessments
            try {
                $dataInternalAssessment = array("gibbonPersonID1" => $gibbonPersonID, "gibbonPersonID2" => $gibbonPersonID, "gibbonSchoolYearID" => $rowYears["gibbonSchoolYearID"]);
                if ($role == "teacher") {
                    $sqlInternalAssessment = "SELECT gibbonInternalAssessmentColumn.*, gibbonInternalAssessmentEntry.*, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class FROM gibbonCourse JOIN gibbonCourseClass ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) JOIN gibbonCourseClassPerson ON (gibbonCourseClassPerson.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonInternalAssessmentColumn ON (gibbonInternalAssessmentColumn.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonInternalAssessmentEntry ON (gibbonInternalAssessmentEntry.gibbonInternalAssessmentColumnID=gibbonInternalAssessmentColumn.gibbonInternalAssessmentColumnID) WHERE gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID1 AND gibbonInternalAssessmentEntry.gibbonPersonIDStudent=:gibbonPersonID2 AND gibbonSchoolYearID=:gibbonSchoolYearID AND completeDate<='" . date("Y-m-d") . "' ORDER BY completeDate DESC, gibbonCourse.nameShort, gibbonCourseClass.nameShort";
                } else {
                    if ($role == "student") {
                        $sqlInternalAssessment = "SELECT gibbonInternalAssessmentColumn.*, gibbonInternalAssessmentEntry.*, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class FROM gibbonCourse JOIN gibbonCourseClass ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) JOIN gibbonCourseClassPerson ON (gibbonCourseClassPerson.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonInternalAssessmentColumn ON (gibbonInternalAssessmentColumn.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonInternalAssessmentEntry ON (gibbonInternalAssessmentEntry.gibbonInternalAssessmentColumnID=gibbonInternalAssessmentColumn.gibbonInternalAssessmentColumnID) WHERE gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID1 AND gibbonInternalAssessmentEntry.gibbonPersonIDStudent=:gibbonPersonID2 AND gibbonSchoolYearID=:gibbonSchoolYearID AND completeDate<='" . date("Y-m-d") . "' AND viewableStudents='Y' ORDER BY completeDate DESC, gibbonCourse.nameShort, gibbonCourseClass.nameShort";
                    } else {
                        if ($role == "parent") {
                            $sqlInternalAssessment = "SELECT gibbonInternalAssessmentColumn.*, gibbonInternalAssessmentEntry.*, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class FROM gibbonCourse JOIN gibbonCourseClass ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) JOIN gibbonCourseClassPerson ON (gibbonCourseClassPerson.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonInternalAssessmentColumn ON (gibbonInternalAssessmentColumn.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonInternalAssessmentEntry ON (gibbonInternalAssessmentEntry.gibbonInternalAssessmentColumnID=gibbonInternalAssessmentColumn.gibbonInternalAssessmentColumnID) WHERE gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID1 AND gibbonInternalAssessmentEntry.gibbonPersonIDStudent=:gibbonPersonID2 AND gibbonSchoolYearID=:gibbonSchoolYearID AND completeDate<='" . date("Y-m-d") . "' AND viewableParents='Y'  ORDER BY completeDate DESC, gibbonCourse.nameShort, gibbonCourseClass.nameShort";
                        }
                    }
                }
                $resultInternalAssessment = $connection2->prepare($sqlInternalAssessment);
                $resultInternalAssessment->execute($dataInternalAssessment);
            } catch (PDOException $e) {
                $output .= "<div class='error'>" . $e->getMessage() . "</div>";
            }
            if ($resultInternalAssessment->rowCount() > 0) {
                $results = TRUE;
                $output .= "<h4>";
                $output .= $rowYears["name"];
                $output .= "</h4>";
                $output .= "<table cellspacing='0' style='width: 100%'>";
                $output .= "<tr class='head'>";
                $output .= "<th style='width: 120px'>";
                $output .= "Assessment";
                $output .= "</th>";
                $output .= "<th style='width: 75px; text-align: center'>";
                if ($attainmentAlternativeName != "") {
                    $output .= $attainmentAlternativeName;
                } else {
                    $output .= _('Attainment');
                }
                $output .= "</th>";
                $output .= "<th style='width: 75px; text-align: center'>";
                if ($effortAlternativeName != "") {
                    $output .= $effortAlternativeName;
                } else {
                    $output .= _('Effort');
                }
                $output .= "</th>";
                $output .= "<th>";
                $output .= "Comment";
                $output .= "</th>";
                $output .= "</tr>";
                $count = 0;
                while ($rowInternalAssessment = $resultInternalAssessment->fetch()) {
                    if ($count % 2 == 0) {
                        $rowNum = "even";
                    } else {
                        $rowNum = "odd";
                    }
                    $count++;
                    $output .= "<tr class={$rowNum}>";
                    $output .= "<td>";
                    $output .= "<span title='" . htmlPrep($rowInternalAssessment["description"]) . "'><b><u>" . $rowInternalAssessment["course"] . "." . $rowInternalAssessment["class"] . " " . $rowInternalAssessment["name"] . "</u></b></span><br/>";
                    $output .= "<span style='font-size: 90%; font-style: italic; font-weight: normal'>";
                    if ($rowInternalAssessment["completeDate"] != "") {
                        $output .= "Marked on " . dateConvertBack($guid, $rowInternalAssessment["completeDate"]) . "<br/>";
                    } else {
                        $output .= "Unmarked<br/>";
                    }
                    if ($rowInternalAssessment["attachment"] != "" and file_exists($_SESSION[$guid]["absolutePath"] . "/" . $rowInternalAssessment["attachment"])) {
                        $output .= " | <a 'title='Download more information' href='" . $_SESSION[$guid]["absoluteURL"] . "/" . $rowInternalAssessment["attachment"] . "'>More info</a>";
                    }
                    $output .= "</span><br/>";
                    $output .= "</td>";
                    if ($rowInternalAssessment["attainment"] == "N" or $rowInternalAssessment["gibbonScaleIDAttainment"] == "") {
                        $output .= "<td class='dull' style='color: #bbb; text-align: center'>";
                        $output .= _('N/A');
                        $output .= "</td>";
                    } else {
                        $output .= "<td style='text-align: center'>";
                        $attainmentExtra = "";
                        try {
                            $dataAttainment = array("gibbonScaleID" => $rowInternalAssessment["gibbonScaleIDAttainment"]);
                            $sqlAttainment = "SELECT * FROM gibbonScale WHERE gibbonScaleID=:gibbonScaleID";
                            $resultAttainment = $connection2->prepare($sqlAttainment);
                            $resultAttainment->execute($dataAttainment);
                        } catch (PDOException $e) {
                            $output .= "<div class='error'>" . $e->getMessage() . "</div>";
                        }
                        if ($resultAttainment->rowCount() == 1) {
                            $rowAttainment = $resultAttainment->fetch();
                            $attainmentExtra = "<br/>" . _($rowAttainment["usage"]);
                        }
                        $styleAttainment = "style='font-weight: bold'";
                        $output .= "<div {$styleAttainment}>" . $rowInternalAssessment["attainmentValue"] . "</div>";
                        if ($rowInternalAssessment["attainmentValue"] != "") {
                            $output .= "<div class='detailItem' style='font-size: 75%; font-style: italic; margin-top: 2px'><b>" . htmlPrep(_($rowInternalAssessment["attainmentDescriptor"])) . "</b>" . _($attainmentExtra) . "</div>";
                        }
                        $output .= "</td>";
                    }
                    if ($rowInternalAssessment["effort"] == "N" or $rowInternalAssessment["gibbonScaleIDEffort"] == "") {
                        $output .= "<td class='dull' style='color: #bbb; text-align: center'>";
                        $output .= _('N/A');
                        $output .= "</td>";
                    } else {
                        $output .= "<td style='text-align: center'>";
                        $effortExtra = "";
                        try {
                            $dataEffort = array("gibbonScaleID" => $rowInternalAssessment["gibbonScaleIDEffort"]);
                            $sqlEffort = "SELECT * FROM gibbonScale WHERE gibbonScaleID=:gibbonScaleID";
                            $resultEffort = $connection2->prepare($sqlEffort);
                            $resultEffort->execute($dataEffort);
                        } catch (PDOException $e) {
                            $output .= "<div class='error'>" . $e->getMessage() . "</div>";
                        }
                        if ($resultEffort->rowCount() == 1) {
                            $rowEffort = $resultEffort->fetch();
                            $effortExtra = "<br/>" . _($rowEffort["usage"]);
                        }
                        $styleEffort = "style='font-weight: bold'";
                        $output .= "<div {$styleEffort}>" . $rowInternalAssessment["effortValue"];
                        $output .= "</div>";
                        if ($rowInternalAssessment["effortValue"] != "") {
                            $output .= "<div class='detailItem' style='font-size: 75%; font-style: italic; margin-top: 2px'>";
                            $output .= "<b>" . htmlPrep(_($rowInternalAssessment["effortDescriptor"])) . "</b>";
                            if ($effortExtra != "") {
                                $output .= _($effortExtra);
                            }
                            $output .= "</div>";
                        }
                        $output .= "</td>";
                    }
                    if ($rowInternalAssessment["comment"] == "N" and $rowInternalAssessment["uploadedResponse"] == "N") {
                        print "<td class='dull' style='color: #bbb; text-align: left'>";
                        print _('N/A');
                        print "</td>";
                    } else {
                        $output .= "<td>";
                        if ($rowInternalAssessment["comment"] != "") {
                            $output .= $rowInternalAssessment["comment"] . "<br/>";
                        }
                        if ($rowInternalAssessment["response"] != "") {
                            $output .= "<a title='" . _('Uploaded Response') . "' href='" . $_SESSION[$guid]["absoluteURL"] . "/" . $rowInternalAssessment["response"] . "'>" . _('Uploaded Response') . "</a><br/>";
                        }
                        $output .= "</td>";
                    }
                    $output .= "</tr>";
                }
                $output .= "</table>";
            }
        }
        if ($results == FALSE) {
            $output .= "<div class='error'>";
            $output .= _("There are no records to display.");
            $output .= "</div>";
        }
    }
    return $output;
}
    }
    //echo "Data: site = $site, crack id = $cid, from = $from, to = $to <Br><Br>";
    $gndmeas = getGndMeas($site = $site, $cid = $cid, $from = $from, $to = $to, $mysql_host, $mysql_database, $mysql_user, $mysql_password);
    echo $gndmeas;
}
if (isset($_GET['coord'])) {
    //echo "coord exists<Br/>";
    $a = getCoord($mysql_host, $mysql_database, $mysql_user, $mysql_password);
    echo $a;
}
if (isset($_GET['alert'])) {
    //echo "accel exists <Br/>";
    $q = $_GET['q'];
    $site = $_GET['site'];
    $nid = (int) $_GET['nid'];
    getAlert($site, $mysql_host, $mysql_database, $mysql_user, $mysql_password);
}
if (isset($_GET['sitecolumn'])) {
    //echo "sitecolumn getter exists <Br/>";
    if (isset($_GET['sidlatest']) && !empty($_GET['sidlatest'])) {
        $sid = (int) $_GET['sidlatest'];
    } else {
        $sid = 0;
    }
    //echo "sid = " . $sid;
    getSiteColumn($sid, $mysql_host, $mysql_database, $mysql_user, $mysql_password);
}
if (isset($_GET['sitecolumnjson'])) {
    //echo "sitecolumn getter exists <Br/>";
    if (isset($_GET['sidlatest']) && !empty($_GET['sidlatest'])) {
        $sid = (int) $_GET['sidlatest'];
Example #13
0
 public function validate()
 {
     if (is_array($this->validations)) {
         foreach ($this->validations as $field => $validation) {
             if ($validation === "required") {
                 if (!POST($field)) {
                     return getAlert("{$field} is required");
                 }
             }
         }
     }
     return FALSE;
 }
Example #14
0
 public function process($data = null, $validations = false)
 {
     if (is_array($validations)) {
         foreach ($validations as $field => $validation) {
             if ($validation === "required") {
                 if (!POST($field)) {
                     $field = $this->rename($field);
                     return array("error" => getAlert(__("{$field} is required")));
                 }
             } elseif ($validation === "name?") {
                 if (!isName(POST($field))) {
                     return array("error" => getAlert(__("{$field} is not a valid name")));
                 }
             } elseif ($validation === "email?") {
                 if (!isEmail(POST($field))) {
                     return array("error" => getAlert(__("{$field} is not a valid email")));
                 }
             } elseif ($validation === "captcha?") {
                 if (!POST("captcha_token") or !POST("captcha_type")) {
                     return array("error" => getAlert(__(POST("captcha_type") === "aritmethic" ? "Please enter your answer again" : "Please type the characters you see in the picture")));
                 } elseif (POST("captcha_type") === "aritmethic") {
                     if (SESSION("ZanCaptcha" . POST("captcha_token")) != POST($field)) {
                         return array("error" => getAlert(__("Your answer was incorrect")));
                     }
                 } else {
                     if (SESSION("ZanCaptcha" . POST("captcha_token")) !== POST($field)) {
                         return array("error" => getAlert(__("The characters did not match the picture")));
                     }
                 }
             } elseif ($validation === "injection?") {
                 if (isInjection(POST($field))) {
                     return array("error" => getAlert(__("SQL/HTML injection attempt blocked")));
                 }
             } elseif ($validation === "spam?") {
                 if (isSPAM(POST($field))) {
                     return array("error" => getAlert(__("SPAM prohibited")));
                 }
             } elseif ($validation === "vulgar?") {
                 if (isVulgar(POST($field))) {
                     return array("error" => getAlert(__("Your {$field} is very vulgar")));
                 }
             } elseif ($validation === "ping") {
                 if (!ping(POST($field))) {
                     return array("error" => getAlert(__("Invalid URL")));
                 }
             } elseif (is_string($validation) and substr($validation, 0, 6) === "length") {
                 $count = (int) substr($validation, 7, 8);
                 $count = $count > 0 ? $count : 6;
                 if (strlen(POST($field)) < $count) {
                     return array("error" => getAlert(__("{$field}") . " " . __("must have at least") . " {$count} " . __("characters")));
                 }
             } elseif (isset($field["exists"]) and isset($this->table)) {
                 if (is_array($validation)) {
                     if (isset($validation["or"]) and count($validation) > 2) {
                         unset($validation["or"]);
                         $fields = array_keys($validation);
                         for ($i = 0; $i <= count($fields) - 1; $i++) {
                             $exists = $this->Db->findBy($fields[$i], $validation[$fields[$i]]);
                             if ($exists) {
                                 return array("error" => getAlert(__("The " . strtolower($fields[$i]) . " already exists")));
                             }
                         }
                     } else {
                         $field = array_keys($validation);
                         $exists = $this->Db->findBy($field[0], $validation[$field[0]]);
                         if ($exists) {
                             return array("error" => getAlert(__("The " . strtolower($field[0]) . " already exists")));
                         }
                     }
                 }
             }
         }
     }
     if (is_null($data)) {
         $data = array();
     }
     $POST = POST(true);
     foreach ($POST as $field => $value) {
         if (!in_array($field, $this->ignore)) {
             if (!isset($data[$this->rename($field)])) {
                 $data[$this->rename($field)] = decode(filter($value, "escape"));
             }
         }
     }
     return $data;
 }
Example #15
0
 private function edit()
 {
     $this->Db->table($this->table);
     $values = "Title = '{$this->title}', Slug = '{$this->slug}', CPanel = '{$this->cpanel}', Adding = '{$this->adding}',";
     $values .= "BeDefault = '{$this->defult}', Category = '{$this->category}', Comments = '{$this->comments}', Situation = '{$this->situation}'";
     $this->Db->values($values);
     $this->Db->save($this->ID);
     return getAlert("The Application has been edit correctly", "success");
 }
Example #16
0
function getAlertBar($guid, $connection2, $gibbonPersonID, $privacy = "", $divExtras = "", $div = TRUE, $large = FALSE)
{
    $output = "";
    $width = "14";
    $height = "13";
    $fontSize = "12";
    $totalHeight = "16";
    if ($large) {
        $width = "42";
        $height = "35";
        $fontSize = "39";
        $totalHeight = "45";
    }
    $highestAction = getHighestGroupedAction($guid, "/modules/Students/student_view_details.php", $connection2);
    if ($highestAction == "View Student Profile_full") {
        if ($div == TRUE) {
            $output .= "<div {$divExtras} style='width: 83px; text-align: right; height: " . $totalHeight . "px; padding: 3px 0px; margin: auto'><b>";
        }
        //Individual Needs
        try {
            $dataAlert = array("gibbonPersonID" => $gibbonPersonID);
            $sqlAlert = "SELECT * FROM gibbonINPersonDescriptor JOIN gibbonAlertLevel ON (gibbonINPersonDescriptor.gibbonAlertLevelID=gibbonAlertLevel.gibbonAlertLevelID) WHERE gibbonPersonID=:gibbonPersonID ORDER BY sequenceNumber DESC";
            $resultAlert = $connection2->prepare($sqlAlert);
            $resultAlert->execute($dataAlert);
        } catch (PDOException $e) {
        }
        if ($resultAlert->rowCount() > 0) {
            $rowAlert = $resultAlert->fetch();
            $highestLevel = _($rowAlert["name"]);
            $highestColour = $rowAlert["color"];
            $highestColourBG = $rowAlert["colorBG"];
            if ($resultAlert->rowCount() == 1) {
                $title = $resultAlert->rowCount() . " " . sprintf(_('Individual Needs alert is set, with an alert level of %1$s.'), $rowAlert["name"]);
            } else {
                $title = $resultAlert->rowCount() . " " . sprintf(_('Individual Needs alerts are set, up to a maximum alert level of %1$s.'), $rowAlert["name"]);
            }
            $output .= "<a style='font-size: " . $fontSize . "px; color: #" . $highestColour . "; text-decoration: none' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Students/student_view_details.php&gibbonPersonID=" . $gibbonPersonID . "&subpage=Individual Needs'><div title='{$title}' style='float: right; text-align: center; vertical-align: middle; max-height: " . $height . "px; height: " . $height . "px; width: " . $width . "px; border-top: 2px solid #" . $highestColour . "; margin-right: 2px; background-color: #" . $highestColourBG . "'>" . _('IN') . "</div></a>";
        }
        //Academic
        $gibbonAlertLevelID = "";
        try {
            $dataAlert = array("gibbonPersonIDStudent" => $gibbonPersonID, "gibbonSchoolYearID" => $_SESSION[$guid]["gibbonSchoolYearID"]);
            $sqlAlert = "SELECT * FROM gibbonMarkbookEntry JOIN gibbonMarkbookColumn ON (gibbonMarkbookEntry.gibbonMarkbookColumnID=gibbonMarkbookColumn.gibbonMarkbookColumnID) JOIN gibbonCourseClass ON (gibbonMarkbookColumn.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) WHERE gibbonPersonIDStudent=:gibbonPersonIDStudent AND (attainmentConcern='Y' OR effortConcern='Y') AND complete='Y' AND gibbonSchoolYearID=:gibbonSchoolYearID";
            $resultAlert = $connection2->prepare($sqlAlert);
            $resultAlert->execute($dataAlert);
        } catch (PDOException $e) {
            $_SESSION[$guid]["sidebarExtra"] .= "<div class='error'>" . $e->getMessage() . "</div>";
        }
        if ($resultAlert->rowCount() > 1 and $resultAlert->rowCount() <= 4) {
            $gibbonAlertLevelID = 03;
        } else {
            if ($resultAlert->rowCount() > 4 and $resultAlert->rowCount() <= 8) {
                $gibbonAlertLevelID = 02;
            } else {
                if ($resultAlert->rowCount() > 8) {
                    $gibbonAlertLevelID = 01;
                }
            }
        }
        if ($gibbonAlertLevelID != "") {
            $alert = getAlert($connection2, $gibbonAlertLevelID);
            if ($alert != FALSE) {
                $title = sprintf(_('Student has a %1$s alert for academic concern in the current academic year.'), _($alert["name"]));
                $output .= "<a style='font-size: " . $fontSize . "px; color: #" . $alert["color"] . "; text-decoration: none' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Students/student_view_details.php&gibbonPersonID=" . $gibbonPersonID . "&subpage=Markbook&filter=" . $_SESSION[$guid]["gibbonSchoolYearID"] . "'><div title='{$title}' style='float: right; text-align: center; vertical-align: middle; max-height: " . $height . "px; height: " . $height . "px; width: " . $width . "px; border-top: 2px solid #" . $alert["color"] . "; margin-right: 2px; background-color: #" . $alert["colorBG"] . "'>" . _('A') . "</div></a>";
            }
        }
        //Behaviour
        $gibbonAlertLevelID = "";
        try {
            $dataAlert = array("gibbonPersonID" => $gibbonPersonID);
            $sqlAlert = "SELECT * FROM gibbonBehaviour WHERE gibbonPersonID=:gibbonPersonID AND type='Negative' AND date>'" . date("Y-m-d", time() - 24 * 60 * 60 * 60) . "'";
            $resultAlert = $connection2->prepare($sqlAlert);
            $resultAlert->execute($dataAlert);
        } catch (PDOException $e) {
            $_SESSION[$guid]["sidebarExtra"] .= "<div class='error'>" . $e->getMessage() . "</div>";
        }
        if ($resultAlert->rowCount() > 1 and $resultAlert->rowCount() <= 4) {
            $gibbonAlertLevelID = 03;
        } else {
            if ($resultAlert->rowCount() > 4 and $resultAlert->rowCount() <= 8) {
                $gibbonAlertLevelID = 02;
            } else {
                if ($resultAlert->rowCount() > 8) {
                    $gibbonAlertLevelID = 01;
                }
            }
        }
        if ($gibbonAlertLevelID != "") {
            $alert = getAlert($connection2, $gibbonAlertLevelID);
            if ($alert != FALSE) {
                $title = sprintf(_('Student has a %1$s alert for behaviour over the past 60 days.'), _($alert["name"]));
                $output .= "<a style='font-size: " . $fontSize . "px; color: #" . $alert["color"] . "; text-decoration: none' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Students/student_view_details.php&gibbonPersonID=" . $gibbonPersonID . "&subpage=Behaviour'><div title='{$title}' style='float: right; text-align: center; vertical-align: middle; max-height: " . $height . "px; height: " . $height . "px; width: " . $width . "px; border-top: 2px solid #" . $alert["color"] . "; margin-right: 2px; background-color: #" . $alert["colorBG"] . "'>" . _('B') . "</div></a>";
            }
        }
        //Medical
        $alert = getHighestMedicalRisk($gibbonPersonID, $connection2);
        if ($alert != FALSE) {
            $highestLevel = $alert[1];
            $highestColour = $alert[3];
            $highestColourBG = $alert[4];
            $title = sprintf(_('Medical alerts are set, up to a maximum of %1$s'), $highestLevel);
            $output .= "<a style='font-size: " . $fontSize . "px; color: #" . $highestColour . "; text-decoration: none' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Students/student_view_details.php&gibbonPersonID=" . $gibbonPersonID . "&subpage=Medical'><div title='{$title}' style='float: right; text-align: center; vertical-align: middle; max-height: " . $height . "px; height: " . $height . "px; width: " . $width . "px; border-top: 2px solid #" . $highestColour . "; margin-right: 2px; background-color: #" . $highestColourBG . "'><b>" . _('M') . "</b></div></a>";
        }
        //Privacy
        $privacySetting = getSettingByScope($connection2, "User Admin", "privacy");
        if ($privacySetting == "Y" and $privacy != "") {
            $alert = getAlert($connection2, 01);
            $title = sprintf(_('Privacy is required: %1$s'), $privacy);
            $output .= "<div title='{$title}' style='font-size: " . $fontSize . "px; float: right; text-align: center; vertical-align: middle; max-height: " . $height . "px; height: " . $height . "px; width: " . $width . "px; border-top: 2px solid #" . $alert["color"] . "; margin-right: 2px; color: #" . $alert["color"] . "; background-color: #" . $alert["colorBG"] . "'>" . _('P') . "</div>";
        }
        if ($div == TRUE) {
            $output .= "</div>";
        }
    }
    return $output;
}
Example #17
0
 private function edit()
 {
     if ($this->data["Principal"] > 0) {
         if ($this->Db->findBySQL("Position = '" . $this->data["Position"] . "' AND Principal = 1", $this->table)) {
             $this->Db->updateBySQL($this->table, "Principal = 0 WHERE Position = '" . $this->data["Position"] . "'");
         }
     }
     $this->Db->update($this->table, $this->data, POST("ID"));
     return getAlert("The ad has been edited correctly", "success");
 }
Example #18
0
 private function edit()
 {
     $this->Db->update($this->table, $this->data, POST("ID"));
     return getAlert("The page has been edit correctly", "success");
 }
Example #19
0
 public function login($from = "users")
 {
     if (segment(3)) {
         $from = segment(3);
     }
     if ($from === "forums") {
         $this->CSS("loginforums", TRUE);
     } else {
         $this->CSS("login", $this->application);
     }
     $this->title("Login");
     if (POST("connect")) {
         if ($this->Users_Model->isAdmin() or $this->Users_Model->isMember()) {
             $user = $this->Users_Model->getUserData();
         } else {
             $user = FALSE;
         }
         if ($user) {
             SESSION("ZanUser", $user[0]["Username"]);
             SESSION("ZanUserPwd", $user[0]["Password"]);
             SESSION("ZanUserGod", $user[0]["God"]);
             SESSION("ZanUserID", $user[0]["ID_User"]);
             SESSION("ZanUserPrivilegeID", $user[0]["ID_Privilege"]);
             SESSION("ZanUserPrivilege", $user[0]["Privilege"]);
             if ($from === "forums") {
                 $vars["success"] = TRUE;
                 $vars["view"] = $this->view("login", $vars);
             } else {
                 redirect(POST("URL"));
             }
         } elseif ($from === "cpanel") {
             showAlert("Incorrect Login", path("cpanel"));
         } else {
             if ($from === "forums") {
                 $vars["href"] = path("users" . _sh . "login" . _sh . $from);
                 $vars["noregister"] = TRUE;
                 $vars["alert"] = getAlert("Incorrect Login");
                 $vars["view"] = $this->view("login", $vars);
             } else {
                 $vars["href"] = path("users" . _sh . "login");
                 $vars["alert"] = getAlert("Incorrect Login");
                 $vars["view"] = $this->view("login", TRUE);
             }
         }
     } else {
         if ($from === "forums") {
             $vars["href"] = path("users" . _sh . "login" . _sh . $from);
             $vars["noregister"] = TRUE;
             $vars["view"] = $this->view("login", $vars);
         } else {
             $vars["href"] = path("users" . _sh . "login");
             $vars["view"] = $this->view("login", TRUE);
         }
     }
     $this->render("content", $vars);
 }
Example #20
0
 /**
  * Upload and resize an image
  *
  * @param string $dir
  * @param string $name = "File"
  * @return array value
  */
 public function uploadImage($dir, $inputName = "file", $type = "resize", $small = TRUE, $medium = TRUE, $original = TRUE)
 {
     if (!is_dir($dir)) {
         @mkdir($dir, 0777);
     }
     if (FILES($inputName, "name")) {
         $this->filename = FILES($inputName, "name");
         $this->fileType = FILES($inputName, "type");
         $this->fileSize = FILES($inputName, "size");
         $this->fileError = FILES($inputName, "error");
         $this->fileTmp = FILES($inputName, "tmp_name");
     } else {
         return FALSE;
     }
     $upload = $this->upload($dir);
     if (!$upload["upload"]) {
         return FALSE;
     }
     $this->Images = $this->core("Images");
     $this->Images->load($dir . $upload["filename"]);
     if ($type === "normal") {
         return $dir . $upload["filename"];
     } elseif ($type === "resize") {
         if ($small) {
             $size["small"] = $this->Images->getResize("small", $dir, $upload["filename"]);
         }
         if ($medium) {
             $size["medium"] = $this->Images->getResize("medium", $dir, $upload["filename"], _minMedium, _maxMedium);
         }
         if ($original) {
             $size["original"] = $this->Images->getResize("original", $dir, $upload["filename"], _minOriginal, _maxOriginal);
         }
         @unlink($dir . $upload["filename"]);
         return $size;
     } elseif ($type === "mural") {
         if ($this->Images->getWidth() !== _muralWidth and $this->Images->getHeight() !== _muralHeight) {
             unlink($dir . $upload["filename"]);
             $alert["alert"] = getAlert("The mural image is too big");
             return $alert;
         } else {
             return $dir . $upload["filename"];
         }
     }
 }
Example #21
0
 private function edit()
 {
     if (!$this->title or is_null($this->title)) {
         return getAlert("You need write a title");
     }
     $values = array("Title" => $this->title, "Slug" => slug($this->title), "Description" => $this->description, "Situation" => $this->situation);
     $response = $this->Db->update($this->table, $values, "ID_Video = " . $this->ID);
     if ($response) {
         return getAlert("The video has been edited correctly", "success");
     } else {
         return getAlert("Edit error");
     }
 }
Example #22
0
 private function edit()
 {
     $this->Db->table($this->table);
     $this->Db->table("url", "URL");
     $this->Db->values("'{$this->URL}'");
     $this->Db->save($this->ID_URL);
     $this->Db->table($this->table);
     $values = "ID_URL = '{$this->ID_URL}', Title = '{$this->title}', Nice = '{$this->nice}', Content = '{$this->content}', Start_Date = '{$this->date1}', ";
     $values .= "Text_Date = '{$this->date2}', Year = '{$this->year}', Month = '{$this->month}', Day = '{$this->day}', Enable_Comments = '{$this->comments}', ";
     $values .= "Language = '{$this->language}', Pwd = '{$this->password}', State = '{$this->state}'";
     $this->Db->values($values);
     $this->Db->save($this->ID);
     return getAlert("The post has been edited correctly", "success", $this->URL);
 }
Example #23
0
 public function edit()
 {
     $this->Db->update($this->table, $this->data, 1);
     return getAlert("The configuration has been edited correctly", "success");
 }
Example #24
0
 public function upload($file)
 {
     $this->Files = $this->core("Files");
     $this->Files->filename = FILES($file, "name");
     $this->Files->fileType = FILES($file, "type");
     $this->Files->fileSize = FILES($file, "size");
     $this->Files->fileError = FILES($file, "error");
     $this->Files->fileTmp = FILES($file, "tmp_name");
     $dir = "www/lib/files/images/works/";
     if (!file_exists($dir)) {
         @mkdir($dir, 0777);
     }
     $upload = $this->Files->upload($dir);
     if ($upload["upload"]) {
         return $dir . $upload["filename"];
     } else {
         $this->error = getAlert($upload["message"]);
         return FALSE;
     }
 }
Example #25
0
 private function setReply()
 {
     $ID_Topic = segment(3);
     if (segment(4) === "edit") {
         $action = "edit";
         $ID_Reply = segment(5);
     } elseif (segment(4) === "new") {
         $action = "save";
     }
     if (segment(6) > 0) {
         $page = segment(6);
     } else {
         $page = 1;
     }
     if (SESSION("ZanUserID") > 0) {
         $this->js("tiny-mce", NULL, "basic");
         $this->js("validations", $this->application);
         if (POST("cancel")) {
             redirect($this->application . _sh . segment(2) . _sh . segment(3) . _sh);
         }
         if (!POST("doAction")) {
             if ($action === "save") {
                 $topic = $this->Forums_Model->getTopicByID($ID_Topic);
             } elseif ($action === "edit") {
                 $topic = $this->Forums_Model->getTopicByID($ID_Reply);
             }
             if ($topic) {
                 $vars["ID_Post"] = $topic[0]["ID_Post"];
                 $vars["ID_Forum"] = $topic[0]["ID_Forum"];
                 if ($action === "save") {
                     $vars["title"] = "Re: " . $topic[0]["Title"];
                     $vars["content"] = "";
                     $vars["href"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh . "new");
                     $vars["hrefURL"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh);
                 } elseif ($action === "edit") {
                     $vars["title"] = $topic[0]["Title"];
                     $vars["content"] = $topic[0]["Content"];
                     $vars["ID_Topic"] = $topic[0]["ID_Parent"];
                     $vars["hrefURL"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh . "page" . _sh . $page);
                     $vars["href"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh . "edit" . _sh . $ID_Reply . _sh . $page);
                 }
                 $vars["action"] = $action;
                 $vars["view"] = $this->view("reply", $this->application, TRUE);
                 $this->template("content", $vars);
             }
         } else {
             if (!POST("title")) {
                 $alert = getAlert("You must to write a title");
             } elseif (isEmptyTiny(POST("content", "decode", FALSE))) {
                 $alert = getAlert("You must to a write a content");
             } elseif (strlen(POST("title")) < 4) {
                 $alert = getAlert("You must to write a valid title");
             } elseif (!POST("content")) {
                 $alert = getAlert("You must to a write a content");
             } elseif (strlen(POST("content")) < 4) {
                 $alert = getAlert("You must to write a valid content");
             } elseif (isInjection(POST("content", "decode", FALSE))) {
                 $alert = getAlert("The content is invalid");
             } elseif (isEmptyTiny(POST("content", "decode", FALSE))) {
                 $alert = getAlert("The content is invalid");
             } elseif (isVulgar(strtolower(POST("title")))) {
                 $alert = getAlert("The title is vulgar");
             } elseif (isVulgar(strtolower(POST("content")))) {
                 $alert = getAlert("The content is vulgar");
             } elseif (isSPAM(POST("content"))) {
                 $alert = getAlert("The content has spam");
             }
             if (isset($alert)) {
                 $vars["alert"] = $alert;
                 $vars["ID_Post"] = POST("ID_Post");
                 $vars["ID_Forum"] = POST("ID_Forum");
                 $vars["title"] = POST("title");
                 $vars["content"] = cleanTiny(POST("content", "decode", FALSE));
                 $vars["action"] = $action;
                 if ($action === "save") {
                     $vars["href"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh . "new");
                     $vars["hrefURL"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh);
                 } elseif ($action === "edit") {
                     $vars["ID_Topic"] = POST("ID_Topic");
                     $vars["href"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh . "edit" . _sh . $ID_Reply . _sh . $page);
                     $vars["hrefURL"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh . "page" . _sh . $page);
                 }
                 $vars["view"] = $this->view("reply", $this->application, TRUE);
                 $this->template("content", $vars);
             } else {
                 if ($action === "save") {
                     $success = $this->Forums_Model->setReply();
                     if ($success > 0) {
                         $page = $this->Forums_Model->getPage($ID_Topic);
                         $reply = $this->Forums_Model->addUserReply();
                     } else {
                         $page = 1;
                     }
                 } elseif ($action === "edit") {
                     $success = $this->Forums_Model->editReply();
                 }
                 $vars["success"] = $success;
                 $vars["action"] = $action;
                 if ($action === "save") {
                     $vars["href"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh . _page . _sh . $page . _sh . "#bottom");
                 } elseif ($action === "edit") {
                     $vars["href"] = path($this->application . _sh . segment(2) . _sh . $ID_Topic . _sh . _page . _sh . $page);
                 }
                 $vars["view"] = $this->view("reply", $this->application, TRUE);
                 $this->template("content", $vars);
             }
         }
     } else {
         redirect($this->application . _sh . segment(2) . _sh . segment(3) . _sh);
     }
 }
    echo $e->getMessage();
}
//Get alternative header names
$attainmentAlternativeName = getSettingByScope($connection2, "Markbook", "attainmentAlternativeName");
$attainmentAlternativeNameAbrev = getSettingByScope($connection2, "Markbook", "attainmentAlternativeNameAbrev");
$effortAlternativeName = getSettingByScope($connection2, "Markbook", "effortAlternativeName");
$effortAlternativeNameAbrev = getSettingByScope($connection2, "Markbook", "effortAlternativeNameAbrev");
@session_start();
$gibbonCourseClassID = $_SESSION[$guid]["exportToExcelParams"];
if (isActionAccessible($guid, $connection2, "/modules/Markbook/markbook_view.php") == FALSE) {
    //Acess denied
    print "<div class='error'>";
    print _("You do not have access to this action.");
    print "</div>";
} else {
    $alert = getAlert($connection2, 02);
    //Count number of columns
    try {
        $data = array("gibbonCourseClassID" => $gibbonCourseClassID);
        $sql = "SELECT * FROM gibbonMarkbookColumn WHERE gibbonCourseClassID=:gibbonCourseClassID ORDER BY complete, completeDate DESC";
        $result = $connection2->prepare($sql);
        $result->execute($data);
    } catch (PDOException $e) {
        print "<div class='error'>" . $e->getMessage() . "</div>";
    }
    $columns = $result->rowCount();
    if ($columns < 1) {
        print "<div class='warning'>";
        print _("There are no records to display.");
        print "</div>";
    } else {
Example #27
0
 public function uploadImage($dir, $name = "file", $type = "resize", $sizes = array("t", "s", "m", "l", "o"))
 {
     if (!is_dir($dir)) {
         @mkdir($dir, 0777);
     }
     if (FILES($name, "name")) {
         $this->filename = FILES($name, "name");
         $this->fileType = FILES($name, "type");
         $this->fileSize = FILES($name, "size");
         $this->fileError = FILES($name, "error");
         $this->fileTmp = FILES($name, "tmp_name");
     } else {
         return false;
     }
     $upload = $this->upload($dir);
     if (!$upload["upload"]) {
         return false;
     }
     $this->Images = $this->core("Images");
     $this->Images->load($dir . $upload["filename"]);
     if ($type === "normal") {
         return $dir . $upload["filename"];
     } elseif ($type === "resize") {
         if (isset($sizes["t"])) {
             $size["thumbnail"] = $this->Images->getResize("thumbnail", $dir, $upload["filename"], MIN_THUMBNAIL, MAX_THUMBNAIL);
         }
         if (isset($sizes["s"])) {
             $size["small"] = $this->Images->getResize("small", $dir, $upload["filename"]);
         }
         if (isset($sizes["m"])) {
             $size["medium"] = $this->Images->getResize("medium", $dir, $upload["filename"], MIN_MEDIUM, MAX_MEDIUM);
         }
         if (isset($sizes["l"])) {
             $size["large"] = $this->Images->getResize("large", $dir, $upload["filename"], MIN_LARGE, MAX_LARGE);
         }
         if (isset($sizes["o"])) {
             $size["original"] = $dir . $upload["filename"];
         }
         return $size;
     } elseif ($type === "mural") {
         if ($this->Images->getWidth() !== MURAL_WIDTH and $this->Images->getHeight() !== MURAL_HEIGHT) {
             unlink($dir . $upload["filename"]);
             $size = MURAL_WIDTH . "x" . MURAL_HEIGHT . __(" exactly.");
             $alert["alert"] = getAlert(__("The mural image's resolution must be ") . $size);
             return $alert;
         } else {
             return $dir . $upload["filename"];
         }
     }
 }