Merge branch 'master' into develop
This commit is contained in:
commit
b9ab613777
164 changed files with 30233 additions and 26266 deletions
|
@ -361,7 +361,7 @@ function api_call(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
Logger::warning(API_LOG_PREFIX . 'not implemented', ['module' => 'api', 'action' => 'call']);
|
||||
Logger::warning(API_LOG_PREFIX . 'not implemented', ['module' => 'api', 'action' => 'call', 'query' => $a->query_string]);
|
||||
throw new NotImplementedException();
|
||||
} catch (HTTPException $e) {
|
||||
header("HTTP/1.1 {$e->getCode()} {$e->httpdesc}");
|
||||
|
@ -611,7 +611,7 @@ function api_get_user(App $a, $contact_id = null)
|
|||
'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"],
|
||||
|
@ -690,7 +690,7 @@ function api_get_user(App $a, $contact_id = null)
|
|||
'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"],
|
||||
|
@ -1271,7 +1271,7 @@ function api_status_show($type, $item_id)
|
|||
function api_get_last_status($ownerId, $uid)
|
||||
{
|
||||
$condition = [
|
||||
'owner-id' => $ownerId,
|
||||
'author-id'=> $ownerId,
|
||||
'uid' => $uid,
|
||||
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT],
|
||||
'private' => false
|
||||
|
|
|
@ -446,80 +446,3 @@ function drop_item($id, $return = '')
|
|||
//NOTREACHED
|
||||
}
|
||||
}
|
||||
|
||||
/* arrange the list in years */
|
||||
function list_post_dates($uid, $wall)
|
||||
{
|
||||
$dnow = DateTimeFormat::localNow('Y-m-d');
|
||||
|
||||
$dthen = Item::firstPostDate($uid, $wall);
|
||||
if (!$dthen) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Set the start and end date to the beginning of the month
|
||||
$dnow = substr($dnow, 0, 8) . '01';
|
||||
$dthen = substr($dthen, 0, 8) . '01';
|
||||
|
||||
$ret = [];
|
||||
|
||||
/*
|
||||
* Starting with the current month, get the first and last days of every
|
||||
* month down to and including the month of the first post
|
||||
*/
|
||||
while (substr($dnow, 0, 7) >= substr($dthen, 0, 7)) {
|
||||
$dyear = intval(substr($dnow, 0, 4));
|
||||
$dstart = substr($dnow, 0, 8) . '01';
|
||||
$dend = substr($dnow, 0, 8) . Temporal::getDaysInMonth(intval($dnow), intval(substr($dnow, 5)));
|
||||
$start_month = DateTimeFormat::utc($dstart, 'Y-m-d');
|
||||
$end_month = DateTimeFormat::utc($dend, 'Y-m-d');
|
||||
$str = L10n::getDay(DateTimeFormat::utc($dnow, 'F'));
|
||||
|
||||
if (empty($ret[$dyear])) {
|
||||
$ret[$dyear] = [];
|
||||
}
|
||||
|
||||
$ret[$dyear][] = [$str, $end_month, $start_month];
|
||||
$dnow = DateTimeFormat::utc($dnow . ' -1 month', 'Y-m-d');
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function posted_date_widget($url, $uid, $wall)
|
||||
{
|
||||
$o = '';
|
||||
|
||||
if (!Feature::isEnabled($uid, 'archives')) {
|
||||
return $o;
|
||||
}
|
||||
|
||||
// For former Facebook folks that left because of "timeline"
|
||||
/*
|
||||
* @TODO old-lost code?
|
||||
if ($wall && intval(PConfig::get($uid, 'system', 'no_wall_archive_widget')))
|
||||
return $o;
|
||||
*/
|
||||
|
||||
$visible_years = PConfig::get($uid, 'system', 'archive_visible_years', 5);
|
||||
|
||||
$ret = list_post_dates($uid, $wall);
|
||||
|
||||
if (!DBA::isResult($ret)) {
|
||||
return $o;
|
||||
}
|
||||
|
||||
$cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years;
|
||||
$cutoff = ((array_key_exists($cutoff_year, $ret))? true : false);
|
||||
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('posted_date_widget.tpl'),[
|
||||
'$title' => L10n::t('Archives'),
|
||||
'$size' => $visible_years,
|
||||
'$cutoff_year' => $cutoff_year,
|
||||
'$cutoff' => $cutoff,
|
||||
'$url' => $url,
|
||||
'$dates' => $ret,
|
||||
'$showmore' => L10n::t('show more')
|
||||
|
||||
]);
|
||||
return $o;
|
||||
}
|
||||
|
|
|
@ -8,10 +8,8 @@ use Friendica\Content\Smilies;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
/**
|
||||
* Turn user/group ACLs stored as angle bracketed text into arrays
|
||||
|
@ -186,21 +184,17 @@ function get_cats_and_terms($item)
|
|||
{
|
||||
$categories = [];
|
||||
$folders = [];
|
||||
|
||||
$matches = [];
|
||||
$first = true;
|
||||
$cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$categories[] = [
|
||||
'name' => XML::escape(FileTag::decode($mtch[1])),
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid'])?'filerm/' . $item['id'] . '?f=&cat=' . XML::escape(FileTag::decode($mtch[1])):""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
$first = false;
|
||||
}
|
||||
|
||||
foreach (FileTag::fileToArray($item['file'] ?? '', 'category') as $savedFolderName) {
|
||||
$categories[] = [
|
||||
'name' => $savedFolderName,
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&cat=' . rawurlencode($savedFolderName) : ""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
$first = false;
|
||||
}
|
||||
|
||||
if (count($categories)) {
|
||||
|
@ -208,20 +202,15 @@ function get_cats_and_terms($item)
|
|||
}
|
||||
|
||||
if (local_user() == $item['uid']) {
|
||||
$matches = [];
|
||||
$first = true;
|
||||
$cnt = preg_match_all('/\[(.*?)\]/', $item['file'], $matches, PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$folders[] = [
|
||||
'name' => XML::escape(FileTag::decode($mtch[1])),
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . XML::escape(FileTag::decode($mtch[1])) : ""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
$first = false;
|
||||
}
|
||||
foreach (FileTag::fileToArray($item['file'] ?? '') as $savedFolderName) {
|
||||
$folders[] = [
|
||||
'name' => $savedFolderName,
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . rawurlencode($savedFolderName) : ""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
$first = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue