Merge pull request #3321 from Alkarex/MySQL5.7
Fix for MySQL 5.7+ NO_ZERO_DATE
This commit is contained in:
commit
457cec3e0d
39 changed files with 142 additions and 142 deletions
|
@ -254,7 +254,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
|
|||
|
||||
// "bd" always contains the upcoming birthday of a contact.
|
||||
// "birthday" might contain the birthday including the year of birth.
|
||||
if ($profile["birthday"] != "0000-00-00") {
|
||||
if ($profile["birthday"] > '0001-01-01') {
|
||||
$bd_timestamp = strtotime($profile["birthday"]);
|
||||
$month = date("m", $bd_timestamp);
|
||||
$day = date("d", $bd_timestamp);
|
||||
|
@ -271,7 +271,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
|
|||
$profile["bd"] = (++$current_year)."-".$month."-".$day;
|
||||
}
|
||||
} else {
|
||||
$profile["bd"] = "0000-00-00";
|
||||
$profile["bd"] = '0001-01-01';
|
||||
}
|
||||
} else {
|
||||
$profile = $default;
|
||||
|
@ -307,7 +307,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
|
|||
$profile["location"] = "";
|
||||
$profile["about"] = "";
|
||||
$profile["gender"] = "";
|
||||
$profile["birthday"] = "0000-00-00";
|
||||
$profile["birthday"] = '0001-01-01';
|
||||
}
|
||||
|
||||
$cache[$url][$uid] = $profile;
|
||||
|
|
|
@ -126,7 +126,7 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
|
|||
// add 32 days so that we at least get year 00, and then hack around the fact that
|
||||
// months and days always start with 1.
|
||||
|
||||
if(substr($s,0,10) == '0000-00-00') {
|
||||
if(substr($s,0,10) <= '0001-01-01') {
|
||||
$d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC'));
|
||||
return str_replace('1','0',$d->format($fmt));
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ function dob($dob) {
|
|||
$f = get_config('system','birthday_input_format');
|
||||
if(! $f)
|
||||
$f = 'ymd';
|
||||
if($dob === '0000-00-00')
|
||||
if($dob <= '0001-01-01')
|
||||
$value = '';
|
||||
else
|
||||
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
|
||||
|
@ -189,7 +189,7 @@ function dob($dob) {
|
|||
)
|
||||
));
|
||||
|
||||
// if ($dob && $dob != '0000-00-00')
|
||||
// if ($dob && $dob > '0001-01-01')
|
||||
// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
|
||||
// else
|
||||
// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
|
||||
|
@ -553,7 +553,7 @@ function update_contact_birthdays() {
|
|||
// This only handles foreign or alien networks where a birthday has been provided.
|
||||
// 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` ");
|
||||
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` > '0001-01-01' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
|
||||
if (dbm::is_result($r)) {
|
||||
foreach ($r as $rr) {
|
||||
|
||||
|
|
|
@ -723,7 +723,7 @@ function db_definition() {
|
|||
"info" => array("type" => "mediumtext"),
|
||||
"profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
|
||||
"bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
|
||||
"bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
|
||||
"notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"ffi_keyword_blacklist" => array("type" => "text"),
|
||||
|
@ -882,7 +882,7 @@ function db_definition() {
|
|||
"about" => array("type" => "text"),
|
||||
"keywords" => array("type" => "text"),
|
||||
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
|
||||
"birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
|
||||
"birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
|
||||
"community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
|
||||
"hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
|
@ -1346,7 +1346,7 @@ function db_definition() {
|
|||
"hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
|
||||
"dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
|
||||
"address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
|
|
|
@ -554,7 +554,7 @@ class dfrn {
|
|||
xml::add_element($doc, $author, "poco:displayName", $profile["name"]);
|
||||
xml::add_element($doc, $author, "poco:updated", $namdate);
|
||||
|
||||
if (trim($profile["dob"]) != "0000-00-00")
|
||||
if (trim($profile["dob"]) > '0001-01-01')
|
||||
xml::add_element($doc, $author, "poco:birthday", "0000-".date("m-d", strtotime($profile["dob"])));
|
||||
|
||||
xml::add_element($doc, $author, "poco:note", $profile["about"]);
|
||||
|
@ -1402,7 +1402,7 @@ class dfrn {
|
|||
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"
|
||||
$value = $xpath->evaluate($element . "/poco:birthday/text()", $context)->item(0)->nodeValue;
|
||||
|
||||
if (!in_array($value, array("", "0000-00-00"))) {
|
||||
if (!in_array($value, array("", "0000-00-00", "0001-01-01"))) {
|
||||
$bdyear = date("Y");
|
||||
$value = str_replace("0000", $bdyear, $value);
|
||||
|
||||
|
|
|
@ -3591,7 +3591,7 @@ class Diaspora {
|
|||
if ($searchable === 'true') {
|
||||
$dob = '1000-00-00';
|
||||
|
||||
if (($profile['dob']) && ($profile['dob'] != '0000-00-00'))
|
||||
if (($profile['dob']) && ($profile['dob'] > '0001-01-01'))
|
||||
$dob = ((intval($profile['dob'])) ? intval($profile['dob']) : '1000') .'-'. datetime_convert('UTC','UTC',$profile['dob'],'m-d');
|
||||
|
||||
$about = $profile['about'];
|
||||
|
|
|
@ -628,7 +628,7 @@ function advanced_profile(App $a) {
|
|||
if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] );
|
||||
|
||||
|
||||
if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) {
|
||||
if(($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) {
|
||||
|
||||
$year_bd_format = t('j F, Y');
|
||||
$short_bd_format = t('j F');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue