本文整理汇总了PHP中getAlert函数的典型用法代码示例。如果您正苦于以下问题:PHP getAlert函数的具体用法?PHP getAlert怎么用?PHP getAlert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getAlert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
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");
}
示例2: send
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");
}
示例3: edit
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");
}
示例4: edit
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");
}
示例5: getAlert
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>
示例6: _
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/>";
示例7: editProfile
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 = '{$ID}'", "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;
}
//.........这里部分代码省略.........
示例8: edit
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);
}
示例9: proccess
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;
}
示例10: defined
<?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'];
示例11: getInternalAssessmentRecord
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'>";
//.........这里部分代码省略.........
示例12: getGndMeas
}
//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'];
示例13: validate
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;
}
示例14: process
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;
}
示例15: edit
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");
}