]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix for badly formatted date time string.
authorMichael <heluecht@pirati.ca>
Wed, 22 Feb 2017 22:04:56 +0000 (22:04 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 22 Feb 2017 22:04:56 +0000 (22:04 +0000)
include/dbm.php
include/socgraph.php

index 62ebb1af082526b8d12ea6eb4154688ffbedba86..0e12417501efd8cdae28eee5a7e00b8f7c3c39a0 100644 (file)
@@ -86,5 +86,16 @@ class dbm {
        public static function esc_array(&$arr, $add_quotation = false) {
                array_walk($arr, 'self::esc_array_callback', $add_quotation);
        }
+
+       /**
+        * Checks Converts any date string into a SQL compatible date string
+        *
+        * @param string $date a date string in any format
+        * @return string SQL style date string
+        */
+       public static function date($date) {
+               $timestamp = strtotime($date);
+               return date('Y-m-d H:i:s');
+       }
 }
 ?>
index 32c151c0431dace3e4951edb1c110f679e7f20dc..f0ce5875ad834a0d519aab72d6eb7cddbbe60e79 100644 (file)
@@ -622,7 +622,7 @@ function poco_last_updated($profile, $force = false) {
                        $last_updated = "0000-00-00 00:00:00";
 
        q("UPDATE `gcontact` SET `updated` = '%s', `last_contact` = '%s' WHERE `nurl` = '%s'",
-               dbesc($last_updated), dbesc(datetime_convert()), dbesc(normalise_link($profile)));
+               dbesc(dbm::date($last_updated)), dbesc(datetime_convert()), dbesc(normalise_link($profile)));
 
        if (($gcontacts[0]["generation"] == 0))
                q("UPDATE `gcontact` SET `generation` = 9 WHERE `nurl` = '%s'",