X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdatetime.php;h=9e1d4b55c9ba622c4242ac5db3f31c3721e12639;hb=1058b28ceabcec802932fc33bb79e6ce7814f945;hp=a17c405dc365ea391d3ada2fd0c3f16d82f3e855;hpb=af2909bf8fa971c222bb7b0fca2ccb373c570988;p=friendica.git diff --git a/include/datetime.php b/include/datetime.php index a17c405dc3..9e1d4b55c9 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -4,6 +4,7 @@ * @brief Some functions for date and time related tasks. */ +use \Friendica\Core\Config; /** * @brief Two-level sort for timezones. @@ -271,8 +272,9 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke $lang = substr(get_browser_language(), 0, 2); // Check if the detected language is supported by the picker - if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"))) - $lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en'); + if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"))) { + $lang = Config::get('system', 'language', 'en'); + } $o = ''; $dateformat = ''; @@ -337,7 +339,7 @@ function relative_date($posted_date, $format = null) { $abs = strtotime($localtime); - if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) { + if (is_null($posted_date) || $posted_date <= NULL_DATE || $abs === False) { return t('never'); } @@ -569,6 +571,17 @@ function update_contact_birthdays() { * */ + // Check for duplicates + $s = q("SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1", + intval($rr['uid']), + intval($rr['id']), + dbesc(datetime_convert('UTC','UTC', $nextbd)), + dbesc('birthday')); + + if (dbm::is_result($s)) { + continue; + } + $bdtext = sprintf( t('%s\'s birthday'), $rr['name']); $bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]') ;