* @brief Some functions for date and time related tasks.
*/
+use \Friendica\Core\Config;
/**
* @brief Two-level sort for timezones.
$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 = '';
* Results relative to current timezone.
* Limited to range of timestamps.
*
- * @param string $posted_date
+ * @param string $posted_date MySQL-formatted date string (YYYY-MM-DD HH:MM:SS)
* @param string $format (optional) Parsed with sprintf()
* <tt>%1$d %2$s ago</tt>, e.g. 22 hours ago, 1 minute ago
*
if ($d >= 1) {
$r = round($d);
// translators - e.g. 22 hours ago, 1 minute ago
- if(! $format) {
+ if (!$format) {
$format = t('%1$d %2$s ago');
}
- return sprintf( $format,$r, (($r == 1) ? $str[0] : $str[1]));
+ return sprintf($format, $r, (($r == 1) ? $str[0] : $str[1]));
}
}
}
// In-network birthdays are handled within local_delivery
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
- if(count($r)) {
- foreach($r as $rr) {
+ if (dbm::is_result($r)) {
+ foreach ($r as $rr) {
logger('update_contact_birthday: ' . $rr['bd']);