'name' => $contact["name"],
'screen_name' => (($contact['nick']) ? $contact['nick'] : $contact['name']),
'location' => ($contact["location"] != "") ? $contact["location"] : ContactSelector::networkToName($contact['network'], $contact['url']),
- 'description' => $contact["about"],
+ 'description' => HTML::toPlaintext(BBCode::toPlaintext($contact["about"])),
'profile_image_url' => $contact["micro"],
'profile_image_url_https' => $contact["micro"],
'profile_image_url_profile_size' => $contact["thumb"],
'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']),
'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']),
'location' => $location,
- 'description' => $description,
+ 'description' => HTML::toPlaintext(BBCode::toPlaintext($description)),
'profile_image_url' => $uinfo[0]['micro'],
'profile_image_url_https' => $uinfo[0]['micro'],
'profile_image_url_profile_size' => $uinfo[0]["thumb"],
function api_get_last_status($ownerId, $uid)
{
$condition = [
- 'owner-id' => $ownerId,
+ 'author-id'=> $ownerId,
'uid' => $uid,
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT],
'private' => false
/**
* @file mod/uexport.php
*/
+
use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\Database\DBStructure;
function uexport_init(App $a) {
+ /// @todo Don't forget to move this global field as static field in src/Modules
+ global $dbStructure;
+
if (!local_user()) {
exit();
}
require_once("mod/settings.php");
settings_init($a);
+
+ $dbStructure = DBStructure::definition($a->getBasePath());
}
function uexport_content(App $a) {
}
function _uexport_multirow($query) {
+ global $dbStructure;
+
+ preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", $query, $match);
+ $table = $match[1];
+
$result = [];
$r = q($query);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$p = [];
foreach ($rr as $k => $v) {
- $p[$k] = $v;
+ switch ($dbStructure[$table]['fields'][$k]['type']) {
+ case 'datetime':
+ $p[$k] = $v ?? DBA::NULL_DATETIME;
+ break;
+ default:
+ $p[$k] = $v;
+ break;
+ }
}
$result[] = $p;
}
}
function _uexport_row($query) {
+ global $dbStructure;
+
+ preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", $query, $match);
+ $table = $match[1];
+
$result = [];
$r = q($query);
if (DBA::isResult($r)) {
+
foreach ($r as $rr) {
foreach ($rr as $k => $v) {
- $result[$k] = $v;
+ switch ($dbStructure[$table]['fields'][$k]['type']) {
+ case 'datetime':
+ $result[$k] = $v ?? DBA::NULL_DATETIME;
+ break;
+ default:
+ $result[$k] = $v;
+ break;
+ }
}
}
}
$tableColumns = DBStructure::getColumns($table);
$tcols = [];
+ $ttype = [];
// get a plain array of column names
foreach ($tableColumns as $tcol) {
$tcols[] = $tcol['Field'];
+ $ttype[$tcol['Field']] = $tcol['Type'];
}
// remove inexistent columns
foreach ($arr as $icol => $ival) {
if (!in_array($icol, $tcols)) {
unset($arr[$icol]);
+ continue;
+ }
+
+ if ($ttype[$icol] === 'datetime') {
+ $arr[$icol] = $ival ?? DBA::NULL_DATETIME;
}
}
}