mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 02:05:19 +02:00
Merge remote-tracking branch 'upstream/develop' into dfrn-2
This commit is contained in:
commit
c9f02d534e
217 changed files with 24805 additions and 30890 deletions
313
mod/acl.php
313
mod/acl.php
|
@ -1,12 +1,315 @@
|
|||
<?php
|
||||
|
||||
/* ACL selector json backend */
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
require_once 'include/acl_selectors.php';
|
||||
require_once 'include/dba.php';
|
||||
require_once 'mod/proxy.php';
|
||||
|
||||
function acl_init(App $a) {
|
||||
acl_lookup($a);
|
||||
function acl_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$start = defaults($_REQUEST, 'start' , 0);
|
||||
$count = defaults($_REQUEST, 'count' , 100);
|
||||
$search = defaults($_REQUEST, 'search' , '');
|
||||
$type = defaults($_REQUEST, 'type' , '');
|
||||
$conv_id = defaults($_REQUEST, 'conversation', null);
|
||||
|
||||
// For use with jquery.textcomplete for private mail completion
|
||||
if (!empty($_REQUEST['query'])) {
|
||||
if (!$type) {
|
||||
$type = 'm';
|
||||
}
|
||||
$search = $_REQUEST['query'];
|
||||
}
|
||||
|
||||
logger("Searching for ".$search." - type ".$type." conversation ".$conv_id, LOGGER_DEBUG);
|
||||
|
||||
if ($search != '') {
|
||||
$sql_extra = "AND `name` LIKE '%%" . dbesc($search) . "%%'";
|
||||
$sql_extra2 = "AND (`attag` LIKE '%%" . dbesc($search) . "%%' OR `name` LIKE '%%" . dbesc($search) . "%%' OR `nick` LIKE '%%" . dbesc($search) . "%%')";
|
||||
} else {
|
||||
/// @TODO Avoid these needless else blocks by putting variable-initialization atop of if()
|
||||
$sql_extra = $sql_extra2 = '';
|
||||
}
|
||||
|
||||
// count groups and contacts
|
||||
$group_count = 0;
|
||||
if ($type == '' || $type == 'g') {
|
||||
$r = q("SELECT COUNT(*) AS g FROM `group` WHERE `deleted` = 0 AND `uid` = %d $sql_extra",
|
||||
intval(local_user())
|
||||
);
|
||||
$group_count = (int) $r[0]['g'];
|
||||
}
|
||||
|
||||
$sql_extra2 .= ' ' . Widget::unavailableNetworks();
|
||||
|
||||
$contact_count = 0;
|
||||
if ($type == '' || $type == 'c') {
|
||||
// autocomplete for editor mentions
|
||||
$r = q("SELECT COUNT(*) AS c FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self`
|
||||
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||
AND `success_update` >= `failure_update`
|
||||
AND `notify` != '' $sql_extra2",
|
||||
intval(local_user())
|
||||
);
|
||||
$contact_count = (int) $r[0]['c'];
|
||||
} elseif ($type == 'f') {
|
||||
// autocomplete for editor mentions of forums
|
||||
$r = q("SELECT COUNT(*) AS c FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self`
|
||||
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||
AND (`forum` OR `prv`)
|
||||
AND `success_update` >= `failure_update`
|
||||
AND `notify` != '' $sql_extra2",
|
||||
intval(local_user())
|
||||
);
|
||||
$contact_count = (int) $r[0]['c'];
|
||||
} elseif ($type == 'm') {
|
||||
// autocomplete for Private Messages
|
||||
$r = q("SELECT COUNT(*) AS c FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self`
|
||||
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||
AND `success_update` >= `failure_update`
|
||||
AND `network` IN ('%s', '%s') $sql_extra2",
|
||||
intval(local_user()),
|
||||
dbesc(NETWORK_DFRN),
|
||||
dbesc(NETWORK_DIASPORA)
|
||||
);
|
||||
$contact_count = (int) $r[0]['c'];
|
||||
} elseif ($type == 'a') {
|
||||
// autocomplete for Contacts
|
||||
$r = q("SELECT COUNT(*) AS c FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self`
|
||||
AND NOT `pending` $sql_extra2",
|
||||
intval(local_user())
|
||||
);
|
||||
$contact_count = (int) $r[0]['c'];
|
||||
}
|
||||
|
||||
$tot = $group_count + $contact_count;
|
||||
|
||||
$groups = [];
|
||||
$contacts = [];
|
||||
|
||||
if ($type == '' || $type == 'g') {
|
||||
/// @todo We should cache this query.
|
||||
// This can be done when we can delete cache entries via wildcard
|
||||
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
|
||||
FROM `group`
|
||||
INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id`
|
||||
WHERE NOT `group`.`deleted` AND `group`.`uid` = %d
|
||||
$sql_extra
|
||||
GROUP BY `group`.`name`, `group`.`id`
|
||||
ORDER BY `group`.`name`
|
||||
LIMIT %d,%d",
|
||||
intval(local_user()),
|
||||
intval($start),
|
||||
intval($count)
|
||||
);
|
||||
|
||||
foreach ($r as $g) {
|
||||
$groups[] = [
|
||||
'type' => 'g',
|
||||
'photo' => 'images/twopeople.png',
|
||||
'name' => htmlentities($g['name']),
|
||||
'id' => intval($g['id']),
|
||||
'uids' => array_map('intval', explode(',', $g['uids'])),
|
||||
'link' => '',
|
||||
'forum' => '0'
|
||||
];
|
||||
}
|
||||
if ((count($groups) > 0) && ($search == '')) {
|
||||
$groups[] = ['separator' => true];
|
||||
}
|
||||
}
|
||||
|
||||
$r = [];
|
||||
if ($type == '') {
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv`, (`prv` OR `forum`) AS `frm` FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
||||
AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s', '%s'))
|
||||
$sql_extra2
|
||||
ORDER BY `name` ASC ",
|
||||
intval(local_user()),
|
||||
dbesc(NETWORK_OSTATUS),
|
||||
dbesc(NETWORK_STATUSNET)
|
||||
);
|
||||
} elseif ($type == 'c') {
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
||||
AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s'))
|
||||
$sql_extra2
|
||||
ORDER BY `name` ASC ",
|
||||
intval(local_user()),
|
||||
dbesc(NETWORK_STATUSNET)
|
||||
);
|
||||
} elseif ($type == 'f') {
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
||||
AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s'))
|
||||
AND (`forum` OR `prv`)
|
||||
$sql_extra2
|
||||
ORDER BY `name` ASC ",
|
||||
intval(local_user()),
|
||||
dbesc(NETWORK_STATUSNET)
|
||||
);
|
||||
} elseif ($type == 'm') {
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||
AND `success_update` >= `failure_update` AND `network` IN ('%s', '%s')
|
||||
$sql_extra2
|
||||
ORDER BY `name` ASC ",
|
||||
intval(local_user()),
|
||||
dbesc(NETWORK_DFRN),
|
||||
dbesc(NETWORK_DIASPORA)
|
||||
);
|
||||
} elseif ($type == 'a') {
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
|
||||
WHERE `uid` = %d AND `pending` = 0 AND `success_update` >= `failure_update`
|
||||
$sql_extra2
|
||||
ORDER BY `name` ASC ",
|
||||
intval(local_user())
|
||||
);
|
||||
} elseif ($type == 'x') {
|
||||
// autocomplete for global contact search (e.g. navbar search)
|
||||
$search = notags(trim($_REQUEST['search']));
|
||||
$mode = $_REQUEST['smode'];
|
||||
|
||||
$r = ACL::contactAutocomplete($search, $mode);
|
||||
|
||||
$contacts = [];
|
||||
foreach ($r as $g) {
|
||||
$contacts[] = [
|
||||
'photo' => proxy_url($g['photo'], false, PROXY_SIZE_MICRO),
|
||||
'name' => $g['name'],
|
||||
'nick' => defaults($g, 'addr', $g['url']),
|
||||
'network' => $g['network'],
|
||||
'link' => $g['url'],
|
||||
'forum' => !empty($g['community']) ? 1 : 0,
|
||||
];
|
||||
}
|
||||
$o = [
|
||||
'start' => $start,
|
||||
'count' => $count,
|
||||
'items' => $contacts,
|
||||
];
|
||||
echo json_encode($o);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
$forums = [];
|
||||
foreach ($r as $g) {
|
||||
$entry = [
|
||||
'type' => 'c',
|
||||
'photo' => proxy_url($g['micro'], false, PROXY_SIZE_MICRO),
|
||||
'name' => htmlentities($g['name']),
|
||||
'id' => intval($g['id']),
|
||||
'network' => $g['network'],
|
||||
'link' => $g['url'],
|
||||
'nick' => htmlentities(defaults($g, 'attag', $g['nick'])),
|
||||
'addr' => htmlentities(defaults($g, 'addr', $g['url'])),
|
||||
'forum' => !empty($g['forum']) || !empty($g['prv']) ? 1 : 0,
|
||||
];
|
||||
if ($entry['forum']) {
|
||||
$forums[] = $entry;
|
||||
} else {
|
||||
$contacts[] = $entry;
|
||||
}
|
||||
}
|
||||
if (count($forums) > 0) {
|
||||
if ($search == '') {
|
||||
$forums[] = ['separator' => true];
|
||||
}
|
||||
$contacts = array_merge($forums, $contacts);
|
||||
}
|
||||
}
|
||||
|
||||
$items = array_merge($groups, $contacts);
|
||||
|
||||
if ($conv_id) {
|
||||
// In multi threaded posts the conv_id is not the parent of the whole thread
|
||||
$parent_item = dba::selectFirst('item', ['parent'], ['id' => $conv_id]);
|
||||
if (DBM::is_result($parent_item)) {
|
||||
$conv_id = $parent_item['parent'];
|
||||
}
|
||||
|
||||
/*
|
||||
* if $conv_id is set, get unknown contacts in thread
|
||||
* but first get known contacts url to filter them out
|
||||
*/
|
||||
$known_contacts = array_map(function ($i) {
|
||||
return dbesc($i['link']);
|
||||
}, $contacts);
|
||||
|
||||
$unknown_contacts = [];
|
||||
$r = q("SELECT `author-link`
|
||||
FROM `item` WHERE `parent` = %d
|
||||
AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%')
|
||||
AND `author-link` NOT IN ('%s')
|
||||
GROUP BY `author-link`, `author-avatar`, `author-name`
|
||||
ORDER BY `author-name` ASC
|
||||
",
|
||||
intval($conv_id),
|
||||
dbesc($search),
|
||||
dbesc($search),
|
||||
implode("', '", $known_contacts)
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $row) {
|
||||
$contact = Contact::getDetailsByURL($row['author-link']);
|
||||
|
||||
if (count($contact) > 0) {
|
||||
$unknown_contacts[] = [
|
||||
'type' => 'c',
|
||||
'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO),
|
||||
'name' => htmlentities($contact['name']),
|
||||
'id' => intval($contact['cid']),
|
||||
'network' => $contact['network'],
|
||||
'link' => $contact['url'],
|
||||
'nick' => htmlentities(defaults($contact, 'nick', $contact['addr'])),
|
||||
'addr' => htmlentities(defaults($contact, 'addr', $contact['url'])),
|
||||
'forum' => $contact['forum']
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$items = array_merge($items, $unknown_contacts);
|
||||
$tot += count($unknown_contacts);
|
||||
}
|
||||
|
||||
$results = [
|
||||
'tot' => $tot,
|
||||
'start' => $start,
|
||||
'count' => $count,
|
||||
'groups' => $groups,
|
||||
'contacts' => $contacts,
|
||||
'items' => $items,
|
||||
'type' => $type,
|
||||
'search' => $search,
|
||||
];
|
||||
|
||||
Addon::callHooks('acl_lookup_end', $results);
|
||||
|
||||
$o = [
|
||||
'tot' => $results['tot'],
|
||||
'start' => $results['start'],
|
||||
'count' => $results['count'],
|
||||
'items' => $results['items'],
|
||||
];
|
||||
|
||||
echo json_encode($o);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -718,7 +718,7 @@ function admin_page_summary(App $a)
|
|||
$warningtext = [];
|
||||
if (DBM::is_result($r)) {
|
||||
$showwarning = true;
|
||||
$warningtext[] = L10n::t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php scripts/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />', 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
|
||||
$warningtext[] = L10n::t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php bin/console.php dbstructure toinnodb</tt> of your Friendica installation for an automatic conversion.<br />', 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
|
||||
}
|
||||
// Check if github.com/friendica/master/VERSION is higher then
|
||||
// the local version of Friendica. Check is opt-in, source may be master or devel branch
|
||||
|
@ -735,7 +735,7 @@ function admin_page_summary(App $a)
|
|||
}
|
||||
if (Config::get('system', 'dbupdate') == DB_UPDATE_FAILED) {
|
||||
$showwarning = true;
|
||||
$warningtext[] = L10n::t('The database update failed. Please run "php scripts/dbstructure.php update" from the command line and have a look at the errors that might appear.');
|
||||
$warningtext[] = L10n::t('The database update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear.');
|
||||
}
|
||||
|
||||
$last_worker_call = Config::get('system', 'last_poller_execution', false);
|
||||
|
@ -871,8 +871,9 @@ function admin_page_site_post(App $a)
|
|||
update_table("gcontact", ['connect', 'addr'], $old_host, $new_host);
|
||||
|
||||
// update config
|
||||
$a->set_baseurl($new_url);
|
||||
Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
|
||||
Config::set('system', 'url', $new_url);
|
||||
$a->set_baseurl($new_url);
|
||||
|
||||
// send relocate
|
||||
$users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
|
||||
|
@ -960,11 +961,19 @@ function admin_page_site_post(App $a)
|
|||
$only_tag_search = ((x($_POST,'only_tag_search')) ? True : False);
|
||||
$rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0);
|
||||
$check_new_version_url = ((x($_POST, 'check_new_version_url')) ? notags(trim($_POST['check_new_version_url'])) : 'none');
|
||||
|
||||
$worker_queues = ((x($_POST,'worker_queues')) ? intval($_POST['worker_queues']) : 4);
|
||||
$worker_dont_fork = ((x($_POST,'worker_dont_fork')) ? True : False);
|
||||
$worker_fastlane = ((x($_POST,'worker_fastlane')) ? True : False);
|
||||
$worker_frontend = ((x($_POST,'worker_frontend')) ? True : False);
|
||||
|
||||
$relay_directly = ((x($_POST,'relay_directly')) ? True : False);
|
||||
$relay_server = ((x($_POST,'relay_server')) ? notags(trim($_POST['relay_server'])) : '');
|
||||
$relay_subscribe = ((x($_POST,'relay_subscribe')) ? True : False);
|
||||
$relay_scope = ((x($_POST,'relay_scope')) ? notags(trim($_POST['relay_scope'])) : '');
|
||||
$relay_server_tags = ((x($_POST,'relay_server_tags')) ? notags(trim($_POST['relay_server_tags'])) : '');
|
||||
$relay_user_tags = ((x($_POST,'relay_user_tags')) ? True : False);
|
||||
|
||||
// Has the directory url changed? If yes, then resubmit the existing profiles there
|
||||
if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
|
||||
Config::set('system', 'directory', $global_directory);
|
||||
|
@ -1118,10 +1127,19 @@ function admin_page_site_post(App $a)
|
|||
Config::set('system', 'basepath', $basepath);
|
||||
Config::set('system', 'proxy_disabled', $proxy_disabled);
|
||||
Config::set('system', 'only_tag_search', $only_tag_search);
|
||||
|
||||
Config::set('system', 'worker_queues', $worker_queues);
|
||||
Config::set('system', 'worker_dont_fork', $worker_dont_fork);
|
||||
Config::set('system', 'worker_fastlane', $worker_fastlane);
|
||||
Config::set('system', 'frontend_worker', $worker_frontend);
|
||||
|
||||
Config::set('system', 'relay_directly', $relay_directly);
|
||||
Config::set('system', 'relay_server', $relay_server);
|
||||
Config::set('system', 'relay_subscribe', $relay_subscribe);
|
||||
Config::set('system', 'relay_scope', $relay_scope);
|
||||
Config::set('system', 'relay_server_tags', $relay_server_tags);
|
||||
Config::set('system', 'relay_user_tags', $relay_user_tags);
|
||||
|
||||
Config::set('system', 'rino_encrypt', $rino);
|
||||
|
||||
info(L10n::t('Site settings updated.') . EOL);
|
||||
|
@ -1270,6 +1288,7 @@ function admin_page_site(App $a)
|
|||
'$portable_contacts' => L10n::t('Auto Discovered Contact Directory'),
|
||||
'$performance' => L10n::t('Performance'),
|
||||
'$worker_title' => L10n::t('Worker'),
|
||||
'$relay_title' => L10n::t('Message Relay'),
|
||||
'$relocate' => L10n::t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
|
||||
'$baseurl' => System::baseUrl(true),
|
||||
// name, label, value, help string, extra data...
|
||||
|
@ -1349,13 +1368,20 @@ function admin_page_site(App $a)
|
|||
|
||||
'$relocate_url' => ['relocate_url', L10n::t("New base url"), System::baseUrl(), L10n::t("Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.")],
|
||||
|
||||
'$rino' => ['rino', L10n::t("RINO Encryption"), intval(Config::get('system','rino_encrypt')), L10n::t("Encryption layer between nodes."), [0 => "Disabled", 1 => "Enabled"]],
|
||||
'$rino' => ['rino', L10n::t("RINO Encryption"), intval(Config::get('system','rino_encrypt')), L10n::t("Encryption layer between nodes."), [0 => L10n::t("Disabled"), 1 => L10n::t("Enabled")]],
|
||||
|
||||
'$worker_queues' => ['worker_queues', L10n::t("Maximum number of parallel workers"), Config::get('system','worker_queues'), L10n::t("On shared hosters set this to 2. On larger systems, values of 10 are great. Default value is 4.")],
|
||||
'$worker_dont_fork' => ['worker_dont_fork', L10n::t("Don't use 'proc_open' with the worker"), Config::get('system','worker_dont_fork'), L10n::t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.")],
|
||||
'$worker_fastlane' => ['worker_fastlane', L10n::t("Enable fastlane"), Config::get('system','worker_fastlane'), L10n::t("When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.")],
|
||||
'$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system','frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed \x28e.g. messages being delivered\x29. On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', System::baseUrl())],
|
||||
|
||||
'$relay_subscribe' => ['relay_subscribe', L10n::t("Subscribe to relay"), Config::get('system','relay_subscribe'), L10n::t("Enables the receiving of public posts from the relay. They will be included in the search, subscribed tags and on the global community page.")],
|
||||
'$relay_server' => ['relay_server', L10n::t("Relay server"), Config::get('system','relay_server'), L10n::t("Address of the relay server where public posts should be send to. For example https://relay.diasp.org")],
|
||||
'$relay_directly' => ['relay_directly', L10n::t("Direct relay transfer"), Config::get('system','relay_directly'), L10n::t("Enables the direct transfer to other servers without using the relay servers")],
|
||||
'$relay_scope' => ['relay_scope', L10n::t("Relay scope"), Config::get('system','relay_scope'), L10n::t("Can be 'all' or 'tags'. 'all' means that every public post should be received. 'tags' means that only posts with selected tags should be received."), ['' => L10n::t('Disabled'), 'all' => L10n::t('all'), 'tags' => L10n::t('tags')]],
|
||||
'$relay_server_tags' => ['relay_server_tags', L10n::t("Server tags"), Config::get('system','relay_server_tags'), L10n::t("Comma separated list of tags for the 'tags' subscription.")],
|
||||
'$relay_user_tags' => ['relay_user_tags', L10n::t("Allow user tags"), Config::get('system','relay_user_tags'), L10n::t("If enabled, the tags from the saved searches will used for the 'tags' subscription in addition to the 'relay_server_tags'.")],
|
||||
|
||||
'$form_security_token' => get_form_security_token("admin_site")
|
||||
]);
|
||||
}
|
||||
|
|
136
mod/babel.php
136
mod/babel.php
|
@ -3,13 +3,9 @@
|
|||
* @file mod/babel.php
|
||||
*/
|
||||
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Content\Text;
|
||||
use Friendica\Core\L10n;
|
||||
|
||||
require_once 'include/bb2diaspora.php';
|
||||
require_once 'include/html2bbcode.php';
|
||||
|
||||
function visible_lf($s)
|
||||
{
|
||||
return str_replace("\n", '<br />', $s);
|
||||
|
@ -17,64 +13,104 @@ function visible_lf($s)
|
|||
|
||||
function babel_content()
|
||||
{
|
||||
$o = '<h1>Babel Diagnostic</h1>';
|
||||
$results = [];
|
||||
if (!empty($_REQUEST['text'])) {
|
||||
switch (defaults($_REQUEST, 'type', 'bbcode')) {
|
||||
case 'bbcode':
|
||||
$bbcode = trim($_REQUEST['text']);
|
||||
$results[] = [
|
||||
'title' => L10n::t('Source input'),
|
||||
'content' => visible_lf($bbcode)
|
||||
];
|
||||
|
||||
$o .= '<form action="babel" method="post">';
|
||||
$o .= L10n::t("Source \x28bbcode\x29 text:") . EOL;
|
||||
$o .= '<textarea name="text" cols="80" rows="10">' . htmlspecialchars($_REQUEST['text']) . '</textarea>' . EOL;
|
||||
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
||||
$html = Text\BBCode::convert($bbcode);
|
||||
$results[] = [
|
||||
'title' => L10n::t("BBCode::convert \x28raw HTML\x29"),
|
||||
'content' => htmlspecialchars($html)
|
||||
];
|
||||
|
||||
$o .= '<br /><br />';
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::convert'),
|
||||
'content' => $html
|
||||
];
|
||||
|
||||
$o .= '<form action="babel" method="post">';
|
||||
$o .= L10n::t("Source \x28Diaspora\x29 text to convert to BBcode:") . EOL;
|
||||
$o .= '<textarea name="d2bbtext" cols="80" rows="10">' . htmlspecialchars($_REQUEST['d2bbtext']) . '</textarea>' . EOL;
|
||||
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
||||
$bbcode2 = Text\HTML::toBBCode($html);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::convert => HTML::toBBCode'),
|
||||
'content' => visible_lf($bbcode2)
|
||||
];
|
||||
|
||||
$o .= '<br /><br />';
|
||||
$markdown = Text\BBCode::toMarkdown($bbcode);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::toMarkdown'),
|
||||
'content' => visible_lf($markdown)
|
||||
];
|
||||
|
||||
if (x($_REQUEST, 'text')) {
|
||||
$text = trim($_REQUEST['text']);
|
||||
$o .= '<h2>' . L10n::t('Source input: ') . '</h2>' . EOL . EOL;
|
||||
$o .= visible_lf($text) . EOL . EOL;
|
||||
$html2 = Text\Markdown::convert($markdown);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::toMarkdown => Markdown::convert'),
|
||||
'content' => $html2
|
||||
];
|
||||
|
||||
$html = BBCode::convert($text);
|
||||
$o .= '<h2>' . L10n::t("bbcode \x28raw HTML\x29: ") . '</h2>' . EOL . EOL;
|
||||
$o .= htmlspecialchars($html) . EOL . EOL;
|
||||
$bbcode3 = Text\Markdown::toBBCode($markdown);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::toMarkdown => Markdown::toBBCode'),
|
||||
'content' => visible_lf($bbcode3)
|
||||
];
|
||||
|
||||
$o .= '<h2>' . L10n::t('bbcode: ') . '</h2>' . EOL . EOL;
|
||||
$o .= $html . EOL . EOL;
|
||||
$bbcode4 = Text\HTML::toBBCode($html2);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode'),
|
||||
'content' => visible_lf($bbcode4)
|
||||
];
|
||||
break;
|
||||
case 'markdown':
|
||||
$markdown = trim($_REQUEST['text']);
|
||||
$results[] = [
|
||||
'title' => L10n::t('Source input \x28Diaspora format\x29'),
|
||||
'content' => '<pre>' . $markdown . '</pre>'
|
||||
];
|
||||
|
||||
$bbcode = html2bbcode($html);
|
||||
$o .= '<h2>' . L10n::t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
|
||||
$o .= visible_lf($bbcode) . EOL . EOL;
|
||||
$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)
|
||||
];
|
||||
|
||||
$diaspora = bb2diaspora($text);
|
||||
$o .= '<h2>' . L10n::t('bb2diaspora: ') . '</h2>' . EOL . EOL;
|
||||
$o .= visible_lf($diaspora) . EOL . EOL;
|
||||
$results[] = [
|
||||
'title' => L10n::t('HTML Input'),
|
||||
'content' => $html
|
||||
];
|
||||
|
||||
$html = Markdown::convert($diaspora);
|
||||
$o .= '<h2>' . L10n::t('bb2diaspora => Markdown: ') . '</h2>' . EOL . EOL;
|
||||
$o .= $html . EOL . EOL;
|
||||
$bbcode = Text\HTML::toBBCode($html);
|
||||
$results[] = [
|
||||
'title' => L10n::t('HTML::toBBCode'),
|
||||
'content' => visible_lf($bbcode)
|
||||
];
|
||||
|
||||
$bbcode = diaspora2bb($diaspora);
|
||||
$o .= '<h2>' . L10n::t('bb2diaspora => diaspora2bb: ') . '</h2>' . EOL . EOL;
|
||||
$o .= visible_lf($bbcode) . EOL . EOL;
|
||||
|
||||
$bbcode = html2bbcode($html);
|
||||
$o .= '<h2>' . L10n::t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
|
||||
$o .= visible_lf($bbcode) . EOL . EOL;
|
||||
$text = Text\HTML::toPlaintext($html);
|
||||
$results[] = [
|
||||
'title' => L10n::t('HTML::toPlaintext'),
|
||||
'content' => '<pre>' . $text . '</pre>'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (x($_REQUEST, 'd2bbtext')) {
|
||||
$d2bbtext = trim($_REQUEST['d2bbtext']);
|
||||
$o .= '<h2>' . L10n::t("Source input \x28Diaspora format\x29: ") . '</h2>' . EOL . EOL;
|
||||
$o .= '<pre>' . $d2bbtext . '</pre>' . EOL . EOL;
|
||||
|
||||
$bb = diaspora2bb($d2bbtext);
|
||||
$o .= '<h2>' . L10n::t('diaspora2bb: ') . '</h2>' . EOL . EOL;
|
||||
$o .= '<pre>' . $bb . '</pre>' . EOL . EOL;
|
||||
}
|
||||
$tpl = get_markup_template('babel.tpl');
|
||||
$o = replace_macros($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;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
/**
|
||||
* @file mod/bookmarklet.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Module\Login;
|
||||
|
@ -35,8 +37,8 @@ function bookmarklet_content(App $a)
|
|||
'default_location' => $a->user['default-location'],
|
||||
'nickname' => $a->user['nickname'],
|
||||
'lockstate' => ((is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))) ? 'lock' : 'unlock'),
|
||||
'default_perms' => get_acl_permissions($a->user),
|
||||
'acl' => populate_acl($a->user, true),
|
||||
'default_perms' => ACL::getDefaultUserPermissions($a->user),
|
||||
'acl' => ACL::getFullSelectorHTML($a->user, true),
|
||||
'bang' => '',
|
||||
'visitor' => 'block',
|
||||
'profile_uid' => local_user(),
|
||||
|
|
30
mod/cal.php
30
mod/cal.php
|
@ -9,19 +9,19 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/event.php';
|
||||
|
||||
function cal_init(App $a)
|
||||
{
|
||||
if ($a->argc > 1) {
|
||||
|
@ -64,7 +64,7 @@ function cal_init(App $a)
|
|||
'$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""),
|
||||
]);
|
||||
|
||||
$cal_widget = widget_events();
|
||||
$cal_widget = Widget\CalendarExport::getHTML();
|
||||
|
||||
if (!x($a->page, 'aside')) {
|
||||
$a->page['aside'] = '';
|
||||
|
@ -82,7 +82,7 @@ function cal_content(App $a)
|
|||
Nav::setSelected('events');
|
||||
|
||||
// get the translation strings for the callendar
|
||||
$i18n = get_event_strings();
|
||||
$i18n = Event::getStrings();
|
||||
|
||||
$htpl = get_markup_template('event_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($htpl, [
|
||||
|
@ -212,25 +212,25 @@ function cal_content(App $a)
|
|||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = [
|
||||
'event_id' => (x($_GET, 'id') ? $_GET["id"] : 0),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'adjust_start' => $adjust_start,
|
||||
'event_id' => intval(defaults($_GET, 'id', 0)),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'adjust_start' => $adjust_start,
|
||||
'adjust_finish' => $adjust_finish,
|
||||
'ignored' => $ignored,
|
||||
'ignore' => $ignored,
|
||||
];
|
||||
|
||||
// get events by id or by date
|
||||
if (x($_GET, 'id')) {
|
||||
$r = event_by_id($owner_uid, $event_params, $sql_extra);
|
||||
if ($event_params['event_id']) {
|
||||
$r = Event::getListById($owner_uid, $event_params['event-id'], $sql_extra);
|
||||
} else {
|
||||
$r = events_by_date($owner_uid, $event_params, $sql_extra);
|
||||
$r = Event::getListByDate($owner_uid, $event_params, $sql_extra);
|
||||
}
|
||||
|
||||
$links = [];
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
$r = Event::sortByDate($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
|
||||
if (!x($links, $j)) {
|
||||
|
@ -240,7 +240,7 @@ function cal_content(App $a)
|
|||
}
|
||||
|
||||
// transform the event in a usable array
|
||||
$events = process_events($r);
|
||||
$events = Event::prepareListForTemplate($r);
|
||||
|
||||
if ($a->argv[2] === 'json') {
|
||||
echo json_encode($events);
|
||||
|
@ -306,7 +306,7 @@ function cal_content(App $a)
|
|||
}
|
||||
|
||||
// Get the export data by uid
|
||||
$evexport = event_export($owner_uid, $format);
|
||||
$evexport = Event::exportListByUserId($owner_uid, $format);
|
||||
|
||||
if (!$evexport["success"]) {
|
||||
if ($evexport["content"]) {
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
/**
|
||||
* @file mod/community.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
|
@ -104,7 +106,7 @@ function community_content(App $a, $update = 0)
|
|||
'default_location' => $a->user['default-location'],
|
||||
'nickname' => $a->user['nickname'],
|
||||
'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
|
||||
'acl' => populate_acl($a->user, true),
|
||||
'acl' => ACL::getFullSelectorHTML($a->user, true),
|
||||
'bang' => '',
|
||||
'visitor' => 'block',
|
||||
'profile_uid' => local_user(),
|
||||
|
|
|
@ -15,7 +15,6 @@ use Friendica\Protocol\DFRN;
|
|||
use Friendica\Protocol\Diaspora;
|
||||
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/event.php';
|
||||
|
||||
function dfrn_notify_post(App $a) {
|
||||
logger(__function__, LOGGER_TRACE);
|
||||
|
|
|
@ -78,13 +78,12 @@ function directory_content(App $a)
|
|||
(`profile`.`prv_keywords` LIKE '%$search%'))";
|
||||
}
|
||||
|
||||
$publish = ((Config::get('system', 'publish_all')) ? '' : " AND `publish` = 1 " );
|
||||
$publish = (Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 " );
|
||||
|
||||
|
||||
$cnt = dba::selectFirst("SELECT COUNT(*) AS `total` FROM `profile`
|
||||
$cnt = dba::fetch_first("SELECT COUNT(*) AS `total` FROM `profile`
|
||||
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra "
|
||||
);
|
||||
WHERE `is-default` $publish AND NOT `user`.`blocked` $sql_extra");
|
||||
if (DBM::is_result($cnt)) {
|
||||
$a->set_pager_total($cnt['total']);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
|
@ -204,7 +206,6 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
|||
|
||||
require_once 'include/security.php';
|
||||
require_once 'include/conversation.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
||||
$o = '';
|
||||
|
||||
|
@ -321,7 +322,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
|||
'default_location' => $a->user['default-location'],
|
||||
'nickname' => $a->user['nickname'],
|
||||
'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
|
||||
'acl' => populate_acl($a->user, true),
|
||||
'acl' => ACL::getFullSelectorHTML($a->user, true),
|
||||
'bang' => '',
|
||||
'visitor' => 'block',
|
||||
'profile_uid' => local_user(),
|
||||
|
@ -371,10 +372,8 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
|||
$o .= conversation($a, $items, 'display', $update_uid);
|
||||
|
||||
// Preparing the meta header
|
||||
require_once 'include/html2plain.php';
|
||||
|
||||
$description = trim(html2plain(BBCode::convert($s[0]["body"], false), 0, true));
|
||||
$title = trim(html2plain(BBCode::convert($s[0]["title"], false), 0, true));
|
||||
$description = trim(HTML::toPlaintext(BBCode::convert($s[0]["body"], false), 0, true));
|
||||
$title = trim(HTML::toPlaintext(BBCode::convert($s[0]["title"], false), 0, true));
|
||||
$author_name = $s[0]["author-name"];
|
||||
|
||||
$image = $a->remove_baseurl($s[0]["author-thumb"]);
|
||||
|
|
|
@ -10,8 +10,6 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
||||
function editpost_content(App $a) {
|
||||
|
||||
$o = '';
|
||||
|
|
|
@ -6,16 +6,18 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget\CalendarExport;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/event.php';
|
||||
require_once 'include/items.php';
|
||||
|
||||
function events_init(App $a) {
|
||||
|
@ -23,22 +25,22 @@ function events_init(App $a) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($a->argc > 1) {
|
||||
// If it's a json request abort here because we don't
|
||||
// need the widget data
|
||||
if ($a->argv[1] === 'json') {
|
||||
return;
|
||||
}
|
||||
|
||||
$cal_widget = widget_events();
|
||||
|
||||
if (! x($a->page,'aside')) {
|
||||
$a->page['aside'] = '';
|
||||
}
|
||||
|
||||
$a->page['aside'] .= $cal_widget;
|
||||
// If it's a json request abort here because we don't
|
||||
// need the widget data
|
||||
if ($a->argc > 1 && $a->argv[1] === 'json') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($a->page['aside'])) {
|
||||
$a->page['aside'] = '';
|
||||
}
|
||||
|
||||
$a->data['user'] = $_SESSION['user'];
|
||||
|
||||
$cal_widget = CalendarExport::getHTML();
|
||||
|
||||
$a->page['aside'] .= $cal_widget;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -154,7 +156,6 @@ function events_post(App $a) {
|
|||
|
||||
|
||||
$datarray = [];
|
||||
$datarray['guid'] = get_guid(32);
|
||||
$datarray['start'] = $start;
|
||||
$datarray['finish'] = $finish;
|
||||
$datarray['summary'] = $summary;
|
||||
|
@ -169,18 +170,16 @@ function events_post(App $a) {
|
|||
$datarray['allow_gid'] = $str_group_allow;
|
||||
$datarray['deny_cid'] = $str_contact_deny;
|
||||
$datarray['deny_gid'] = $str_group_deny;
|
||||
$datarray['private'] = (($private_event) ? 1 : 0);
|
||||
$datarray['private'] = $private_event;
|
||||
$datarray['id'] = $event_id;
|
||||
$datarray['created'] = $created;
|
||||
$datarray['edited'] = $edited;
|
||||
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
$html = format_event_html($datarray);
|
||||
$html = Event::getHTML($datarray);
|
||||
echo $html;
|
||||
killme();
|
||||
}
|
||||
|
||||
$item_id = event_store($datarray);
|
||||
$item_id = Event::store($datarray);
|
||||
|
||||
if (! $cid) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "event", $item_id);
|
||||
|
@ -221,7 +220,7 @@ function events_content(App $a) {
|
|||
}
|
||||
|
||||
// get the translation strings for the callendar
|
||||
$i18n = get_event_strings();
|
||||
$i18n = Event::getStrings();
|
||||
|
||||
$htpl = get_markup_template('event_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($htpl, [
|
||||
|
@ -330,25 +329,25 @@ function events_content(App $a) {
|
|||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = [
|
||||
'event_id' => (x($_GET, 'id') ? $_GET['id'] : 0),
|
||||
'event_id' => intval(defaults($_GET, 'id', 0)),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'adjust_start' => $adjust_start,
|
||||
'adjust_finish' => $adjust_finish,
|
||||
'ignored' => $ignored,
|
||||
'ignore' => $ignored,
|
||||
];
|
||||
|
||||
// get events by id or by date
|
||||
if (x($_GET, 'id')) {
|
||||
$r = event_by_id(local_user(), $event_params);
|
||||
if ($event_params['event_id']) {
|
||||
$r = Event::getListById(local_user(), $event_params['event_id']);
|
||||
} else {
|
||||
$r = events_by_date(local_user(), $event_params);
|
||||
$r = Event::getListByDate(local_user(), $event_params);
|
||||
}
|
||||
|
||||
$links = [];
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
$r = Event::sortByDate($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
|
||||
if (! x($links,$j)) {
|
||||
|
@ -361,8 +360,8 @@ function events_content(App $a) {
|
|||
|
||||
// transform the event in a usable array
|
||||
if (DBM::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
$events = process_events($r);
|
||||
$r = Event::sortByDate($r);
|
||||
$events = Event::prepareListForTemplate($r);
|
||||
}
|
||||
|
||||
if ($a->argc > 1 && $a->argv[1] === 'json'){
|
||||
|
@ -371,7 +370,7 @@ function events_content(App $a) {
|
|||
}
|
||||
|
||||
if (x($_GET, 'id')) {
|
||||
$tpl = get_markup_template("event.tpl");
|
||||
$tpl = get_markup_template("event.tpl");
|
||||
} else {
|
||||
$tpl = get_markup_template("events_js.tpl");
|
||||
}
|
||||
|
@ -478,12 +477,10 @@ function events_content(App $a) {
|
|||
$fhour = ((x($orig_event)) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : '00');
|
||||
$fminute = ((x($orig_event)) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00');
|
||||
|
||||
require_once 'include/acl_selectors.php' ;
|
||||
|
||||
$perms = get_acl_permissions($orig_event);
|
||||
$perms = ACL::getDefaultUserPermissions($orig_event);
|
||||
|
||||
if ($mode === 'new' || $mode === 'copy') {
|
||||
$acl = (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user)));
|
||||
$acl = (($cid) ? '' : ACL::getFullSelectorHTML(((x($orig_event)) ? $orig_event : $a->user)));
|
||||
}
|
||||
|
||||
// If we copy an old event, we need to remove the ID and URI
|
||||
|
@ -544,8 +541,7 @@ function events_content(App $a) {
|
|||
if ($mode === 'drop' && $event_id) {
|
||||
$del = 0;
|
||||
|
||||
$params = ['event_id' => ($event_id)];
|
||||
$ev = event_by_id(local_user(), $params);
|
||||
$ev = Event::getListById(local_user(), $event_id);
|
||||
|
||||
// Delete only real events (no birthdays)
|
||||
if (DBM::is_result($ev) && $ev[0]['type'] == 'event') {
|
||||
|
|
53
mod/feedtest.php
Normal file
53
mod/feedtest.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file_tag_list_to_file mod/feedtest.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\Feed;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/dba.php';
|
||||
require_once 'include/text.php';
|
||||
|
||||
function feedtest_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
info(L10n::t('You must be logged in to use this module'));
|
||||
return;
|
||||
};
|
||||
|
||||
$result = [];
|
||||
if (!empty($_REQUEST['url'])) {
|
||||
$url = $_REQUEST['url'];
|
||||
|
||||
$importer = dba::selectFirst('user', [], ['uid' => local_user()]);
|
||||
|
||||
$contact_id = Contact::getIdForURL($url, local_user(), true);
|
||||
|
||||
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
|
||||
|
||||
$ret = Network::curl($contact['poll']);
|
||||
$xml = $ret['body'];
|
||||
|
||||
$dummy = null;
|
||||
$import_result = Feed::import($xml, $importer, $contact, $dummy, true);
|
||||
|
||||
$result = [
|
||||
'input' => text_highlight($xml, 'xml'),
|
||||
'output' => var_export($import_result, true),
|
||||
];
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('feedtest.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
'$url' => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''],
|
||||
'$result' => $result
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
135
mod/follow.php
135
mod/follow.php
|
@ -11,10 +11,10 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Network\Probe;
|
||||
use Friendica\Database\DBM;
|
||||
|
||||
function follow_post(App $a) {
|
||||
|
||||
function follow_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
notice(L10n::t('Permission denied.'));
|
||||
goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ function follow_post(App $a) {
|
|||
|
||||
// Makes the connection request for friendica contacts easier
|
||||
// This is just a precaution if maybe this page is called somewhere directly via POST
|
||||
$_SESSION["fastlane"] = $url;
|
||||
$_SESSION['fastlane'] = $url;
|
||||
|
||||
$result = Contact::createFromProbe($uid, $url, true);
|
||||
|
||||
|
@ -39,19 +39,19 @@ function follow_post(App $a) {
|
|||
}
|
||||
goaway($return_url);
|
||||
} elseif ($result['cid']) {
|
||||
goaway(System::baseUrl().'/contacts/'.$result['cid']);
|
||||
goaway(System::baseUrl() . '/contacts/' . $result['cid']);
|
||||
}
|
||||
|
||||
info(L10n::t('The contact could not be added.').EOL);
|
||||
info(L10n::t('The contact could not be added.'));
|
||||
|
||||
goaway($return_url);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
function follow_content(App $a) {
|
||||
|
||||
function follow_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
notice(L10n::t('Permission denied.'));
|
||||
goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ function follow_content(App $a) {
|
|||
|
||||
if ($r) {
|
||||
if ($r[0]['pending']) {
|
||||
notice(L10n::t('You already added this contact.').EOL);
|
||||
$submit = "";
|
||||
notice(L10n::t('You already added this contact.'));
|
||||
$submit = '';
|
||||
//goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -79,104 +79,107 @@ function follow_content(App $a) {
|
|||
|
||||
$ret = Probe::uri($url);
|
||||
|
||||
if (($ret["network"] == NETWORK_DIASPORA) && !Config::get('system', 'diaspora_enabled')) {
|
||||
notice(L10n::t("Diaspora support isn't enabled. Contact can't be added.") . EOL);
|
||||
$submit = "";
|
||||
if (($ret['network'] == NETWORK_DIASPORA) && !Config::get('system', 'diaspora_enabled')) {
|
||||
notice(L10n::t("Diaspora support isn't enabled. Contact can't be added."));
|
||||
$submit = '';
|
||||
//goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (($ret["network"] == NETWORK_OSTATUS) && Config::get('system', 'ostatus_disabled')) {
|
||||
notice(L10n::t("OStatus support is disabled. Contact can't be added.") . EOL);
|
||||
$submit = "";
|
||||
if (($ret['network'] == NETWORK_OSTATUS) && Config::get('system', 'ostatus_disabled')) {
|
||||
notice(L10n::t("OStatus support is disabled. Contact can't be added."));
|
||||
$submit = '';
|
||||
//goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if ($ret["network"] == NETWORK_PHANTOM) {
|
||||
notice(L10n::t("The network type couldn't be detected. Contact can't be added.") . EOL);
|
||||
$submit = "";
|
||||
if ($ret['network'] == NETWORK_PHANTOM) {
|
||||
notice(L10n::t("The network type couldn't be detected. Contact can't be added."));
|
||||
$submit = '';
|
||||
//goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if ($ret["network"] == NETWORK_MAIL) {
|
||||
$ret["url"] = $ret["addr"];
|
||||
if ($ret['network'] == NETWORK_MAIL) {
|
||||
$ret['url'] = $ret['addr'];
|
||||
}
|
||||
|
||||
if (($ret['network'] === NETWORK_DFRN) && !DBM::is_result($r)) {
|
||||
$request = $ret["request"];
|
||||
$request = $ret['request'];
|
||||
$tpl = get_markup_template('dfrn_request.tpl');
|
||||
} else {
|
||||
$request = System::baseUrl()."/follow";
|
||||
$request = System::baseUrl() . '/follow';
|
||||
$tpl = get_markup_template('auto_request.tpl');
|
||||
}
|
||||
|
||||
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid));
|
||||
|
||||
if (!$r) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
notice(L10n::t('Permission denied.'));
|
||||
goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$myaddr = $r[0]["url"];
|
||||
$myaddr = $r[0]['url'];
|
||||
$gcontact_id = 0;
|
||||
|
||||
// Makes the connection request for friendica contacts easier
|
||||
$_SESSION["fastlane"] = $ret["url"];
|
||||
$_SESSION['fastlane'] = $ret['url'];
|
||||
|
||||
$r = q("SELECT `id`, `location`, `about`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'",
|
||||
normalise_link($ret["url"]));
|
||||
normalise_link($ret['url']));
|
||||
|
||||
if (!$r) {
|
||||
$r = [["location" => "", "about" => "", "keywords" => ""]];
|
||||
$r = [['location' => '', 'about' => '', 'keywords' => '']];
|
||||
} else {
|
||||
$gcontact_id = $r[0]["id"];
|
||||
$gcontact_id = $r[0]['id'];
|
||||
}
|
||||
|
||||
if ($ret['network'] === NETWORK_DIASPORA) {
|
||||
$r[0]["location"] = "";
|
||||
$r[0]["about"] = "";
|
||||
$r[0]['location'] = '';
|
||||
$r[0]['about'] = '';
|
||||
}
|
||||
|
||||
$header = L10n::t("Connect/Follow");
|
||||
$header = L10n::t('Connect/Follow');
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
'$header' => htmlentities($header),
|
||||
//'$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL),
|
||||
'$desc' => "",
|
||||
'$pls_answer' => L10n::t('Please answer the following:'),
|
||||
'$does_know_you' => ['knowyou', L10n::t('Does %s know you?', $ret["name"]), false, '', [L10n::t('No'), L10n::t('Yes')]],
|
||||
'$add_note' => L10n::t('Add a personal note:'),
|
||||
'$page_desc' => "",
|
||||
'$friendica' => "",
|
||||
'$statusnet' => "",
|
||||
'$diaspora' => "",
|
||||
'$diasnote' => "",
|
||||
'$your_address' => L10n::t('Your Identity Address:'),
|
||||
'$invite_desc' => "",
|
||||
'$emailnet' => "",
|
||||
'$submit' => $submit,
|
||||
'$cancel' => L10n::t('Cancel'),
|
||||
'$nickname' => "",
|
||||
'$name' => $ret["name"],
|
||||
'$url' => $ret["url"],
|
||||
'$zrl' => Profile::zrl($ret["url"]),
|
||||
'$url_label' => L10n::t("Profile URL"),
|
||||
'$myaddr' => $myaddr,
|
||||
'$request' => $request,
|
||||
/*'$location' => Friendica\Content\Text\BBCode::::convert($r[0]["location"]),
|
||||
'$location_label' => L10n::t("Location:"),
|
||||
'$about' => Friendica\Content\Text\BBCode::::convert($r[0]["about"], false, false),
|
||||
'$about_label' => L10n::t("About:"), */
|
||||
'$keywords' => $r[0]["keywords"],
|
||||
'$keywords_label' => L10n::t("Tags:")
|
||||
$o = replace_macros($tpl, [
|
||||
'$header' => htmlentities($header),
|
||||
//'$photo' => proxy_url($ret['photo'], false, PROXY_SIZE_SMALL),
|
||||
'$desc' => '',
|
||||
'$pls_answer' => L10n::t('Please answer the following:'),
|
||||
'$does_know_you' => ['knowyou', L10n::t('Does %s know you?', $ret['name']), false, '', [L10n::t('No'), L10n::t('Yes')]],
|
||||
'$add_note' => L10n::t('Add a personal note:'),
|
||||
'$page_desc' => '',
|
||||
'$friendica' => '',
|
||||
'$statusnet' => '',
|
||||
'$diaspora' => '',
|
||||
'$diasnote' => '',
|
||||
'$your_address' => L10n::t('Your Identity Address:'),
|
||||
'$invite_desc' => '',
|
||||
'$emailnet' => '',
|
||||
'$submit' => $submit,
|
||||
'$cancel' => L10n::t('Cancel'),
|
||||
'$nickname' => '',
|
||||
'$name' => $ret['name'],
|
||||
'$url' => $ret['url'],
|
||||
'$zrl' => Profile::zrl($ret['url']),
|
||||
'$url_label' => L10n::t('Profile URL'),
|
||||
'$myaddr' => $myaddr,
|
||||
'$request' => $request,
|
||||
/*'$location' => Friendica\Content\Text\BBCode::::convert($r[0]['location']),
|
||||
'$location_label'=> L10n::t('Location:'),
|
||||
'$about' => Friendica\Content\Text\BBCode::::convert($r[0]['about'], false, false),
|
||||
'$about_label' => L10n::t('About:'),*/
|
||||
'$keywords' => $r[0]['keywords'],
|
||||
'$keywords_label'=> L10n::t('Tags:')
|
||||
]);
|
||||
|
||||
$a->page['aside'] = "";
|
||||
$a->page['aside'] = '';
|
||||
|
||||
Profile::load($a, "", 0, Contact::getDetailsByURL($ret["url"]), false);
|
||||
$profiledata = Contact::getDetailsByURL($ret['url']);
|
||||
if ($profiledata) {
|
||||
Profile::load($a, '', 0, $profiledata, false);
|
||||
}
|
||||
|
||||
if ($gcontact_id <> 0) {
|
||||
$o .= replace_macros(get_markup_template('section_title.tpl'),
|
||||
|
@ -184,7 +187,7 @@ function follow_content(App $a) {
|
|||
);
|
||||
|
||||
// Show last public posts
|
||||
$o .= Contact::getPostsFromUrl($ret["url"]);
|
||||
$o .= Contact::getPostsFromUrl($ret['url']);
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -75,8 +76,6 @@ function fsuggest_post(App $a)
|
|||
|
||||
function fsuggest_content(App $a)
|
||||
{
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
||||
if (! local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
return;
|
||||
|
@ -105,11 +104,10 @@ function fsuggest_content(App $a)
|
|||
|
||||
$o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';
|
||||
|
||||
$o .= contact_selector(
|
||||
$o .= ACL::getSuggestContactSelectHTML(
|
||||
'suggest',
|
||||
'suggest-select',
|
||||
['size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true],
|
||||
false
|
||||
['size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true]
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ function group_content(App $a) {
|
|||
}
|
||||
|
||||
if (($a->argc > 1) && (intval($a->argv[1]))) {
|
||||
require_once 'include/acl_selectors.php';
|
||||
require_once 'mod/contacts.php';
|
||||
|
||||
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
|
||||
|
|
|
@ -808,7 +808,6 @@ function item_post(App $a) {
|
|||
$link = '<a href="' . System::baseUrl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
|
||||
$html = prepare_body($datarray);
|
||||
$message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
|
||||
include_once 'include/html2plain.php';
|
||||
$params = [
|
||||
'fromName' => $a->user['username'],
|
||||
'fromEmail' => $a->user['email'],
|
||||
|
@ -816,7 +815,7 @@ function item_post(App $a) {
|
|||
'replyTo' => $a->user['email'],
|
||||
'messageSubject' => $subject,
|
||||
'htmlVersion' => $message,
|
||||
'textVersion' => html2plain($html.$disclaimer)
|
||||
'textVersion' => Friendica\Content\Text\HTML::toPlaintext($html.$disclaimer)
|
||||
];
|
||||
Emailer::send($params);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -15,7 +16,6 @@ use Friendica\Model\Mail;
|
|||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/acl_selectors.php';
|
||||
require_once 'include/conversation.php';
|
||||
|
||||
function message_init(App $a)
|
||||
|
@ -207,7 +207,7 @@ function message_content(App $a)
|
|||
'$linkurl' => L10n::t('Please enter a link URL:')
|
||||
]);
|
||||
|
||||
$preselect = isset($a->argv[2]) ? [$a->argv[2]] : false;
|
||||
$preselect = isset($a->argv[2]) ? [$a->argv[2]] : [];
|
||||
|
||||
$prename = $preurl = $preid = '';
|
||||
|
||||
|
@ -236,14 +236,14 @@ function message_content(App $a)
|
|||
$preid = $r[0]['id'];
|
||||
$preselect = [$preid];
|
||||
} else {
|
||||
$preselect = false;
|
||||
$preselect = [];
|
||||
}
|
||||
}
|
||||
|
||||
$prefill = $preselect ? $prename : '';
|
||||
|
||||
// the ugly select box
|
||||
$select = contact_select('messageto', 'message-to-select', $preselect, 4, true, false, false, 10);
|
||||
$select = ACL::getMessageContactSelectHTML('messageto', 'message-to-select', $preselect, 4, 10);
|
||||
|
||||
$tpl = get_markup_template('prv_message.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Content\ForumManager;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -24,7 +25,6 @@ use Friendica\Util\DateTimeFormat;
|
|||
|
||||
require_once 'include/conversation.php';
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
||||
function network_init(App $a)
|
||||
{
|
||||
|
@ -427,8 +427,8 @@ function networkFlatView(App $a, $update = 0)
|
|||
'lockstate' => (((is_array($a->user) &&
|
||||
((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
|
||||
(strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
|
||||
'default_perms' => get_acl_permissions($a->user),
|
||||
'acl' => populate_acl($a->user, true),
|
||||
'default_perms' => ACL::getDefaultUserPermissions($a->user),
|
||||
'acl' => ACL::getFullSelectorHTML($a->user, true),
|
||||
'bang' => '',
|
||||
'visitor' => 'block',
|
||||
'profile_uid' => local_user(),
|
||||
|
@ -576,8 +576,8 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
'lockstate' => ((($gid) || ($cid) || ($nets) || (is_array($a->user) &&
|
||||
((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
|
||||
(strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
|
||||
'default_perms' => get_acl_permissions($a->user),
|
||||
'acl' => populate_acl((($gid || $cid || $nets) ? $def_acl : $a->user), true),
|
||||
'default_perms' => ACL::getDefaultUserPermissions($a->user),
|
||||
'acl' => ACL::getFullSelectorHTML((($gid || $cid || $nets) ? $def_acl : $a->user), true),
|
||||
'bang' => (($gid || $cid || $nets) ? '!' : ''),
|
||||
'visitor' => 'block',
|
||||
'profile_uid' => local_user(),
|
||||
|
|
|
@ -33,7 +33,6 @@ function notes_content(App $a, $update = false)
|
|||
|
||||
require_once 'include/security.php';
|
||||
require_once 'include/conversation.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
$groups = [];
|
||||
|
||||
|
||||
|
|
|
@ -46,13 +46,11 @@ function oexchange_content(App $a) {
|
|||
return;
|
||||
}
|
||||
|
||||
require_once('include/html2bbcode.php');
|
||||
|
||||
$post = [];
|
||||
|
||||
$post['profile_uid'] = local_user();
|
||||
$post['return'] = '/oexchange/done' ;
|
||||
$post['body'] = html2bbcode($s);
|
||||
$post['body'] = Friendica\Content\Text\HTML::toBBCode($s);
|
||||
$post['type'] = 'wall';
|
||||
|
||||
$_REQUEST = $post;
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -26,7 +27,6 @@ use Friendica\Util\Map;
|
|||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
require_once 'include/security.php';
|
||||
|
||||
function photos_init(App $a) {
|
||||
|
@ -1084,7 +1084,7 @@ function photos_content(App $a)
|
|||
|
||||
$tpl = get_markup_template('photos_upload.tpl');
|
||||
|
||||
$aclselect_e = ($visitor ? '' : populate_acl($a->user));
|
||||
$aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML($a->user));
|
||||
|
||||
$o .= replace_macros($tpl,[
|
||||
'$pagename' => L10n::t('Upload Photos'),
|
||||
|
@ -1425,7 +1425,7 @@ function photos_content(App $a)
|
|||
|
||||
$album_e = $ph[0]['album'];
|
||||
$caption_e = $ph[0]['desc'];
|
||||
$aclselect_e = populate_acl($ph[0]);
|
||||
$aclselect_e = ACL::getFullSelectorHTML($ph[0]);
|
||||
|
||||
$edit = replace_macros($edit_tpl, [
|
||||
'$id' => $ph[0]['id'],
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -118,7 +119,6 @@ function profile_content(App $a, $update = 0)
|
|||
|
||||
require_once 'include/security.php';
|
||||
require_once 'include/conversation.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
require_once 'include/items.php';
|
||||
|
||||
$groups = [];
|
||||
|
@ -213,7 +213,7 @@ function profile_content(App $a, $update = 0)
|
|||
|| strlen($a->user['deny_cid'])
|
||||
|| strlen($a->user['deny_gid'])
|
||||
) ? 'lock' : 'unlock',
|
||||
'acl' => $is_owner ? populate_acl($a->user, true) : '',
|
||||
'acl' => $is_owner ? ACL::getFullSelectorHTML($a->user, true) : '',
|
||||
'bang' => '',
|
||||
'visitor' => $is_owner || $commvisitor ? 'block' : 'none',
|
||||
'profile_uid' => $a->profile['profile_uid'],
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Object\Image;
|
||||
|
@ -105,18 +106,11 @@ function profile_photo_post(App $a) {
|
|||
|
||||
// If setting for the default profile, unset the profile photo flag from any other photos I own
|
||||
|
||||
if($is_default_profile) {
|
||||
if ($is_default_profile) {
|
||||
$r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
|
||||
dbesc($base_image['resource-id']),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
$r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `self` AND `uid` = %d",
|
||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
|
||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
|
||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-6.' . $Image->getExt()),
|
||||
intval(local_user())
|
||||
);
|
||||
} else {
|
||||
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
|
||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
|
||||
|
@ -126,13 +120,7 @@ function profile_photo_post(App $a) {
|
|||
);
|
||||
}
|
||||
|
||||
// we'll set the updated profile-photo timestamp even if it isn't the default profile,
|
||||
// so that browsers will do a cache update unconditionally
|
||||
|
||||
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
intval(local_user())
|
||||
);
|
||||
Contact::updateSelfFromUserID(local_user(), true);
|
||||
|
||||
info(L10n::t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL);
|
||||
// Update global directory in background
|
||||
|
@ -229,10 +217,7 @@ function profile_photo_content(App $a) {
|
|||
dbesc($resource_id)
|
||||
);
|
||||
|
||||
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
intval(local_user())
|
||||
);
|
||||
Contact::updateSelfFromUserID(local_user(), true);
|
||||
|
||||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
|
|
|
@ -485,29 +485,15 @@ function profiles_post(App $a) {
|
|||
info(L10n::t('Profile updated.') . EOL);
|
||||
}
|
||||
|
||||
|
||||
if ($namechanged && $is_default) {
|
||||
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
||||
dbesc($name),
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
intval(local_user())
|
||||
);
|
||||
$r = q("UPDATE `user` set `username` = '%s' where `uid` = %d",
|
||||
dbesc($name),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
|
||||
if ($is_default) {
|
||||
$location = Profile::formatLocation(["locality" => $locality, "region" => $region, "country-name" => $country_name]);
|
||||
if ($namechanged) {
|
||||
$r = q("UPDATE `user` set `username` = '%s' where `uid` = %d",
|
||||
dbesc($name),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
|
||||
q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
|
||||
dbesc($about),
|
||||
dbesc($location),
|
||||
dbesc($pub_keywords),
|
||||
dbesc($gender),
|
||||
intval(local_user())
|
||||
);
|
||||
Contact::updateSelfFromUserID(local_user());
|
||||
|
||||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -13,6 +14,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\User;
|
||||
|
@ -386,13 +388,18 @@ function settings_post(App $a)
|
|||
if (!x($newpass) || !x($confirm)) {
|
||||
notice(L10n::t('Empty passwords are not allowed. Password unchanged.') . EOL);
|
||||
$err = true;
|
||||
}
|
||||
}
|
||||
|
||||
// check if the old password was supplied correctly before changing it to the new value
|
||||
if (!User::authenticate(intval(local_user()), $_POST['opassword'])) {
|
||||
notice(L10n::t('Wrong password.') . EOL);
|
||||
$err = true;
|
||||
}
|
||||
if (!Config::get('system', 'disable_password_exposed', false) && User::isPasswordExposed($newpass)) {
|
||||
notice(L10n::t('The new password has been exposed in a public data dump, please choose another.') . EOL);
|
||||
$err = true;
|
||||
}
|
||||
|
||||
// check if the old password was supplied correctly before changing it to the new value
|
||||
if (!User::authenticate(intval(local_user()), $_POST['opassword'])) {
|
||||
notice(L10n::t('Wrong password.') . EOL);
|
||||
$err = true;
|
||||
}
|
||||
|
||||
if (!$err) {
|
||||
$result = User::updatePassword(local_user(), $newpass);
|
||||
|
@ -484,10 +491,7 @@ function settings_post(App $a)
|
|||
|
||||
$err = '';
|
||||
|
||||
$name_change = false;
|
||||
|
||||
if ($username != $a->user['username']) {
|
||||
$name_change = true;
|
||||
if (strlen($username) > 40) {
|
||||
$err .= L10n::t(' Please use a shorter name.');
|
||||
}
|
||||
|
@ -627,14 +631,7 @@ function settings_post(App $a)
|
|||
intval(local_user())
|
||||
);
|
||||
|
||||
|
||||
if ($name_change) {
|
||||
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
|
||||
dbesc($username),
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
Contact::updateSelfFromUserID(local_user());
|
||||
|
||||
if (($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
|
||||
// Update global directory in background
|
||||
|
@ -998,8 +995,6 @@ function settings_content(App $a)
|
|||
* ACCOUNT SETTINGS
|
||||
*/
|
||||
|
||||
require_once('include/acl_selectors.php');
|
||||
|
||||
$profile = dba::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
|
||||
if (!DBM::is_result($profile)) {
|
||||
notice(L10n::t('Unable to find your profile. Please contact your admin.') . EOL);
|
||||
|
@ -1223,7 +1218,7 @@ function settings_content(App $a)
|
|||
'$permissions' => L10n::t('Default Post Permissions'),
|
||||
'$permdesc' => L10n::t("\x28click to open/close\x29"),
|
||||
'$visibility' => $profile['net-publish'],
|
||||
'$aclselect' => populate_acl($a->user),
|
||||
'$aclselect' => ACL::getFullSelectorHTML($a->user),
|
||||
'$suggestme' => $suggestme,
|
||||
'$blockwall'=> $blockwall, // array('blockwall', L10n::t('Allow friends to post to your profile page:'), !$blockwall, ''),
|
||||
'$blocktags'=> $blocktags, // array('blocktags', L10n::t('Allow friends to tag your posts:'), !$blocktags, ''),
|
||||
|
@ -1274,7 +1269,7 @@ function settings_content(App $a)
|
|||
|
||||
'$detailed_notif' => ['detailed_notif', L10n::t('Show detailled notifications'),
|
||||
PConfig::get(local_user(), 'system', 'detailed_notif'),
|
||||
L10n::t('Per default the notificiation are condensed to a single notification per item. When enabled, every notification is displayed.')],
|
||||
L10n::t('Per default, notifications are condensed to a single notification per item. When enabled every notification is displayed.')],
|
||||
|
||||
'$h_advn' => L10n::t('Advanced Account/Page Type Settings'),
|
||||
'$h_descadvn' => L10n::t('Change the behaviour of this account for special situations'),
|
||||
|
|
|
@ -19,7 +19,6 @@ use Friendica\Protocol\DFRN;
|
|||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
require_once 'include/security.php';
|
||||
|
||||
function videos_init(App $a) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue