define('FRIENDICA_PLATFORM', 'Friendica');
define('FRIENDICA_CODENAME', 'Dalmatian Bellflower');
-define('FRIENDICA_VERSION', '2019.06-dev');
+define('FRIENDICA_VERSION', '2019.06-rc');
define('DFRN_PROTOCOL_VERSION', '2.23');
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
$account_type = Contact::getAccountType($profile);
- $tpl = Renderer::getMarkupTemplate("vcard-widget.tpl");
+ $tpl = Renderer::getMarkupTemplate("widget/vcard.tpl");
$vcard_widget = Renderer::replaceMacros($tpl, [
'$name' => $profile['name'],
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]);
if (DBA::isResult($contact)) {
- $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("vcard-widget.tpl"), [
+ $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("widget/vcard.tpl"), [
'$name' => $contact['name'],
'$photo' => $contact['photo'],
'url' => 'contact/' . $cid
function fsuggest_post(App $a)
{
- if (! local_user()) {
+ if (!local_user()) {
return;
}
}
$contact_id = intval($a->argv[1]);
+ if (empty($contact_id)) {
+ return;
+ }
- $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
- if (! DBA::isResult($contact)) {
+ // We do query the "uid" as well to ensure that it is our contact
+ if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
notice(L10n::t('Contact not found.') . EOL);
return;
}
- $new_contact = intval($_POST['suggest']);
+ $suggest_contact_id = intval($_POST['suggest']);
+ if (empty($suggest_contact_id)) {
+ return;
+ }
- $hash = Strings::getRandomHex();
+ // We do query the "uid" as well to ensure that it is our contact
+ $contact = DBA::selectFirst('contact', ['name', 'url', 'request', 'avatar'], ['id' => $suggest_contact_id, 'uid' => local_user()]);
+ if (!DBA::isResult($contact)) {
+ notice(L10n::t('Suggested contact not found.') . EOL);
+ return;
+ }
$note = Strings::escapeHtml(trim(defaults($_POST, 'note', '')));
- if ($new_contact) {
- $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($new_contact),
- intval(local_user())
- );
- if (DBA::isResult($r)) {
- q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
- VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
- intval(local_user()),
- intval($contact_id),
- DBA::escape($contact['name']),
- DBA::escape($contact['url']),
- DBA::escape($contact['request']),
- DBA::escape($contact['photo']),
- DBA::escape($hash),
- DBA::escape(DateTimeFormat::utcNow())
- );
- $r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
- DBA::escape($hash),
- intval(local_user())
- );
- if (DBA::isResult($r)) {
- $fsuggest_id = $contact['id'];
- q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d",
- DBA::escape($note),
- intval($fsuggest_id),
- intval(local_user())
- );
- Worker::add(PRIORITY_HIGH, 'Notifier', 'suggest', $fsuggest_id);
- }
-
- info(L10n::t('Friend suggestion sent.') . EOL);
- }
- }
+ $fields = ['uid' => local_user(),'cid' => $contact_id, 'name' => $contact['name'],
+ 'url' => $contact['url'], 'request' => $contact['request'],
+ 'photo' => $contact['avatar'], 'note' => $note, 'created' => DateTimeFormat::utcNow()];
+ DBA::insert('fsuggest', $fields);
+
+ Worker::add(PRIORITY_HIGH, 'Notifier', 'suggest', DBA::lastInsertId());
+
+ info(L10n::t('Friend suggestion sent.') . EOL);
}
function fsuggest_content(App $a)
$account_type = Contact::getAccountType($profile);
- $tpl = Renderer::getMarkupTemplate("vcard-widget.tpl");
+ $tpl = Renderer::getMarkupTemplate("widget/vcard.tpl");
$vcard_widget = Renderer::replaceMacros($tpl, [
'$name' => $profile['name'],
+++ /dev/null
-<?php
-/**
- * @file mod/probe.php
- */
-use Friendica\App;
-use Friendica\Core\L10n;
-use Friendica\Core\System;
-use Friendica\Network\Probe;
-
-function probe_content(App $a)
-{
- if (!local_user()) {
- $e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t("Only logged in users are permitted to perform a probing."));
- $e->httpdesc = L10n::t("Public access denied.");
- throw $e;
- }
-
- $o = '<div class="generic-page-wrapper">';
- $o .= '<h3>Probe Diagnostic</h3>';
-
- $o .= '<form action="probe" method="get">';
- $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . defaults($_GET, 'addr', '') . '" />';
- $o .= '<input type="submit" name="submit" value="Submit" /></form>';
-
- $o .= '<br /><br />';
-
- if (!empty($_GET['addr'])) {
- $addr = trim($_GET['addr']);
- $res = Probe::uri($addr, "", 0, false);
- $o .= '<pre>';
- $o .= str_replace("\n", '<br />', print_r($res, true));
- $o .= '</pre>';
- }
- $o .= '</div>';
-
- return $o;
-}
$account_type = Contact::getAccountType($profile);
- $tpl = Renderer::getMarkupTemplate("vcard-widget.tpl");
+ $tpl = Renderer::getMarkupTemplate("widget/vcard.tpl");
$vcard_widget = Renderer::replaceMacros($tpl, [
'$name' => $profile['name'],
$this->routeCollector->addRoute(['GET'], '/allfriends/{id:\d+}', Module\AllFriends::class);
$this->routeCollector->addRoute(['GET'], '/apps', Module\Apps::class);
$this->routeCollector->addRoute(['GET'], '/attach/{item:\d+}', Module\Attach::class);
- $this->routeCollector->addRoute(['GET'], '/babel', Module\Babel::class);
+ $this->routeCollector->addRoute(['GET'], '/babel', Module\Debug\Babel::class);
$this->routeCollector->addRoute(['GET'], '/bookmarklet', Module\Bookmarklet::class);
$this->routeCollector->addGroup('/contact', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '[/]', Module\Contact::class);
$collector->addRoute(['GET'], '/{id:\d+}/posts', Module\Contact::class);
$collector->addRoute(['GET'], '/{id:\d+}/update', Module\Contact::class);
$collector->addRoute(['GET'], '/{id:\d+}/updateprofile', Module\Contact::class);
- $collector->addRoute(['GET'], '/all', Module\Contact::class);
$collector->addRoute(['GET'], '/archived', Module\Contact::class);
$collector->addRoute(['GET', 'POST'], '/batch', Module\Contact::class);
$collector->addRoute(['GET'], '/blocked', Module\Contact::class);
$collector->addRoute(['GET'], '/{nickname}/replies', Module\Feed::class);
$collector->addRoute(['GET'], '/{nickname}/activity', Module\Feed::class);
});
- $this->routeCollector->addRoute(['GET'], '/feedtest', Module\Feedtest::class);
+ $this->routeCollector->addRoute(['GET'], '/feedtest', Module\Debug\Feed::class);
$this->routeCollector->addGroup('/fetch', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '/{guid}/post', Module\Diaspora\Fetch::class);
$collector->addRoute(['GET'], '/{guid}/status_message', Module\Diaspora\Fetch::class);
$collector->addRoute(['GET', 'POST'], '[/]', Module\Install::class);
$collector->addRoute(['GET'], '/testrewrite', Module\Install::class);
});
- $this->routeCollector->addRoute(['GET', 'POST'], '/itemsource[/{guid}]', Module\Itemsource::class);
$this->routeCollector->addRoute(['GET'], '/like/{item:\d+}', Module\Like::class);
- $this->routeCollector->addRoute(['GET', 'POST'], '/localtime', Module\Localtime::class);
+ $this->routeCollector->addRoute(['GET', 'POST'], '/localtime', Module\Debug\Localtime::class);
$this->routeCollector->addRoute(['GET', 'POST'], '/login', Module\Login::class);
$this->routeCollector->addRoute(['GET', 'POST'], '/logout', Module\Logout::class);
$this->routeCollector->addRoute(['GET'], '/magic', Module\Magic::class);
$collector->addRoute(['GET'], '/view/{id:\d+}', Module\Notifications\Notify::class);
$collector->addRoute(['GET'], '/mark/all', Module\Notifications\Notify::class);
});
- $this->routeCollector->addRoute(['GET'], '/notice/{id:\d+}', Module\GnuSocial\Notice::class);
$this->routeCollector->addRoute(['GET'], '/objects/{guid}', Module\Objects::class);
$this->routeCollector->addGroup('/oembed', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '/b2h', Module\Oembed::class);
$collector->addRoute(['GET'], '/{type}/{customize}/{name}', Module\Photo::class);
});
$this->routeCollector->addRoute(['GET'], '/pretheme', Module\ThemeDetails::class);
+ $this->routeCollector->addRoute(['GET'], '/probe', Module\Debug\Probe::class);
$this->routeCollector->addGroup('/profile', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '/{nickname}', Module\Profile::class);
$collector->addRoute(['GET'], '/{profile:\d+}/view', Module\Profile::class);
$this->routeCollector->addRoute(['GET'], '/toggle_mobile', Module\ToggleMobile::class);
$this->routeCollector->addRoute(['GET'], '/tos', Module\Tos::class);
$this->routeCollector->addRoute(['GET'], '/view/theme/{theme}/style.pcss', Module\Theme::class);
- $this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\ItemBody::class);
- $this->routeCollector->addRoute(['GET'], '/webfinger', Module\WebFinger::class);
+ $this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\Debug\ItemBody::class);
+ $this->routeCollector->addRoute(['GET'], '/webfinger', Module\Debug\WebFinger::class);
$this->routeCollector->addRoute(['GET'], '/xrd', Module\Xrd::class);
}
*/
public static function follow($value = "")
{
- return Renderer::replaceMacros(Renderer::getMarkupTemplate('follow.tpl'), array(
+ return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/follow.tpl'), array(
'$connect' => L10n::t('Add New Contact'),
'$desc' => L10n::t('Enter address or web location'),
'$hint' => L10n::t('Example: bob@example.com, http://example.com/barbara'),
$aside = [];
$aside['$nv'] = $nv;
- return Renderer::replaceMacros(Renderer::getMarkupTemplate('peoplefind.tpl'), $aside);
+ return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/peoplefind.tpl'), $aside);
}
/**
return $network_filter;
}
+ /**
+ * @param string $type
+ * @param string $title
+ * @param string $desc
+ * @param string $all
+ * @param string $baseUrl
+ * @param array $options
+ * @param string $selected
+ * @return string
+ * @throws \Exception
+ */
+ public static function filter($type, $title, $desc, $all, $baseUrl, array $options, $selected = null)
+ {
+ $queryString = parse_url($baseUrl, PHP_URL_QUERY);
+ $queryArray = [];
+
+ if ($queryString) {
+ parse_str($queryString, $queryArray);
+ unset($queryArray[$type]);
+
+ if (count($queryArray)) {
+ $baseUrl = substr($baseUrl, 0, strpos($baseUrl, '?')) . '?' . http_build_query($queryArray) . '&';
+ } else {
+ $baseUrl = substr($baseUrl, 0, strpos($baseUrl, '?')) . '?';
+ }
+ } else {
+ $baseUrl = trim($baseUrl, '?') . '?';
+ }
+
+ return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/filter.tpl'), [
+ '$type' => $type,
+ '$title' => $title,
+ '$desc' => $desc,
+ '$selected' => $selected,
+ '$all_label' => $all,
+ '$options' => $options,
+ '$base' => $baseUrl,
+ ]);
+ }
+
/**
* Return networks widget
*
$nets = array();
while ($rr = DBA::fetch($r)) {
- $nets[] = array('ref' => $rr['network'], 'name' => ContactSelector::networkToName($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
+ $nets[] = ['ref' => $rr['network'], 'name' => ContactSelector::networkToName($rr['network'])];
}
DBA::close($r);
return '';
}
- return Renderer::replaceMacros(Renderer::getMarkupTemplate('nets.tpl'), array(
- '$title' => L10n::t('Protocols'),
- '$desc' => '',
- '$sel_all' => (($selected == '') ? 'selected' : ''),
- '$all' => L10n::t('All Protocols'),
- '$nets' => $nets,
- '$base' => $baseurl,
- ));
+ return self::filter(
+ 'nets',
+ L10n::t('Protocols'),
+ '',
+ L10n::t('All Protocols'),
+ $baseurl,
+ $nets,
+ $selected
+ );
}
/**
return;
}
- $matches = false;
+ $matches = [];
$terms = array();
$cnt = preg_match_all('/\[(.*?)\]/', $saved, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch)
{
$unescaped = XML::escape(FileTag::decode($mtch[1]));
- $terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
+ $terms[] = ['ref' => $unescaped, 'name' => $unescaped];
}
}
- return Renderer::replaceMacros(Renderer::getMarkupTemplate('fileas_widget.tpl'), array(
- '$title' => L10n::t('Saved Folders'),
- '$desc' => '',
- '$sel_all' => (($selected == '') ? 'selected' : ''),
- '$all' => L10n::t('Everything'),
- '$terms' => $terms,
- '$base' => $baseurl,
- ));
+ return self::filter(
+ 'file',
+ L10n::t('Saved Folders'),
+ '',
+ L10n::t('Everything'),
+ $baseurl,
+ $terms,
+ $selected
+ );
}
/**
return;
}
- $matches = false;
+ $matches = [];
$terms = array();
$cnt = preg_match_all('/<(.*?)>/', $saved, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
$unescaped = XML::escape(FileTag::decode($mtch[1]));
- $terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
+ $terms[] = ['ref' => $unescaped, 'name' => $unescaped];
}
}
- return Renderer::replaceMacros(Renderer::getMarkupTemplate('categories_widget.tpl'), array(
- '$title' => L10n::t('Categories'),
- '$desc' => '',
- '$sel_all' => (($selected == '') ? 'selected' : ''),
- '$all' => L10n::t('Everything'),
- '$terms' => $terms,
- '$base' => $baseurl,
- ));
+ return self::filter(
+ 'category',
+ L10n::t('Categories'),
+ '',
+ L10n::t('Everything'),
+ $baseurl,
+ $terms,
+ $selected
+ );
}
/**
$entries[] = $entry;
}
- $tpl = Renderer::getMarkupTemplate('remote_friends_common.tpl');
+ $tpl = Renderer::getMarkupTemplate('widget/remote_friends_common.tpl');
return Renderer::replaceMacros($tpl, [
'$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t),
'$base' => System::baseUrl(),
// of the profile page it should be the personal /events page. So we can use $a->user.
$user = defaults($a->data['user'], 'nickname', $a->user['nickname']);
- $tpl = Renderer::getMarkupTemplate("events_aside.tpl");
+ $tpl = Renderer::getMarkupTemplate("widget/events.tpl");
$return = Renderer::replaceMacros($tpl, [
'$etitle' => L10n::t("Export"),
'$export_ical' => L10n::t("Export calendar as ical"),
/**
* Get HTML for contact block
*
- * @template contact_block.tpl
+ * @template widget/contacts.tpl
* @hook contact_block_end (contacts=>array, output=>string)
* @return string
*/
DBA::close($contact_ids_stmt);
}
- $tpl = Renderer::getMarkupTemplate('contact_block.tpl');
+ $tpl = Renderer::getMarkupTemplate('widget/contacts.tpl');
$o = Renderer::replaceMacros($tpl, [
'$contacts' => $contacts_title,
'$nickname' => $profile['nickname'],
$tags[] = $tag;
}
- $tpl = Renderer::getMarkupTemplate('tagblock_widget.tpl');
+ $tpl = Renderer::getMarkupTemplate('widget/tagcloud.tpl');
$o = Renderer::replaceMacros($tpl, [
'$title' => L10n::t('Tags'),
'$tags' => $tags
+++ /dev/null
-<?php
-
-namespace Friendica\Module;
-
-use Friendica\BaseModule;
-use Friendica\Content\Text;
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Model\Item;
-
-/**
- * Translates input text into different formats (HTML, BBCode, Markdown)
- */
-class Babel extends BaseModule
-{
- public static function content()
- {
- function visible_whitespace($s)
- {
- $s = str_replace(' ', ' ', $s);
-
- return str_replace(["\r\n", "\n", "\r"], '<br />', $s);
- }
-
- $results = [];
- if (!empty($_REQUEST['text'])) {
- switch (defaults($_REQUEST, 'type', 'bbcode')) {
- case 'bbcode':
- $bbcode = trim($_REQUEST['text']);
- $results[] = [
- 'title' => L10n::t('Source input'),
- 'content' => visible_whitespace($bbcode)
- ];
-
- $plain = Text\BBCode::toPlaintext($bbcode, false);
- $results[] = [
- 'title' => L10n::t('BBCode::toPlaintext'),
- 'content' => visible_whitespace($plain)
- ];
-
- $html = Text\BBCode::convert($bbcode);
- $results[] = [
- 'title' => L10n::t('BBCode::convert (raw HTML)'),
- 'content' => visible_whitespace(htmlspecialchars($html))
- ];
-
- $results[] = [
- 'title' => L10n::t('BBCode::convert'),
- 'content' => $html
- ];
-
- $bbcode2 = Text\HTML::toBBCode($html);
- $results[] = [
- 'title' => L10n::t('BBCode::convert => HTML::toBBCode'),
- 'content' => visible_whitespace($bbcode2)
- ];
-
- $markdown = Text\BBCode::toMarkdown($bbcode);
- $results[] = [
- 'title' => L10n::t('BBCode::toMarkdown'),
- 'content' => visible_whitespace($markdown)
- ];
-
- $html2 = Text\Markdown::convert($markdown);
- $results[] = [
- 'title' => L10n::t('BBCode::toMarkdown => Markdown::convert'),
- 'content' => $html2
- ];
-
- $bbcode3 = Text\Markdown::toBBCode($markdown);
- $results[] = [
- 'title' => L10n::t('BBCode::toMarkdown => Markdown::toBBCode'),
- 'content' => visible_whitespace($bbcode3)
- ];
-
- $bbcode4 = Text\HTML::toBBCode($html2);
- $results[] = [
- 'title' => L10n::t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode'),
- 'content' => visible_whitespace($bbcode4)
- ];
-
- $item = [
- 'body' => $bbcode,
- 'tag' => '',
- ];
-
- Item::setHashtags($item);
- $results[] = [
- 'title' => L10n::t('Item Body'),
- 'content' => visible_whitespace($item['body'])
- ];
- $results[] = [
- 'title' => L10n::t('Item Tags'),
- 'content' => $item['tag']
- ];
- break;
- case 'markdown':
- $markdown = trim($_REQUEST['text']);
- $results[] = [
- 'title' => L10n::t('Source input (Diaspora format)'),
- 'content' => '<pre>' . $markdown . '</pre>'
- ];
-
- $html = Text\Markdown::convert($markdown);
- $results[] = [
- 'title' => L10n::t('Markdown::convert (raw HTML)'),
- 'content' => visible_whitespace(htmlspecialchars($html))
- ];
-
- $results[] = [
- 'title' => L10n::t('Markdown::convert'),
- 'content' => $html
- ];
-
- $bbcode = Text\Markdown::toBBCode($markdown);
- $results[] = [
- 'title' => L10n::t('Markdown::toBBCode'),
- 'content' => '<pre>' . $bbcode . '</pre>'
- ];
- break;
- case 'html' :
- $html = trim($_REQUEST['text']);
- $results[] = [
- 'title' => L10n::t('Raw HTML input'),
- 'content' => htmlspecialchars($html)
- ];
-
- $results[] = [
- 'title' => L10n::t('HTML Input'),
- 'content' => $html
- ];
-
- $bbcode = Text\HTML::toBBCode($html);
- $results[] = [
- 'title' => L10n::t('HTML::toBBCode'),
- 'content' => visible_whitespace($bbcode)
- ];
-
- $html2 = Text\BBCode::convert($bbcode);
- $results[] = [
- 'title' => L10n::t('HTML::toBBCode => BBCode::convert'),
- 'content' => $html2
- ];
-
- $results[] = [
- 'title' => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'),
- 'content' => htmlspecialchars($html2)
- ];
-
- $markdown = Text\HTML::toMarkdown($html);
- $results[] = [
- 'title' => L10n::t('HTML::toMarkdown'),
- 'content' => visible_whitespace($markdown)
- ];
-
- $text = Text\HTML::toPlaintext($html);
- $results[] = [
- 'title' => L10n::t('HTML::toPlaintext'),
- 'content' => '<pre>' . $text . '</pre>'
- ];
- }
- }
-
- $tpl = Renderer::getMarkupTemplate('babel.tpl');
- $o = Renderer::replaceMacros($tpl, [
- '$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
- '$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
- '$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
- '$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
- '$results' => $results
- ]);
-
- return $o;
- }
-}
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model;
+use Friendica\Network\HTTPException\BadRequestException;
+use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
*/
class Contact extends BaseModule
{
- public static function init()
- {
- $a = self::getApp();
-
- if (!local_user()) {
- return;
- }
-
- $nets = defaults($_GET, 'nets', '');
-
- if (empty($a->page['aside'])) {
- $a->page['aside'] = '';
- }
-
- $contact_id = null;
- $contact = null;
- // @TODO: Replace with parameter from router
- if ($a->argc == 2 && intval($a->argv[1])
- || $a->argc == 3 && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])
- ) {
- $contact_id = intval($a->argv[1]);
- $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
-
- if (!DBA::isResult($contact)) {
- $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0, 'deleted' => false]);
- }
-
- // Don't display contacts that are about to be deleted
- if ($contact['network'] == Protocol::PHANTOM) {
- $contact = false;
- }
- }
-
- if (DBA::isResult($contact)) {
- if ($contact['self']) {
- // @TODO: Replace with parameter from router
- if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
- $a->internalRedirect('profile/' . $contact['nick']);
- } else {
- $a->internalRedirect('profile/' . $contact['nick'] . '?tab=profile');
- }
- }
-
- $a->data['contact'] = $contact;
-
- if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
- $network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
- } else {
- $network_link = '';
- }
-
- $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('vcard-widget.tpl'), [
- '$name' => $contact['name'],
- '$photo' => $contact['photo'],
- '$url' => Model\Contact::MagicLink($contact['url']),
- '$addr' => defaults($contact, 'addr', ''),
- '$network_link' => $network_link,
- '$network' => L10n::t('Network:'),
- '$account_type' => Model\Contact::getAccountType($contact)
- ]);
-
- $findpeople_widget = '';
- $follow_widget = '';
- $networks_widget = '';
- } else {
- $vcard_widget = '';
- $networks_widget = Widget::networks('contact', $nets);
- if (isset($_GET['add'])) {
- $follow_widget = Widget::follow($_GET['add']);
- } else {
- $follow_widget = Widget::follow();
- }
-
- $findpeople_widget = Widget::findPeople();
- }
-
- if ($contact['uid'] != 0) {
- $groups_widget = Model\Group::sidebarWidget('contact', 'group', 'full', 'everyone', $contact_id);
- } else {
- $groups_widget = null;
- }
-
- $a->page['aside'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contacts-widget-sidebar.tpl'), [
- '$vcard_widget' => $vcard_widget,
- '$findpeople_widget' => $findpeople_widget,
- '$follow_widget' => $follow_widget,
- '$groups_widget' => $groups_widget,
- '$networks_widget' => $networks_widget
- ]);
-
- $tpl = Renderer::getMarkupTemplate('contacts-head.tpl');
- $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
- '$baseurl' => $a->getBaseURL(true),
- ]);
- }
-
private static function batchActions(App $a)
{
if (empty($_POST['contact_batch']) || !is_array($_POST['contact_batch'])) {
public static function content($update = 0)
{
+ if (!local_user()) {
+ return Login::form($_SERVER['REQUET_URI']);
+ }
+
$a = self::getApp();
+
+ $nets = defaults($_GET, 'nets', '');
+
+ if (empty($a->page['aside'])) {
+ $a->page['aside'] = '';
+ }
+
+ $contact_id = null;
+ $contact = null;
+ // @TODO: Replace with parameter from router
+ if ($a->argc == 2 && intval($a->argv[1])
+ || $a->argc == 3 && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])
+ ) {
+ $contact_id = intval($a->argv[1]);
+ $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
+
+ if (!DBA::isResult($contact)) {
+ $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0, 'deleted' => false]);
+ }
+
+ // Don't display contacts that are about to be deleted
+ if ($contact['network'] == Protocol::PHANTOM) {
+ $contact = false;
+ }
+ }
+
+ if (DBA::isResult($contact)) {
+ if ($contact['self']) {
+ // @TODO: Replace with parameter from router
+ if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
+ $a->internalRedirect('profile/' . $contact['nick']);
+ } else {
+ $a->internalRedirect('profile/' . $contact['nick'] . '?tab=profile');
+ }
+ }
+
+ $a->data['contact'] = $contact;
+
+ if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
+ $network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
+ } else {
+ $network_link = '';
+ }
+
+ $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
+ '$name' => $contact['name'],
+ '$photo' => $contact['photo'],
+ '$url' => Model\Contact::magicLinkByContact($contact, $contact['url']),
+ '$addr' => defaults($contact, 'addr', ''),
+ '$network_link' => $network_link,
+ '$network' => L10n::t('Network:'),
+ '$account_type' => Model\Contact::getAccountType($contact)
+ ]);
+
+ $findpeople_widget = '';
+ $follow_widget = '';
+ $networks_widget = '';
+ } else {
+ $vcard_widget = '';
+ $findpeople_widget = Widget::findPeople();
+ if (isset($_GET['add'])) {
+ $follow_widget = Widget::follow($_GET['add']);
+ } else {
+ $follow_widget = Widget::follow();
+ }
+
+ $networks_widget = Widget::networks($_SERVER['REQUEST_URI'], $nets);
+ }
+
+ if ($contact['uid'] != 0) {
+ $groups_widget = Model\Group::sidebarWidget('contact', 'group', 'full', 'everyone', $contact_id);
+ } else {
+ $groups_widget = null;
+ }
+
+ $a->page['aside'] .= $vcard_widget . $findpeople_widget . $follow_widget . $groups_widget . $networks_widget;
+
+ $tpl = Renderer::getMarkupTemplate('contacts-head.tpl');
+ $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
+ '$baseurl' => $a->getBaseURL(true),
+ ]);
+
$sort_type = 0;
$o = '';
Nav::setSelected('contact');
if ($a->argc == 3) {
$contact_id = intval($a->argv[1]);
if (!$contact_id) {
- return;
+ throw new BadRequestException();
}
// @TODO: Replace with parameter from router
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'self' => false, 'deleted' => false]);
if (!DBA::isResult($orig_record)) {
- notice(L10n::t('Could not access contact record.') . EOL);
- $a->internalRedirect('contact');
- return; // NOTREACHED
+ throw new NotFoundException(L10n::t('Contact not found'));
}
if ($cmd === 'update' && ($orig_record['uid'] != 0)) {
info(($blocked ? L10n::t('Contact has been blocked') : L10n::t('Contact has been unblocked')) . EOL);
$a->internalRedirect('contact/' . $contact_id);
- return; // NOTREACHED
+ // NOTREACHED
}
if ($cmd === 'ignore') {
info(($ignored ? L10n::t('Contact has been ignored') : L10n::t('Contact has been unignored')) . EOL);
$a->internalRedirect('contact/' . $contact_id);
- return; // NOTREACHED
+ // NOTREACHED
}
if ($cmd === 'archive' && ($orig_record['uid'] != 0)) {
}
$a->internalRedirect('contact/' . $contact_id);
- return; // NOTREACHED
+ // NOTREACHED
}
if ($cmd === 'drop' && ($orig_record['uid'] != 0)) {
info(L10n::t('Contact has been removed.') . EOL);
$a->internalRedirect('contact');
- return; // NOTREACHED
+ // NOTREACHED
}
if ($cmd === 'posts') {
return self::getPostsHTML($a, $contact_id);
return $arr['output'];
}
- $blocked = false;
- $hidden = false;
- $ignored = false;
- $archived = false;
- $all = false;
-
// @TODO: Replace with parameter from router
- if (($a->argc == 2) && ($a->argv[1] === 'all')) {
- $sql_extra = '';
- $all = true;
- } elseif (($a->argc == 2) && ($a->argv[1] === 'blocked')) {
- $sql_extra = " AND `blocked` = 1 ";
- $blocked = true;
- } elseif (($a->argc == 2) && ($a->argv[1] === 'hidden')) {
- $sql_extra = " AND `hidden` = 1 ";
- $hidden = true;
- } elseif (($a->argc == 2) && ($a->argv[1] === 'ignored')) {
- $sql_extra = " AND `readonly` = 1 ";
- $ignored = true;
- } elseif (($a->argc == 2) && ($a->argv[1] === 'archived')) {
- $sql_extra = " AND `archive` = 1 ";
- $archived = true;
- } else {
- $sql_extra = " AND `blocked` = 0 ";
+ $type = defaults($a->argv, 1, '');
+
+ switch ($type) {
+ case 'blocked':
+ $sql_extra = " AND `blocked` = 1";
+ break;
+ case 'hidden':
+ $sql_extra = " AND `hidden` = 1 AND `blocked` = 0";
+ break;
+ case 'ignored':
+ $sql_extra = " AND `readonly` = 1 AND `blocked` = 0";
+ break;
+ case 'archived':
+ $sql_extra = " AND `archive` = 1 AND `blocked` = 0";
+ break;
+ default:
+ $sql_extra = " AND `blocked` = 0";
}
$sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
$nets = Strings::escapeTags(trim(defaults($_GET, 'nets' , '')));
$tabs = [
- [
- 'label' => L10n::t('Suggestions'),
- 'url' => 'suggest',
- 'sel' => '',
- 'title' => L10n::t('Suggest potential friends'),
- 'id' => 'suggestions-tab',
- 'accesskey' => 'g',
- ],
[
'label' => L10n::t('All Contacts'),
- 'url' => 'contact/all',
- 'sel' => ($all) ? 'active' : '',
+ 'url' => 'contact',
+ 'sel' => !$type ? 'active' : '',
'title' => L10n::t('Show all contacts'),
'id' => 'showall-tab',
'accesskey' => 'l',
],
- [
- 'label' => L10n::t('Unblocked'),
- 'url' => 'contact',
- 'sel' => ((!$all) && (!$blocked) && (!$hidden) && (!$search) && (!$nets) && (!$ignored) && (!$archived)) ? 'active' : '',
- 'title' => L10n::t('Only show unblocked contacts'),
- 'id' => 'showunblocked-tab',
- 'accesskey' => 'o',
- ],
[
'label' => L10n::t('Blocked'),
'url' => 'contact/blocked',
- 'sel' => ($blocked) ? 'active' : '',
+ 'sel' => $type == 'blocked' ? 'active' : '',
'title' => L10n::t('Only show blocked contacts'),
'id' => 'showblocked-tab',
'accesskey' => 'b',
[
'label' => L10n::t('Ignored'),
'url' => 'contact/ignored',
- 'sel' => ($ignored) ? 'active' : '',
+ 'sel' => $type == 'ignored' ? 'active' : '',
'title' => L10n::t('Only show ignored contacts'),
'id' => 'showignored-tab',
'accesskey' => 'i',
[
'label' => L10n::t('Archived'),
'url' => 'contact/archived',
- 'sel' => ($archived) ? 'active' : '',
+ 'sel' => $type == 'archived' ? 'active' : '',
'title' => L10n::t('Only show archived contacts'),
'id' => 'showarchived-tab',
'accesskey' => 'y',
[
'label' => L10n::t('Hidden'),
'url' => 'contact/hidden',
- 'sel' => ($hidden) ? 'active' : '',
+ 'sel' => $type == 'hidden' ? 'active' : '',
'title' => L10n::t('Only show hidden contacts'),
'id' => 'showhidden-tab',
'accesskey' => 'h',
[
'label' => L10n::t('Groups'),
'url' => 'group',
- 'sel' => ($hidden) ? 'active' : '',
+ 'sel' => '',
'title' => L10n::t('Organize your contact groups'),
'id' => 'contactgroups-tab',
'accesskey' => 'e',
}
}
+ switch ($type) {
+ case 'blocked': $header .= ' - ' . L10n::t('Blocked'); break;
+ case 'hidden': $header .= ' - ' . L10n::t('Hidden'); break;
+ case 'ignored': $header .= ' - ' . L10n::t('Ignored'); break;
+ case 'archived': $header .= ' - ' . L10n::t('Archived'); break;
+ }
+
+ $header .= $nets ? ' - ' . ContactSelector::networkToName($nets) : '';
+
$tpl = Renderer::getMarkupTemplate('contacts-template.tpl');
$o .= Renderer::replaceMacros($tpl, [
- '$header' => L10n::t('Contacts') . (($nets) ? ' - ' . ContactSelector::networkToName($nets) : ''),
+ '$header' => $header,
'$tabs' => $t,
'$total' => $total,
'$search' => $search_hdr,
--- /dev/null
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Content\Text;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Model\Item;
+use Friendica\Util\XML;
+
+/**
+ * Translates input text into different formats (HTML, BBCode, Markdown)
+ */
+class Babel extends BaseModule
+{
+ public static function content()
+ {
+ function visible_whitespace($s)
+ {
+ $s = str_replace(' ', ' ', $s);
+
+ return str_replace(["\r\n", "\n", "\r"], '<br />', $s);
+ }
+
+ $results = [];
+ if (!empty($_REQUEST['text'])) {
+ switch (defaults($_REQUEST, 'type', 'bbcode')) {
+ case 'bbcode':
+ $bbcode = trim($_REQUEST['text']);
+ $results[] = [
+ 'title' => L10n::t('Source input'),
+ 'content' => visible_whitespace($bbcode)
+ ];
+
+ $plain = Text\BBCode::toPlaintext($bbcode, false);
+ $results[] = [
+ 'title' => L10n::t('BBCode::toPlaintext'),
+ 'content' => visible_whitespace($plain)
+ ];
+
+ $html = Text\BBCode::convert($bbcode);
+ $results[] = [
+ 'title' => L10n::t('BBCode::convert (raw HTML)'),
+ 'content' => visible_whitespace(htmlspecialchars($html))
+ ];
+
+ $results[] = [
+ 'title' => L10n::t('BBCode::convert'),
+ 'content' => $html
+ ];
+
+ $bbcode2 = Text\HTML::toBBCode($html);
+ $results[] = [
+ 'title' => L10n::t('BBCode::convert => HTML::toBBCode'),
+ 'content' => visible_whitespace($bbcode2)
+ ];
+
+ $markdown = Text\BBCode::toMarkdown($bbcode);
+ $results[] = [
+ 'title' => L10n::t('BBCode::toMarkdown'),
+ 'content' => visible_whitespace($markdown)
+ ];
+
+ $html2 = Text\Markdown::convert($markdown);
+ $results[] = [
+ 'title' => L10n::t('BBCode::toMarkdown => Markdown::convert'),
+ 'content' => $html2
+ ];
+
+ $bbcode3 = Text\Markdown::toBBCode($markdown);
+ $results[] = [
+ 'title' => L10n::t('BBCode::toMarkdown => Markdown::toBBCode'),
+ 'content' => visible_whitespace($bbcode3)
+ ];
+
+ $bbcode4 = Text\HTML::toBBCode($html2);
+ $results[] = [
+ 'title' => L10n::t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode'),
+ 'content' => visible_whitespace($bbcode4)
+ ];
+
+ $item = [
+ 'body' => $bbcode,
+ 'tag' => '',
+ ];
+
+ Item::setHashtags($item);
+ $results[] = [
+ 'title' => L10n::t('Item Body'),
+ 'content' => visible_whitespace($item['body'])
+ ];
+ $results[] = [
+ 'title' => L10n::t('Item Tags'),
+ 'content' => $item['tag']
+ ];
+ break;
+ case 'markdown':
+ $markdown = trim($_REQUEST['text']);
+ $results[] = [
+ 'title' => L10n::t('Source input (Diaspora format)'),
+ 'content' => '<pre>' . htmlspecialchars($markdown) . '</pre>'
+ ];
+
+ $html = Text\Markdown::convert(html_entity_decode($markdown,ENT_COMPAT, 'UTF-8'));
+ $results[] = [
+ 'title' => L10n::t('Markdown::convert (raw HTML)'),
+ 'content' => visible_whitespace(htmlspecialchars($html))
+ ];
+
+ $results[] = [
+ 'title' => L10n::t('Markdown::convert'),
+ 'content' => $html
+ ];
+
+ $bbcode = Text\Markdown::toBBCode(XML::unescape($markdown));
+ $results[] = [
+ 'title' => L10n::t('Markdown::toBBCode'),
+ 'content' => '<pre>' . $bbcode . '</pre>'
+ ];
+ break;
+ case 'html' :
+ $html = trim($_REQUEST['text']);
+ $results[] = [
+ 'title' => L10n::t('Raw HTML input'),
+ 'content' => htmlspecialchars($html)
+ ];
+
+ $results[] = [
+ 'title' => L10n::t('HTML Input'),
+ 'content' => $html
+ ];
+
+ $bbcode = Text\HTML::toBBCode($html);
+ $results[] = [
+ 'title' => L10n::t('HTML::toBBCode'),
+ 'content' => visible_whitespace($bbcode)
+ ];
+
+ $html2 = Text\BBCode::convert($bbcode);
+ $results[] = [
+ 'title' => L10n::t('HTML::toBBCode => BBCode::convert'),
+ 'content' => $html2
+ ];
+
+ $results[] = [
+ 'title' => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'),
+ 'content' => htmlspecialchars($html2)
+ ];
+
+ $markdown = Text\HTML::toMarkdown($html);
+ $results[] = [
+ 'title' => L10n::t('HTML::toMarkdown'),
+ 'content' => visible_whitespace($markdown)
+ ];
+
+ $text = Text\HTML::toPlaintext($html);
+ $results[] = [
+ 'title' => L10n::t('HTML::toPlaintext'),
+ 'content' => '<pre>' . $text . '</pre>'
+ ];
+ }
+ }
+
+ $tpl = Renderer::getMarkupTemplate('babel.tpl');
+ $o = Renderer::replaceMacros($tpl, [
+ '$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
+ '$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
+ '$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
+ '$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
+ '$results' => $results
+ ]);
+
+ return $o;
+ }
+}
--- /dev/null
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Model;
+use Friendica\Protocol;
+use Friendica\Util\Network;
+
+/**
+ * Tests a given feed of a contact
+ */
+class Feed extends BaseModule
+{
+ public static function init()
+ {
+ if (!local_user()) {
+ info(L10n::t('You must be logged in to use this module'));
+ self::getApp()->internalRedirect();
+ }
+ }
+
+ public static function content()
+ {
+ $result = [];
+ if (!empty($_REQUEST['url'])) {
+ $url = $_REQUEST['url'];
+
+ $importer = Model\User::getById(local_user());
+
+ $contact_id = Model\Contact::getIdForURL($url, local_user(), true);
+ $contact = Model\Contact::getById($contact_id);
+
+ $xml = Network::fetchUrl($contact['poll']);
+
+ $dummy = null;
+ $import_result = Protocol\Feed::import($xml, $importer, $contact, $dummy, true);
+
+ $result = [
+ 'input' => $xml,
+ 'output' => var_export($import_result, true),
+ ];
+ }
+
+ $tpl = Renderer::getMarkupTemplate('feedtest.tpl');
+ return Renderer::replaceMacros($tpl, [
+ '$url' => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''],
+ '$result' => $result
+ ]);
+ }
+}
--- /dev/null
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\L10n;
+use Friendica\Model\Item;
+use Friendica\Network\HTTPException;
+
+/**
+ * Print the body of an Item
+ */
+class ItemBody extends BaseModule
+{
+ public static function content()
+ {
+ if (!local_user()) {
+ throw new HTTPException\UnauthorizedException(L10n::t('Access denied.'));
+ }
+
+ $app = self::getApp();
+
+ // @TODO: Replace with parameter from router
+ $itemId = (($app->argc > 1) ? intval($app->argv[1]) : 0);
+
+ if (!$itemId) {
+ throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
+ }
+
+ $item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $itemId]);
+
+ if (!empty($item)) {
+ if ($app->isAjax()) {
+ echo str_replace("\n", '<br />', $item['body']);
+ exit();
+ } else {
+ return str_replace("\n", '<br />', $item['body']);
+ }
+ } else {
+ throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
+ }
+ }
+}
--- /dev/null
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\Installer;
+use Friendica\Core\L10n;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Temporal;
+
+class Localtime extends BaseModule
+{
+ public static function post()
+ {
+ $time = defaults($_REQUEST, 'time', 'now');
+
+ $bd_format = L10n::t('l F d, Y \@ g:i A');
+
+ if (!empty($_POST['timezone'])) {
+ self::getApp()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
+ }
+ }
+
+ public static function content()
+ {
+ $app = self::getApp();
+
+ $time = defaults($_REQUEST, 'time', 'now');
+
+ $output = '<h3>' . L10n::t('Time Conversion') . '</h3>';
+ $output .= '<p>' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
+ $output .= '<p>' . L10n::t('UTC time: %s', $time) . '</p>';
+
+ if (!empty($_REQUEST['timezone'])) {
+ $output .= '<p>' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '</p>';
+ }
+
+ if (!empty($app->data['mod-localtime'])) {
+ $output .= '<p>' . L10n::t('Converted localtime: %s', $app->data['mod-localtime']) . '</p>';
+ }
+
+ $output .= '<form action ="' . $app->getBaseURL() . '/localtime?f=&time=' . $time . '" method="post" >';
+ $output .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
+ $output .= Temporal::getTimezoneSelect(defaults($_REQUEST, 'timezone', Installer::DEFAULT_TZ));
+ $output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
+
+ return $output;
+ }
+}
--- /dev/null
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Network\HTTPException;
+use Friendica\Network\Probe as NetworkProbe;
+
+/**
+ * Fetch information (protocol endpoints and user information) about a given uri
+ */
+class Probe extends BaseModule
+{
+ public static function content()
+ {
+ if (!local_user()) {
+ $e = new HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));
+ $e->httpdesc = L10n::t('Public access denied.');
+ throw $e;
+ }
+
+ $addr = defaults($_GET, 'addr', '');
+ $res = '';
+
+ if (!empty($addr)) {
+ $res = NetworkProbe::uri($addr, '', 0, false);
+ $res = print_r($res, true);
+ }
+
+ $tpl = Renderer::getMarkupTemplate('probe.tpl');
+ return Renderer::replaceMacros($tpl, [
+ '$addr' => ['addr',
+ L10n::t('Lookup address'),
+ $addr,
+ '',
+ 'required'
+ ],
+ '$res' => $res,
+ ]);
+ }
+}
--- /dev/null
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Network\Probe;
+
+/**
+ * Web based module to perform webfinger probing
+ */
+class WebFinger extends BaseModule
+{
+ public static function content()
+ {
+ if (!local_user()) {
+ $e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));
+ $e->httpdesc = L10n::t('Public access denied.');
+ throw $e;
+ }
+
+ $addr = defaults($_GET, 'addr', '');
+ $res = '';
+
+ if (!empty($addr)) {
+ $res = Probe::lrdd($addr);
+ $res = print_r($res, true);
+ }
+
+ $tpl = Renderer::getMarkupTemplate('webfinger.tpl');
+ return Renderer::replaceMacros($tpl, [
+ '$addr' => $addr,
+ '$res' => $res,
+ ]);
+ }
+}
+++ /dev/null
-<?php
-
-namespace Friendica\Module;
-
-use Friendica\BaseModule;
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Model;
-use Friendica\Protocol;
-use Friendica\Util\Network;
-
-/**
- * Tests a given feed of a contact
- */
-class Feedtest extends BaseModule
-{
- public static function init()
- {
- if (!local_user()) {
- info(L10n::t('You must be logged in to use this module'));
- self::getApp()->internalRedirect();
- }
- }
-
- public static function content()
- {
- $result = [];
- if (!empty($_REQUEST['url'])) {
- $url = $_REQUEST['url'];
-
- $importer = Model\User::getById(local_user());
-
- $contact_id = Model\Contact::getIdForURL($url, local_user(), true);
- $contact = Model\Contact::getById($contact_id);
-
- $xml = Network::fetchUrl($contact['poll']);
-
- $dummy = null;
- $import_result = Protocol\Feed::import($xml, $importer, $contact, $dummy, true);
-
- $result = [
- 'input' => $xml,
- 'output' => var_export($import_result, true),
- ];
- }
-
- $tpl = Renderer::getMarkupTemplate('feedtest.tpl');
- return Renderer::replaceMacros($tpl, [
- '$url' => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''],
- '$result' => $result
- ]);
- }
-}
+++ /dev/null
-<?php
-
-namespace Friendica\Module\GnuSocial;
-
-use Friendica\BaseModule;
-use Friendica\Core\L10n;
-use Friendica\Database\DBA;
-use Friendica\Network\HTTPException;
-
-/**
- * GNU Social -> friendica items permanent-url compatibility
- */
-class Notice extends BaseModule
-{
- public static function content()
- {
- $a = self::getApp();
-
- // @TODO: Replace with parameter from router
- $id = ($a->argc > 1) ? $a->argv[1] : 0;
-
- if (empty($id)) {
- throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
- }
-
- $item = DBA::selectFirst('item', ['guid'], ['id' => $id]);
-
- if (empty($item )) {
- throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
- } else {
- $a->internalRedirect('display/' . $item['guid']);
- }
- }
-}
+++ /dev/null
-<?php
-
-namespace Friendica\Module;
-
-use Friendica\BaseModule;
-use Friendica\Core\L10n;
-use Friendica\Model\Item;
-use Friendica\Network\HTTPException;
-
-/**
- * Print the body of an Item
- */
-class ItemBody extends BaseModule
-{
- public static function content()
- {
- if (!local_user()) {
- throw new HTTPException\UnauthorizedException(L10n::t('Access denied.'));
- }
-
- $app = self::getApp();
-
- // @TODO: Replace with parameter from router
- $itemId = (($app->argc > 1) ? intval($app->argv[1]) : 0);
-
- if (!$itemId) {
- throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
- }
-
- $item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $itemId]);
-
- if (!empty($item)) {
- if ($app->isAjax()) {
- echo str_replace("\n", '<br />', $item['body']);
- exit();
- } else {
- return str_replace("\n", '<br />', $item['body']);
- }
- } else {
- throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
- }
- }
-}
+++ /dev/null
-<?php
-
-namespace Friendica\Module;
-
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Model;
-
-/**
- * @author Hypolite Petovan <mrpetovan@gmail.com>
- */
-class Itemsource extends \Friendica\BaseModule
-{
- public static function content()
- {
- if (!is_site_admin()) {
- return;
- }
-
- $a = self::getApp();
-
- // @TODO: Replace with parameter from router
- if (!empty($a->argv[1])) {
- $guid = $a->argv[1];
- }
-
- $guid = defaults($_REQUEST['guid'], $guid);
-
- $source = '';
- $item_uri = '';
- $item_id = '';
- $terms = [];
- if (!empty($guid)) {
- $item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
-
- $conversation = Model\Conversation::getByItemUri($item['uri']);
-
- $item_id = $item['id'];
- $item_uri = $item['uri'];
- $source = $conversation['source'];
- $terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
- }
-
- $tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
- $o = Renderer::replaceMacros($tpl, [
- '$guid' => ['guid', L10n::t('Item Guid'), $guid, ''],
- '$source' => $source,
- '$item_uri' => $item_uri,
- '$item_id' => $item_id,
- '$terms' => $terms,
- ]);
-
- return $o;
- }
-}
+++ /dev/null
-<?php
-
-namespace Friendica\Module;
-
-use Friendica\BaseModule;
-use Friendica\Core\Installer;
-use Friendica\Core\L10n;
-use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Temporal;
-
-class Localtime extends BaseModule
-{
- public static function post()
- {
- $time = defaults($_REQUEST, 'time', 'now');
-
- $bd_format = L10n::t('l F d, Y \@ g:i A');
-
- if (!empty($_POST['timezone'])) {
- self::getApp()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
- }
- }
-
- public static function content()
- {
- $app = self::getApp();
-
- $time = defaults($_REQUEST, 'time', 'now');
-
- $output = '<h3>' . L10n::t('Time Conversion') . '</h3>';
- $output .= '<p>' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
- $output .= '<p>' . L10n::t('UTC time: %s', $time) . '</p>';
-
- if (!empty($_REQUEST['timezone'])) {
- $output .= '<p>' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '</p>';
- }
-
- if (!empty($app->data['mod-localtime'])) {
- $output .= '<p>' . L10n::t('Converted localtime: %s', $app->data['mod-localtime']) . '</p>';
- }
-
- $output .= '<form action ="' . $app->getBaseURL() . '/localtime?f=&time=' . $time . '" method="post" >';
- $output .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
- $output .= Temporal::getTimezoneSelect(defaults($_REQUEST, 'timezone', Installer::DEFAULT_TZ));
- $output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
-
- return $output;
- }
-}
+++ /dev/null
-<?php
-
-namespace Friendica\Module;
-
-use Friendica\BaseModule;
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Network\Probe;
-
-/**
- * Web based module to perform webfinger probing
- */
-class WebFinger extends BaseModule
-{
- public static function content()
- {
- if (!local_user()) {
- $e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t("Only logged in users are permitted to perform a probing."));
- $e->httpdesc = L10n::t("Public access denied.");
- throw $e;
- }
-
- $app = self::getApp();
-
- $addr = defaults($_GET, 'addr', '');
- $res = '';
-
- if (!empty($addr)) {
- $res = Probe::lrdd($addr);
- $res = print_r($res, true);
- }
-
- $tpl = Renderer::getMarkupTemplate('webfinger.tpl');
- return Renderer::replaceMacros($tpl, [
- '$addr' => $addr,
- '$res' => $res,
- ]);
- }
-}
*/
private static function processSuggestion($xpath, $suggestion, $importer)
{
- Logger::log("Processing suggestions");
+ Logger::log('Processing suggestions');
/// @TODO Rewrite this to one statement
$suggest = [];
- $suggest["uid"] = $importer["importer_uid"];
- $suggest["cid"] = $importer["id"];
- $suggest["url"] = $xpath->query("dfrn:url/text()", $suggestion)->item(0)->nodeValue;
- $suggest["name"] = $xpath->query("dfrn:name/text()", $suggestion)->item(0)->nodeValue;
- $suggest["photo"] = $xpath->query("dfrn:photo/text()", $suggestion)->item(0)->nodeValue;
- $suggest["request"] = $xpath->query("dfrn:request/text()", $suggestion)->item(0)->nodeValue;
- $suggest["body"] = $xpath->query("dfrn:note/text()", $suggestion)->item(0)->nodeValue;
+ $suggest['uid'] = $importer['importer_uid'];
+ $suggest['cid'] = $importer['id'];
+ $suggest['url'] = $xpath->query('dfrn:url/text()', $suggestion)->item(0)->nodeValue;
+ $suggest['name'] = $xpath->query('dfrn:name/text()', $suggestion)->item(0)->nodeValue;
+ $suggest['photo'] = $xpath->query('dfrn:photo/text()', $suggestion)->item(0)->nodeValue;
+ $suggest['request'] = $xpath->query('dfrn:request/text()', $suggestion)->item(0)->nodeValue;
+ $suggest['body'] = $xpath->query('dfrn:note/text()', $suggestion)->item(0)->nodeValue;
// Does our member already have a friend matching this description?
*
* @see https://github.com/friendica/friendica/pull/3254#discussion_r107315246
*/
- $condition = ['name' => $suggest["name"], 'nurl' => Strings::normaliseLink($suggest["url"]),
- 'uid' => $suggest["uid"]];
+ $condition = ['nurl' => Strings::normaliseLink($suggest['url']), 'uid' => $suggest['uid']];
if (DBA::exists('contact', $condition)) {
return false;
}
-
// Do we already have an fcontact record for this person?
$fid = 0;
- $condition = ['url' => $suggest["url"], 'name' => $suggest["name"], 'request' => $suggest["request"]];
- $fcontact = DBA::selectFirst('fcontact', ['id'], $condition);
+ $fcontact = DBA::selectFirst('fcontact', ['id'], ['url' => $suggest['url']]);
if (DBA::isResult($fcontact)) {
- $fid = $fcontact["id"];
+ $fid = $fcontact['id'];
// OK, we do. Do we already have an introduction for this person?
- if (DBA::exists('intro', ['uid' => $suggest["uid"], 'fid' => $fid])) {
+ if (DBA::exists('intro', ['uid' => $suggest['uid'], 'fid' => $fid])) {
/*
* The valid result means the friend we're about to send a friend
* suggestion already has them in their contact, which means no further
return false;
}
}
+
if (!$fid) {
- $r = q(
- "INSERT INTO `fcontact` (`name`,`url`,`photo`,`request`) VALUES ('%s', '%s', '%s', '%s')",
- DBA::escape($suggest["name"]),
- DBA::escape($suggest["url"]),
- DBA::escape($suggest["photo"]),
- DBA::escape($suggest["request"])
- );
- $fid = $r[0]["id"];
+ $fields = ['name' => $suggest['name'], 'url' => $suggest['url'],
+ 'photo' => $suggest['photo'], 'request' => $suggest['request']];
+ DBA::insert('fcontact', $fields);
+ $fid = DBA::lastInsertId();
}
- $condition = ['url' => $suggest["url"], 'name' => $suggest["name"], 'request' => $suggest["request"]];
- $fcontact = DBA::selectFirst('fcontact', ['id'], $condition);
-
/*
* If no record in fcontact is found, below INSERT statement will not
* link an introduction to it.
*/
- if (!DBA::isResult($fcontact)) {
+ if (empty($fid)) {
// Database record did not get created. Quietly give up.
exit();
}
$hash = Strings::getRandomHex();
- q(
- "INSERT INTO `intro` (`uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked`)
- VALUES(%d, %d, %d, '%s', '%s', '%s', %d)",
- intval($suggest["uid"]),
- intval($fid),
- intval($suggest["cid"]),
- DBA::escape($suggest["body"]),
- DBA::escape($hash),
- DBA::escape(DateTimeFormat::utcNow()),
- intval(0)
- );
+ $fields = ['uid' => $suggest['uid'], 'fid' => $fid, 'contact-id' => $suggest['cid'],
+ 'note' => $suggest['body'], 'hash' => $hash, 'datetime' => DateTimeFormat::utcNow(), 'blocked' => false];
+ DBA::insert('intro', $fields);
notification(
[
- "type" => NOTIFY_SUGGEST,
- "notify_flags" => $importer["notify-flags"],
- "language" => $importer["language"],
- "to_name" => $importer["username"],
- "to_email" => $importer["email"],
- "uid" => $importer["importer_uid"],
- "item" => $suggest,
- "link" => System::baseUrl()."/notifications/intros",
- "source_name" => $importer["name"],
- "source_link" => $importer["url"],
- "source_photo" => $importer["photo"],
- "verb" => ACTIVITY_REQ_FRIEND,
- "otype" => "intro"]
+ 'type' => NOTIFY_SUGGEST,
+ 'notify_flags' => $importer['notify-flags'],
+ 'language' => $importer['language'],
+ 'to_name' => $importer['username'],
+ 'to_email' => $importer['email'],
+ 'uid' => $importer['importer_uid'],
+ 'item' => $suggest,
+ 'link' => System::baseUrl().'/notifications/intros',
+ 'source_name' => $importer['name'],
+ 'source_link' => $importer['url'],
+ 'source_photo' => $importer['photo'],
+ 'verb' => ACTIVITY_REQ_FRIEND,
+ 'otype' => 'intro']
);
return true;
*/
public static function autoLinkRegEx()
{
- return '@(?xi)
+ return '@
(?<![=\'\]"/]) # Not preceded by [, =, \', ], ", /
\b
( # Capture 1: entire matched URL
https?:// # http or https protocol
(?:
- [^/\s`!()\[\]{};:\'",<>?«»“”‘’.] # Domain can\'t start with a .
- [^/\s`!()\[\]{};:\'",<>?«»“”‘’]+ # Domain can\'t end with a .
+ [^/\s\xA0`!()\[\]{};:\'",<>?«»“”‘’.] # Domain can\'t start with a .
+ [^/\s\xA0`!()\[\]{};:\'",<>?«»“”‘’]+ # Domain can\'t end with a .
\.
- [^/\s`!()\[\]{};:\'".,<>?«»“”‘’]+/? # Followed by a slash
+ [^/\s\xA0`!()\[\]{};:\'".,<>?«»“”‘’]+/? # Followed by a slash
)
(?: # One or more:
- [^\s()<>]+ # Run of non-space, non-()<>
+ [^\s\xA0()<>]+ # Run of non-space, non-()<>
| # or
- \(([^\s()<>]+|(\([^\s()<>]+\)))*\) # balanced parens, up to 2 levels
+ \(([^\s\xA0()<>]+|(\([^\s()<>]+\)))*\) # balanced parens, up to 2 levels
| # or
- [^\s`!()\[\]{};:\'".,<>?«»“”‘’] # not a space or one of these punct chars
+ [^\s\xA0`!()\[\]{};:\'".,<>?«»“”‘’] # not a space or one of these punct chars
)*
-)@';
+)@xiu';
}
/**
*/
public static function escape($str)
{
- $buffer = htmlentities($str, ENT_QUOTES, 'UTF-8');
+ $buffer = htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
$buffer = trim($buffer);
return $buffer;
*/
public static function unescape($s)
{
- $ret = html_entity_decode($s, ENT_QUOTES);
+ $ret = htmlspecialchars_decode($s, ENT_QUOTES);
return $ret;
}
$deliver_status = DFRN::deliver($owner, $contact, $atom, false, true);
}
- Logger::log('Delivery to ' . $contact['url'] . ' with guid ' . defaults($target_item, 'guid', $target_item['id']) . ' returns ' . $deliver_status);
+ Logger::info('DFRN Delivery', ['cmd' => $cmd, 'url' => $contact['url'], 'guid' => defaults($target_item, 'guid', $target_item['id']), 'return' => $deliver_status]);
if ($deliver_status < 0) {
Logger::info('Delivery failed: defer message', ['id' => defaults($target_item, 'guid', $target_item['id'])]);
'data' => "http://example.com<ul>",
'assertHTML' => false
],
+ 'bug-7150' => [
+ 'data' => html_entity_decode('http://example.com ', ENT_QUOTES, 'UTF-8'),
+ 'assertHTML' => false
+ ],
];
}
+++ /dev/null
-
-<div id="categories-sidebar" class="widget">
- <h3>{{$title}}</h3>
- <div id="nets-desc">{{$desc nofilter}}</div>
-
- <ul class="categories-ul">
- <li class="tool"><a href="{{$base}}" class="categories-link categories-all{{if $sel_all}} categories-selected{{/if}}">{{$all}}</a></li>
- {{foreach $terms as $term}}
- <li class="tool"><a href="{{$base}}?f=&category={{$term.name}}" class="categories-link{{if $term.selected}} categories-selected{{/if}}">{{$term.name}}</a></li>
- {{/foreach}}
- </ul>
-
-</div>
+++ /dev/null
-
-<div id="contact-block">
-<h3 class="contact-block-h4">{{$contacts}}</h3>
-{{if $micropro}}
- <a class="allcontact-link" href="viewcontacts/{{$nickname}}">{{$viewcontacts}}</a>
- <div class='contact-block-content'>
- {{foreach $micropro as $m}}
- {{$m nofilter}}
- {{/foreach}}
- </div>
-{{/if}}
-</div>
-<div class="clear"></div>
+++ /dev/null
-
-{{$vcard_widget nofilter}}
-{{$findpeople_widget nofilter}}
-{{$follow_widget nofilter}}
-{{$groups_widget nofilter}}
-{{$networks_widget nofilter}}
-
+++ /dev/null
-
-<div id="sidebar-events" class="widget">
- <h3>{{$etitle}}</h3>
-
- <ul class="sidebar-calendar-export-ul">
- <li role="menuitem" class="sidebar-calendar-export-li"><a href="{{$baseurl}}/cal/{{$user}}/export/ical" >{{$export_ical}}</a></li>
- <li role="menuitem" class="sidebar-calendar-export-li"><a href="{{$baseurl}}/cal/{{$user}}/export/csv" >{{$export_csv}}</a></li>
- </ul>
-</div>
+++ /dev/null
-
-<div id="fileas-sidebar" class="widget">
- <h3>{{$title}}</h3>
- <div id="nets-desc">{{$desc nofilter}}</div>
-
- <ul class="fileas-ul">
- <li class="tool"><a href="{{$base}}" class="fileas-link fileas-all{{if $sel_all}} fileas-selected{{/if}}">{{$all}}</a></li>
- {{foreach $terms as $term}}
- <li class="tool"><a href="{{$base}}?f=&file={{$term.name}}" class="fileas-link{{if $term.selected}} fileas-selected{{/if}}">{{$term.name}}</a></li>
- {{/foreach}}
- </ul>
-
-</div>
+++ /dev/null
-
-<div id="follow-sidebar" class="widget">
- <h3>{{$connect}}</h3>
- <div id="connect-desc">{{$desc nofilter}}</div>
- <form action="follow" method="get" >
- <input id="side-follow-url" type="text" name="url" value="{{$value}}" size="24" placeholder="{{$hint}}" title="{{$hint}}" /><input id="side-follow-submit" type="submit" name="submit" value="{{$follow}}" />
- </form>
-</div>
-
+++ /dev/null
-
-<div id="nets-sidebar" class="widget">
- <h3>{{$title}}</h3>
- <div id="nets-desc">{{$desc nofilter}}</div>
- <a href="{{$base}}" class="nets-link{{if $sel_all}} nets-selected{{/if}} nets-all">{{$all}}</a>
- <ul role="menu" class="nets-ul">
- {{foreach $nets as $net}}
- <li role="menuitem" ><a href="{{$base}}?nets={{$net.ref}}" class="nets-link{{if $net.selected}} nets-selected{{/if}}">{{$net.name}}</a></li>
- {{/foreach}}
- </ul>
-</div>
+++ /dev/null
-
-<div id="peoplefind-sidebar" class="widget">
- <h3>{{$nv.findpeople}}</h3>
- <div id="peoplefind-desc">{{$nv.desc}}</div>
- <form action="dirfind" method="get" />
- <input id="side-peoplefind-url" type="text" name="search" size="24" title="{{$nv.hint}}" /><input id="side-peoplefind-submit" type="submit" name="submit" value="{{$nv.findthem}}" />
- </form>
- <div class="side-link" id="side-match-link"><a href="match" >{{$nv.similar}}</a></div>
- <div class="side-link" id="side-suggest-link"><a href="suggest" >{{$nv.suggest}}</a></div>
- <div class="side-link" id="side-directory-link"><a href="directory" >{{$nv.local_directory}}</a></div>
- <div class="side-link" id="side-directory-link"><a href="{{$nv.global_dir}}" target="extlink" >{{$nv.directory}}</a></div>
- <div class="side-link" id="side-random-profile-link" ><a href="randprof" target="extlink" >{{$nv.random}}</a></div>
- {{if $nv.inv}}
- <div class="side-link" id="side-invite-link" ><a href="invite" >{{$nv.inv}}</a></div>
- {{/if}}
-</div>
-
--- /dev/null
+<div id="probe" class="generic-page-wrapper">
+ <h2>Probe Diagnostic</h2>
+ <form action="probe" method="get" class="panel panel-default">
+ <div class="panel-body">
+ <div class="form-group">
+ {{include file="field_input.tpl" field=$addr}}
+ </div>
+ <p><button type="submit" class="btn btn-primary">Submit</button></p>
+ </div>
+ </form>
+
+ {{if $res}}
+ <div class="probe-result">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Output</h3>
+ </div>
+ <div class="panel-body">
+ <pre>{{$res}}</pre>
+ </div>
+ </div>
+ </div>
+ {{/if}}
+</div>
+++ /dev/null
-
-<div id="remote-friends-in-common" class="bigwidget">
- <div id="rfic-desc">{{$desc nofilter}} {{if $linkmore}}<a href="{{$base}}/common/rem/{{$uid}}/{{$cid}}">{{$more}}</a>{{/if}}</div>
- {{if $items}}
- {{foreach $items as $item}}
- <div class="profile-match-wrapper">
- <div class="profile-match-photo">
- <a href="{{$item.url}}">
- <img src="{{$item.photo}}" width="80" height="80" alt="{{$item.name}}" title="{{$item.name}}" />
- </a>
- </div>
- <div class="profile-match-break"></div>
- <div class="profile-match-name">
- <a href="{{$item.url}}" title="{{$item.name}}">{{$item.name}}</a>
- </div>
- <div class="profile-match-end"></div>
- </div>
- {{/foreach}}
- {{/if}}
- <div id="rfic-end" class="clear"></div>
-</div>
-
+++ /dev/null
-
-<div class="tagblock widget">
- <h3>{{$title}}</h3>
-
- <div class="tag-cloud">
- {{foreach $tags as $tag}}
- <span class="tags">
- <span class="tag{{$tag.level}}">#</span><a href="{{$tag.url}}" class="tag{{$tag.level}}">{{$tag.name}}</a>
- </span>
- {{/foreach}}
- </div>
- <div class="tagblock-widget-end clear"></div>
-</div>
+++ /dev/null
-
-<div class="vcard h-card">
- <div class="fn p-name">{{$name}}</div>
- {{if $addr}}<div class="p-addr">{{$addr}}</div>{{/if}}
- {{if $pdesc}}<div class="title p-job-title">{{$pdesc}}</div>{{/if}}
- {{if $url}}
- <div id="profile-photo-wrapper"><a href="{{$url}}"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></a></div>
- {{else}}
- <div id="profile-photo-wrapper"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></div>
- {{/if}}
- {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
- {{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
- <div id="profile-vcard-break"></div>
-</div>
--- /dev/null
+
+<div id="contact-block">
+<h3 class="contact-block-h4">{{$contacts}}</h3>
+{{if $micropro}}
+ <a class="allcontact-link" href="profile/{{$nickname}}/contacts">{{$viewcontacts}}</a>
+ <div class='contact-block-content'>
+ {{foreach $micropro as $m}}
+ {{$m nofilter}}
+ {{/foreach}}
+ </div>
+{{/if}}
+</div>
+<div class="clear"></div>
--- /dev/null
+
+<div id="sidebar-events" class="widget">
+ <h3>{{$etitle}}</h3>
+
+ <ul class="sidebar-calendar-export-ul">
+ <li role="menuitem" class="sidebar-calendar-export-li"><a href="{{$baseurl}}/cal/{{$user}}/export/ical" >{{$export_ical}}</a></li>
+ <li role="menuitem" class="sidebar-calendar-export-li"><a href="{{$baseurl}}/cal/{{$user}}/export/csv" >{{$export_csv}}</a></li>
+ </ul>
+</div>
--- /dev/null
+
+<div id="{{$type}}-sidebar" class="widget">
+ <h3>{{$title}}</h3>
+ <div id="{{$type}}-desc">{{$desc nofilter}}</div>
+ <ul role="menu" class="{{$type}}-ul">
+ <li role="menuitem" {{if !$selected}}class="selected"{{/if}}><a href="{{$base}}" class="{{$type}}-link{{if !$selected}} {{$type}}-selected{{/if}} {{$type}}-all">{{$all_label}}</a></li>
+ {{foreach $options as $option}}
+ <li role="menuitem" {{if $selected == $option.ref}}class="selected"{{/if}}><a href="{{$base}}{{$type}}={{$option.ref}}" class="{{$type}}-link{{if $selected == $option.ref}} {{$type}}-selected{{/if}}">{{$option.name}}</a></li>
+ {{/foreach}}
+ </ul>
+</div>
--- /dev/null
+
+<div id="follow-sidebar" class="widget">
+ <h3>{{$connect}}</h3>
+ <div id="connect-desc">{{$desc nofilter}}</div>
+ <form action="follow" method="get" >
+ <input id="side-follow-url" type="text" name="url" value="{{$value}}" size="24" placeholder="{{$hint}}" title="{{$hint}}" /><input id="side-follow-submit" type="submit" name="submit" value="{{$follow}}" />
+ </form>
+</div>
+
--- /dev/null
+
+<div id="peoplefind-sidebar" class="widget">
+ <h3>{{$nv.findpeople}}</h3>
+ <div id="peoplefind-desc">{{$nv.desc}}</div>
+ <form action="dirfind" method="get" />
+ <input id="side-peoplefind-url" type="text" name="search" size="24" title="{{$nv.hint}}" /><input id="side-peoplefind-submit" type="submit" name="submit" value="{{$nv.findthem}}" />
+ </form>
+ <div class="side-link" id="side-match-link"><a href="match" >{{$nv.similar}}</a></div>
+ <div class="side-link" id="side-suggest-link"><a href="suggest" >{{$nv.suggest}}</a></div>
+ <div class="side-link" id="side-directory-link"><a href="directory" >{{$nv.local_directory}}</a></div>
+ <div class="side-link" id="side-directory-link"><a href="{{$nv.global_dir}}" target="extlink" >{{$nv.directory}}</a></div>
+ <div class="side-link" id="side-random-profile-link" ><a href="randprof" target="extlink" >{{$nv.random}}</a></div>
+ {{if $nv.inv}}
+ <div class="side-link" id="side-invite-link" ><a href="invite" >{{$nv.inv}}</a></div>
+ {{/if}}
+</div>
+
--- /dev/null
+
+<div id="remote-friends-in-common" class="bigwidget">
+ <div id="rfic-desc">{{$desc nofilter}} {{if $linkmore}}<a href="{{$base}}/common/rem/{{$uid}}/{{$cid}}">{{$more}}</a>{{/if}}</div>
+ {{if $items}}
+ {{foreach $items as $item}}
+ <div class="profile-match-wrapper">
+ <div class="profile-match-photo">
+ <a href="{{$item.url}}">
+ <img src="{{$item.photo}}" width="80" height="80" alt="{{$item.name}}" title="{{$item.name}}" />
+ </a>
+ </div>
+ <div class="profile-match-break"></div>
+ <div class="profile-match-name">
+ <a href="{{$item.url}}" title="{{$item.name}}">{{$item.name}}</a>
+ </div>
+ <div class="profile-match-end"></div>
+ </div>
+ {{/foreach}}
+ {{/if}}
+ <div id="rfic-end" class="clear"></div>
+</div>
+
--- /dev/null
+
+<div class="tagblock widget">
+ <h3>{{$title}}</h3>
+
+ <div class="tag-cloud">
+ {{foreach $tags as $tag}}
+ <span class="tags">
+ <span class="tag{{$tag.level}}">#</span><a href="{{$tag.url}}" class="tag{{$tag.level}}">{{$tag.name}}</a>
+ </span>
+ {{/foreach}}
+ </div>
+ <div class="tagblock-widget-end clear"></div>
+</div>
--- /dev/null
+
+<div class="vcard h-card">
+ <div class="fn p-name">{{$name}}</div>
+ {{if $addr}}<div class="p-addr">{{$addr}}</div>{{/if}}
+ {{if $pdesc}}<div class="title p-job-title">{{$pdesc}}</div>{{/if}}
+ {{if $url}}
+ <div id="profile-photo-wrapper"><a href="{{$url}}"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></a></div>
+ {{else}}
+ <div id="profile-photo-wrapper"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></div>
+ {{/if}}
+ {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
+ {{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
+ <div id="profile-vcard-break"></div>
+</div>
background:#2e2f2e;
}
-.group-selected, .nets-selected, .fileas-selected, .categories-selected{
+.widget .selected, .group-selected {
background:#2e2f2e;
}
}
-.contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo, .profile-jot-text, .group-selected, .nets-selected, .fileas-selected, #profile-jot-submit, .categories-selected {
+.contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo, .profile-jot-text, .group-selected, .widget .selected, #profile-jot-submit {
border-radius: 3px;
-moz-border-radius: 3px;
box-shadow: 4px 4px 3px 0 #444444;
margin-bottom: 10px;
}
-.group-selected, .nets-selected, .fileas-selected, .categories-selected, .forum-selected {
+.widget .selected, .group-selected, .forum-selected {
padding: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
list-style: none;
}
-.nets-ul, .fileas-ul, .categories-ul, .datebrowse-ul {
+.nets-ul, .fileas-ul, .category-ul, .datebrowse-ul {
list-style-type: none;
}
-.nets-ul li, .fileas-ul li, .categories-ul li, .datebrowse-ul li {
+.nets-ul li, .fileas-ul li, .category-ul li, .datebrowse-ul li {
margin-top: 10px;
}
margin-left: 42px;
}
-.fileas-link, .categories-link {
+.fileas-link, .category-link {
margin-left: 24px;
}
-.fileas-all, .categories-all {
+.fileas-all, .category-all {
margin-left: 0px;
}
+++ /dev/null
-
-<div id="contact-block">
- <h3 class="contact-block-h4 pull-left">{{$contacts}}</h3>
-
- {{if $micropro}}
- <a class="pull-right widget-action faded-icon" id="contact-block-view-contacts" href="viewcontacts/{{$nickname}}">
- <i class="fa fa-eye" aria-hidden="true"></i>
- <span class="sr-only">{{$viewcontacts}}</span>
- </a>
-
- <div class='contact-block-content'>
- {{foreach $micropro as $m}}
- {{$m nofilter}}
- {{/foreach}}
- </div>
- {{/if}}
-</div>
-<div class="clear"></div>
+++ /dev/null
-
-<div id="fileas-sidebar" class="widget">
- <h3>{{$title}}</h3>
- <div id="nets-desc">{{$desc nofilter}}</div>
-
- <ul class="fileas-ul">
- <li class="tool{{if $sel_all}} selected{{/if}}"><a href="{{$base}}" class="fileas-link fileas-all{{if $sel_all}} fileas-selected{{/if}}">{{$all}}</a></li>
- {{foreach $terms as $term}}
- <li class="tool{{if $term.selected}} selected{{/if}}"><a href="{{$base}}?f=&file={{$term.name}}" class="fileas-link{{if $term.selected}} fileas-selected{{/if}}">{{$term.name}}</a></li>
- {{/foreach}}
- </ul>
-
-</div>
+++ /dev/null
-
-<div id="follow-sidebar" class="widget">
- <h3>{{$connect}}</h3>
-
- <form action="follow" method="get">
- <label for="side-follow-url" id="connect-desc">{{$desc nofilter}}</label>
- {{* The input field - For visual consistence we are using a search input field*}}
- <div class="form-group form-group-search">
- <input id="side-follow-url" class="search-input form-control form-search" type="text" name="url" value="{{$value}}" placeholder="{{$hint}}" data-toggle="tooltip" title="{{$hint}}" />
- <button id="side-follow-submit" class="btn btn-default btn-sm form-button-search" type="submit">{{$follow}}</button>
- </div>
- </form>
-</div>
-
+++ /dev/null
-
-<div id="nets-sidebar" class="widget">
- <h3>{{$title}}</h3>
- <div id="nets-desc">{{$desc nofilter}}</div>
- <ul role="menu" class="nets-ul">
- <li role="menuitem" {{if $sel_all}}class="selected"{{/if}}><a href="{{$base}}" class="nets-link{{if $sel_all}} nets-selected{{/if}} nets-all">{{$all}}</a></li>
- {{foreach $nets as $net}}
- <li role="menuitem" {{if $net.selected}}class="selected"{{/if}}><a href="{{$base}}?nets={{$net.ref}}" class="nets-link{{if $net.selected}} nets-selected{{/if}}">{{$net.name}}</a></li>
- {{/foreach}}
- </ul>
-</div>
+++ /dev/null
-<div id="peoplefind-sidebar" class="widget">
- <h3>{{$nv.findpeople}}</h3>
-
- <form action="dirfind" method="get">
- {{* The search field *}}
- <label for="side-peoplefind-url" id="peoplefind-desc">{{$nv.desc}}</label>
- <div class="form-group form-group-search">
- <input id="side-peoplefind-url" class="search-input form-control form-search" type="text" name="search" data-toggle="tooltip" title="{{$nv.hint}}" />
- <button id="side-peoplefind-submit" class="btn btn-default btn-sm form-button-search" type="submit">{{$nv.findthem}}</button>
- </div>
- </form>
-
- {{* Directory links *}}
- <div class="side-link" id="side-directory-link"><a href="directory" >{{$nv.local_directory}}</a></div>
- <div class="side-link" id="side-directory-link"><a href="{{$nv.global_dir}}" target="extlink" >{{$nv.directory}}</a></div>
- {{* Additional links *}}
- <div class="side-link" id="side-match-link"><a href="match" >{{$nv.similar}}</a></div>
- <div class="side-link" id="side-suggest-link"><a href="suggest" >{{$nv.suggest}}</a></div>
-
- {{if $nv.inv}}
- <div class="side-link" id="side-invite-link" ><button type="button" class="btn-link" onclick="addToModal('invite'); return false;">{{$nv.inv}}</button></div>
- {{/if}}
-</div>
+++ /dev/null
-<div class="vcard h-card widget">
-
- <div id="profile-photo-wrapper">
- {{if $url}}
- <a href="{{$url}}"><img class="photo u-photo" src="{{$photo}}" alt="{{$name}}" /></a>
- {{else}}
- <img class="photo u-photo" src="{{$photo}}" alt="{{$name}}" />
- {{/if}}
- </div>
-
- {{* The short information which will appended to the second navbar by scrollspy *}}
- <div id="vcard-short-info-wrapper" style="display: none;">
- <div id="vcard-short-info" class="media" style="display: none">
- <div id="vcard-short-photo-wrapper" class="pull-left">
- <img class="media-object" src="{{$photo}}" alt="{{$name}}" />
- </div>
-
- <div id="vcard-short-desc" class="media-body">
- <h4 class="media-heading">{{$name}}</h4>
- {{if $addr}}<div class="vcard-short-addr">{{$addr}}</div>{{/if}}
- </div>
- </div>
- </div>
-
- <div class="panel-body">
- <div class="profile-header">
- <h3 class="fn p-name">{{$name}}</h3>
-
- {{if $addr}}<div class="p-addr">{{$addr}}</div>{{/if}}
-
- {{if $account_type}}<div class="account-type">({{$account_type}})</div>{{/if}}
-
- {{if $pdesc}}<div class="title">{{$pdesc}}</div>{{/if}}
-
- {{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
- </div>
- </div>
-</div>
--- /dev/null
+
+<div id="contact-block">
+ <h3 class="contact-block-h4 pull-left">{{$contacts}}</h3>
+
+{{if $micropro}}
+ <a class="pull-right widget-action faded-icon" id="contact-block-view-contacts" href="profile/{{$nickname}}/contacts">
+ <i class="fa fa-eye" aria-hidden="true"></i>
+ <span class="sr-only">{{$viewcontacts}}</span>
+ </a>
+
+ <div class='contact-block-content'>
+ {{foreach $micropro as $m}}
+ {{$m nofilter}}
+ {{/foreach}}
+ </div>
+{{/if}}
+</div>
+<div class="clear"></div>
--- /dev/null
+
+<div id="follow-sidebar" class="widget">
+ <h3>{{$connect}}</h3>
+
+ <form action="follow" method="get">
+ <label for="side-follow-url" id="connect-desc">{{$desc nofilter}}</label>
+ {{* The input field - For visual consistence we are using a search input field*}}
+ <div class="form-group form-group-search">
+ <input id="side-follow-url" class="search-input form-control form-search" type="text" name="url" value="{{$value}}" placeholder="{{$hint}}" data-toggle="tooltip" title="{{$hint}}" />
+ <button id="side-follow-submit" class="btn btn-default btn-sm form-button-search" type="submit">{{$follow}}</button>
+ </div>
+ </form>
+</div>
+
--- /dev/null
+<div id="peoplefind-sidebar" class="widget">
+ <h3>{{$nv.findpeople}}</h3>
+
+ <form action="dirfind" method="get">
+ {{* The search field *}}
+ <label for="side-peoplefind-url" id="peoplefind-desc">{{$nv.desc}}</label>
+ <div class="form-group form-group-search">
+ <input id="side-peoplefind-url" class="search-input form-control form-search" type="text" name="search" data-toggle="tooltip" title="{{$nv.hint}}" />
+ <button id="side-peoplefind-submit" class="btn btn-default btn-sm form-button-search" type="submit">{{$nv.findthem}}</button>
+ </div>
+ </form>
+
+ {{* Directory links *}}
+ <div class="side-link" id="side-directory-link"><a href="directory" >{{$nv.local_directory}}</a></div>
+ <div class="side-link" id="side-directory-link"><a href="{{$nv.global_dir}}" target="extlink" >{{$nv.directory}}</a></div>
+ {{* Additional links *}}
+ <div class="side-link" id="side-match-link"><a href="match" >{{$nv.similar}}</a></div>
+ <div class="side-link" id="side-suggest-link"><a href="suggest" >{{$nv.suggest}}</a></div>
+
+ {{if $nv.inv}}
+ <div class="side-link" id="side-invite-link" ><button type="button" class="btn-link" onclick="addToModal('invite'); return false;">{{$nv.inv}}</button></div>
+ {{/if}}
+</div>
--- /dev/null
+<div class="vcard h-card widget">
+
+ <div id="profile-photo-wrapper">
+ {{if $url}}
+ <a href="{{$url}}"><img class="photo u-photo" src="{{$photo}}" alt="{{$name}}" /></a>
+ {{else}}
+ <img class="photo u-photo" src="{{$photo}}" alt="{{$name}}" />
+ {{/if}}
+ </div>
+
+ {{* The short information which will appended to the second navbar by scrollspy *}}
+ <div id="vcard-short-info-wrapper" style="display: none;">
+ <div id="vcard-short-info" class="media" style="display: none">
+ <div id="vcard-short-photo-wrapper" class="pull-left">
+ <img class="media-object" src="{{$photo}}" alt="{{$name}}" />
+ </div>
+
+ <div id="vcard-short-desc" class="media-body">
+ <h4 class="media-heading">{{$name}}</h4>
+ {{if $addr}}<div class="vcard-short-addr">{{$addr}}</div>{{/if}}
+ </div>
+ </div>
+ </div>
+
+ <div class="panel-body">
+ <div class="profile-header">
+ <h3 class="fn p-name">{{$name}}</h3>
+
+ {{if $addr}}<div class="p-addr">{{$addr}}</div>{{/if}}
+
+ {{if $account_type}}<div class="account-type">({{$account_type}})</div>{{/if}}
+
+ {{if $pdesc}}<div class="title">{{$pdesc}}</div>{{/if}}
+
+ {{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
+ </div>
+ </div>
+</div>
+++ /dev/null
-<div id="fileas-sidebar" class="widget">
- <h3>{{$title}}</h3>
- <div id="nets-desc">{{$desc nofilter}}</div>
-
- <ul class="fileas-ul">
- <li class="tool {{if $sel_all}}selected{{/if}}"><a href="{{$base}}" class="fileas-link fileas-all">{{$all}}</a></li>
- {{foreach $terms as $term}}
- <li class="tool {{if $term.selected}}selected{{/if}}"><a href="{{$base}}?f=&file={{$term.name}}" class="fileas-link">{{$term.name}}</a></li>
- {{/foreach}}
- </ul>
-
-</div>
+++ /dev/null
-<div id="nets-sidebar" class="widget">
- <h3>{{$title}}</h3>
- <div id="nets-desc">{{$desc nofilter}}</div>
-
- <ul class="nets-ul">
- <li class="tool {{if $sel_all}}selected{{/if}}"><a href="{{$base}}" class="nets-link nets-all">{{$all}}</a>
- {{foreach $nets as $net}}
- <li class="tool {{if $net.selected}}selected{{/if}}"><a href="{{$base}}?f=&nets={{$net.ref}}" class="nets-link">{{$net.name}}</a></li>
- {{/foreach}}
- </ul>
-
-</div>
--- /dev/null
+<div id="{{$type}}-sidebar" class="widget">
+ <h3>{{$title}}</h3>
+{{if $desc}}
+ <div id="{{$type}}-desc">{{$desc nofilter}}</div>
+{{/if}}
+
+ <ul class="{{$type}}-ul">
+ <li class="tool {{if !$selected}}selected{{/if}}"><a href="{{$base}}" class="{{$type}}-link {{$type}}-all">{{$all_label}}</a>
+{{foreach $options as $option}}
+ <li class="tool {{if $selected == $option.ref}}selected{{/if}}"><a href="{{$base}}{{$type}}={{$option.ref}}" class="{{$type}}-link">{{$option.name}}</a></li>
+{{/foreach}}
+ </ul>
+
+</div>
top: 1px;
}
-.group-selected,
-.nets-selected,
-.fileas-selected,
-.categories-selected {
+
+.widget .selected,
+.group-selected {
padding-bottom: 0px;
padding-left: 2px;
padding-right: 2px;
width: 12px;
}
-.nets-ul, .fileas-ul, .categories-ul, .datebrowse-ul {
+.nets-ul, .fileas-ul, .category-ul, .datebrowse-ul {
list-style-type: none;
}
.nets-ul li,
.fileas-ul li,
-.categories-ul li,
+.category-ul li,
.datebrowse-link {
}
}
.fileas-link,
-.categories-link {
+.category-link {
margin-left: 0px;
}
.fileas-all,
-.categories-all {
+.category-all {
margin-left: 0px;
}
#birthday-notice {}
#nav-notifications-template {}
-#categories-sidebar {}
+#category-sidebar {}
#nets-desc {}
#status-tab {}
#page-footer {}
+++ /dev/null
-
-<div id="follow-sidebar" class="widget">
- <h3>{{$connect}}</h3>
- <div id="connect-desc">{{$desc nofilter}}</div>
- <form action="follow" method="post" >
- <input id="side-follow-url" type="text-sidebar" name="url" size="24" title="{{$hint}}" /><input id="side-follow-submit" type="submit" name="submit" value="{{$follow}}" />
- </form>
-</div>
-
--- /dev/null
+
+<div id="follow-sidebar" class="widget">
+ <h3>{{$connect}}</h3>
+ <div id="connect-desc">{{$desc nofilter}}</div>
+ <form action="follow" method="post" >
+ <input id="side-follow-url" type="text-sidebar" name="url" size="24" title="{{$hint}}" /><input id="side-follow-submit" type="submit" name="submit" value="{{$follow}}" />
+ </form>
+</div>
+
/* color: #000; */
}
-.group-selected, .nets-selected, .fileas-selected, .forum-selected {
+.widget .selected, .forum-selected {
font-weight: bold;
}
{{/if}}
{{if $nv}}
-{{include file='peoplefind.tpl' nv=$nv}}
+{{include file='widget/peoplefind.tpl' nv=$nv}}
{{/if}}
{{if $lastusers_title}}