diff --git a/include/Contact.php b/include/Contact.php index a1597cf304..fea4a2aaf1 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -577,16 +577,23 @@ function get_contact($url, $uid = 0, $no_update = false) { $url = $data["url"]; if (!$contact_id) { + if (!isset($data['priority'])) { + $data['priority'] = 0; + } + if (!isset($data['batch'])) { + $data['batch'] = ''; + } dba::insert('contact', array('uid' => $uid, 'created' => datetime_convert(), 'url' => $data["url"], 'nurl' => normalise_link($data["url"]), 'addr' => $data["addr"], 'alias' => $data["alias"], 'notify' => $data["notify"], 'poll' => $data["poll"], 'name' => $data["name"], 'nick' => $data["nick"], 'photo' => $data["photo"], 'network' => $data["network"], 'pubkey' => $data["pubkey"], 'rel' => CONTACT_IS_SHARING, 'priority' => $data["priority"], - 'batch' => $data["batch"], 'request' => $data["request"], 'confirm' => $data["confirm"], - 'poco' => $data["poco"], 'name-date' => datetime_convert(), - 'uri-date' => datetime_convert(), 'avatar-date' => datetime_convert(), - 'writable' => 1, 'blocked' => 0, 'readonly' => 0, 'pending' => 0)); + 'batch' => $data["batch"], 'request' => $data["request"], + 'confirm' => $data["confirm"], 'poco' => $data["poco"], + 'name-date' => datetime_convert(), 'uri-date' => datetime_convert(), + 'avatar-date' => datetime_convert(), 'writable' => 1, 'blocked' => 0, + 'readonly' => 0, 'pending' => 0)); $contacts = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d ORDER BY `id` LIMIT 2", dbesc(normalise_link($data["url"])), diff --git a/include/dba.php b/include/dba.php index e39e6f136e..49ec956453 100644 --- a/include/dba.php +++ b/include/dba.php @@ -647,8 +647,11 @@ class dba { $error = self::$dbo->error; $errorno = self::$dbo->errorno; + $sql = $args[0]; + array_shift($args); + logger('DB Error '.self::$dbo->errorno.': '.self::$dbo->error."\n". - $a->callstack(8))."\n".self::replace_parameters($sql, $args); + $a->callstack(8)."\n".self::replace_parameters($sql, $args)); self::$dbo->error = $error; self::$dbo->errorno = $errorno; @@ -711,8 +714,11 @@ class dba { $error = self::$dbo->error; $errorno = self::$dbo->errorno; + $sql = $args[0]; + array_shift($args); + logger('DB Error '.self::$dbo->errorno.': '.self::$dbo->error."\n". - $a->callstack(8))."\n".self::replace_parameters($sql, $args); + $a->callstack(8)."\n".self::replace_parameters($sql, $args)); self::$dbo->error = $error; self::$dbo->errorno = $errorno;