本文整理汇总了PHP中CheckDateTime函数的典型用法代码示例。如果您正苦于以下问题:PHP CheckDateTime函数的具体用法?PHP CheckDateTime怎么用?PHP CheckDateTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckDateTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFilter
function CheckFilter()
{
global $FilterArr, $lAdmin, $statDB;
foreach ($FilterArr as $f) {
global ${$f};
}
$arr = array();
$arr[] = array("date1" => $find_date_enter_1, "date2" => $find_date_enter_2, "mess1" => GetMessage("STAT_WRONG_FIRST_DATE_FROM"), "mess2" => GetMessage("STAT_WRONG_FIRST_DATE_TILL"), "mess3" => GetMessage("STAT_FROM_TILL_FIRST_DATE"));
$arr[] = array("date1" => $find_date_last_1, "date2" => $find_date_last_2, "mess1" => GetMessage("STAT_WRONG_LAST_DATE_FROM"), "mess2" => GetMessage("STAT_WRONG_LAST_DATE_TILL"), "mess3" => GetMessage("STAT_FROM_TILL_LAST_DATE"));
$arr[] = array("date1" => $find_date1_period, "date2" => $find_date2_period, "mess1" => GetMessage("STAT_WRONG_PERIOD_DATE_FROM"), "mess2" => GetMessage("STAT_WRONG_PERIOD_DATE_TILL"), "mess3" => GetMessage("STAT_FROM_TILL_PERIOD_DATE"));
foreach ($arr as $ar) {
if (strlen($ar["date1"]) > 0 && !CheckDateTime($ar["date1"])) {
$lAdmin->AddFilterError($ar["mess1"]);
}
if (strlen($ar["date2"]) > 0 && !CheckDateTime($ar["date2"])) {
$lAdmin->AddFilterError($ar["mess2"]);
}
if (strlen($ar["date1"]) > 0 && strlen($ar["date2"]) > 0 && $statDB->CompareDates($ar["date1"], $ar["date2"]) == 1) {
$lAdmin->AddFilterError($ar["mess3"]);
}
}
// sessions
if (intval($find_counter1) > intval($find_counter2)) {
$lAdmin->AddFilterError(GetMessage("STAT_COUNTER1_COUNTER2"));
}
// statistics keep days
if (intval($find_keep_days1) > intval($find_keep_days2)) {
$lAdmin->AddFilterError(GetMessage("STAT_DAYS1_DAYS2"));
}
// dynamics keep days
if (intval($find_dynamic_keep_days1) > intval($find_dynamic_keep_days2)) {
$lAdmin->AddFilterError(GetMessage("STAT_DYNAMIC_DAYS1_DAYS2"));
}
return count($lAdmin->arFilterErrors) == 0;
}
示例2: CheckFilter
function CheckFilter()
{
global $strError, $arFilterFields, $statDB;
foreach ($arFilterFields as $f) {
global ${$f};
}
$str = "";
$arMsg = array();
$arr = array();
$arr[] = array("date1" => $find_date1, "date2" => $find_date2, "mess1" => GetMessage("STAT_WRONG_DATE_FROM"), "mess2" => GetMessage("STAT_WRONG_DATE_TILL"), "mess3" => GetMessage("STAT_FROM_TILL_DATE"));
$arr[] = array("date1" => $find_date_end1, "date2" => $find_date_end2, "mess1" => GetMessage("STAT_WRONG_DATE_END_FROM"), "mess2" => GetMessage("STAT_WRONG_DATE_END_TILL"), "mess3" => GetMessage("STAT_FROM_TILL_DATE_END"));
foreach ($arr as $ar) {
if (strlen($ar["date1"]) > 0 && !CheckDateTime($ar["date1"])) {
$arMsg[] = array("id" => "find_date1", "text" => $ar["mess1"]);
} elseif (strlen($ar["date2"]) > 0 && !CheckDateTime($ar["date2"])) {
$arMsg[] = array("id" => "find_date2", "text" => $ar["mess2"]);
} elseif (strlen($ar["date1"]) > 0 && strlen($ar["date2"]) > 0 && $statDB->CompareDates($ar["date1"], $ar["date2"]) == 1) {
$arMsg[] = array("id" => "find_date2", "text" => $ar["mess3"]);
}
}
// hits
if (intval($find_hits1) > 0 and intval($find_hits2) > 0 and $find_hits1 > $find_hits2) {
$arMsg[] = array("id" => "find_hits2", "text" => GetMessage("STAT_HITS1_HITS2"));
}
// events
if (intval($find_events1) > 0 and intval($find_events2) > 0 and $find_events1 > $find_events2) {
$arMsg[] = array("id" => "find_events2", "text" => GetMessage("STAT_EVENTS1_EVENTS2"));
}
if (!empty($arMsg)) {
$e = new CAdminException($arMsg);
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
}
return true;
}
示例3: validate
public function validate($value, $primary, array $row, Entity\Field $field)
{
if (CheckDateTime($value, FORMAT_DATE)) {
return true;
}
return $this->getErrorMessage($value, $field);
}
示例4: CheckFilter
function CheckFilter()
{
global $strError, $arFilterFields, $statDB;
foreach ($arFilterFields as $f) {
global ${$f};
}
$str = "";
$arr = array();
$arr[] = array("date1" => $find_date1, "date2" => $find_date2, "mess1" => GetMessage("STAT_WRONG_DATE_FROM"), "mess2" => GetMessage("STAT_WRONG_DATE_TILL"), "mess3" => GetMessage("STAT_FROM_TILL_DATE"));
$arr[] = array("date1" => $find_date1_period, "date2" => $find_date2_period, "mess1" => GetMessage("STAT_WRONG_DATE_PERIOD_FROM"), "mess2" => GetMessage("STAT_WRONG_DATE_PERIOD_TILL"), "mess3" => GetMessage("STAT_FROM_TILL_DATE_PERIOD"));
foreach ($arr as $ar) {
if (strlen($ar["date1"]) > 0 && !CheckDateTime($ar["date1"])) {
$str .= $ar["mess1"] . "<br>";
} elseif (strlen($ar["date2"]) > 0 && !CheckDateTime($ar["date2"])) {
$str .= $ar["mess2"] . "<br>";
} elseif (strlen($ar["date1"]) > 0 && strlen($ar["date2"]) > 0 && $statDB->CompareDates($ar["date1"], $ar["date2"]) == 1) {
$str .= $ar["mess3"] . "<br>";
}
}
if (intval($find_hits1) > 0 && intval($find_hits2) > 0 && $find_hits1 > $find_hits2) {
$str .= GetMessage("STAT_FROM_TILL_HITS") . "<br>";
}
$strError .= $str;
if (strlen($str) > 0) {
return false;
} else {
return true;
}
}
示例5: CheckFields
function CheckFields($ID, &$arFields)
{
$DB = CDatabase::GetModuleConnection('statistic');
$aMsg = array();
$arFields["TEST"] = "N";
unset($arFields["ID"]);
unset($arFields["TIMESTAMP_X"]);
$arFields["~TIMESTAMP_X"] = $DB->GetNowFunction();
if (strlen($arFields["SITE_ID"]) <= 0 || $arFields["SITE_ID"] == "NOT_REF") {
$arFields["SITE_ID"] = false;
}
if ($arFields["ACTIVE"] != "N") {
$arFields["ACTIVE"] = "Y";
}
if ($arFields["SAVE_STATISTIC"] != "Y") {
$arFields["SAVE_STATISTIC"] = "N";
}
$arIPFields = array("IP_1", "IP_2", "IP_3", "IP_4", "MASK_1", "MASK_2", "MASK_3", "MASK_4");
foreach ($arIPFields as $FIELD_ID) {
if (strlen(trim($arFields[$FIELD_ID])) > 0) {
$arFields[$FIELD_ID] = intval($arFields[$FIELD_ID]);
if ($arFields[$FIELD_ID] < 0) {
$arFields[$FIELD_ID] = 0;
} elseif ($arFields[$FIELD_ID] > 255) {
$arFields[$FIELD_ID] = 255;
}
} else {
$arFields[$FIELD_ID] = false;
}
}
if ($arFields["USER_AGENT_IS_NULL"] != "Y") {
$arFields["USER_AGENT_IS_NULL"] = "N";
}
if (strlen($arFields["DATE_END"]) > 0 && !CheckDateTime($arFields["DATE_END"])) {
$aMsg[] = array("id" => "DATE_END", "text" => GetMessage("STAT_WRONG_END_DATE"));
}
if (strlen($arFields["DATE_START"]) > 0 && !CheckDateTime($arFields["DATE_START"])) {
$aMsg[] = array("id" => "DATE_START", "text" => GetMessage("STAT_WRONG_START_DATE"));
}
$arTestFields = $arFields;
$arTestFields["TEST"] = "Y";
$TEST_ID = $DB->Add("b_stop_list", $arTestFields);
$TEST_ID = intval($TEST_ID);
$TEST_STOP_ID = $this->Check("Y");
$TEST_STOP_ID = intval($TEST_STOP_ID);
if ($TEST_ID == $TEST_STOP_ID && $TEST_STOP_ID > 0 && $TEST_ID > 0) {
$aMsg[] = array("id" => "WRONG_PARAMS", "text" => GetMessage("STAT_WRONG_STOPLIST_PARAMS"));
}
$DB->Query("DELETE FROM b_stop_list WHERE ID='" . $TEST_ID . "'");
if (!empty($aMsg)) {
$e = new CAdminException($aMsg);
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
}
return true;
}
示例6: validate
public function validate($value, $primary, array $row, Entity\Field $field)
{
if ($value instanceof Type\DateTime) {
// self-validating object
return true;
}
if (\CheckDateTime($value, FORMAT_DATE)) {
return true;
}
return $this->getErrorMessage($value, $field);
}
示例7: CheckFilterDates
function CheckFilterDates($date1, $date2, &$date1_wrong, &$date2_wrong, &$date2_less_date1)
{
global $DB;
$date1 = trim($date1);
$date2 = trim($date2);
$date1_wrong = "N";
$date2_wrong = "N";
$date2_less_date1 = "N";
if (strlen($date1)>0 && !CheckDateTime($date1)) $date1_wrong = "Y";
if (strlen($date2)>0 && !CheckDateTime($date2)) $date2_wrong = "Y";
if ($date1_wrong!="Y" && $date2_wrong!="Y" && strlen($date1)>0 && strlen($date2)>0 && $DB->CompareDates($date2,$date1)<0) $date2_less_date1="Y";
}
示例8: CheckFDate
function CheckFDate($date, $mess) // date check
{
global $strError;
if (strlen($date)>0)
{
$str = "";
if (!CheckDateTime($date)) $str.= $mess."<br>";
$strError .= $str;
if (strlen($str)>0) return false;
}
return true;
}
示例9: CheckFilter
function CheckFilter()
{
$str = "";
if (strlen($_REQUEST["find_timestamp_x_1"]) > 0) {
if (!CheckDateTime($_REQUEST["find_timestamp_x_1"], CSite::GetDateFormat("FULL"))) {
$str .= GetMessage("MAIN_EVENTLOG_WRONG_TIMESTAMP_X_FROM") . "<br>";
}
}
if (strlen($_REQUEST["find_timestamp_x_2"]) > 0) {
if (!CheckDateTime($_REQUEST["find_timestamp_x_2"], CSite::GetDateFormat("FULL"))) {
$str .= GetMessage("MAIN_EVENTLOG_WRONG_TIMESTAMP_X_TO") . "<br>";
}
}
if (strlen($str) > 0) {
global $lAdmin;
$lAdmin->AddFilterError($str);
return false;
}
return true;
}
示例10: GetDynamicList
/**
* <p>Возвращает количество <a href="http://dev.1c-bitrix.ru/api_help/statistic/terms.php#search_hit">хитов</a> (проиндексированных страниц), для указанной <a href="http://dev.1c-bitrix.ru/api_help/statistic/terms.php#search">поисковой системы</a> в разрезе по дням.</p>
*
*
* @param int $searcher_id ID поисковой системы. </ht
*
* @param string &$by = "s_date" Поле для сортировки. Возможные значения: <ul><li> <b>s_date</b> - дата. </li></ul>
*
* @param string &$order = "desc" Порядок сортировки. Возможные значения: <ul> <li> <b>asc</b> - по
* возрастанию; </li> <li> <b>desc</b> - по убыванию. </li> </ul>
*
* @param array &$max_min Ссылка на массив содержащий максимальную и минимальную даты
* результирующего списка. Структура данного массива: <pre> Array (
* [DATE_FIRST] => минимальная дата [MIN_DAY] => номер дня для минимальной
* даты (1-31) [MIN_MONTH] => номер месяца для минимальной даты (1-12) [MIN_YEAR] =>
* номер года для минимальной даты [DATE_LAST] => максимальная дата [MAX_DAY]
* => номер дня для максимальной даты (1-31) [MAX_MONTH] => номер месяца для
* максимальной даты (1-12) [MAX_YEAR] => номер года для максимальной даты
* )</pre>
*
* @param array $filter = array() Массив для фильтрации результирующего списка. В массиве
* допустимы следующие ключи: <ul> <li> <b>DATE1</b> - начальное значение
* интервала для поля "дата"; </li> <li> <b>DATE2</b> - конечное значение
* интервала для поля "дата". </li> </ul>
*
* @return CDBResult
*
* <h4>Example</h4>
* <pre>
* <?
* $searcher_id = 1;
*
* // установим фильтр на декабрь 2005 года
* $arFilter = array(
* "DATE1" => "01.12.2005",
* "DATE2" => "31.12.2005"
* );
*
* // получим набор записей
* $rs = <b>CSearcher::GetDynamicList</b>(
* $searcher_id,
* ($by="s_date"),
* ($order="desc"),
* $arMaxMin,
* $arFilter
* );
*
* // выведем массив с максимальной и минимальной датами
* echo "<pre>"; print_r($arMaxMin); echo "</pre>";
*
* // выведем все записи
* while ($ar = $rs->Fetch())
* {
* echo "<pre>"; print_r($ar); echo "</pre>";
* }
* ?>
* </pre>
*
*
* <h4>See Also</h4>
* <ul><li> <a href="http://dev.1c-bitrix.ru/api_help/statistic/terms.php#search_hit">Термин "Хит
* поисковой системы"</a> </li></ul> <a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/statistic/classes/csearcher/getdynamiclist.php
* @author Bitrix
*/
public static function GetDynamicList($SEARCHER_ID, &$by, &$order, &$arMaxMin, $arFilter = array())
{
$err_mess = "File: " . __FILE__ . "<br>Line: ";
$DB = CDatabase::GetModuleConnection('statistic');
$SEARCHER_ID = intval($SEARCHER_ID);
$arSqlSearch = array();
$strSqlSearch = "";
if (is_array($arFilter)) {
foreach ($arFilter as $key => $val) {
if (is_array($val)) {
if (count($val) <= 0) {
continue;
}
} else {
if (strlen($val) <= 0 || $val === "NOT_REF") {
continue;
}
}
$key = strtoupper($key);
switch ($key) {
case "DATE1":
if (CheckDateTime($val)) {
$arSqlSearch[] = "D.DATE_STAT>=" . $DB->CharToDateFunction($val, "SHORT");
}
break;
case "DATE2":
if (CheckDateTime($val)) {
$arSqlSearch[] = "D.DATE_STAT<" . $DB->CharToDateFunction($val, "SHORT") . " + INTERVAL 1 DAY";
}
break;
}
}
//.........这里部分代码省略.........
示例11: GetList
//.........这里部分代码省略.........
"CITY.REGION" => true,
"CITY.NAME" => true,
);
if (is_array($arFilter))
{
foreach ($arFilter as $key => $val)
{
if(is_array($val))
{
if(count($val) <= 0)
continue;
}
else
{
if( (strlen($val) <= 0) || ($val === "NOT_REF") )
continue;
}
$match_value_set = array_key_exists($key."_EXACT_MATCH", $arFilter);
$key = strtoupper($key);
switch($key)
{
case "ID":
$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("G.ID",$val,$match);
break;
case "REGISTERED":
if ($val=="Y")
$arSqlSearch[] = "G.LAST_USER_ID>0 and G.LAST_USER_ID is not null";
elseif ($val=="N")
$arSqlSearch[] = "G.LAST_USER_ID<=0 or G.LAST_USER_ID is null";
break;
case "FIRST_DATE1":
if (CheckDateTime($val))
$arSqlSearch[] = "G.FIRST_DATE >= ".$DB->CharToDateFunction($val, "SHORT");
break;
case "FIRST_DATE2":
if (CheckDateTime($val))
$arSqlSearch[] = "G.FIRST_DATE < ".CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
break;
case "LAST_DATE1":
if (CheckDateTime($val))
$arSqlSearch[] = "G.LAST_DATE >= ".$DB->CharToDateFunction($val, "SHORT");
break;
case "LAST_DATE2":
if (CheckDateTime($val))
$arSqlSearch[] = "G.LAST_DATE < ".CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
break;
case "PERIOD_DATE1":
ResetFilterLogic();
if (CheckDateTime($val))
{
$arSqlSearch[] = "S.DATE_FIRST >= ".$DB->CharToDateFunction($val, "SHORT");
$from0 = " INNER JOIN b_stat_session S ON (S.GUEST_ID = G.ID) ";
$select0 = "count(S.ID) as SESS,";
$bGroup = true;
}
break;
case "PERIOD_DATE2":
ResetFilterLogic();
if (CheckDateTime($val))
{
$arSqlSearch[] = "S.DATE_LAST < ".CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
$from0 = " INNER JOIN b_stat_session S ON (S.GUEST_ID = G.ID) ";
$select0 = "count(S.ID) as SESS,";
$bGroup = true;
示例12: Set
function Set($arFields, $OLD_SID, $CHECK_RIGHTS = "Y")
{
$err_mess = CAdvType_all::err_mess() . "<br>Function: Set<br>Line: ";
global $DB, $USER;
$SID = false;
$OLD_SID = trim($OLD_SID);
if (CAdvType::CheckFields($arFields, $OLD_SID, $CHECK_RIGHTS)) {
$arFields_i = array();
$arrKeys = array_keys($arFields);
if (in_array("SID", $arrKeys)) {
$arFields_i["SID"] = "'" . $DB->ForSql($arFields["SID"], 255) . "'";
}
if (in_array("ACTIVE", $arrKeys) && ($arFields["ACTIVE"] == "Y" || $arFields["ACTIVE"] == "N")) {
$arFields_i["ACTIVE"] = "'" . $arFields["ACTIVE"] . "'";
}
if (in_array("SORT", $arrKeys)) {
$arFields_i["SORT"] = "'" . intval($arFields["SORT"]) . "'";
}
if (in_array("NAME", $arrKeys)) {
$arFields_i["NAME"] = "'" . $DB->ForSql($arFields["NAME"], 255) . "'";
}
if (in_array("DESCRIPTION", $arrKeys)) {
$arFields_i["DESCRIPTION"] = "'" . $DB->ForSql($arFields["DESCRIPTION"], 2000) . "'";
}
if (count($arFields_i) > 0) {
if (strlen($OLD_SID) > 0) {
if (in_array("DATE_MODIFY", $arrKeys) && CheckDateTime($arFields["DATE_MODIFY"])) {
$arFields_i["DATE_MODIFY"] = $DB->CharToDateFunction($arFields["DATE_MODIFY"]);
} else {
$arFields_i["DATE_MODIFY"] = $DB->GetNowFunction();
}
if (in_array("MODIFIED_BY", $arrKeys)) {
$arFields_i["MODIFIED_BY"] = intval($arFields["MODIFIED_BY"]);
} else {
$arFields_i["MODIFIED_BY"] = $USER->GetID();
}
$str = "";
while (list($field, $value) = each($arFields_i)) {
if (strlen($value) <= 0) {
$str .= "{$field} = '', ";
} else {
$str .= "{$field} = {$value}, ";
}
}
$str = TrimEx($str, ",");
$strSql = "UPDATE b_adv_type SET " . $str . " WHERE SID='" . $DB->ForSql($OLD_SID, 255) . "'";
$DB->Query($strSql, false, $err_mess . __LINE__);
if (in_array("SID", $arrKeys)) {
$SID = $arFields["SID"];
// если SID изменился то
if ($arFields["SID"] != $OLD_SID) {
// обновим тип у баннеров
$arF = array("TYPE_SID" => "'" . $DB->ForSql($arFields["SID"], 255) . "'");
$DB->Update("b_adv_banner", $arF, "WHERE TYPE_SID='" . $DB->ForSql($OLD_SID, 255) . "'", $err_mess . __LINE__);
// обновим тип у баннеров
$arF = array("TYPE_SID" => "'" . $DB->ForSql($arFields["SID"], 255) . "'");
$DB->Update("b_adv_contract_2_type", $arF, "WHERE TYPE_SID='" . $DB->ForSql($OLD_SID, 255) . "'", $err_mess . __LINE__);
}
} else {
$SID = $OLD_SID;
}
} elseif (strlen($arFields_i["SID"]) > 0) {
if (in_array("DATE_CREATE", $arrKeys) && CheckDateTime($arFields["DATE_CREATE"])) {
$arFields_i["DATE_CREATE"] = $DB->CharToDateFunction($arFields["DATE_CREATE"]);
} else {
$arFields_i["DATE_CREATE"] = $DB->GetNowFunction();
}
if (in_array("CREATED_BY", $arrKeys)) {
$arFields_i["CREATED_BY"] = intval($arFields["CREATED_BY"]);
} else {
$arFields_i["CREATED_BY"] = $USER->GetID();
}
if (in_array("DATE_MODIFY", $arrKeys) && CheckDateTime($arFields["DATE_MODIFY"])) {
$arFields_i["DATE_MODIFY"] = $DB->CharToDateFunction($arFields["DATE_MODIFY"]);
} else {
$arFields_i["DATE_MODIFY"] = $DB->GetNowFunction();
}
if (in_array("MODIFIED_BY", $arrKeys)) {
$arFields_i["MODIFIED_BY"] = intval($arFields["MODIFIED_BY"]);
} else {
$arFields_i["MODIFIED_BY"] = $USER->GetID();
}
$str1 = $str2 = "";
while (list($field, $value) = each($arFields_i)) {
$str1 .= $field . ", ";
if (strlen($value) <= 0) {
$str2 .= "'', ";
} else {
$str2 .= "{$value}, ";
}
}
$str1 = TrimEx($str1, ",");
$str2 = TrimEx($str2, ",");
$strSql = "INSERT INTO b_adv_type (" . $str1 . ") VALUES (" . $str2 . ")";
$DB->Query($strSql, false, $err_mess . __LINE__);
$SID = $arFields["SID"];
}
}
} else {
$SID = $arFields["SID"];
//.........这里部分代码省略.........
示例13: Check
//.........这里部分代码省略.........
$arAnswerValues[] = $arrVALUES[$fname];
$ANSWER_ID = intval($arAnswer["ID"]);
$USER_TEXT = $arrVALUES[$fname];
if (strlen($USER_TEXT) > 0) {
if (!preg_match("/^(http|https|ftp):\\/\\//i", $USER_TEXT)) {
CForm::__check_PushError($errors, GetMessage('FORM_ERROR_BAD_URL'), $FIELD_SID);
}
if ($FIELD_REQUIRED == "Y") {
$REQUIRED_FIELDS[$FIELD_SID] = "Y";
break;
}
}
break;
case "email":
$fname = "form_" . $FIELD_TYPE . "_" . $arAnswer["ID"];
$arAnswerValues[] = $arrVALUES[$fname];
$ANSWER_ID = intval($arAnswer["ID"]);
$USER_TEXT = $arrVALUES[$fname];
if (strlen($USER_TEXT) > 0) {
if (!check_email($USER_TEXT)) {
CForm::__check_PushError($errors, GetMessage('FORM_ERROR_BAD_EMAIL'), $FIELD_SID);
}
if ($FIELD_REQUIRED == "Y") {
$REQUIRED_FIELDS[$FIELD_SID] = "Y";
break;
}
}
break;
case "date":
$fname = "form_" . $FIELD_TYPE . "_" . $arAnswer["ID"];
$arAnswerValues[] = $arrVALUES[$fname];
$USER_DATE = $arrVALUES[$fname];
if (strlen($USER_DATE) > 0) {
if (!CheckDateTime($USER_DATE)) {
CForm::__check_PushError($errors, str_replace("#FIELD_NAME#", $FIELD_TITLE, GetMessage("FORM_INCORRECT_DATE_FORMAT")), $FIELD_SID);
}
if ($FIELD_REQUIRED == "Y") {
$REQUIRED_FIELDS[$FIELD_SID] = "Y";
break;
}
}
break;
case "image":
$fname = "form_" . $FIELD_TYPE . "_" . $arAnswer["ID"];
$fname_del = $arrVALUES["form_" . $FIELD_TYPE . "_" . $arAnswer["ID"] . "_del"];
$ANSWER_ID = intval($arAnswer["ID"]);
$arIMAGE = isset($arrVALUES[$fname]) ? $arrVALUES[$fname] : $HTTP_POST_FILES[$fname];
if (is_array($arIMAGE) && strlen($arIMAGE["tmp_name"]) > 0) {
$arIMAGE["MODULE_ID"] = "form";
if (strlen(CFile::CheckImageFile($arIMAGE)) > 0) {
CForm::__check_PushError($errors, str_replace("#FIELD_NAME#", $FIELD_TITLE, GetMessage("FORM_INCORRECT_FILE_TYPE")), $FIELD_SID);
} else {
$arAnswerValues[] = $arIMAGE;
}
if ($FIELD_REQUIRED == "Y") {
$REQUIRED_FIELDS[$FIELD_SID] = "Y";
break;
}
} elseif ($RESULT_ID > 0 && $fname_del != "Y") {
$REQUIRED_FIELDS[$FIELD_SID] = "Y";
break;
}
break;
case "file":
$fname = "form_" . $FIELD_TYPE . "_" . $arAnswer["ID"];
$fname_del = $arrVALUES["form_" . $FIELD_TYPE . "_" . $arAnswer["ID"] . "_del"];
示例14: GetHistoryList
function GetHistoryList(&$by, &$order, $arFilter = array(), &$is_filtered)
{
$err_mess = CWorkflow::err_mess() . "<br>Function: GetHistoryList<br>Line: ";
global $DB;
$arSqlSearch = array();
$strSqlSearch = "";
if (is_array($arFilter)) {
foreach ($arFilter as $key => $val) {
if (strlen($val) <= 0 || "{$val}" == "NOT_REF") {
continue;
}
if (is_array($val) && count($val) <= 0) {
continue;
}
$match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter) ? true : false;
$key = strtoupper($key);
switch ($key) {
case "ID":
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("L.ID", $val, $match);
break;
case "DOCUMENT_ID":
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("L.DOCUMENT_ID", $val, $match);
break;
case "DATE_MODIFY_1":
if (CheckDateTime($val)) {
$arSqlSearch[] = "L.TIMESTAMP_X >= " . $DB->CharToDateFunction($val, "SHORT");
}
break;
case "DATE_MODIFY_2":
if (CheckDateTime($val)) {
$arSqlSearch[] = "L.TIMESTAMP_X < " . $DB->CharToDateFunction($val, "SHORT") . " + INTERVAL 1 DAY";
}
break;
case "MODIFIED_BY":
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("L.MODIFIED_BY", $val, $match);
break;
case "MODIFIED_USER":
$match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
$arSqlSearch[] = GetFilterQuery("L.MODIFIED_BY, U.LOGIN, U.NAME, U.LAST_NAME", $val, $match);
break;
case "TITLE":
case "SITE_ID":
$match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
$arSqlSearch[] = GetFilterQuery("L." . $key, $val, $match);
break;
case "FILENAME":
$match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
$arSqlSearch[] = GetFilterQuery("L.FILENAME", $val, $match, array("/", "\\", ".", "_"));
break;
case "BODY":
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("L.BODY", $val, $match, array(), "Y");
break;
case "STATUS":
$match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
$arSqlSearch[] = GetFilterQuery("L.STATUS_ID, S.TITLE", $val, $match);
break;
case "STATUS_ID":
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("L.STATUS_ID", $val, $match);
break;
}
}
}
if ($by == "s_id") {
$strSqlOrder = "ORDER BY L.ID";
} elseif ($by == "s_document_id") {
$strSqlOrder = "ORDER BY L.DOCUMENT_ID";
} elseif ($by == "s_date_modify") {
$strSqlOrder = "ORDER BY L.TIMESTAMP_X";
} elseif ($by == "s_modified_by") {
$strSqlOrder = "ORDER BY L.MODIFIED_BY";
} elseif ($by == "s_filename") {
$strSqlOrder = "ORDER BY L.FILENAME";
} elseif ($by == "s_site_id") {
$strSqlOrder = "ORDER BY L.SITE_ID";
} elseif ($by == "s_title") {
$strSqlOrder = "ORDER BY L.TITLE";
} elseif ($by == "s_status") {
$strSqlOrder = "ORDER BY L.STATUS_ID";
} else {
$by = "s_id";
$strSqlOrder = "ORDER BY L.ID";
}
if ($order != "asc") {
$strSqlOrder .= " desc ";
$order = "desc";
}
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
$strSql = "\n\t\t\tSELECT DISTINCT\n\t\t\t\tL.*,\n\t\t\t\t" . $DB->DateToCharFunction("L.TIMESTAMP_X") . " TIMESTAMP_X,\n\t\t\t\tconcat('(',U.LOGIN,') ',ifnull(U.NAME,''),' ',ifnull(U.LAST_NAME,'')) USER_NAME,\n\t\t\t\tS.TITLE STATUS_TITLE\n\t\t\tFROM\n\t\t\t\tb_workflow_log L\n\t\t\t\tLEFT JOIN b_workflow_status S ON (S.ID = L.STATUS_ID)\n\t\t\t\tLEFT JOIN b_user U ON (U.ID = L.MODIFIED_BY)\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\t{$strSqlOrder}\n\t\t\t";
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
$is_filtered = IsFiltered($strSqlSearch);
return $res;
}
示例15: IsDate
/**
* <p>Проверяет дату на корректность и возвращает "true" если дата корректна, в противном случае - "false". Динамичный метод.</p> <p> </p>
*
*
* @param string $date Строка с проверяемой датой.
*
* @param string $format = false Формат даты.<br> Необязательный. По умолчанию - "false" - определять
* формат по текущему сайту, либо языку (если административная
* часть).
*
* @param string $lang = false Код сайта для публичной части, либо код языка для
* административной части (для определения формата, если <i>format</i>
* равен false).<br>Необязательный. По умолчанию - текущий сайт, либо
* текущий язык (если административная часть).
*
* @param string $format_type = "SHORT" Тип формата даты: "FULL" - для даты со временем, "SHORT" - для даты (без
* времени) <br>Необязательный. По умолчанию "SHORT". С версии 3.3.7 до
* версии 4.1.0 назывался Type.
*
* @return bool
*
* <h4>Example</h4>
* <pre>
* <?
* if (!<b>$DB->IsDate</b>("12.10.2005 22:34:15", "DD.MM.YYYY HH:MI:SS"))
* echo "Ошибка. Неверный формат даты.";
* ?>
* </pre>
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/functions/date/index.php">Функции для работы с
* датой и временем</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/main/functions/filter/checkfilterdates.php">CheckFilterDates</a> </li> </ul> <a
* name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/main/reference/cdatabase/isdate.php
* @author Bitrix
*/
public static function IsDate($value, $format = false, $lang = false, $format_type = "SHORT")
{
if ($format === false) {
$format = CLang::GetDateFormat($format_type, $lang);
}
return CheckDateTime($value, $format);
}