本文整理汇总了PHP中ParseDateTime函数的典型用法代码示例。如果您正苦于以下问题:PHP ParseDateTime函数的具体用法?PHP ParseDateTime怎么用?PHP ParseDateTime使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseDateTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DoValidate
public static function DoValidate($arParams, $arQuestion, $arAnswers, $arValues)
{
global $APPLICATION;
foreach ($arValues as $value)
{
if (strlen($value) <= 0) continue;
// prepare check numbers
$arValueCheck = ParseDateTime($value);
$valueCheckSum = $arValueCheck["YYYY"] + $arValueCheck["MM"]/12 + $arValueCheck["DD"]/365;
$currentCheckSum = date("Y") + date("n")/12 + date("j")/365;
// check minimum age
if (strlen($arParams["AGE_TO"]) > 0 && $valueCheckSum < $currentCheckSum-$arParams["AGE_TO"])
{
$APPLICATION->ThrowException(GetMessage("FORM_VALIDATOR_VAL_DATE_AGE_ERROR_MORE"));
return false;
}
// check minimum age
if (strlen($arParams["AGE_FROM"]) > 0 && $valueCheckSum > $currentCheckSum-$arParams["AGE_FROM"])
{
$APPLICATION->ThrowException(GetMessage("FORM_VALIDATOR_VAL_DATE_AGE_ERROR_LESS"));
return false;
}
}
return true;
}
示例2: IsMaxDatabaseDate
public static function IsMaxDatabaseDate($datetime, $format = false)
{
$parts = ParseDateTime($datetime, is_string($format) && $format !== '' ? $format : FORMAT_DATETIME);
if (!is_array($parts)) {
return false;
}
$year = isset($parts['YYYY']) ? intval($parts['YYYY']) : 0;
return $year === 9999;
}
示例3: generateRow
/**
* Генерирует HTML для поля в списке
* @see AdminListHelper::addRowCell();
* @param CAdminListRow $row
* @param array $data - данные текущей строки
* @return mixed
*/
public function generateRow(&$row, $data)
{
if (isset($this->settings['EDIT_IN_LIST']) and $this->settings['EDIT_IN_LIST']) {
$row->AddCalendarField($this->getCode());
} else {
$arDate = ParseDateTime($this->getValue());
if ($arDate['YYYY'] < 10) {
$stDate = '-';
} else {
$stDate = ConvertDateTime($this->getValue(), "DD.MM.YYYY HH:MI:SS", "ru");
}
$row->AddViewField($this->getCode(), $stDate);
}
}
示例4: IsToday
function IsToday($date)
{
if ($date && ($arDate = ParseDateTime($date, CSite::GetDateFormat('SHORT')))) {
if (isset($arDate["M"])) {
if (is_numeric($arDate["M"])) {
$arDate["MM"] = intval($arDate["M"]);
} else {
$arDate["MM"] = GetNumMonth($arDate["M"], true);
if (!$arDate["MM"]) {
$arDate["MM"] = intval(date('m', strtotime($arDate["M"])));
}
}
} elseif (isset($arDate["MMMM"])) {
if (is_numeric($arDate["MMMM"])) {
$arDate["MM"] = intval($arDate["MMMM"]);
} else {
$arDate["MM"] = GetNumMonth($arDate["MMMM"]);
if (!$arDate["MM"]) {
$arDate["MM"] = intval(date('m', strtotime($arDate["MMMM"])));
}
}
}
return intval($arDate['MM']) == date('n') && intval($arDate['DD']) == date('j');
} else {
return false;
}
}
示例5: GetList
function GetList($arOrder = array("ID" => "DESC"), $arFilter = array())
{
global $DB;
$err_mess = "FILE: " . __FILE__ . "<br>LINE: ";
$arSqlSearch = array();
$arSqlOrder = array();
$arOFields = array("ID" => "A.ID", "ACTIVE" => "A.ACTIVE", "IS_PERIOD" => "A.IS_PERIOD", "NAME" => "A.NAME", "MODULE_ID" => "A.MODULE_ID", "USER_ID" => "A.USER_ID", "LAST_EXEC" => "A.LAST_EXEC", "AGENT_INTERVAL" => "A.AGENT_INTERVAL", "NEXT_EXEC" => "A.NEXT_EXEC", "SORT" => "A.SORT");
if (!is_array($arFilter)) {
$filter_keys = array();
} else {
$filter_keys = array_keys($arFilter);
}
for ($i = 0, $n = count($filter_keys); $i < $n; $i++) {
$val = $arFilter[$filter_keys[$i]];
$key = strtoupper($filter_keys[$i]);
if (strlen($val) <= 0 || $key == "USER_ID" && $val !== false && $val !== null) {
continue;
}
switch ($key) {
case "ID":
$arSqlSearch[] = "A.ID=" . IntVal($val);
break;
case "ACTIVE":
$t_val = strtoupper($val);
if ($t_val == "Y" || $t_val == "N") {
$arSqlSearch[] = "A.ACTIVE='" . $t_val . "'";
}
break;
case "IS_PERIOD":
$t_val = strtoupper($val);
if ($t_val == "Y" || $t_val == "N") {
$arSqlSearch[] = "A.IS_PERIOD='" . $t_val . "'";
}
break;
case "NAME":
$arSqlSearch[] = "A.NAME LIKE '" . $DB->ForSQLLike($val) . "'";
break;
case "MODULE_ID":
$arSqlSearch[] = "A.MODULE_ID = '" . $DB->ForSQL($val) . "'";
break;
case "USER_ID":
$arSqlSearch[] = "A.USER_ID " . (IntVal($val) <= 0 ? "IS NULL" : "=" . IntVal($val));
break;
case "LAST_EXEC":
$arr = ParseDateTime($val, CLang::GetDateFormat());
if ($arr) {
$date2 = mktime(0, 0, 0, $arr["MM"], $arr["DD"] + 1, $arr["YYYY"]);
$arSqlSearch[] = "A.LAST_EXEC>=" . $DB->CharToDateFunction($DB->ForSql($val), "SHORT") . " AND A.LAST_EXEC<" . $DB->CharToDateFunction(ConvertTimeStamp($date2), "SHORT");
}
break;
case "NEXT_EXEC":
$arr = ParseDateTime($val);
if ($arr) {
$date2 = mktime(0, 0, 0, $arr["MM"], $arr["DD"] + 1, $arr["YYYY"]);
$arSqlSearch[] = "A.NEXT_EXEC>=" . $DB->CharToDateFunction($DB->ForSql($val), "SHORT") . " AND A.NEXT_EXEC<" . $DB->CharToDateFunction(ConvertTimeStamp($date2), "SHORT");
}
break;
}
}
foreach ($arOrder as $by => $order) {
$by = strtoupper($by);
$order = strtoupper($order);
if (array_key_exists($by, $arOFields)) {
if ($order != "ASC") {
$order = "DESC" . ($DB->type == "ORACLE" ? " NULLS LAST" : "");
} else {
$order = "ASC" . ($DB->type == "ORACLE" ? " NULLS FIRST" : "");
}
$arSqlOrder[] = $arOFields[$by] . " " . $order;
}
}
$strSql = "SELECT A.ID, A.MODULE_ID, A.USER_ID, B.LOGIN, B.NAME as USER_NAME, B.LAST_NAME, A.SORT, " . "A.NAME, A.ACTIVE, " . $DB->DateToCharFunction("A.LAST_EXEC") . " as LAST_EXEC, " . $DB->DateToCharFunction("A.NEXT_EXEC") . " as NEXT_EXEC, " . "A.AGENT_INTERVAL, A.IS_PERIOD " . "FROM b_agent A LEFT JOIN b_user B ON(A.USER_ID = B.ID)";
$strSql .= count($arSqlSearch) > 0 ? " WHERE " . implode(" AND ", $arSqlSearch) : "";
$strSql .= count($arSqlOrder) > 0 ? " ORDER BY " . implode(", ", $arSqlOrder) : "";
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
return $res;
}
示例6: BuildRSS
//.........这里部分代码省略.........
$postPerm = CBlogComment::GetSocNetUserPerms($postID, $arPost["AUTHOR_ID"]);
}
else
$postPerm = CBlogPost::GetBlogUserCommentPerms($postID, IntVal($user_id));
if($postPerm >= BLOG_PERMS_READ)
{
$parser = new blogTextParser();
$arParserParams = Array(
"imageWidth" => $arPathTemplate["IMAGE_MAX_WIDTH"],
"imageHeight" => $arPathTemplate["IMAGE_MAX_HEIGHT"],
);
CTimeZone::Disable();
$dbComments = CBlogComment::GetList(
array("DATE_CREATE" => "DESC"),
array(
//"BLOG_ID" => $blogID,
"POST_ID" => $postID,
"PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
),
false,
array("nTopCount" => $numPosts),
array("ID", "TITLE", "DATE_CREATE", "POST_TEXT", "AUTHOR_EMAIL", "AUTHOR_ID", "AUTHOR_NAME", "USER_LOGIN", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_NAME", "BLOG_USER_ALIAS")
);
CTimeZone::Enable();
$arImages = Array();
$dbImages = CBlogImage::GetList(Array(), Array("BLOG_ID" => $blogID, "POST_ID" => $postID, "IS_COMMENT" => "Y", "!COMMENT_ID" => false));
while($arI = $dbImages->Fetch())
$arImages[$arI["ID"]] = $arI["FILE_ID"];
while ($arComments = $dbComments->Fetch())
{
$arDate = ParseDateTime($arComments["DATE_CREATE"], CSite::GetDateFormat("FULL", $arGroup["SITE_ID"]));
$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
if(strpos($url, "?") !== false)
$url1 = $url."&";
else
$url1 = $url."?";
$url1 .= "commentId=".$arComments["ID"]."#".$arComments["ID"];
$authorURL = "";
if(IntVal($arComments["AUTHOR_ID"]) > 0)
{
$author = CBlogUser::GetUserName($arComments["BLOG_USER_ALIAS"], $arComments["USER_NAME"], $arComments["USER_LAST_NAME"], $arComments["USER_LOGIN"], $arComments["USER_SECOND_NAME"]);
if(strLen($arPathTemplate["PATH_TO_USER"])>0)
$authorURL = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_USER"], array("user_id"=>$arComments["AUTHOR_ID"])));
else
$authorURL = htmlspecialcharsbx("http://".$serverName.CBlogUser::PreparePath($arComments["AUTHOR_ID"], $arGroup["SITE_ID"]));
}
else
$author = $arComments["AUTHOR_NAME"];
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "TABLE" => "Y", "CUT_ANCHOR" => "N");
if($arPathTemplate["NO_URL_IN_COMMENTS"] == "L" || (IntVal($arComments["AUTHOR_ID"]) <= 0 && $arPathTemplate["NO_URL_IN_COMMENTS"] == "A"))
$arAllow["CUT_ANCHOR"] = "Y";
if($arPathTemplate["NO_URL_IN_COMMENTS_AUTHORITY_CHECK"] == "Y" && $arAllow["CUT_ANCHOR"] != "Y" && IntVal($arComments["AUTHOR_ID"]) > 0)
{
$authorityRatingId = CRatings::GetAuthorityRating();
$arRatingResult = CRatings::GetRatingResult($authorityRatingId, $arComments["AUTHOR_ID"]);
if($arRatingResult["CURRENT_VALUE"] < $arPathTemplate["NO_URL_IN_COMMENTS_AUTHORITY"])
$arAllow["CUT_ANCHOR"] = "Y";
}
$text = $parser->convert_to_rss($arComments["POST_TEXT"], $arImages, $arAllow, false, $arParserParams);
示例7: FormatDateEx
function FormatDateEx($strDate, $format=false, $new_format=false)
{
$strDate = trim($strDate);
if (false === $format) $format = CSite::GetDateFormat('FULL');
if (false === $new_format) $new_format = CSite::GetDateFormat('FULL');
$new_format = str_replace("MI","I", $new_format);
$new_format = preg_replace("/([DMYIHGST])\\1+/is".BX_UTF_PCRE_MODIFIER, "\\1", $new_format);
$arFormat = preg_split('/[^0-9A-Za-z]/', strtoupper($format));
$arDate = preg_split('/[^A-Za-z0-9]/', $strDate);
$arParsedDate = ParseDateTime($strDate);
if (isset($arParsedDate["MMMM"]))
{
if (is_numeric($arParsedDate["MMMM"]))
{
$arParsedDate["MM"] = intval($arParsedDate["MMMM"]);
}
else
{
$arParsedDate["MM"] = GetNumMonth($arParsedDate["MMMM"]);
if (!$arParsedDate["MM"])
$arParsedDate["MM"] = intval(date('m', strtotime($arParsedDate["MMMM"])));
}
}
elseif (isset($arParsedDate["MM"]))
{
$arParsedDate["MM"] = intval($arParsedDate["MM"]);
}
elseif (isset($arParsedDate["M"]))
{
if (is_numeric($arParsedDate["M"]))
{
$arParsedDate["MM"] = intval($arParsedDate["M"]);
}
else
{
$arParsedDate["MM"] = GetNumMonth($arParsedDate["M"], true);
if (!$arParsedDate["MM"])
$arParsedDate["MM"] = intval(date('m', strtotime($arParsedDate["M"])));
}
}
if (isset($arParsedDate["H"]))
{
$arParsedDate["HH"] = intval($arParsedDate["H"]);
}
elseif (isset($arParsedDate["GG"]))
{
$arParsedDate["HH"] = intval($arParsedDate["GG"]);
}
elseif (isset($arParsedDate["G"]))
{
$arParsedDate["HH"] = intval($arParsedDate["G"]);
}
if (isset($arParsedDate['TT']) || isset($arParsedDate['T']))
{
$middletime = isset($arParsedDate['TT']) ? $arParsedDate['TT'] : $arParsedDate['T'];
if (strcasecmp('pm', $middletime)===0)
{
if ($arParsedDate["HH"] < 12)
$arParsedDate["HH"] += 12;
else
$arParsedDate["HH"] -= 12;
}
}
if (isset($arParsedDate["YYYY"]))
$arParsedDate["YY"] = $arParsedDate["YYYY"];
if (intval($arParsedDate["DD"])<=0 || intval($arParsedDate["MM"])<=0 || intval($arParsedDate["YY"])<=0)
return false;
$strResult = "";
if(intval($arParsedDate["YY"])>1970 && intval($arParsedDate["YY"])<2038)
{
$ux_time = mktime(
intval($arParsedDate["HH"]),
intval($arParsedDate["MI"]),
intval($arParsedDate["SS"]),
intval($arParsedDate["MM"]),
intval($arParsedDate["DD"]),
intval($arParsedDate["YY"])
);
for ($i=0; $i<strlen($new_format); $i++)
{
$simbol = substr($new_format, $i ,1);
switch ($simbol)
{
case "F":$match=GetMessage("MONTH_".date("n", $ux_time)."_S");break;
case "f":$match=GetMessage("MONTH_".date("n", $ux_time));break;
case "M":$match=GetMessage("MON_".date("n", $ux_time));break;
case "l":$match=GetMessage("DAY_OF_WEEK_".date("w", $ux_time));break;
case "D":$match=GetMessage("DOW_".date("w", $ux_time));break;
//.........这里部分代码省略.........
示例8: preg_replace
case 'PERSONAL_PHONE':
case 'PERSONAL_FAX':
case 'PERSONAL_MOBILE':
case 'WORK_PHONE':
case 'WORK_FAX':
if (StrLen($val) > 0) {
$valEncoded = preg_replace('/[^\\d\\+]+/', '', htmlspecialcharsbx($val));
$val = '<a href="callto:' . $valEncoded . '">' . htmlspecialcharsbx($val) . '</a>';
}
break;
case 'PERSONAL_GENDER':
$val = $val == 'F' ? GetMessage("MAIN_UL_SEX_F") : ($val == 'M' ? GetMessage("MAIN_UL_SEX_M") : "");
break;
case 'PERSONAL_BIRTHDAY':
if (StrLen($val) > 0) {
$arDateTmp = ParseDateTime($val, CSite::GetDateFormat('SHORT'));
$day = IntVal($arDateTmp["DD"]);
$month = IntVal($arDateTmp["MM"]);
$year = IntVal($arDateTmp["YYYY"]);
$val = $day . ' ' . ToLower(GetMessage('MONTH_' . $month . '_S'));
if ($arParams['SHOW_YEAR'] == 'Y' || $arParams['SHOW_YEAR'] == 'M' && $arResult["User"]['PERSONAL_GENDER'] == 'M') {
$val .= ' ' . $year;
}
$arResult['IS_BIRTHDAY'] = intval($arDateTmp['MM']) == date('n') && intval($arDateTmp['DD']) == date('j');
}
break;
case 'WORK_LOGO':
if (IntVal($val) > 0) {
$iSize = 150;
$imageFile = CFile::GetFileArray($val);
if ($imageFile !== false) {
示例9: timestamp
/**
* @param $date
* @return int
*/
public static function timestamp($time)
{
if (preg_match('{^\\d+$}', $time)) {
return $time;
}
if ($m = \ParseDateTime($time)) {
return mktime($m['HH'], $m['MI'], $m['SS'], $m['MM'], $m['DD'], $m['YYYY']);
}
return time();
}
示例10: prepareFilter
/**
* Creates filter for CSaleOrder::GetList() based on $_REQUEST and other parameters
* @return void
*/
protected function prepareFilter()
{
global $USER;
global $DB;
$arFilter = array();
$arFilter["USER_ID"] = $USER->GetID();
$arFilter["LID"] = SITE_ID;
if (strlen($_REQUEST["filter_id"])) {
if ($this->options['USE_ACCOUNT_NUMBER']) {
$arFilter["ACCOUNT_NUMBER"] = $_REQUEST["filter_id"];
} else {
$arFilter["ID"] = intval($_REQUEST["filter_id"]);
}
}
if (strlen($_REQUEST["filter_date_from"])) {
$arFilter["DATE_FROM"] = trim($_REQUEST["filter_date_from"]);
}
if (strlen($_REQUEST["filter_date_to"])) {
$arFilter["DATE_TO"] = trim($_REQUEST["filter_date_to"]);
if ($arDate = ParseDateTime(trim($_REQUEST["filter_date_to"]), $this->dateFormat)) {
if (StrLen(trim($_REQUEST["filter_date_to"])) < 11) {
$arDate["HH"] = 23;
$arDate["MI"] = 59;
$arDate["SS"] = 59;
}
$arFilter["DATE_TO"] = date($DB->DateFormatToPHP($this->dateFormat), mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
}
}
if (strlen($_REQUEST["filter_status"])) {
$arFilter["STATUS_ID"] = trim($_REQUEST["filter_status"]);
}
if (strlen($_REQUEST["filter_payed"])) {
$arFilter["PAYED"] = trim($_REQUEST["filter_payed"]);
}
if (!isset($_REQUEST['show_all']) || $_REQUEST['show_all'] == 'N') {
if ($_REQUEST["filter_history"] != "Y") {
$arFilter["!@COMPLETE_ORDERS"] = $this->arParams['HISTORIC_STATUSES'];
}
if (isset($_REQUEST["filter_history"]) && $_REQUEST["filter_history"] == "Y") {
$arFilter["@COMPLETE_ORDERS"] = $this->arParams['HISTORIC_STATUSES'];
}
}
if (strlen($_REQUEST["filter_canceled"])) {
$arFilter["CANCELED"] = trim($_REQUEST["filter_canceled"]);
}
$this->filter = $arFilter;
}
示例11: isset
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$arParams["SEARCH_FILTER_NAME"] = isset($arParams["SEARCH_FILTER_NAME"]) && strlen($arParams["SEARCH_FILTER_NAME"]) > 0 ? $arParams["SEARCH_FILTER_NAME"] : "sonet_search_filter";
$arParams["SEARCH_FILTER_DATE_NAME"] = isset($arParams["SEARCH_FILTER_DATE_NAME"]) && strlen($arParams["SEARCH_FILTER_DATE_NAME"]) > 0 ? $arParams["SEARCH_FILTER_DATE_NAME"] : "sonet_search_filter_date";
$arParams["SEARCH_RESTART"] = isset($arParams["SEARCH_RESTART"]) && $arParams["SEARCH_RESTART"] == "Y" ? $arParams["SEARCH_RESTART"] : "N";
$arParams["SEARCH_USE_LANGUAGE_GUESS"] = isset($arParams["SEARCH_USE_LANGUAGE_GUESS"]) && $arParams["SEARCH_USE_LANGUAGE_GUESS"] == "N" ? $arParams["SEARCH_USE_LANGUAGE_GUESS"] : "Y";
global ${$arParams["SEARCH_FILTER_NAME"]}, $sonet_search_settings;
$sonet_search_filter = array();
$EntityType = strpos($componentPage, "group_content_search") !== false ? SONET_ENTITY_GROUP : SONET_ENTITY_USER;
$sFilterDateTo = $_REQUEST[$arParams["SEARCH_FILTER_DATE_NAME"] . "_to"];
if ($arr = ParseDateTime($_REQUEST[$arParams["SEARCH_FILTER_DATE_NAME"] . "_to"])) {
if (intval($arr["HH"]) == 0 && intval($arr["MI"]) == 0 && intval($arr["SS"]) == 0) {
$arr["HH"] = "23";
$arr["MI"] = "59";
$arr["SS"] = "59";
$sDateTime = $arr["DD"] . "." . $arr["MM"] . "." . $arr["YYYY"] . " " . $arr["HH"] . ":" . $arr["MI"] . ":" . $arr["SS"];
$stmp = MakeTimeStamp($sDateTime, "DD.MM.YYYY HH:MI:SS");
$sFilterDateTo = ConvertTimeStamp($stmp, "FULL");
}
}
if (strlen($_REQUEST[$arParams["SEARCH_FILTER_NAME"]]) > 0) {
$sonet_search_filter["SONET_FEATURE"] = $_REQUEST[$arParams["SEARCH_FILTER_NAME"]];
}
if (strlen($_REQUEST[$arParams["SEARCH_FILTER_DATE_NAME"] . "_from"]) > 0) {
$sonet_search_filter[">=DATE_CHANGE"] = $_REQUEST[$arParams["SEARCH_FILTER_DATE_NAME"] . "_from"];
}
if (strlen($sFilterDateTo) > 0) {
$sonet_search_filter["<=DATE_CHANGE"] = $sFilterDateTo;
示例12: CronRun
public static function CronRun($profileID, $setup, $delete_cron = false)
{
$path2export = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/php_interface/include/exportpro/";
$logPath = $_SERVER["DOCUMENT_ROOT"] . "/upload/exportpro_log/";
$cron_period = intval($setup["PERIOD"]);
$dirExport = !preg_match("/.+\\..{3,}/", $setup["URL_DATA_FILE"], $arMatches);
if ($dirExport) {
$path2export = $_SERVER["DOCUMENT_ROOT"] . $setup["URL_DATA_FILE"];
}
// Получаем список записей в crontab
$cfg_data = "";
$cron_list = array();
@exec("crontab -l", $cron_list);
CheckDirPath($path2export);
CheckDirPath($logPath);
$datetime = $setup["DAT_START"];
$format = CSite::GetDateFormat();
$date = ParseDateTime($datetime, $format);
$starttime = intval($date["HH"]);
$cronTime = array();
if ($cron_period <= 0) {
$cronTime[] = intval($date["MI"]) . " " . intval($date["HH"]) . " " . intval($date["DD"]) . " " . intval($date["MM"]) . " * ";
} elseif ($cron_period < 24) {
$cronHours = array($starttime);
for ($i = 0; $i < 24; $i++) {
$starttime += $cron_period;
$starttime = $starttime > 23 ? $starttime - 24 : $starttime;
$cronHours[] = $starttime;
}
sort($cronHours);
$cronHours = array_unique($cronHours);
$cronTime[] = intval($date["MI"]) . " " . implode(",", $cronHours) . " * * * ";
} elseif ($cron_period > 23 && $cron_period < 720) {
$cron_period_mod = $cron_period % 24;
$cron_period_div = intval($cron_period / 24);
if ($cron_period_mod == 0) {
$cron_period_div--;
$i = 2;
} else {
$i = 1;
}
$dateVal = 1 + $date["DD"] - 1;
$dateVal = $dateVal > 30 ? $dateVal - 30 : $dateVal;
$cronDaysHours = array($starttime => array($dateVal));
for ($i; $i < 31; $i++) {
$i += $cron_period_div;
$starttime += $cron_period_mod;
if ($starttime > 23) {
$starttime = $starttime - 24;
$i++;
}
$dateVal = $i + $date["DD"] - 1;
$dateVal = $dateVal > 30 ? $dateVal - 30 : $dateVal;
$cronDaysHours[$starttime][] = $dateVal;
}
foreach ($cronDaysHours as $hour => $days) {
$cronTime[] = intval($date["MI"]) . " " . $hour . " " . implode(",", $days) . " * * ";
}
}
foreach ($cron_list as $id => $cronRecord) {
if (strpos($cronRecord, "/acrit.exportpro/tools/cronrun.php {$profileID}")) {
unset($cron_list[$id]);
}
}
//$dateStart = ParseDateTime( $setup["DAT_START"], CSite::GetDateFormat( "FULL" ) );
//$strTimeNow = "{$dateStart["MI"]} {$dateStart["HH"]} {$dateStart["DD"]} {$dateStart["MM"]} *";
if (!$delete_cron) {
foreach ($cronTime as $strTime) {
$cron_list[] = "{$strTime} php -f {$_SERVER["DOCUMENT_ROOT"]}/bitrix/modules/acrit.exportpro/tools/cronrun.php {$profileID} \"{$_SERVER["DOCUMENT_ROOT"]}\"";
}
}
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/");
file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", implode(PHP_EOL, $cron_list) . PHP_EOL);
// Записываем новое значение в crontab
@exec("crontab " . $_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg");
}
示例13: array
}else{
$arComments = CCommentEx::getList(array("UF_USER_ID"=>$USER_ID, "UF_TEXT"=>$text, "UF_PROG_ID" => $prog_id), array("ID"));
}*/
$rsUser = CUser::GetByID($USER_ID);
$arUser = $rsUser->Fetch();
/*if(count($arComments)>0)
{
$result = array(
"status" => "warning",
"username" => trim($arUser["NAME"]." ".$arUser["LAST_NAME"]),
"user_photo" => CFile::GetPath($arUser["PERSONAL_PHOTO"]),
"publish_date" => $arDATE["DD"]." ".ToLower(GetMessage("MONTH_".intval($arDATE["MM"])."_S"))." ".$arDATE["YYYY"],
"comment_text" => $text,
"message" => "Такой комментарий уже добавлен вами."
);
}
else
{*/
$arDATE = ParseDateTime(date("d.m.Y"), FORMAT_DATETIME);
$res = CCommentEx::create(array("TEXT" => $text, "PROG_ID" => $prog_id));
if ($res === true) {
$result = array("status" => "success", "username" => trim($arUser["NAME"] . " " . $arUser["LAST_NAME"]), "user_avatar" => CFile::GetPath($arUser["PERSONAL_PHOTO"]), "publish_date" => $arDATE["DD"] . " " . ToLower(GetMessage("MONTH_" . intval($arDATE["MM"]) . "_S")) . " " . $arDATE["YYYY"], "comment_text" => $text);
} else {
$result["message"] = $res;
}
//}
} else {
$result["message"] = 'Введите сообщение.';
}
exit(json_encode($result));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
示例14: IntVal
if (strlen($_SESSION["spo_filter_canceled"]) > 0) {
$_REQUEST["filter_canceled"] = $_SESSION["spo_filter_canceled"];
}
if ($_SESSION["spo_filter_history"] == "Y") {
$_REQUEST["filter_history"] == "Y";
}
}
if (IntVal($_REQUEST["filter_id"]) > 0) {
$arFilter["ID"] = IntVal($_REQUEST["filter_id"]);
}
if (strlen($_REQUEST["filter_date_from"]) > 0) {
$arFilter["DATE_FROM"] = Trim($_REQUEST["filter_date_from"]);
}
if (strlen($_REQUEST["filter_date_to"]) > 0) {
$arFilter["DATE_TO"] = Trim($_REQUEST["filter_date_to"]);
if ($arDate = ParseDateTime(Trim($_REQUEST["filter_date_to"]), CSite::GetDateFormat("FULL", SITE_ID))) {
if (StrLen(Trim($_REQUEST["filter_date_to"])) < 11) {
$arDate["HH"] = 23;
$arDate["MI"] = 59;
$arDate["SS"] = 59;
}
$arFilter["DATE_TO"] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
}
}
if (strlen($_REQUEST["filter_status"]) > 0) {
$arFilter["STATUS_ID"] = Trim($_REQUEST["filter_status"]);
}
if (strlen($_REQUEST["filter_payed"]) > 0) {
$arFilter["PAYED"] = Trim($_REQUEST["filter_payed"]);
}
if ($_REQUEST["filter_history"] != "Y") {
示例15: foreach
if (count($arResult["COMMENTS"]) > 0) {
?>
in<?php
}
?>
">
<div class="block-header">
<h3 class="block-title">Отзывы</h3>
</div>
<div class="block-body">
<ul class="comments-list">
<?php
foreach ($arResult["COMMENTS"] as $arComment) {
$arUser = $arResult["USERS"][$arComment["UF_USER_ID"]];
$date = $arComment['UF_DATETIME']->toString();
$arDATE = ParseDateTime($date, FORMAT_DATETIME);
?>
<li>
<div class="user-avatar<?php
if (!$arUser["PERSONAL_PHOTO"]) {
?>
is-empty<?php
}
?>
">
<?php
if ($arUser["PERSONAL_PHOTO"]) {
?>
<img src="<?php
echo CFile::GetPath($arUser["PERSONAL_PHOTO"]);
?>