mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 04:05:16 +02:00
Merge branch 'master' into develop
This commit is contained in:
commit
b9ab613777
164 changed files with 30233 additions and 26266 deletions
|
@ -147,7 +147,7 @@ function cal_content(App $a)
|
|||
$sql_extra = " AND `event`.`cid` = 0 " . $sql_perms;
|
||||
|
||||
// get the tab navigation bar
|
||||
$tabs = Profile::getTabs($a, false, $a->data['user']['nickname']);
|
||||
$tabs = Profile::getTabs($a, 'cal', false, $a->data['user']['nickname']);
|
||||
|
||||
// The view mode part is similiar to /mod/events.php
|
||||
if ($mode == 'view') {
|
||||
|
|
|
@ -209,7 +209,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
*
|
||||
*/
|
||||
|
||||
$res = Network::post($dfrn_confirm, $params, null, $redirects, 120)->getBody();
|
||||
$res = Network::post($dfrn_confirm, $params, [], 120)->getBody();
|
||||
|
||||
Logger::log(' Confirm: received data: ' . $res, Logger::DATA);
|
||||
|
||||
|
|
|
@ -190,13 +190,13 @@ function dfrn_dispatch_public($postdata)
|
|||
}
|
||||
|
||||
// Fetch the corresponding public contact
|
||||
$contact = Contact::getDetailsByAddr($msg['author'], 0);
|
||||
if (!$contact) {
|
||||
$contact_id = Contact::getIdForURL($msg['author']);
|
||||
if (empty($contact_id)) {
|
||||
Logger::log('Contact not found for address ' . $msg['author']);
|
||||
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
|
||||
}
|
||||
|
||||
$importer = DFRN::getImporter($contact['id']);
|
||||
$importer = DFRN::getImporter($contact_id);
|
||||
|
||||
// This should never fail
|
||||
if (empty($importer)) {
|
||||
|
|
|
@ -476,7 +476,7 @@ function dfrn_request_post(App $a)
|
|||
|
||||
function dfrn_request_content(App $a)
|
||||
{
|
||||
if (($a->argc != 2) || (!count($a->profile))) {
|
||||
if ($a->argc != 2 || empty($a->profile)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
265
mod/dirfind.php
265
mod/dirfind.php
|
@ -1,265 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @file mod/dirfind.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
||||
function dirfind_init(App $a) {
|
||||
|
||||
if (! local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL );
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($a->page['aside'])) {
|
||||
$a->page['aside'] = '';
|
||||
}
|
||||
|
||||
$a->page['aside'] .= Widget::findPeople();
|
||||
|
||||
$a->page['aside'] .= Widget::follow();
|
||||
}
|
||||
|
||||
function dirfind_content(App $a, $prefix = "") {
|
||||
|
||||
$community = false;
|
||||
$discover_user = false;
|
||||
|
||||
$local = Config::get('system','poco_local_search');
|
||||
|
||||
$search = $prefix.Strings::escapeTags(trim(defaults($_REQUEST, 'search', '')));
|
||||
|
||||
$header = '';
|
||||
|
||||
if (strpos($search,'@') === 0) {
|
||||
$search = substr($search,1);
|
||||
$header = L10n::t('People Search - %s', $search);
|
||||
if ((filter_var($search, FILTER_VALIDATE_EMAIL) && Network::isEmailDomainValid($search)) ||
|
||||
(substr(Strings::normaliseLink($search), 0, 7) == "http://")) {
|
||||
$user_data = Probe::uri($search);
|
||||
$discover_user = (in_array($user_data["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]));
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($search,'!') === 0) {
|
||||
$search = substr($search,1);
|
||||
$community = true;
|
||||
$header = L10n::t('Forum Search - %s', $search);
|
||||
}
|
||||
|
||||
$o = '';
|
||||
|
||||
if ($search) {
|
||||
$pager = new Pager($a->query_string);
|
||||
|
||||
if ($discover_user) {
|
||||
$j = new stdClass();
|
||||
$j->total = 1;
|
||||
$j->items_page = 1;
|
||||
$j->page = $pager->getPage();
|
||||
|
||||
$objresult = new stdClass();
|
||||
$objresult->cid = 0;
|
||||
$objresult->name = $user_data["name"];
|
||||
$objresult->addr = $user_data["addr"];
|
||||
$objresult->url = $user_data["url"];
|
||||
$objresult->photo = $user_data["photo"];
|
||||
$objresult->tags = "";
|
||||
$objresult->network = $user_data["network"];
|
||||
|
||||
$contact = Model\Contact::getDetailsByURL($user_data["url"], local_user());
|
||||
$objresult->cid = $contact["cid"];
|
||||
$objresult->pcid = $contact["zid"];
|
||||
|
||||
$j->results[] = $objresult;
|
||||
|
||||
// Add the contact to the global contacts if it isn't already in our system
|
||||
if (($contact["cid"] == 0) && ($contact["zid"] == 0) && ($contact["gid"] == 0)) {
|
||||
Model\GContact::update($user_data);
|
||||
}
|
||||
} elseif ($local) {
|
||||
if ($community) {
|
||||
$extra_sql = " AND `community`";
|
||||
} else {
|
||||
$extra_sql = "";
|
||||
}
|
||||
|
||||
$pager->setItemsPerPage(80);
|
||||
|
||||
if (Config::get('system','diaspora_enabled')) {
|
||||
$diaspora = Protocol::DIASPORA;
|
||||
} else {
|
||||
$diaspora = Protocol::DFRN;
|
||||
}
|
||||
|
||||
if (!Config::get('system','ostatus_disabled')) {
|
||||
$ostatus = Protocol::OSTATUS;
|
||||
} else {
|
||||
$ostatus = Protocol::DFRN;
|
||||
}
|
||||
|
||||
$search2 = "%".$search."%";
|
||||
|
||||
/// @TODO These 2 SELECTs are not checked on validity with DBA::isResult()
|
||||
$count = q("SELECT count(*) AS `total` FROM `gcontact`
|
||||
WHERE NOT `hide` AND `network` IN ('%s', '%s', '%s', '%s') AND
|
||||
((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) AND
|
||||
(`url` LIKE '%s' OR `name` LIKE '%s' OR `location` LIKE '%s' OR
|
||||
`addr` LIKE '%s' OR `about` LIKE '%s' OR `keywords` LIKE '%s') $extra_sql",
|
||||
DBA::escape(Protocol::ACTIVITYPUB), DBA::escape(Protocol::DFRN), DBA::escape($ostatus), DBA::escape($diaspora),
|
||||
DBA::escape(Strings::escapeHtml($search2)), DBA::escape(Strings::escapeHtml($search2)), DBA::escape(Strings::escapeHtml($search2)),
|
||||
DBA::escape(Strings::escapeHtml($search2)), DBA::escape(Strings::escapeHtml($search2)), DBA::escape(Strings::escapeHtml($search2)));
|
||||
|
||||
$results = q("SELECT `nurl`
|
||||
FROM `gcontact`
|
||||
WHERE NOT `hide` AND `network` IN ('%s', '%s', '%s', '%s') AND
|
||||
((`last_contact` >= `last_failure`) OR (`updated` >= `last_failure`)) AND
|
||||
(`url` LIKE '%s' OR `name` LIKE '%s' OR `location` LIKE '%s' OR
|
||||
`addr` LIKE '%s' OR `about` LIKE '%s' OR `keywords` LIKE '%s') $extra_sql
|
||||
GROUP BY `nurl`
|
||||
ORDER BY `updated` DESC LIMIT %d, %d",
|
||||
DBA::escape(Protocol::ACTIVITYPUB), DBA::escape(Protocol::DFRN), DBA::escape($ostatus), DBA::escape($diaspora),
|
||||
DBA::escape(Strings::escapeHtml($search2)), DBA::escape(Strings::escapeHtml($search2)), DBA::escape(Strings::escapeHtml($search2)),
|
||||
DBA::escape(Strings::escapeHtml($search2)), DBA::escape(Strings::escapeHtml($search2)), DBA::escape(Strings::escapeHtml($search2)),
|
||||
$pager->getStart(), $pager->getItemsPerPage());
|
||||
$j = new stdClass();
|
||||
$j->total = $count[0]["total"];
|
||||
$j->items_page = $pager->getItemsPerPage();
|
||||
$j->page = $pager->getPage();
|
||||
foreach ($results AS $result) {
|
||||
if (PortableContact::alternateOStatusUrl($result["nurl"])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$urlparts = parse_url($result["nurl"]);
|
||||
|
||||
// Ignore results that look strange.
|
||||
// For historic reasons the gcontact table does contain some garbage.
|
||||
if (!empty($urlparts['query']) || !empty($urlparts['fragment'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$result = Model\Contact::getDetailsByURL($result["nurl"], local_user());
|
||||
|
||||
if ($result["name"] == "") {
|
||||
$result["name"] = end(explode("/", $urlparts["path"]));
|
||||
}
|
||||
|
||||
$objresult = new stdClass();
|
||||
$objresult->cid = $result["cid"];
|
||||
$objresult->pcid = $result["zid"];
|
||||
$objresult->name = $result["name"];
|
||||
$objresult->addr = $result["addr"];
|
||||
$objresult->url = $result["url"];
|
||||
$objresult->photo = $result["photo"];
|
||||
$objresult->tags = $result["keywords"];
|
||||
$objresult->network = $result["network"];
|
||||
|
||||
$j->results[] = $objresult;
|
||||
}
|
||||
|
||||
// Add found profiles from the global directory to the local directory
|
||||
Worker::add(PRIORITY_LOW, 'DiscoverPoCo', "dirsearch", urlencode($search));
|
||||
} elseif (strlen(Config::get('system','directory'))) {
|
||||
$p = (($pager->getPage() != 1) ? '&p=' . $pager->getPage() : '');
|
||||
|
||||
$x = Network::fetchUrl(get_server() . '/lsearch?f=' . $p . '&search=' . urlencode($search));
|
||||
|
||||
$j = json_decode($x);
|
||||
$pager->setItemsPerPage($j->items_page);
|
||||
}
|
||||
|
||||
if (!empty($j->results)) {
|
||||
$id = 0;
|
||||
|
||||
$entries = [];
|
||||
foreach ($j->results as $jj) {
|
||||
|
||||
$alt_text = "";
|
||||
|
||||
$contact_details = Model\Contact::getDetailsByURL($jj->url, local_user());
|
||||
|
||||
$itemurl = (($contact_details["addr"] != "") ? $contact_details["addr"] : $jj->url);
|
||||
|
||||
// If We already know this contact then don't show the "connect" button
|
||||
if ($jj->cid > 0) {
|
||||
$connlnk = "";
|
||||
$conntxt = "";
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
|
||||
if (DBA::isResult($contact)) {
|
||||
$photo_menu = Model\Contact::photoMenu($contact);
|
||||
$details = Module\Contact::getContactTemplateVars($contact);
|
||||
$alt_text = $details['alt_text'];
|
||||
} else {
|
||||
$photo_menu = [];
|
||||
}
|
||||
} else {
|
||||
$connlnk = System::baseUrl().'/follow/?url='.(!empty($jj->connect) ? $jj->connect : $jj->url);
|
||||
$conntxt = L10n::t('Connect');
|
||||
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $jj->pcid]);
|
||||
if (DBA::isResult($contact)) {
|
||||
$photo_menu = Model\Contact::photoMenu($contact);
|
||||
} else {
|
||||
$photo_menu = [];
|
||||
}
|
||||
|
||||
$photo_menu['profile'] = [L10n::t("View Profile"), Model\Contact::magicLink($jj->url)];
|
||||
$photo_menu['follow'] = [L10n::t("Connect/Follow"), $connlnk];
|
||||
}
|
||||
|
||||
$jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
|
||||
|
||||
$entry = [
|
||||
'alt_text' => $alt_text,
|
||||
'url' => Model\Contact::magicLink($jj->url),
|
||||
'itemurl' => $itemurl,
|
||||
'name' => $jj->name,
|
||||
'thumb' => ProxyUtils::proxifyUrl($jj->photo, false, ProxyUtils::SIZE_THUMB),
|
||||
'img_hover' => $jj->tags,
|
||||
'conntxt' => $conntxt,
|
||||
'connlnk' => $connlnk,
|
||||
'photo_menu' => $photo_menu,
|
||||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
'account_type' => Model\Contact::getAccountType($contact_details),
|
||||
'network' => ContactSelector::networkToName($jj->network, $jj->url),
|
||||
'id' => ++$id,
|
||||
];
|
||||
$entries[] = $entry;
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl,[
|
||||
'title' => $header,
|
||||
'$contacts' => $entries,
|
||||
'$paginate' => $pager->renderFull($j->total),
|
||||
]);
|
||||
} else {
|
||||
info(L10n::t('No matches') . EOL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
|
@ -84,6 +84,10 @@ function display_init(App $a)
|
|||
displayShowFeed($item['id'], $a->argc > 3 && $a->argv[3] == 'conversation.atom');
|
||||
}
|
||||
|
||||
if ($a->argc >= 3 && $nick == 'feed-item') {
|
||||
displayShowFeed($item['id'], $a->argc > 3 && $a->argv[3] == 'conversation.atom');
|
||||
}
|
||||
|
||||
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
|
||||
Logger::log('Directly serving XML for id '.$item["id"], Logger::DEBUG);
|
||||
displayShowFeed($item["id"], false);
|
||||
|
@ -186,16 +190,7 @@ function display_fetchauthor($a, $item)
|
|||
|
||||
$profiledata["photo"] = System::removedBaseUrl($profiledata["photo"]);
|
||||
|
||||
if (local_user()) {
|
||||
if (in_array($profiledata["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
|
||||
$profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
|
||||
}
|
||||
} elseif ($profiledata["network"] == Protocol::DFRN) {
|
||||
$connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]);
|
||||
$profiledata["remoteconnect"] = $connect;
|
||||
}
|
||||
|
||||
return($profiledata);
|
||||
return $profiledata;
|
||||
}
|
||||
|
||||
function display_content(App $a, $update = false, $update_uid = 0)
|
||||
|
|
|
@ -21,6 +21,7 @@ use Friendica\Module\Login;
|
|||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
function events_init(App $a)
|
||||
{
|
||||
|
@ -195,7 +196,7 @@ function events_post(App $a)
|
|||
$item_id = Event::store($datarray);
|
||||
|
||||
if (!$cid) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "event", $item_id);
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $item_id);
|
||||
}
|
||||
|
||||
$a->internalRedirect('events');
|
||||
|
@ -246,7 +247,7 @@ function events_content(App $a)
|
|||
$tabs = '';
|
||||
// tabs
|
||||
if ($a->theme_events_in_profile) {
|
||||
$tabs = Profile::getTabs($a, true);
|
||||
$tabs = Profile::getTabs($a, 'events', true);
|
||||
}
|
||||
|
||||
$mode = 'view';
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Worker;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
function fsuggest_post(App $a)
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ function fsuggest_post(App $a)
|
|||
'photo' => $contact['avatar'], 'note' => $note, 'created' => DateTimeFormat::utcNow()];
|
||||
DBA::insert('fsuggest', $fields);
|
||||
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', 'suggest', DBA::lastInsertId());
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, DBA::lastInsertId());
|
||||
|
||||
info(L10n::t('Friend suggestion sent.') . EOL);
|
||||
}
|
||||
|
|
17
mod/item.php
17
mod/item.php
|
@ -27,12 +27,12 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Attach;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Attach;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\Email;
|
||||
|
@ -40,6 +40,7 @@ use Friendica\Util\DateTimeFormat;
|
|||
use Friendica\Util\Emailer;
|
||||
use Friendica\Util\Security;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
require_once 'include/items.php';
|
||||
|
||||
|
@ -327,10 +328,9 @@ function item_post(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($categories))
|
||||
{
|
||||
if (!empty($categories)) {
|
||||
// get the "fileas" tags for this post
|
||||
$filedas = FileTag::fileToList($categories, 'file');
|
||||
$filedas = FileTag::fileToArray($categories);
|
||||
}
|
||||
|
||||
// save old and new categories, so we can determine what needs to be deleted from pconfig
|
||||
|
@ -338,10 +338,9 @@ function item_post(App $a) {
|
|||
$categories = FileTag::listToFile(trim(defaults($_REQUEST, 'category', '')), 'category');
|
||||
$categories_new = $categories;
|
||||
|
||||
if (!empty($filedas))
|
||||
{
|
||||
if (!empty($filedas) && is_array($filedas)) {
|
||||
// append the fileas stuff to the new categories list
|
||||
$categories .= FileTag::listToFile($filedas, 'file');
|
||||
$categories .= FileTag::arrayToFile($filedas);
|
||||
}
|
||||
|
||||
// get contact info for poster
|
||||
|
@ -605,8 +604,6 @@ function item_post(App $a) {
|
|||
$origin = $_REQUEST['origin'];
|
||||
}
|
||||
|
||||
$notify_type = ($toplevel_item_id ? 'comment-new' : 'wall-new');
|
||||
|
||||
$uri = ($message_id ? $message_id : Item::newURI($api_source ? $profile_uid : $uid, $guid));
|
||||
|
||||
// Fallback so that we alway have a parent uri
|
||||
|
@ -871,7 +868,7 @@ function item_post(App $a) {
|
|||
// When we are doing some forum posting via ! we have to start the notifier manually.
|
||||
// These kind of posts don't initiate the notifier call in the item class.
|
||||
if ($only_to_forum) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", $notify_type, $post_id);
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $post_id);
|
||||
}
|
||||
|
||||
Logger::log('post_complete');
|
||||
|
|
|
@ -78,9 +78,7 @@ function network_init(App $a)
|
|||
|
||||
// convert query string to array. remove friendica args
|
||||
$query_array = [];
|
||||
$query_string = str_replace($a->cmd . '?', '', $a->query_string);
|
||||
parse_str($query_string, $query_array);
|
||||
array_shift($query_array);
|
||||
parse_str(parse_url($a->query_string, PHP_URL_QUERY), $query_array);
|
||||
|
||||
// fetch last used network view and redirect if needed
|
||||
if (!$is_a_date_query) {
|
||||
|
@ -100,7 +98,7 @@ function network_init(App $a)
|
|||
|
||||
if ($remember_tab) {
|
||||
// redirect if current selected tab is '/network' and
|
||||
// last selected tab is _not_ '/network?f=&order=comment'.
|
||||
// last selected tab is _not_ '/network?order=comment'.
|
||||
// and this isn't a date query
|
||||
|
||||
$tab_baseurls = [
|
||||
|
@ -112,12 +110,12 @@ function network_init(App $a)
|
|||
'', //bookmarked
|
||||
];
|
||||
$tab_args = [
|
||||
'f=&order=comment', //all
|
||||
'f=&order=post', //postord
|
||||
'f=&conv=1', //conv
|
||||
'order=comment', //all
|
||||
'order=post', //postord
|
||||
'conv=1', //conv
|
||||
'', //new
|
||||
'f=&star=1', //starred
|
||||
'f=&bmark=1', //bookmarked
|
||||
'star=1', //starred
|
||||
'bmark=1', //bookmarked
|
||||
];
|
||||
|
||||
$k = array_search('active', $last_sel_tabs);
|
||||
|
@ -141,7 +139,7 @@ function network_init(App $a)
|
|||
|
||||
if ($remember_tab) {
|
||||
$net_args = array_merge($query_array, $net_args);
|
||||
$net_queries = build_querystring($net_args);
|
||||
$net_queries = http_build_query($net_args);
|
||||
|
||||
$redir_url = ($net_queries ? $net_baseurl . '?' . $net_queries : $net_baseurl);
|
||||
|
||||
|
@ -155,7 +153,7 @@ function network_init(App $a)
|
|||
|
||||
$a->page['aside'] .= Group::sidebarWidget('network/0', 'network', 'standard', $group_id);
|
||||
$a->page['aside'] .= ForumManager::widget(local_user(), $cid);
|
||||
$a->page['aside'] .= posted_date_widget('network', local_user(), false);
|
||||
$a->page['aside'] .= Widget::postedByYear('network', local_user(), false);
|
||||
$a->page['aside'] .= Widget::networks('network', defaults($_GET, 'nets', '') );
|
||||
$a->page['aside'] .= saved_searches($search);
|
||||
$a->page['aside'] .= Widget::fileAs('network', defaults($_GET, 'file', '') );
|
||||
|
@ -203,12 +201,12 @@ function saved_searches($search)
|
|||
*
|
||||
* urls -> returns
|
||||
* '/network' => $no_active = 'active'
|
||||
* '/network?f=&order=comment' => $comment_active = 'active'
|
||||
* '/network?f=&order=post' => $postord_active = 'active'
|
||||
* '/network?f=&conv=1', => $conv_active = 'active'
|
||||
* '/network?order=comment' => $comment_active = 'active'
|
||||
* '/network?order=post' => $postord_active = 'active'
|
||||
* '/network?conv=1', => $conv_active = 'active'
|
||||
* '/network/new', => $new_active = 'active'
|
||||
* '/network?f=&star=1', => $starred_active = 'active'
|
||||
* '/network?f=&bmark=1', => $bookmarked_active = 'active'
|
||||
* '/network?star=1', => $starred_active = 'active'
|
||||
* '/network?bmark=1', => $bookmarked_active = 'active'
|
||||
*
|
||||
* @param App $a
|
||||
* @return array ($no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active);
|
||||
|
@ -974,7 +972,7 @@ function network_tabs(App $a)
|
|||
$tabs = [
|
||||
[
|
||||
'label' => L10n::t('Commented Order'),
|
||||
'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . (!empty($_GET['cid']) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'url' => str_replace('/new', '', $cmd) . '?order=comment' . (!empty($_GET['cid']) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $all_active,
|
||||
'title' => L10n::t('Sort by Comment Date'),
|
||||
'id' => 'commented-order-tab',
|
||||
|
@ -982,7 +980,7 @@ function network_tabs(App $a)
|
|||
],
|
||||
[
|
||||
'label' => L10n::t('Posted Order'),
|
||||
'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . (!empty($_GET['cid']) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'url' => str_replace('/new', '', $cmd) . '?order=post' . (!empty($_GET['cid']) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $postord_active,
|
||||
'title' => L10n::t('Sort by Post Date'),
|
||||
'id' => 'posted-order-tab',
|
||||
|
@ -992,7 +990,7 @@ function network_tabs(App $a)
|
|||
|
||||
$tabs[] = [
|
||||
'label' => L10n::t('Personal'),
|
||||
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
|
||||
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
|
||||
'sel' => $conv_active,
|
||||
'title' => L10n::t('Posts that mention or involve you'),
|
||||
'id' => 'personal-tab',
|
||||
|
@ -1002,7 +1000,7 @@ function network_tabs(App $a)
|
|||
if (Feature::isEnabled(local_user(), 'new_tab')) {
|
||||
$tabs[] = [
|
||||
'label' => L10n::t('New'),
|
||||
'url' => 'network/new' . (!empty($_GET['cid']) ? '/?f=&cid=' . $_GET['cid'] : ''),
|
||||
'url' => 'network/new' . (!empty($_GET['cid']) ? '/?cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $new_active,
|
||||
'title' => L10n::t('Activity Stream - by date'),
|
||||
'id' => 'activitiy-by-date-tab',
|
||||
|
@ -1013,7 +1011,7 @@ function network_tabs(App $a)
|
|||
if (Feature::isEnabled(local_user(), 'link_tab')) {
|
||||
$tabs[] = [
|
||||
'label' => L10n::t('Shared Links'),
|
||||
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
|
||||
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
|
||||
'sel' => $bookmarked_active,
|
||||
'title' => L10n::t('Interesting Links'),
|
||||
'id' => 'shared-links-tab',
|
||||
|
@ -1023,7 +1021,7 @@ function network_tabs(App $a)
|
|||
|
||||
$tabs[] = [
|
||||
'label' => L10n::t('Starred'),
|
||||
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
|
||||
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?cid=' . $_GET['cid'] : '/?f=') . '&star=1',
|
||||
'sel' => $starred_active,
|
||||
'title' => L10n::t('Favourite Posts'),
|
||||
'id' => 'starred-posts-tab',
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @file mod/newmember.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
||||
function newmember_content(App $a)
|
||||
{
|
||||
$o = '<div class="generic-page-wrapper">';
|
||||
$o .= '<h1>' . L10n::t('Welcome to Friendica') . '</h1>';
|
||||
$o .= '<h3>' . L10n::t('New Member Checklist') . '</h3>';
|
||||
$o .= '<div style="font-size: 120%;">';
|
||||
$o .= L10n::t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
|
||||
$o .= '<h4>' . L10n::t('Getting Started') . '</h4>';
|
||||
$o .= '<ul>';
|
||||
$o .= '<li> ' . '<a target="newmember" href="help/Quick-Start-guide">' . L10n::t('Friendica Walk-Through') . '</a><br />' . L10n::t('On your <em>Quick Start</em> page - find a brief introduction to your profile and network tabs, make some new connections, and find some groups to join.') . '</li>' . EOL;
|
||||
$o .= '</ul>';
|
||||
$o .= '<h4>' . L10n::t('Settings') . '</h4>';
|
||||
$o .= '<ul>';
|
||||
$o .= '<li>' . '<a target="newmember" href="settings">' . L10n::t('Go to Your Settings') . '</a><br />' . L10n::t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</li>' . EOL;
|
||||
$o .= '<li>' . L10n::t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</li>' . EOL;
|
||||
$o .= '</ul>';
|
||||
$o .= '<h4>' . L10n::t('Profile') . '</h4>';
|
||||
$o .= '<ul>';
|
||||
$o .= '<li>' . '<a target="newmember" href="profile_photo">' . L10n::t('Upload Profile Photo') . '</a><br />' . L10n::t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</li>' . EOL;
|
||||
$o .= '<li>' . '<a target="newmember" href="profiles">' . L10n::t('Edit Your Profile') . '</a><br />' . L10n::t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</li>' . EOL;
|
||||
$o .= '<li>' . '<a target="newmember" href="profiles">' . L10n::t('Profile Keywords') . '</a><br />' . L10n::t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</li>' . EOL;
|
||||
$o .= '</ul>';
|
||||
$o .= '<h4>' . L10n::t('Connecting') . '</h4>';
|
||||
$o .= '<ul>';
|
||||
|
||||
$mail_disabled = ((function_exists('imap_open') && (!Config::get('system', 'imap_disabled'))) ? 0 : 1);
|
||||
|
||||
if (!$mail_disabled) {
|
||||
$o .= '<li>' . '<a target="newmember" href="settings/connectors">' . L10n::t('Importing Emails') . '</a><br />' . L10n::t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL;
|
||||
}
|
||||
|
||||
$o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Go to Your Contacts Page') . '</a><br />' . L10n::t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL;
|
||||
$o .= '<li>' . '<a target="newmember" href="directory">' . L10n::t("Go to Your Site's Directory") . '</a><br />' . L10n::t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL;
|
||||
$o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Finding New People') . '</a><br />' . L10n::t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</li>' . EOL;
|
||||
$o .= '</ul>';
|
||||
$o .= '<h4>' . L10n::t('Groups') . '</h4>';
|
||||
$o .= '<ul>';
|
||||
$o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Group Your Contacts') . '</a><br />' . L10n::t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL;
|
||||
|
||||
if (Config::get('system', 'newuser_private')) {
|
||||
$o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . L10n::t("Why Aren't My Posts Public?") . '</a><br />' . L10n::t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL;
|
||||
}
|
||||
|
||||
$o .= '</ul>';
|
||||
$o .= '<h4>' . L10n::t('Getting Help') . '</h4>';
|
||||
$o .= '<ul>';
|
||||
$o .= '<li>' . '<a target="newmember" href="help">' . L10n::t('Go to the Help Section') . '</a><br />' . L10n::t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</li>' . EOL;
|
||||
$o .= '</ul>';
|
||||
$o .= '</div>';
|
||||
$o .= '</div>';
|
||||
|
||||
return $o;
|
||||
}
|
|
@ -28,7 +28,7 @@ function notes_content(App $a, $update = false)
|
|||
return;
|
||||
}
|
||||
|
||||
$o = Profile::getTabs($a, true);
|
||||
$o = Profile::getTabs($a, 'notes', true);
|
||||
|
||||
if (!$update) {
|
||||
$o .= '<h3>' . L10n::t('Personal Notes') . '</h3>';
|
||||
|
|
|
@ -121,6 +121,9 @@ function notifications_content(App $a)
|
|||
} elseif (($a->argc > 1) && ($a->argv[1] == 'home')) {
|
||||
$notif_header = L10n::t('Home Notifications');
|
||||
$notifs = $nm->homeNotifs($show, $startrec, $perpage);
|
||||
// fallback - redirect to main page
|
||||
} else {
|
||||
$a->internalRedirect('notifications');
|
||||
}
|
||||
|
||||
// Set the pager
|
||||
|
|
|
@ -9,12 +9,14 @@
|
|||
*
|
||||
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function parse_url_content(App $a)
|
||||
{
|
||||
|
@ -25,10 +27,14 @@ function parse_url_content(App $a)
|
|||
|
||||
$br = "\n";
|
||||
|
||||
if (!empty($_GET['binurl'])) {
|
||||
if (!empty($_GET['binurl']) && Strings::isHex($_GET['binurl'])) {
|
||||
$url = trim(hex2bin($_GET['binurl']));
|
||||
} else {
|
||||
} elseif (!empty($_GET['url'])) {
|
||||
$url = trim($_GET['url']);
|
||||
// fallback in case no url is valid
|
||||
} else {
|
||||
Logger::info('No url given');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!empty($_GET['title'])) {
|
||||
|
@ -64,9 +70,8 @@ function parse_url_content(App $a)
|
|||
|
||||
// Check if the URL is an image, video or audio file. If so format
|
||||
// the URL with the corresponding BBCode media tag
|
||||
$redirects = 0;
|
||||
// Fetch the header of the URL
|
||||
$curlResponse = Network::curl($url, false, $redirects, ['novalidate' => true, 'nobody' => true]);
|
||||
$curlResponse = Network::curl($url, false, ['novalidate' => true, 'nobody' => true]);
|
||||
|
||||
if ($curlResponse->isSuccess()) {
|
||||
// Convert the header fields into an array
|
||||
|
|
|
@ -29,8 +29,8 @@ use Friendica\Util\Crypto;
|
|||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Security;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
function photos_init(App $a) {
|
||||
|
@ -188,6 +188,9 @@ function photos_post(App $a)
|
|||
}
|
||||
|
||||
if ($a->argc > 3 && $a->argv[2] === 'album') {
|
||||
if (!Strings::isHex($a->argv[3])) {
|
||||
$a->internalRedirect('photos/' . $a->data['user']['nickname'] . '/album');
|
||||
}
|
||||
$album = hex2bin($a->argv[3]);
|
||||
|
||||
if ($album === L10n::t('Profile Photos') || $album === 'Contact Photos' || $album === L10n::t('Contact Photos')) {
|
||||
|
@ -315,7 +318,7 @@ function photos_post(App $a)
|
|||
$str_group_deny = !empty($_POST['group_deny']) ? perms2str($_POST['group_deny']) : '';
|
||||
$str_contact_deny = !empty($_POST['contact_deny']) ? perms2str($_POST['contact_deny']) : '';
|
||||
|
||||
$resource_id = $a->argv[2];
|
||||
$resource_id = $a->argv[3];
|
||||
|
||||
if (!strlen($albname)) {
|
||||
$albname = DateTimeFormat::localNow('Y');
|
||||
|
@ -418,10 +421,11 @@ function photos_post(App $a)
|
|||
|
||||
if ($item_id) {
|
||||
$item = Item::selectFirst(['tag', 'inform'], ['id' => $item_id, 'uid' => $page_owner_uid]);
|
||||
}
|
||||
if (DBA::isResult($item)) {
|
||||
$old_tag = $item['tag'];
|
||||
$old_inform = $item['inform'];
|
||||
|
||||
if (DBA::isResult($item)) {
|
||||
$old_tag = $item['tag'];
|
||||
$old_inform = $item['inform'];
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($rawtags)) {
|
||||
|
@ -524,13 +528,13 @@ function photos_post(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$newtag = $old_tag;
|
||||
$newtag = $old_tag ?? '';
|
||||
if (strlen($newtag) && strlen($str_tags)) {
|
||||
$newtag .= ',';
|
||||
}
|
||||
$newtag .= $str_tags;
|
||||
|
||||
$newinform = $old_inform;
|
||||
$newinform = $old_inform ?? '';
|
||||
if (strlen($newinform) && strlen($inform)) {
|
||||
$newinform .= ',';
|
||||
}
|
||||
|
@ -735,7 +739,7 @@ function photos_post(App $a)
|
|||
@unlink($src);
|
||||
$foo = 0;
|
||||
Hook::callAll('photo_post_end',$foo);
|
||||
exit();
|
||||
return;
|
||||
}
|
||||
|
||||
$exif = $image->orient($src);
|
||||
|
@ -761,7 +765,7 @@ function photos_post(App $a)
|
|||
if (!$r) {
|
||||
Logger::log('mod/photos.php: photos_post(): image store failed', Logger::DEBUG);
|
||||
notice(L10n::t('Image upload failed.') . EOL);
|
||||
exit();
|
||||
return;
|
||||
}
|
||||
|
||||
if ($width > 640 || $height > 640) {
|
||||
|
@ -950,7 +954,7 @@ function photos_content(App $a)
|
|||
|
||||
// tabs
|
||||
$is_owner = (local_user() && (local_user() == $owner_uid));
|
||||
$o .= Profile::getTabs($a, $is_owner, $a->data['user']['nickname']);
|
||||
$o .= Profile::getTabs($a, 'photos', $is_owner, $a->data['user']['nickname']);
|
||||
|
||||
// Display upload form
|
||||
if ($datatype === 'upload') {
|
||||
|
@ -959,7 +963,7 @@ function photos_content(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
$selname = $datum ? hex2bin($datum) : '';
|
||||
$selname = Strings::isHex($datum) ? hex2bin($datum) : '';
|
||||
|
||||
$albumselect = '';
|
||||
|
||||
|
@ -1026,6 +1030,10 @@ function photos_content(App $a)
|
|||
|
||||
// Display a single photo album
|
||||
if ($datatype === 'album') {
|
||||
// if $datum is not a valid hex, redirect to the default page
|
||||
if (!Strings::isHex($datum)) {
|
||||
$a->internalRedirect('photos/' . $a->data['user']['nickname']. '/album');
|
||||
}
|
||||
$album = hex2bin($datum);
|
||||
|
||||
$total = 0;
|
||||
|
@ -1503,7 +1511,7 @@ function photos_content(App $a)
|
|||
'$title' => $title_e,
|
||||
'$body' => $body_e,
|
||||
'$ago' => Temporal::getRelativeDate($item['created']),
|
||||
'$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
|
||||
'$indent' => (($item['parent'] != $item['id']) ? ' comment' : ''),
|
||||
'$drop' => $drop,
|
||||
'$comment' => $comment
|
||||
]);
|
||||
|
@ -1512,7 +1520,7 @@ function photos_content(App $a)
|
|||
$comments .= Renderer::replaceMacros($cmnt_tpl, [
|
||||
'$return_path' => '',
|
||||
'$jsreload' => $return_path,
|
||||
'$id' => $item['item_id'],
|
||||
'$id' => $item['id'],
|
||||
'$parent' => $item['parent'],
|
||||
'$profile_uid' => $owner_uid,
|
||||
'$mylink' => $contact['url'],
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function redir_init(App $a) {
|
||||
|
||||
|
@ -70,7 +71,9 @@ function redir_init(App $a) {
|
|||
&& is_array($_SESSION['remote']))
|
||||
{
|
||||
foreach ($_SESSION['remote'] as $v) {
|
||||
if ($v['uid'] == $_SESSION['visitor_visiting'] && $v['cid'] == $_SESSION['visitor_id']) {
|
||||
if (!empty($v['uid']) && !empty($v['cid']) &&
|
||||
$v['uid'] == Session::get('visitor_visiting') &&
|
||||
$v['cid'] == Session::get('visitor_id')) {
|
||||
// Remote user is already authenticated.
|
||||
$target_url = defaults($url, $contact_url);
|
||||
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
|
||||
|
|
|
@ -12,13 +12,11 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Module\BaseSearchModule;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
require_once 'mod/dirfind.php';
|
||||
|
||||
function search_saved_searches() {
|
||||
|
||||
$o = '';
|
||||
|
@ -150,10 +148,10 @@ function search_content(App $a) {
|
|||
$search = substr($search,1);
|
||||
}
|
||||
if (strpos($search,'@') === 0) {
|
||||
return dirfind_content($a);
|
||||
return BaseSearchModule::performSearch();
|
||||
}
|
||||
if (strpos($search,'!') === 0) {
|
||||
return dirfind_content($a);
|
||||
return BaseSearchModule::performSearch();
|
||||
}
|
||||
|
||||
if (!empty($_GET['search-option']))
|
||||
|
@ -164,11 +162,9 @@ function search_content(App $a) {
|
|||
$tag = true;
|
||||
break;
|
||||
case 'contacts':
|
||||
return dirfind_content($a, "@");
|
||||
break;
|
||||
return BaseSearchModule::performSearch('@');
|
||||
case 'forums':
|
||||
return dirfind_content($a, "!");
|
||||
break;
|
||||
return BaseSearchModule::performSearch('!');
|
||||
}
|
||||
|
||||
if (!$search)
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Protocol\Email;
|
|||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
function get_theme_config_file($theme)
|
||||
{
|
||||
|
@ -390,7 +391,7 @@ function settings_post(App $a)
|
|||
BaseModule::checkFormSecurityTokenRedirectOnError('/settings', 'settings');
|
||||
|
||||
if (!empty($_POST['resend_relocate'])) {
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', 'relocate', local_user());
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
|
||||
info(L10n::t("Relocate message has been send to your contacts"));
|
||||
$a->internalRedirect('settings');
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
function tagger_content(App $a) {
|
||||
|
||||
|
@ -194,7 +195,7 @@ EOT;
|
|||
|
||||
Hook::callAll('post_local_end', $arr);
|
||||
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "tag", $post_id);
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $post_id);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -2,20 +2,27 @@
|
|||
/**
|
||||
* @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) {
|
||||
|
@ -55,13 +62,25 @@ 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;
|
||||
}
|
||||
|
@ -70,12 +89,25 @@ function _uexport_multirow($query) {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ function videos_content(App $a)
|
|||
|
||||
// tabs
|
||||
$_is_owner = (local_user() && (local_user() == $owner_uid));
|
||||
$o .= Profile::getTabs($a, $_is_owner, $a->data['user']['nickname']);
|
||||
$o .= Profile::getTabs($a, 'videos', $_is_owner, $a->data['user']['nickname']);
|
||||
|
||||
//
|
||||
// dispatch request
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @file mod/viewcontacts.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
||||
function viewcontacts_init(App $a)
|
||||
{
|
||||
if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Access denied.'));
|
||||
}
|
||||
|
||||
if ($a->argc < 2) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Access denied.'));
|
||||
}
|
||||
|
||||
Nav::setSelected('home');
|
||||
|
||||
$user = DBA::selectFirst('user', [], ['nickname' => $a->argv[1], 'blocked' => false]);
|
||||
if (!DBA::isResult($user)) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
$a->data['user'] = $user;
|
||||
$a->profile_uid = $user['uid'];
|
||||
|
||||
Profile::load($a, $a->argv[1]);
|
||||
}
|
||||
|
||||
function viewcontacts_content(App $a)
|
||||
{
|
||||
if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
|
||||
notice(L10n::t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$is_owner = $a->profile['profile_uid'] == local_user();
|
||||
|
||||
// tabs
|
||||
$o = Profile::getTabs($a, $is_owner, $a->data['user']['nickname']);
|
||||
|
||||
if (!count($a->profile) || $a->profile['hide-friends']) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
return $o;
|
||||
}
|
||||
|
||||
$condition = [
|
||||
'uid' => $a->profile['uid'],
|
||||
'blocked' => false,
|
||||
'pending' => false,
|
||||
'hidden' => false,
|
||||
'archive' => false,
|
||||
'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]
|
||||
];
|
||||
|
||||
$total = DBA::count('contact', $condition);
|
||||
|
||||
$pager = new Pager($a->query_string);
|
||||
|
||||
$params = ['order' => ['name' => false], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
|
||||
$contacts_stmt = DBA::select('contact', [], $condition, $params);
|
||||
|
||||
if (!DBA::isResult($contacts_stmt)) {
|
||||
info(L10n::t('No contacts.') . EOL);
|
||||
return $o;
|
||||
}
|
||||
|
||||
$contacts = [];
|
||||
|
||||
while ($contact = DBA::fetch($contacts_stmt)) {
|
||||
/// @TODO This triggers an E_NOTICE if 'self' is not there
|
||||
if ($contact['self']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$contact_details = Contact::getDetailsByURL($contact['url'], $a->profile['uid'], $contact);
|
||||
|
||||
$contacts[] = [
|
||||
'id' => $contact['id'],
|
||||
'img_hover' => L10n::t('Visit %s\'s profile [%s]', $contact_details['name'], $contact['url']),
|
||||
'photo_menu' => Contact::photoMenu($contact),
|
||||
'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
|
||||
'name' => substr($contact_details['name'], 0, 20),
|
||||
'username' => $contact_details['name'],
|
||||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
'account_type' => Contact::getAccountType($contact_details),
|
||||
'url' => Contact::magicLink($contact['url']),
|
||||
'sparkle' => '',
|
||||
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $contact['url']),
|
||||
'network' => ContactSelector::networkToName($contact['network'], $contact['url']),
|
||||
];
|
||||
}
|
||||
|
||||
DBA::close($contacts_stmt);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate("viewcontact_template.tpl");
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Contacts'),
|
||||
'$contacts' => $contacts,
|
||||
'$paginate' => $pager->renderFull($total),
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue