本文整理汇总了PHP中functions::isDate方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::isDate方法的具体用法?PHP functions::isDate怎么用?PHP functions::isDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::isDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OutputPositionsEditorUpdate
//.........这里部分代码省略.........
$inputFields[$tbl][$fieldname]["value"] = !empty($inputFields[$tbl][$fieldname]["value"]) ? 1 : 0;
} else {
// text fields, leave as default case without explicit listing of field names
$inputFields[$tbl][$fieldname]["type"] = "text";
}
$inputFields[$tbl][$fieldname]["error"] = 0;
$inputFields[$tbl][$fieldname]["required"] = in_array($fieldname, $reqFields) ? 1 : 0;
}
}
// ----------------------------------------------
echo "<hr>usedTableRecords";
debug::rr($usedTableRecords);
//TODO: echo "<hr>usedFieldValues"; debug::rr($usedFieldValues);
echo "<hr>foreignFieldValues";
debug::rr($foreignFieldValues);
echo "<hr>tableFields";
debug::rr($tableFields);
echo "<hr>lookup";
debug::rr($lookup);
}
// -----------------------------------------------------------
// -- Insert new lookup record
// -----------------------------------------------------------
if ($GLOBALS["new"] || $GLOBALS["update"]) {
$stdout .= ($GLOBALS["update"] ? "UPDATE" : "NEW") . " RECORD";
// -- Check for errors
if ($GLOBALS["table"] == "position") {
foreach (array("title", "regend") as $fieldname) {
if (empty($GLOBALS[$fieldname])) {
$founderror[$fieldname] = 1;
$error[] = "Please enter a " . ucfirst($fieldname) . ".";
}
}
if (!functions::isDate($GLOBALS["regend"], "Y-m-d")) {
$founderror["regend"] = 1;
$error[] = "Please enter a Regend in the form 'YYYY-mm-dd'.";
}
foreach (array("method_id", "type_id") as $fieldname) {
if (isset($GLOBALS[$fieldname]) && $GLOBALS[$fieldname] < 0) {
$founderror[$fieldname] = 1;
$error[] = "Please select a " . ucfirst(str_replace("_id", "", $fieldname)) . ".";
}
}
/*
if (!empty($GLOBALS["sortorder"])
&& (!is_numeric($GLOBALS["sortorder"]) || ((int) $GLOBALS["sortorder"] != $GLOBALS["sortorder"]) )
) {
$founderror["sortorder"] = 1;
$error[] =
"The sortorder must be an integer.";
}
*/
foreach ($tableFields[$GLOBALS["table"]] as $fieldname) {
/*
if (in_array($fieldname,array("method","group"))
&& (preg_match("#\W#",$value))
) {
$founderror[$fieldname] = 1;
$error[] =
"The field '".$fieldname."' must only contain ASCII 7 alphanumeric characters.";
}
*/
/*
if ($GLOBALS["new"]
&& !empty($value)
&& (strpos($fieldname,"_id")===FALSE)
示例2: drawArticleEditorNew
private static function drawArticleEditorNew()
{
$stdout = "";
$showform = 1;
$error = $warning = $founderror = array();
$article_id = $GLOBALS["aid"];
$GLOBALS["aid"] = 0;
// -----------------------------------------------------------
functions::gpc_declare_input("headline", "", false);
functions::gpc_declare_input("body", "", false, array(), false, false);
functions::gpc_declare_input("date", "", false);
functions::gpc_declare_input("author", NEWS_NOAUTHOR, false);
functions::gpc_declare_input("section", 0, false);
functions::gpc_declare_input("country", array(), false);
functions::gpc_declare_input("category", array(), false);
functions::gpc_declare_input("articlestatus", 0, false);
// -----------------------------------------------------------
if (empty($GLOBALS["headline"])) {
$founderror["headline"] = 1;
$error[] = "Please write a non-empty headline.";
}
if (empty($GLOBALS["body"])) {
$founderror["body"] = 1;
$error[] = "Please enter a non-empty article body.";
}
if (!functions::isDate($GLOBALS["date"], "Y-m-d")) {
$founderror["date"] = 1;
$error[] = "There is something strange with the date " . "'<strong><em>" . $GLOBALS["date"] . "</em></strong>'.";
}
if ($GLOBALS["author"] == NEWS_NOAUTHOR) {
$founderror["author"] = 1;
$warning[] = "No author selected. (<em>Optional field</em>.)";
}
if (empty($GLOBALS["section"])) {
$founderror["section"] = 1;
$warning[] = "No section selected. (<em>Optional field; Can be selected later, or re-edit this article now</em>.)";
} elseif (!is_numeric($GLOBALS["section"])) {
$founderror["section"] = 1;
$error[] = "There is something strange with a section.";
} elseif (is_array($GLOBALS["section"])) {
$mess = "";
foreach ($GLOBALS["section"] as $key => $val) {
if (!is_numeric($val)) {
$founderror["section"] = 1;
$mess = "There is something strange with a section.";
}
}
if (!empty($mess)) {
$error[] = $mess;
}
}
if (is_array($GLOBALS["country"])) {
$mess = "";
foreach ($GLOBALS["country"] as $key => $val) {
if (!in_array($val, array("DK", "FI", "IS", "NO", "SE"))) {
$founderror["country"] = 1;
$mess = "There is something strange with a country.";
}
}
if (!empty($mess)) {
$error[] = $mess;
}
}
if (empty($GLOBALS["category"])) {
$founderror["category"] = 1;
$warning[] = "No category selected. (<em>Optional field</em>.)";
} else {
$mess = "";
foreach ($GLOBALS["category"] as $key => $val) {
if (!is_numeric($val)) {
$founderror["category"] = 1;
$mess = "There is something strange with a category.";
}
}
if (!empty($mess)) {
$error[] = $mess;
}
}
// -----------------------------------------------------------
// -- If errors found, display form with error messages and warnings
if (!empty($error)) {
$stdout .= functions::boxMessage("error", $error);
$showform = 1;
}
if (!empty($warning)) {
$stdout .= functions::boxMessage("warning", $warning);
$showform = 1;
}
if (!empty($error) || !empty($error)) {
$stdout .= PADDED_HR;
}
// -- If no errors, update database with submitted data
if (empty($error)) {
self::initiateNewsClass();
$record = array("article_id" => $article_id, "headline" => $GLOBALS["headline"], "body" => $GLOBALS["body"], "date" => $GLOBALS["date"], "author" => $GLOBALS["author"], "section" => $GLOBALS["section"], "country" => $GLOBALS["country"], "category" => $GLOBALS["category"], "articlestatus" => $GLOBALS["articlestatus"]);
$res = $record["article_id"] ? $GLOBALS["newsClass"]->updateArticle($record) : $GLOBALS["newsClass"]->insertArticle($record);
// false or $article_id
if (!$res) {
$stdout .= "\r\n" . functions::boxMessage("error", "Could not save the new article "" . $GLOBALS["headline"] . ""</strong>.") . PADDED_HR . "\r\n";
$showform = 1;
//.........这里部分代码省略.........