Merge branch 'develop' of github.com:friendica/friendica into rewrites/coding-convention-split2-4-2

Fixed some stuff:
- converted some files from DOS to Uni* (CRLF -> LF)
- removed trailing white-spaces

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-05-11 14:54:26 +02:00
commit 7a9456d5ac
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
350 changed files with 19367 additions and 16093 deletions

View file

@ -1,6 +1,7 @@
<?php
use \Friendica\Core\Config;
use Friendica\App;
use Friendica\Core\Config;
require_once("mod/hostxrd.php");
require_once("mod/nodeinfo.php");

View file

@ -1,6 +1,8 @@
<?php
require_once('include/Scrape.php');
use Friendica\App;
require_once 'include/probe.php';
function acctlink_init(App $a) {

View file

@ -1,6 +1,8 @@
<?php
/* ACL selector json backend */
use Friendica\App;
require_once 'include/acl_selectors.php';
function acl_init(App $a) {

View file

@ -6,7 +6,8 @@
* @brief Friendica admin
*/
use \Friendica\Core\Config;
use Friendica\App;
use Friendica\Core\Config;
require_once("include/enotify.php");
require_once("include/text.php");
@ -109,6 +110,9 @@ function admin_post(App $a) {
case 'dbsync':
admin_page_dbsync_post($a);
break;
case 'blocklist':
admin_page_blocklist_post($a);
break;
}
}
@ -166,6 +170,7 @@ function admin_content(App $a) {
'features' => array("admin/features/", t("Additional features") , "features"),
'dbsync' => array("admin/dbsync/", t('DB updates'), "dbsync"),
'queue' => array("admin/queue/", t('Inspect Queue'), "queue"),
'blocklist' => array("admin/blocklist/", t('Server Blocklist'), "blocklist"),
'federation' => array("admin/federation/", t('Federation Statistics'), "federation"),
);
@ -236,6 +241,9 @@ function admin_content(App $a) {
case 'federation':
$o = admin_page_federation($a);
break;
case 'blocklist':
$o = admin_page_blocklist($a);
break;
default:
notice(t("Item not found."));
}
@ -252,6 +260,94 @@ function admin_content(App $a) {
}
}
/**
* @brief Subpage to modify the server wide block list via the admin panel.
*
* This function generates the subpage of the admin panel to allow the
* modification of the node wide block/black list to block entire
* remote servers from communication with this node. The page allows
* adding, removing and editing of entries from the blocklist.
*
* @param App $a
* @return string
*/
function admin_page_blocklist(App $a) {
$blocklist = Config::get('system', 'blocklist');
$blocklistform = array();
if (is_array($blocklist)) {
foreach($blocklist as $id => $b) {
$blocklistform[] = array(
'domain' => array("domain[$id]", t('Blocked domain'), $b['domain'], '', t('The blocked domain'), 'required', '', ''),
'reason' => array("reason[$id]", t("Reason for the block"), $b['reason'], t('The reason why you blocked this domain.').'('.$b['domain'].')', 'required', '', ''),
'delete' => array("delete[$id]", t("Delete domain").' ('.$b['domain'].')', False , t("Check to delete this entry from the blocklist"))
);
}
}
$t = get_markup_template("admin_blocklist.tpl");
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Server Blocklist'),
'$intro' => t('This page can be used to define a black list of servers from the federated network that are not allowed to interact with your node. For all entered domains you should also give a reason why you have blocked the remote server.'),
'$public' => t('The list of blocked servers will be made publically available on the /friendica page so that your users and people investigating communication problems can find the reason easily.'),
'$addtitle' => t('Add new entry to block list'),
'$newdomain' => array('newentry_domain', t('Server Domain'), '', t('The domain of the new server to add to the block list. Do not include the protocol.'), 'required', '', ''),
'$newreason' => array('newentry_reason', t('Block reason'), '', t('The reason why you blocked this domain.'), 'required', '', ''),
'$submit' => t('Add Entry'),
'$savechanges' => t('Save changes to the blocklist'),
'$currenttitle' => t('Current Entries in the Blocklist'),
'$thurl' => t('Blocked domain'),
'$threason' => t('Reason for the block'),
'$delentry' => t('Delete entry from blocklist'),
'$entries' => $blocklistform,
'$baseurl' => App::get_baseurl(true),
'$confirm_delete' => t('Delete entry from blocklist?'),
'$form_security_token' => get_form_security_token("admin_blocklist")
));
}
/**
* @brief Process send data from Admin Blocklist Page
*
* @param App $a
*/
function admin_page_blocklist_post(App $a) {
if (!x($_POST,"page_blocklist_save") && (!x($_POST['page_blocklist_edit']))) {
return;
}
check_form_security_token_redirectOnErr('/admin/blocklist', 'admin_blocklist');
if (x($_POST['page_blocklist_save'])) {
// Add new item to blocklist
$blocklist = get_config('system', 'blocklist');
$blocklist[] = array(
'domain' => notags(trim($_POST['newentry_domain'])),
'reason' => notags(trim($_POST['newentry_reason']))
);
Config::set('system', 'blocklist', $blocklist);
info(t('Server added to blocklist.').EOL);
} else {
// Edit the entries from blocklist
$blocklist = array();
foreach ($_POST['domain'] as $id => $domain) {
// Trimming whitespaces as well as any lingering slashes
$domain = notags(trim($domain, "\x00..\x1F/"));
$reason = notags(trim($_POST['reason'][$id]));
if (!x($_POST['delete'][$id])) {
$blocklist[] = array(
'domain' => $domain,
'reason' => $reason
);
}
}
Config::set('system', 'blocklist', $blocklist);
info(t('Site blocklist updated.').EOL);
}
goaway('admin/blocklist');
return; // NOTREACHED
}
/**
* @brief Subpage with some stats about "the federation" network
*
@ -447,7 +543,7 @@ function admin_page_summary(App $a) {
$warningtext = array();
if (dbm::is_result($r)) {
$showwarning = true;
$warningtext[] = sprintf(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 <tt>convert_innodb.sql</tt> in the <tt>/util</tt> directory of your Friendica installation.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
$warningtext[] = sprintf(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 include/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');
}
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
@ -636,6 +732,7 @@ function admin_page_site_post(App $a) {
$timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
$maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
$maxloadavg_frontend = ((x($_POST,'maxloadavg_frontend')) ? intval(trim($_POST['maxloadavg_frontend'])) : 50);
$min_memory = ((x($_POST,'min_memory')) ? intval(trim($_POST['min_memory'])) : 0);
$optimize_max_tablesize = ((x($_POST,'optimize_max_tablesize')) ? intval(trim($_POST['optimize_max_tablesize'])): 100);
$optimize_fragmentation = ((x($_POST,'optimize_fragmentation')) ? intval(trim($_POST['optimize_fragmentation'])): 30);
$poco_completion = ((x($_POST,'poco_completion')) ? intval(trim($_POST['poco_completion'])) : false);
@ -721,6 +818,7 @@ function admin_page_site_post(App $a) {
set_config('system','ssl_policy',$ssl_policy);
set_config('system','maxloadavg',$maxloadavg);
set_config('system','maxloadavg_frontend',$maxloadavg_frontend);
set_config('system','min_memory',$min_memory);
set_config('system','optimize_max_tablesize',$optimize_max_tablesize);
set_config('system','optimize_fragmentation',$optimize_fragmentation);
set_config('system','poco_completion',$poco_completion);
@ -1018,6 +1116,7 @@ function admin_page_site(App $a) {
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
'$maxloadavg_frontend' => array('maxloadavg_frontend', t("Maximum Load Average (Frontend)"), ((intval(get_config('system','maxloadavg_frontend')) > 0)?get_config('system','maxloadavg_frontend'):50), t("Maximum system load before the frontend quits service - default 50.")),
'$min_memory' => array('min_memory', t("Minimal Memory"), ((intval(get_config('system','min_memory')) > 0)?get_config('system','min_memory'):0), t("Minimal free memory in MB for the poller. Needs access to /proc/meminfo - default 0 (deactivated).")),
'$optimize_max_tablesize'=> array('optimize_max_tablesize', t("Maximum table size for optimization"), $optimize_max_tablesize, t("Maximum table size (in MB) for the automatic optimization - default 100 MB. Enter -1 to disable it.")),
'$optimize_fragmentation'=> array('optimize_fragmentation', t("Minimum level of fragmentation"), ((intval(get_config('system','optimize_fragmentation')) > 0)?get_config('system','optimize_fragmentation'):30), t("Minimum fragmenation level to start the automatic optimization - default value is 30%.")),

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/socgraph.php');
require_once('include/Contact.php');
require_once('include/contact_selectors.php');

View file

@ -1,8 +1,9 @@
<?php
use Friendica\App;
function amcd_content(App $a) {
//header("Content-type: text/json");
echo <<< EOT
echo <<< JSON
{
"version":1,
"sessionstatus":{
@ -44,6 +45,6 @@ echo <<< EOT
}
}
}
EOT;
killme();
JSON;
killme();
}

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/api.php');
function oauth_get_client($request){
@ -106,8 +108,6 @@ function api_content(App $a) {
'$no' => t('No'),
));
//echo "<pre>"; var_dump($app); killme();
return $o;
}

View file

@ -1,25 +1,25 @@
<?php
use Friendica\App;
function apps_content(App $a) {
$privateaddons = get_config('config','private_addons');
if ($privateaddons === "1") {
if((! (local_user()))) {
info( t("You must be logged in to use addons. "));
return;};
}
$privateaddons = get_config('config', 'private_addons');
if ($privateaddons === "1") {
if (! local_user()) {
info(t('You must be logged in to use addons. '));
return;
};
}
$title = t('Applications');
$title = t('Applications');
if(count($a->apps)==0)
notice( t('No installed applications.') . EOL);
if (count($a->apps) == 0) {
notice(t('No installed applications.') . EOL);
}
$tpl = get_markup_template("apps.tpl");
$tpl = get_markup_template('apps.tpl');
return replace_macros($tpl, array(
'$title' => $title,
'$apps' => $a->apps,
));
}

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/security.php');
function attach_init(App $a) {

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once 'include/bbcode.php';
require_once 'library/markdown.php';
require_once 'include/bb2diaspora.php';

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/conversation.php');
require_once('include/items.php');

View file

@ -6,6 +6,8 @@
* of the profile owner
*/
use Friendica\App;
require_once('include/event.php');
require_once('include/redir.php');

View file

@ -4,6 +4,7 @@
* General purpose landing page for plugins/addons
*/
use Friendica\App;
function cb_init(App $a) {
call_hooks('cb_init');

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/socgraph.php');
require_once('include/Contact.php');
require_once('include/contact_selectors.php');

View file

@ -1,6 +1,7 @@
<?php
use \Friendica\Core\Config;
use Friendica\App;
use Friendica\Core\Config;
function community_init(App $a) {
if (! local_user()) {
@ -9,7 +10,6 @@ function community_init(App $a) {
}
}
function community_content(App $a, $update = 0) {
$o = '';

View file

@ -1,10 +1,10 @@
<?php
use Friendica\App;
require_once('include/group.php');
function contactgroup_content(App $a) {
if (! local_user()) {
killme();
}

View file

@ -1,11 +1,14 @@
<?php
require_once('include/Contact.php');
require_once('include/socgraph.php');
require_once('include/contact_selectors.php');
require_once('include/Scrape.php');
require_once('mod/proxy.php');
require_once('include/Photo.php');
use Friendica\App;
use Friendica\Network\Probe;
require_once 'include/Contact.php';
require_once 'include/socgraph.php';
require_once 'include/contact_selectors.php';
require_once 'include/probe.php';
require_once 'mod/proxy.php';
require_once 'include/Photo.php';
function contacts_init(App $a) {
if (! local_user()) {
@ -25,8 +28,8 @@ function contacts_init(App $a) {
}
}
require_once('include/group.php');
require_once('include/contact_widgets.php');
require_once 'include/group.php';
require_once 'include/contact_widgets.php';
if ($_GET['nets'] == "all") {
$_GET['nets'] = "";
@ -260,7 +263,7 @@ function _contact_update_profile($contact_id) {
if ($uid != local_user())
return;
$data = probe_url($r[0]["url"]);
$data = Probe::uri($r[0]["url"], "", 0, false);
// "Feed" or "Unknown" is mostly a sign of communication problems
if ((in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) AND ($data["network"] != $r[0]["network"]))
@ -496,7 +499,7 @@ function contacts_content(App $a) {
'$baseurl' => App::get_baseurl(true),
));
require_once('include/contact_selectors.php');
require_once 'include/contact_selectors.php';
$tpl = get_markup_template("contact_edit.tpl");
@ -828,7 +831,7 @@ function contacts_content(App $a) {
*
* Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
*
* @param app $a
* @param App $a
* @param int $contact_id The ID of the contact
* @param int $active_tab 1 if tab should be marked as active
*

View file

@ -15,6 +15,7 @@
// fast - e.g. one or two milliseconds to fetch parent items for the current content,
// and 10-20 milliseconds to fetch all the child items.
use Friendica\App;
function content_content(App $a, $update = 0) {

View file

@ -1,20 +1,23 @@
<?php
/**
* Show a credits page for all the developers who helped with the project
* (only contributors to the git repositories for friendica core and the
* addons repository will be listed though ATM)
*/
function credits_content (App $a) {
/* fill the page with credits */
$f = fopen('util/credits.txt','r');
$names = fread($f, filesize('util/credits.txt'));
$arr = explode("\n", htmlspecialchars($names));
fclose($f);
$tpl = get_markup_template('credits.tpl');
return replace_macros( $tpl, array(
'$title' => t('Credits'),
'$thanks' => t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
'$names' => $arr,
));
use Friendica\App;
function credits_content(App $a) {
/* fill the page with credits */
$f = fopen('util/credits.txt', 'r');
$names = fread($f, filesize('util/credits.txt'));
$arr = explode("\n", htmlspecialchars($names));
fclose($f);
$tpl = get_markup_template('credits.tpl');
return replace_macros($tpl, array(
'$title' => t('Credits'),
'$thanks' => t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
'$names' => $arr,
));
}

View file

@ -1,4 +1,7 @@
<?php
use Friendica\App;
require_once("include/contact_selectors.php");
require_once("mod/contacts.php");

View file

@ -1,11 +1,13 @@
<?php
use Friendica\App;
require_once('mod/settings.php');
function delegate_init(App $a) {
return settings_init($a);
}
function delegate_content(App $a) {
if (! local_user()) {

View file

@ -18,9 +18,11 @@
* https://github.com/friendica/friendica/blob/master/spec/dfrn2_contact_confirmation.png
*/
require_once('include/enotify.php');
require_once('include/group.php');
require_once('include/Probe.php');
use Friendica\App;
use Friendica\Network\Probe;
require_once 'include/enotify.php';
require_once 'include/group.php';
function dfrn_confirm_post(App $a, $handsfree = null) {
@ -152,7 +154,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
* worried about key leakage than anybody cracking it.
*
*/
require_once('include/crypto.php');
require_once 'include/crypto.php';
$res = new_keypair(4096);
@ -317,7 +319,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
*
*/
require_once('include/Photo.php');
require_once 'include/Photo.php';
update_contact_avatar($contact['photo'],$uid,$contact_id);
@ -433,7 +435,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
if (($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
require_once('include/diaspora.php');
require_once 'include/diaspora.php';
$ret = Diaspora::send_share($user[0],$r[0]);
logger('share returns: ' . $ret);
}
@ -446,7 +448,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
require_once('include/items.php');
require_once 'include/items.php';
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid)
@ -670,7 +672,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$photo = App::get_baseurl() . '/images/person-175.jpg';
}
require_once("include/Photo.php");
require_once 'include/Photo.php';
update_contact_avatar($photo,$local_uid,$dfrn_record);
@ -750,7 +752,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
require_once('include/items.php');
require_once 'include/items.php';
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($local_uid)

View file

@ -5,6 +5,9 @@
* @brief The dfrn notify endpoint
* @see PDF with dfrn specs: https://github.com/friendica/friendica/blob/master/spec/dfrn2.pdf
*/
use Friendica\App;
require_once('include/items.php');
require_once('include/dfrn.php');
require_once('include/event.php');

View file

@ -1,12 +1,12 @@
<?php
use Friendica\App;
require_once('include/items.php');
require_once('include/auth.php');
require_once('include/dfrn.php');
function dfrn_poll_init(App $a) {
$dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
$type = ((x($_GET,'type')) ? $_GET['type'] : 'data');
$last_update = ((x($_GET,'last_update')) ? $_GET['last_update'] : '');

View file

@ -12,10 +12,12 @@
* https://github.com/friendica/friendica/blob/master/spec/dfrn2_contact_request.png
*/
require_once('include/enotify.php');
require_once('include/Scrape.php');
require_once('include/Probe.php');
require_once('include/group.php');
use Friendica\App;
use Friendica\Network\Probe;
require_once 'include/enotify.php';
require_once 'include/probe.php';
require_once 'include/group.php';
function dfrn_request_init(App $a) {
@ -131,7 +133,7 @@ function dfrn_request_post(App $a) {
if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL );
}
$invalid = Probe::valid_dfrn($parms);
$invalid = Probe::validDfrn($parms);
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
@ -453,7 +455,7 @@ function dfrn_request_post(App $a) {
$network = $data["network"];
// Canonicalise email-style profile locator
$url = Probe::webfinger_dfrn($url,$hcard);
$url = Probe::webfingerDfrn($url,$hcard);
if (substr($url,0,5) === 'stat:') {
@ -514,8 +516,11 @@ function dfrn_request_post(App $a) {
return; // NOTREACHED
}
require_once('include/Scrape.php');
if (blocked_url($url)) {
notice( t('Blocked domain') . EOL);
goaway(App::get_baseurl() . '/' . $a->cmd);
return; // NOTREACHED
}
$parms = Probe::profile(($hcard) ? $hcard : $url);
@ -530,7 +535,7 @@ function dfrn_request_post(App $a) {
if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL );
}
$invalid = Probe::valid_dfrn($parms);
$invalid = Probe::validDfrn($parms);
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
@ -760,7 +765,7 @@ function dfrn_request_content(App $a) {
}
if($auto_confirm) {
require_once('mod/dfrn_confirm.php');
require_once 'mod/dfrn_confirm.php';
$handsfree = array(
'uid' => $r[0]['uid'],
'node' => $r[0]['nickname'],

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function directory_init(App $a) {
$a->set_pager_itemspage(60);
@ -9,24 +11,18 @@ function directory_init(App $a) {
$a->page['aside'] .= findpeople_widget();
$a->page['aside'] .= follow_widget();
}
else {
unset($_SESSION['theme']);
unset($_SESSION['mobile-theme']);
}
}
function directory_post(App $a) {
if(x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
function directory_content(App $a) {
global $db;

View file

@ -1,9 +1,13 @@
<?php
require_once('include/contact_widgets.php');
require_once('include/socgraph.php');
require_once('include/Contact.php');
require_once('include/contact_selectors.php');
require_once('mod/contacts.php');
use Friendica\App;
require_once 'include/contact_widgets.php';
require_once 'include/probe.php';
require_once 'include/socgraph.php';
require_once 'include/Contact.php';
require_once 'include/contact_selectors.php';
require_once 'mod/contacts.php';
function dirfind_init(App $a) {
@ -21,8 +25,6 @@ function dirfind_init(App $a) {
$a->page['aside'] .= follow_widget();
}
function dirfind_content(App $a, $prefix = "") {
$community = false;

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function display_init(App $a) {
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
@ -106,7 +108,6 @@ function display_init(App $a) {
}
profile_load($a, $nick, 0, $profiledata);
}
function display_fetchauthor($a, $item) {

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/acl_selectors.php');
function editpost_content(App $a) {

View file

@ -3,6 +3,9 @@
* @file mod/events.php
* @brief The events module
*/
use Friendica\App;
require_once 'include/bbcode.php';
require_once 'include/datetime.php';
require_once 'include/event.php';

View file

@ -5,6 +5,8 @@
* @author Fabio Comuni <fabrixxm@kirgroup.com>
*/
use Friendica\App;
require_once('include/Photo.php');
/**

View file

@ -2,6 +2,9 @@
/*
This file is part of the Diaspora protocol. It is used for fetching single public posts.
*/
use Friendica\App;
require_once("include/crypto.php");
require_once("include/diaspora.php");
require_once("include/xml.php");

View file

@ -1,10 +1,11 @@
<?php
use Friendica\App;
require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');
function filer_content(App $a) {
if (! local_user()) {

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function filerm_content(App $a) {
if (! local_user()) {

View file

@ -1,9 +1,11 @@
<?php
require_once('include/Scrape.php');
require_once('include/follow.php');
require_once('include/Contact.php');
require_once('include/contact_selectors.php');
use Friendica\App;
require_once 'include/probe.php';
require_once 'include/follow.php';
require_once 'include/Contact.php';
require_once 'include/contact_selectors.php';
function follow_content(App $a) {

View file

@ -1,57 +1,61 @@
<?php
use \Friendica\Core\Config;
use Friendica\App;
use Friendica\Core\Config;
function friendica_init(App $a) {
if ($a->argv[1]=="json"){
if ($a->argv[1] == "json"){
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
$sql_extra = '';
if(x($a->config,'admin_nickname')) {
$sql_extra = sprintf(" AND nickname = '%s' ",dbesc($a->config['admin_nickname']));
if (x($a->config,'admin_nickname')) {
$sql_extra = sprintf(" AND `nickname` = '%s' ", dbesc($a->config['admin_nickname']));
}
if (isset($a->config['admin_email']) && $a->config['admin_email']!=''){
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
if (isset($a->config['admin_email']) && $a->config['admin_email']!='') {
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
//$r = q("SELECT username, nickname FROM user WHERE email='%s' $sql_extra", dbesc($a->config['admin_email']));
$r = q("SELECT username, nickname FROM user WHERE email='%s' $sql_extra", dbesc($adminlist[0]));
$r = q("SELECT `username`, `nickname` FROM `user` WHERE `email` = '%s' $sql_extra", dbesc($adminlist[0]));
$admin = array(
'name' => $r[0]['username'],
'profile'=> App::get_baseurl().'/profile/'.$r[0]['nickname'],
'profile'=> App::get_baseurl() . '/profile/' . $r[0]['nickname'],
);
} else {
$admin = false;
}
$visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0");
if (dbm::is_result($r))
foreach($r as $rr)
if (is_array($a->plugins) && count($a->plugins)) {
$r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
if (dbm::is_result($r)) {
foreach($r as $rr) {
$visible_plugins[] = $rr['name'];
}
}
}
Config::load('feature_lock');
$locked_features = array();
if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
foreach($a->config['feature_lock'] as $k => $v) {
if($k === 'config_loaded')
if (is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
foreach ($a->config['feature_lock'] as $k => $v) {
if ($k === 'config_loaded') {
continue;
}
$locked_features[$k] = intval($v);
}
}
$data = Array(
'version' => FRIENDICA_VERSION,
'url' => z_root(),
'plugins' => $visible_plugins,
'version' => FRIENDICA_VERSION,
'url' => z_root(),
'plugins' => $visible_plugins,
'locked_features' => $locked_features,
'register_policy' => $register_policy[$a->config['register_policy']],
'admin' => $admin,
'site_name' => $a->config['sitename'],
'platform' => FRIENDICA_PLATFORM,
'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
'no_scrape_url' => App::get_baseurl().'/noscrape'
'admin' => $admin,
'site_name' => $a->config['sitename'],
'platform' => FRIENDICA_PLATFORM,
'info' => ((x($a->config,'info')) ? $a->config['info'] : ''),
'no_scrape_url' => App::get_baseurl().'/noscrape'
);
echo json_encode($data);
@ -59,53 +63,63 @@ function friendica_init(App $a) {
}
}
function friendica_content(App $a) {
$o = '<h1>Friendica</h1>' . PHP_EOL;
$o .= '<p>';
$o .= t('This is Friendica, version') . ' <strong>' . FRIENDICA_VERSION . '</strong> ';
$o .= t('running at web location') . ' ' . z_root();
$o .= '</p>' . PHP_EOL;
$o = '';
$o .= '<h3>Friendica</h3>';
$o .= '<p>';
$o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . PHP_EOL;
$o .= '</p>' . PHP_EOL;
$o .= '<p></p><p>';
$o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' ';
$o .= t('running at web location') . ' ' . z_root() . '</p><p>';
$o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';
$o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a></p><p>';
$o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '</p>';
$o .= '<p></p>';
$o .= '<p>';
$o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a>';
$o .= '</p>' . PHP_EOL;
$o .= '<p>';
$o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com');
$o .= '</p>' . PHP_EOL;
$visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0");
if (dbm::is_result($r))
foreach($r as $rr)
if (is_array($a->plugins) && count($a->plugins)) {
$r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
if (dbm::is_result($r)) {
foreach($r as $rr) {
$visible_plugins[] = $rr['name'];
}
}
}
if(count($visible_plugins)) {
$o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
if (count($visible_plugins)) {
$o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>' . PHP_EOL;
$sorted = $visible_plugins;
$s = '';
sort($sorted);
foreach($sorted as $p) {
if(strlen($p)) {
if(strlen($s)) $s .= ', ';
foreach ($sorted as $p) {
if (strlen($p)) {
if (strlen($s)) {
$s .= ', ';
}
$s .= $p;
}
}
$o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>';
$o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>' . PHP_EOL;
} else {
$o .= '<p>' . t('No installed plugins/addons/apps') . '</p>' . PHP_EOL;
}
$blocklist = Config::get('system', 'blocklist');
if (count($blocklist)) {
$o .= '<div id="about_blocklist"><p>' . t('On this server the following remote servers are blocked.') . '</p>' . PHP_EOL;
$o .= '<table class="table"><thead><tr><th>' . t('Blocked domain') . '</th><th>' . t('Reason for the block') . '</th></thead><tbody>' . PHP_EOL;
foreach ($blocklist as $b) {
$o .= '<tr><td>' . $b['domain'] .'</td><td>' . $b['reason'] . '</td></tr>' . PHP_EOL;
}
$o .= '</tbody></table></div>' . PHP_EOL;
}
else
$o .= '<p>' . t('No installed plugins/addons/apps') . '</p>';
call_hooks('about_hook', $o);
return $o;
}

View file

@ -1,5 +1,6 @@
<?php
use Friendica\App;
function fsuggest_post(App $a) {

View file

@ -1,38 +1,39 @@
<?php
/**
* @file mod/group.php
* @brief The group module (create and rename contact groups, add and
* remove contacts to the contact groups
*/
function validate_members(&$item) {
$item = intval($item);
}
use Friendica\App;
function group_init(App $a) {
if(local_user()) {
require_once('include/group.php');
$a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0));
if (local_user()) {
require_once 'include/group.php';
$a->page['aside'] = group_side('contacts', 'group', 'extended', (($a->argc > 1) ? intval($a->argv[1]) : 0));
}
}
function group_post(App $a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
notice(t('Permission denied.') . EOL);
return;
}
if(($a->argc == 2) && ($a->argv[1] === 'new')) {
if (($a->argc == 2) && ($a->argv[1] === 'new')) {
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
$name = notags(trim($_POST['groupname']));
$r = group_add(local_user(),$name);
$r = group_add(local_user(), $name);
if ($r) {
info( t('Group created.') . EOL );
$r = group_byname(local_user(),$name);
info(t('Group created.') . EOL);
$r = group_byname(local_user(), $name);
if ($r) {
goaway(App::get_baseurl() . '/group/' . $r);
}
} else {
notice( t('Could not create group.') . EOL );
notice(t('Could not create group.') . EOL);
}
goaway(App::get_baseurl() . '/group');
return; // NOTREACHED
@ -46,7 +47,7 @@ function group_post(App $a) {
intval(local_user())
);
if (! dbm::is_result($r)) {
notice( t('Group not found.') . EOL );
notice(t('Group not found.') . EOL);
goaway(App::get_baseurl() . '/contacts');
return; // NOTREACHED
}
@ -60,7 +61,7 @@ function group_post(App $a) {
);
if ($r) {
info( t('Group name changed.') . EOL );
info(t('Group name changed.') . EOL);
}
}
@ -73,17 +74,19 @@ function group_content(App $a) {
$change = false;
if (! local_user()) {
notice( t('Permission denied') . EOL);
notice(t('Permission denied') . EOL);
return;
}
// Switch to text mode interface if we have more than 'n' contacts or group members
$switchtotext = get_pconfig(local_user(),'system','groupedit_image_limit');
if($switchtotext === false)
$switchtotext = get_config('system','groupedit_image_limit');
if($switchtotext === false)
$switchtotext = get_pconfig(local_user(), 'system', 'groupedit_image_limit');
if ($switchtotext === false) {
$switchtotext = get_config('system', 'groupedit_image_limit');
}
if ($switchtotext === false) {
$switchtotext = 400;
}
$tpl = get_markup_template('group_edit.tpl');
@ -92,7 +95,6 @@ function group_content(App $a) {
);
if (($a->argc == 2) && ($a->argv[1] === 'new')) {
return replace_macros($tpl, $context + array(
'$title' => t('Create a group of contacts/friends.'),
'$gname' => array('groupname', t('Group Name: '), '', ''),
@ -115,13 +117,13 @@ function group_content(App $a) {
$result = null;
if (dbm::is_result($r)) {
$result = group_rmv(local_user(),$r[0]['name']);
$result = group_rmv(local_user(), $r[0]['name']);
}
if ($result) {
info( t('Group removed.') . EOL);
info(t('Group removed.') . EOL);
} else {
notice( t('Unable to remove group.') . EOL);
notice(t('Unable to remove group.') . EOL);
}
}
goaway(App::get_baseurl() . '/group');
@ -135,66 +137,75 @@ function group_content(App $a) {
intval($a->argv[2]),
intval(local_user())
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$change = intval($a->argv[2]);
}
}
if (($a->argc > 1) && (intval($a->argv[1]))) {
require_once 'include/acl_selectors.php';
require_once 'mod/contacts.php';
require_once('include/acl_selectors.php');
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
intval($a->argv[1]),
intval(local_user())
);
if (! dbm::is_result($r)) {
notice( t('Group not found.') . EOL );
notice(t('Group not found.') . EOL);
goaway(App::get_baseurl() . '/contacts');
}
$group = $r[0];
$members = group_get_members($group['id']);
$preselected = array();
if(count($members)) {
foreach($members as $member)
$entry = array();
$id = 0;
if (count($members)) {
foreach ($members as $member) {
$preselected[] = $member['id'];
}
}
if($change) {
if(in_array($change,$preselected)) {
group_rmv_member(local_user(),$group['name'],$change);
}
else {
group_add_member(local_user(),$group['name'],$change);
if ($change) {
if (in_array($change, $preselected)) {
group_rmv_member(local_user(), $group['name'], $change);
} else {
group_add_member(local_user(), $group['name'], $change);
}
$members = group_get_members($group['id']);
$preselected = array();
if(count($members)) {
foreach($members as $member)
if (count($members)) {
foreach ($members as $member) {
$preselected[] = $member['id'];
}
}
}
$drop_tpl = get_markup_template('group_drop.tpl');
$drop_txt = replace_macros($drop_tpl, array(
'$id' => $group['id'],
'$delete' => t('Delete'),
'$delete' => t('Delete Group'),
'$form_security_token' => get_form_security_token("group_drop"),
));
$context = $context + array(
'$title' => t('Group Editor'),
'$gname' => array('groupname', t('Group Name: '),$group['name'], ''),
'$gname' => array('groupname', t('Group Name: '), $group['name'], ''),
'$gid' => $group['id'],
'$drop' => $drop_txt,
'$form_security_token' => get_form_security_token('group_edit'),
'$edit_name' => t('Edit Group Name')
);
}
if(! isset($group))
if (! isset($group)) {
return;
}
$groupeditor = array(
'label_members' => t('Members'),
@ -205,14 +216,24 @@ function group_content(App $a) {
);
$sec_token = addslashes(get_form_security_token('group_member_change'));
$textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
foreach($members as $member) {
if($member['url']) {
$member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . ',\'' . $sec_token . '\'); return true;';
$groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode);
// Format the data of the group members
foreach ($members as $member) {
if ($member['url']) {
$entry = _contact_detail_for_template($member);
$entry['label'] = 'members';
$entry['photo_menu'] = '';
$entry['change_member'] = array(
'title' => t("Remove Contact"),
'gid' => $group['id'],
'cid' => $member['id'],
'sec_token' => $sec_token
);
$groupeditor['members'][] = $entry;
} else {
group_rmv_member(local_user(), $group['name'], $member['id']);
}
else
group_rmv_member(local_user(),$group['name'],$member['id']);
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC",
@ -220,11 +241,20 @@ function group_content(App $a) {
);
if (dbm::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) {
if(! in_array($member['id'],$preselected)) {
$member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . ',\'' . $sec_token . '\'); return true;';
$groupeditor['contacts'][] = micropro($member,true,'mpall', $textmode);
// Format the data of the contacts who aren't in the contact group
foreach ($r as $member) {
if (! in_array($member['id'], $preselected)) {
$entry = _contact_detail_for_template($member);
$entry['label'] = 'contacts';
$entry['photo_menu'] = '';
$entry['change_member'] = array(
'title' => t("Add Contact"),
'gid' => $group['id'],
'cid' => $member['id'],
'sec_token' => $sec_token
);
$groupeditor['contacts'][] = $entry;
}
}
}
@ -232,7 +262,11 @@ function group_content(App $a) {
$context['$groupeditor'] = $groupeditor;
$context['$desc'] = t('Click on a contact to add or remove.');
if($change) {
// If there are to many contacts we could provide an alternative view mode
$total = count($groupeditor['members']) + count($groupeditor['contacts']);
$context['$shortmode'] = (($switchtotext && ($total > $switchtotext)) ? true : false);
if ($change) {
$tpl = get_markup_template('groupeditor.tpl');
echo replace_macros($tpl, $context);
killme();

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function hcard_init(App $a) {
$blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);

View file

@ -1,4 +1,7 @@
<?php
use Friendica\App;
require_once('library/markdown.php');
if (!function_exists('load_doc_file')) {
@ -87,7 +90,7 @@ function help_content(App $a) {
for($k=0;$k<$lastlevel; $k++) $toc.="</ul>";
$html = implode("\n",$lines);
$a->page['aside'] = $toc.$a->page['aside'];
$a->page['aside'] = '<section class="help-aside-wrapper">' . $toc . $a->page['aside'] . '</section>';
}
$html = "

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
if(! function_exists('home_init')) {
function home_init(App $a) {

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/crypto.php');
function hostxrd_init(App $a) {

View file

@ -8,6 +8,8 @@
* License: GNU AFFERO GENERAL PUBLIC LICENSE (Version 3)
*/
use Friendica\App;
require_once("include/socgraph.php");
require_once("include/Contact.php");
@ -15,6 +17,7 @@ function hovercard_init(App $a) {
// Just for testing purposes
$_GET["mode"] = "minimal";
}
function hovercard_content() {
$profileurl = (x($_REQUEST,'profileurl') ? $_REQUEST['profileurl'] : "");
$datatype = (x($_REQUEST,'datatype') ?$_REQUEST['datatype'] : "json");
@ -38,9 +41,9 @@ function hovercard_content() {
// the real url (nurl)
if(local_user() && strpos($profileurl, "redir/") === 0) {
$cid = intval(substr($profileurl, 6));
$r = q("SELECT `nurl`, `self` FROM `contact` WHERE `id` = '%d' LIMIT 1", intval($cid));
$profileurl = ($r[0]["nurl"] ? $r[0]["nurl"] : "");
$self = ($r[0]["self"] ? $r[0]["self"] : "");
$r = dba::select('contact', array('nurl', 'self'), array('id' => $cid), array('limit' => 1));
$profileurl = ($r["nurl"] ? $r["nurl"] : "");
$self = ($r["self"] ? $r["self"] : "");
}
// if it's the url containing https it should be converted to http

View file

@ -1,5 +1,6 @@
<?php
use Friendica\App;
function ignored_init(App $a) {

View file

@ -1,13 +1,15 @@
<?php
use Friendica\App;
require_once "include/Photo.php";
$install_wizard_pass=1;
$install_wizard_pass = 1;
function install_init(App $a) {
// $baseurl/install/testrwrite to test if rewite in .htaccess is working
if ($a->argc==2 && $a->argv[1]=="testrewrite") {
if ($a->argc == 2 && $a->argv[1] == "testrewrite") {
echo "ok";
killme();
}
@ -18,7 +20,7 @@ function install_init(App $a) {
$a->theme['stylesheet'] = App::get_baseurl()."/view/install/style.css";
global $install_wizard_pass;
if (x($_POST,'pass')) {
if (x($_POST, 'pass')) {
$install_wizard_pass = intval($_POST['pass']);
}
@ -43,27 +45,8 @@ function install_post(App $a) {
require_once("include/dba.php");
unset($db);
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
/*if(get_db_errno()) {
unset($db);
$db = new dba($dbhost, $dbuser, $dbpass, '', true);
if(! get_db_errno()) {
$r = q("CREATE DATABASE '%s' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci",
dbesc($dbdata)
);
if ($r) {
unset($db);
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
} else {
$a->data['db_create_failed']=true;
}
} else {
$a->data['db_conn_failed']=true;
return;
}
}*/
if (get_db_errno()) {
$a->data['db_conn_failed']=true;
if (!$db->connected) {
$a->data['db_conn_failed'] = true;
}
return;
@ -117,14 +100,6 @@ function install_post(App $a) {
}
}
function get_db_errno() {
if (class_exists('mysqli')) {
return mysqli_connect_errno();
} else {
return mysql_errno();
}
}
function install_content(App $a) {
global $install_wizard_pass, $db;
@ -134,30 +109,30 @@ function install_content(App $a) {
if (x($a->data,'db_conn_failed')) {
if (x($a->data, 'db_conn_failed')) {
$install_wizard_pass = 2;
$wizard_status = t('Could not connect to database.');
$wizard_status = t('Could not connect to database.');
}
if (x($a->data,'db_create_failed')) {
if (x($a->data, 'db_create_failed')) {
$install_wizard_pass = 2;
$wizard_status = t('Could not create table.');
$wizard_status = t('Could not create table.');
}
$db_return_text="";
if (x($a->data,'db_installed')) {
$db_return_text = "";
if (x($a->data, 'db_installed')) {
$txt = '<p style="font-size: 130%;">';
$txt .= t('Your Friendica site database has been installed.') . EOL;
$db_return_text .= $txt;
}
if (x($a->data,'db_failed')) {
if (x($a->data, 'db_failed')) {
$txt = t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL;
$txt .= t('Please see the file "INSTALL.txt".') . EOL ."<hr>" ;
$txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL ;
$txt .= t('Please see the file "INSTALL.txt".') . EOL ."<hr>";
$txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL;
$db_return_text .= $txt;
}
if($db && $db->connected) {
if ($db && $db->connected) {
$r = q("SELECT COUNT(*) as `total` FROM `user`");
if (dbm::is_result($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl');
@ -170,11 +145,11 @@ function install_content(App $a) {
}
}
if (x($a->data,'txt') && strlen($a->data['txt'])) {
if (x($a->data, 'txt') && strlen($a->data['txt'])) {
$db_return_text .= manual_config($a);
}
if ($db_return_text!="") {
if ($db_return_text != "") {
$tpl = get_markup_template('install.tpl');
return replace_macros($tpl, array(
'$title' => $install_title,
@ -183,7 +158,7 @@ function install_content(App $a) {
));
}
switch ($install_wizard_pass){
switch ($install_wizard_pass) {
case 1: { // System check
@ -199,7 +174,7 @@ function install_content(App $a) {
check_keys($checks);
if (x($_POST,'phpath')) {
if (x($_POST, 'phpath')) {
$phpath = notags(trim($_POST['phpath']));
}
@ -208,7 +183,7 @@ function install_content(App $a) {
check_htaccess($checks);
/// @TODO Maybe move this out?
function check_passed($v, $c){
function check_passed($v, $c) {
if ($c['required']) {
$v = $v && $c['status'];
}
@ -235,7 +210,7 @@ function install_content(App $a) {
case 2: { // Database config
$dbhost = ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
$dbhost = ((x($_POST, 'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
$dbuser = notags(trim($_POST['dbuser']));
$dbpass = notags(trim($_POST['dbpass']));
$dbdata = notags(trim($_POST['dbdata']));
@ -273,14 +248,14 @@ function install_content(App $a) {
}; break;
case 3: { // Site settings
require_once('include/datetime.php');
$dbhost = ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
$dbhost = ((x($_POST, 'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
$dbuser = notags(trim($_POST['dbuser']));
$dbpass = notags(trim($_POST['dbpass']));
$dbdata = notags(trim($_POST['dbdata']));
$phpath = notags(trim($_POST['phpath']));
$adminmail = notags(trim($_POST['adminmail']));
$timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
$timezone = ((x($_POST, 'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
/* Installed langs */
$lang_choices = get_available_languages();
@ -322,7 +297,7 @@ function install_content(App $a) {
* required : boolean
* help : string optional
*/
function check_add(&$checks, $title, $status, $required, $help){
function check_add(&$checks, $title, $status, $required, $help) {
$checks[] = array(
'title' => $title,
'status' => $status,
@ -333,7 +308,7 @@ function check_add(&$checks, $title, $status, $required, $help){
function check_php(&$phpath, &$checks) {
$passed = $passed2 = $passed3 = false;
if (strlen($phpath)){
if (strlen($phpath)) {
$passed = file_exists($phpath);
} else {
$phpath = trim(shell_exec('which php'));
@ -342,24 +317,24 @@ function check_php(&$phpath, &$checks) {
$help = "";
if (!$passed) {
$help .= t('Could not find a command line version of PHP in the web server PATH.'). EOL;
$help .= t("If you don't have a command line version of PHP installed on server, you will not be able to run background polling via cron. See <a href='https://github.com/friendica/friendica/blob/master/doc/Install.md#set-up-the-poller'>'Setup the poller'</a>") . EOL ;
$help .= EOL . EOL ;
$help .= t("If you don't have a command line version of PHP installed on server, you will not be able to run the background processing. See <a href='https://github.com/friendica/friendica/blob/master/doc/Install.md#set-up-the-poller'>'Setup the poller'</a>") . EOL;
$help .= EOL . EOL;
$tpl = get_markup_template('field_input.tpl');
$help .= replace_macros($tpl, array(
'$field' => array('phpath', t('PHP executable path'), $phpath, t('Enter full path to php executable. You can leave this blank to continue the installation.')),
));
$phpath="";
$phpath = "";
}
check_add($checks, t('Command line PHP').($passed?" (<tt>$phpath</tt>)":""), $passed, false, $help);
if($passed) {
if ($passed) {
$cmd = "$phpath -v";
$result = trim(shell_exec($cmd));
$passed2 = ( strpos($result, "(cli)") !== false );
$passed2 = ( strpos($result, "(cli)") !== false);
list($result) = explode("\n", $result);
$help = "";
if(!$passed2) {
if (!$passed2) {
$help .= t('PHP executable is not the php cli binary (could be cgi-fgci version)'). EOL;
$help .= t('Found PHP version: ')."<tt>$result</tt>";
}
@ -373,7 +348,7 @@ function check_php(&$phpath, &$checks) {
$result = trim(shell_exec($cmd));
$passed3 = $result == $str;
$help = "";
if(!$passed3) {
if (!$passed3) {
$help .= t('The command line version of PHP on your system does not have "register_argc_argv" enabled.'). EOL;
$help .= t('This is required for message delivery to work.');
}
@ -413,12 +388,12 @@ function check_funcs(&$checks) {
check_add($ck_funcs, t('libCurl PHP module'), true, true, "");
check_add($ck_funcs, t('GD graphics PHP module'), true, true, "");
check_add($ck_funcs, t('OpenSSL PHP module'), true, true, "");
check_add($ck_funcs, t('mysqli PHP module'), true, true, "");
check_add($ck_funcs, t('PDO or MySQLi PHP module'), true, true, "");
check_add($ck_funcs, t('mb_string PHP module'), true, true, "");
check_add($ck_funcs, t('XML PHP module'), true, true, "");
check_add($ck_funcs, t('iconv module'), true, true, "");
if (function_exists('apache_get_modules')){
if (function_exists('apache_get_modules')) {
if (! in_array('mod_rewrite',apache_get_modules())) {
check_add($ck_funcs, t('Apache mod_rewrite module'), false, true, t('Error: Apache webserver mod-rewrite module is required but not installed.'));
} else {
@ -426,29 +401,33 @@ function check_funcs(&$checks) {
}
}
if (! function_exists('curl_init')){
$ck_funcs[0]['status']= false;
$ck_funcs[0]['help']= t('Error: libCURL PHP module required but not installed.');
if (! function_exists('curl_init')) {
$ck_funcs[0]['status'] = false;
$ck_funcs[0]['help'] = t('Error: libCURL PHP module required but not installed.');
}
if (! function_exists('imagecreatefromjpeg')){
$ck_funcs[1]['status']= false;
$ck_funcs[1]['help']= t('Error: GD graphics PHP module with JPEG support required but not installed.');
if (! function_exists('imagecreatefromjpeg')) {
$ck_funcs[1]['status'] = false;
$ck_funcs[1]['help'] = t('Error: GD graphics PHP module with JPEG support required but not installed.');
}
if (! function_exists('openssl_public_encrypt')) {
$ck_funcs[2]['status']= false;
$ck_funcs[2]['help']= t('Error: openssl PHP module required but not installed.');
$ck_funcs[2]['status'] = false;
$ck_funcs[2]['help'] = t('Error: openssl PHP module required but not installed.');
}
if (! function_exists('mysqli_connect')){
$ck_funcs[3]['status']= false;
$ck_funcs[3]['help']= t('Error: mysqli PHP module required but not installed.');
if (! function_exists('mysqli_connect') && !class_exists('pdo')) {
$ck_funcs[3]['status'] = false;
$ck_funcs[3]['help'] = t('Error: PDO or MySQLi PHP module required but not installed.');
}
if (! function_exists('mb_strlen')){
$ck_funcs[4]['status']= false;
$ck_funcs[4]['help']= t('Error: mb_string PHP module required but not installed.');
if (!function_exists('mysqli_connect') && class_exists('pdo') && !in_array('mysql', PDO::getAvailableDrivers())) {
$ck_funcs[3]['status'] = false;
$ck_funcs[3]['help'] = t('Error: The MySQL driver for PDO is not installed.');
}
if (! function_exists('iconv_strlen')){
$ck_funcs[7]['status']= false;
$ck_funcs[7]['help']= t('Error: iconv PHP module required but not installed.');
if (! function_exists('mb_strlen')) {
$ck_funcs[4]['status'] = false;
$ck_funcs[4]['help'] = t('Error: mb_string PHP module required but not installed.');
}
if (! function_exists('iconv_strlen')) {
$ck_funcs[7]['status'] = false;
$ck_funcs[7]['help'] = t('Error: iconv PHP module required but not installed.');
}
$checks = array_merge($checks, $ck_funcs);
@ -467,9 +446,9 @@ function check_htconfig(&$checks) {
$status = true;
$help = "";
if ((file_exists('.htconfig.php') && !is_writable('.htconfig.php')) ||
(!file_exists('.htconfig.php') && !is_writable('.')) ) {
(!file_exists('.htconfig.php') && !is_writable('.'))) {
$status=false;
$status = false;
$help = t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') .EOL;
$help .= t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.').EOL;
$help .= t('At the end of this procedure, we will give you a text to save in a file named .htconfig.php in your Friendica top folder.').EOL;
@ -483,9 +462,9 @@ function check_htconfig(&$checks) {
function check_smarty3(&$checks) {
$status = true;
$help = "";
if (!is_writable('view/smarty3') ) {
if (!is_writable('view/smarty3')) {
$status=false;
$status = false;
$help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL;
$help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').EOL;
$help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL;
@ -502,11 +481,11 @@ function check_htaccess(&$checks) {
if (function_exists('curl_init')) {
$test = fetch_url(App::get_baseurl()."/install/testrewrite");
if ($test!="ok") {
if ($test != "ok") {
$test = fetch_url(normalise_link(App::get_baseurl()."/install/testrewrite"));
}
if ($test!="ok") {
if ($test != "ok") {
$status = false;
$help = t('Url rewrite in .htaccess is not working. Check your server configuration.');
}
@ -539,15 +518,15 @@ function check_imagik(&$checks) {
}
function manual_config(App $a) {
$data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8');
$data = htmlentities($a->data['txt'],ENT_COMPAT, 'UTF-8');
$o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
$o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
return $o;
}
function load_database_rem($v, $i){
function load_database_rem($v, $i) {
$l = trim($i);
if (strlen($l)>1 && ($l[0]=="-" || ($l[0]=="/" && $l[1]=="*"))){
if (strlen($l)>1 && ($l[0] == "-" || ($l[0] == "/" && $l[1] == "*"))) {
return $v;
} else {
return $v."\n".$i;
@ -559,18 +538,6 @@ function load_database($db) {
require_once("include/dbstructure.php");
$errors = update_structure(false, true);
/* $str = file_get_contents('database.sql');
$arr = explode(';',$str);
$errors = false;
foreach($arr as $a) {
if(strlen(trim($a))) {
$r = @$db->q(trim($a));
if(false === $r) {
$errors .= t('Errors encountered creating database tables.') . $a . EOL;
}
}
}*/
return $errors;
}
@ -584,5 +551,3 @@ function what_next() {
.t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
."</p>";
}

View file

@ -7,6 +7,8 @@
*
*/
use Friendica\App;
require_once('include/email.php');
function invite_post(App $a) {

View file

@ -15,6 +15,8 @@
* posting categories go through item_store() instead of this function.
*/
use Friendica\App;
require_once 'include/crypto.php';
require_once 'include/enotify.php';
require_once 'include/email.php';
@ -23,7 +25,7 @@ require_once 'include/files.php';
require_once 'include/threads.php';
require_once 'include/text.php';
require_once 'include/items.php';
require_once 'include/Scrape.php';
require_once 'include/probe.php';
require_once 'include/diaspora.php';
require_once 'include/Contact.php';
@ -142,7 +144,6 @@ function item_post(App $a) {
$parent_contact = get_contact_details_by_url($thrparent[0]["author-link"]);
if (!isset($parent_contact["nick"])) {
require_once 'include/Scrape.php';
$probed_contact = probe_url($thrparent[0]["author-link"]);
if ($probed_contact["network"] != NETWORK_FEED) {
$parent_contact = $probed_contact;
@ -723,6 +724,18 @@ function item_post(App $a) {
$datarray['last-child'] = 1;
$datarray['visible'] = 1;
$datarray['protocol'] = PROTOCOL_DFRN;
$r = dba::fetch_first("SELECT `conversation-uri`, `conversation-href` FROM `conversation` WHERE `item-uri` = ?", $datarray['parent-uri']);
if (dbm::is_result($r)) {
if ($r['conversation-uri'] != '') {
$datarray['conversation-uri'] = $r['conversation-uri'];
}
if ($r['conversation-href'] != '') {
$datarray['conversation-href'] = $r['conversation-href'];
}
}
if ($orig_post) {
$datarray['edit'] = true;
}
@ -762,6 +775,8 @@ function item_post(App $a) {
// Fill the cache field
put_item_in_cache($datarray);
$datarray = store_conversation($datarray);
if ($orig_post) {
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($datarray['title']),
@ -1090,7 +1105,6 @@ function item_content(App $a) {
* @return boolean true if replaced, false if not replaced
*/
function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") {
require_once 'include/Scrape.php';
require_once 'include/socgraph.php';
$replaced = false;

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');

View file

@ -1,7 +1,8 @@
<?php
require_once('include/datetime.php');
use Friendica\App;
require_once('include/datetime.php');
function localtime_post(App $a) {

View file

@ -1,5 +1,6 @@
<?php
use Friendica\App;
function lockview_content(App $a) {

View file

@ -1,13 +1,19 @@
<?php
use Friendica\App;
function login_content(App $a) {
if(x($_SESSION,'theme'))
if (x($_SESSION, 'theme')) {
unset($_SESSION['theme']);
if(x($_SESSION,'mobile-theme'))
}
if (x($_SESSION, 'mobile-theme')) {
unset($_SESSION['mobile-theme']);
}
if(local_user())
if (local_user()) {
goaway(z_root());
return login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
}
return login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
}

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/email.php');
require_once('include/enotify.php');
require_once('include/text.php');

View file

@ -1,6 +1,7 @@
<?php
use \Friendica\Core\Config;
use Friendica\App;
use Friendica\Core\Config;
function maintenance_content(App $a) {

View file

@ -1,7 +1,8 @@
<?php
require_once("include/text.php");
use Friendica\App;
require_once("include/text.php");
function manage_post(App $a) {

View file

@ -1,26 +1,26 @@
<?php
use Friendica\Core\Config;
function manifest_content(App $a) {
use Friendica\App;
use Friendica\Core\Config;
$tpl = get_markup_template('manifest.tpl');
function manifest_content(App $a) {
header('Content-type: application/manifest+json');
$tpl = get_markup_template('manifest.tpl');
$touch_icon = Config::get('system', 'touch_icon', 'images/friendica-128.png');
if ($touch_icon == '') {
$touch_icon = 'images/friendica-128.png';
}
$o = replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$touch_icon' => $touch_icon,
'$title' => Config::get('config', 'sitename', 'Friendica'),
));
echo $o;
killme();
header('Content-type: application/manifest+json');
$touch_icon = Config::get('system', 'touch_icon', 'images/friendica-128.png');
if ($touch_icon == '') {
$touch_icon = 'images/friendica-128.png';
}
?>
$o = replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$touch_icon' => $touch_icon,
'$title' => Config::get('config', 'sitename', 'Friendica'),
));
echo $o;
killme();
}

View file

@ -1,5 +1,8 @@
<?php
include_once('include/text.php');
use Friendica\App;
require_once('include/text.php');
require_once('include/socgraph.php');
require_once('include/contact_widgets.php');
require_once('mod/proxy.php');

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/acl_selectors.php');
require_once('include/message.php');
require_once('include/Smilies.php');
@ -349,7 +351,7 @@ function message_content(App $a) {
$o .= $header;
$r = q("SELECT count(*) AS `total` FROM `mail`, ANY_VALUE(`created`) AS `created`
$r = q("SELECT count(*) AS `total`, ANY_VALUE(`created`) AS `created` FROM `mail`
WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
intval(local_user())
);

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('library/asn1.php');
function modexp_init(App $a) {

View file

@ -1,10 +1,11 @@
<?php
use Friendica\App;
require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');
function mood_init(App $a) {
if (! local_user()) {

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function msearch_post(App $a) {
$perpage = (($_POST['n']) ? $_POST['n'] : 80);

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once("include/nav.php");
function navigation_content(App $a) {

View file

@ -1,4 +1,7 @@
<?php
use Friendica\App;
function network_init(App $a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
@ -792,7 +795,7 @@ function network_content(App $a, $update = 0) {
/**
* @brief Get the network tabs menu
*
* @param app $a The global App
* @param App $a The global App
* @return string Html of the networktab
*/
function network_tabs(App $a) {

View file

@ -1,83 +1,54 @@
<?php
use Friendica\App;
function newmember_content(App $a) {
$o = '<h1>' . t('Welcome to Friendica') . '</h1>';
$o .= '<h3>' . t('New Member Checklist') . '</h3>';
$o .= '<div style="font-size: 120%;">';
$o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
$o .= '<h4>' . t('Getting Started') . '</h4>';
$o .= '<ul>';
$o .= '<li> ' . '<a target="newmember" href="help/guide">' . t('Friendica Walk-Through') . '</a><br />' . t('On your <em>Quick Start</em> page - find a brief introduction to your profile and network tabs, make some new connections, and find some groups to join.') . '</li>' . EOL;
$o .= '</ul>';
$o .= '<h4>' . t('Settings') . '</h4>';
$o .= '<ul>';
$o .= '<li>' . '<a target="newmember" href="settings">' . t('Go to Your Settings') . '</a><br />' . t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</li>' . EOL;
$o .= '<li>' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</li>' . EOL;
$o .= '</ul>';
$o .= '<h4>' . t('Profile') . '</h4>';
$o .= '<ul>';
$o .= '<li>' . '<a target="newmember" href="profile_photo">' . t('Upload Profile Photo') . '</a><br />' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</li>' . EOL;
$o .= '<li>' . '<a target="newmember" href="profiles">' . t('Edit Your Profile') . '</a><br />' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</li>' . EOL;
$o .= '<li>' . '<a target="newmember" href="profiles">' . t('Profile Keywords') . '</a><br />' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</li>' . EOL;
$o .= '</ul>';
$o .= '<h4>' . t('Connecting') . '</h4>';
$o .= '<ul>';
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
$mail_disabled = ((function_exists('imap_open') && (!get_config('system', 'imap_disabled'))) ? 0 : 1);
if(! $mail_disabled)
if (!$mail_disabled) {
$o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Importing Emails') . '</a><br />' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL;
}
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Go to Your Contacts Page') . '</a><br />' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL;
$o .= '<li>' . '<a target="newmember" href="directory">' . t("Go to Your Site's Directory") . '</a><br />' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL;
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Finding New People') . '</a><br />' . t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</li>' . EOL;
$o .= '</ul>';
$o .= '<h4>' . t('Groups') . '</h4>';
$o .= '<ul>';
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Group Your Contacts') . '</a><br />' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL;
if(get_config('system', 'newuser_private')) {
if (get_config('system', 'newuser_private')) {
$o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . t("Why Aren't My Posts Public?") . '</a><br />' . t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL;
}
$o .= '</ul>';
$o .= '<h4>' . t('Getting Help') . '</h4>';
$o .= '<ul>';
$o .= '<li>' . '<a target="newmember" href="help">' . t('Go to the Help Section') . '</a><br />' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</li>' . EOL;
$o .= '</ul>';
$o .= '</div>';
return $o;

View file

@ -5,7 +5,8 @@
* Documentation: http://nodeinfo.diaspora.software/schema.html
*/
use \Friendica\Core\Config;
use Friendica\App;
use Friendica\Core\Config;
require_once 'include/plugin.php';
@ -251,5 +252,3 @@ function nodeinfo_cron() {
logger('cron_end');
Config::set('nodeinfo', 'last_calucation', time());
}
?>

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/Contact.php');
require_once('include/socgraph.php');
require_once('include/contact_selectors.php');

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function noscrape_init(App $a) {
if($a->argc > 1)

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function notes_init(App $a) {
if (! local_user()) {

View file

@ -1,20 +1,21 @@
<?php
/* identi.ca -> friendica items permanent-url compatibility */
function notice_init(App $a) {
$id = $a->argv[1];
$r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
intval($id)
);
if (dbm::is_result($r)){
$nick = $r[0]['nickname'];
$url = App::get_baseurl()."/display/$nick/$id";
goaway($url);
} else {
$a->error = 404;
notice( t('Item not found.') . EOL);
/* identi.ca -> friendica items permanent-url compatibility */
}
return;
use Friendica\App;
function notice_init(App $a) {
$id = $a->argv[1];
$r = q("SELECT `user`.`nickname` FROM `user` LEFT JOIN `item` ON `item`.`uid` = `user`.`uid` WHERE `item`.`id` = %d", intval($id));
if (dbm::is_result($r)) {
$nick = $r[0]['nickname'];
$url = App::get_baseurl() . "/display/$nick/$id";
goaway($url);
} else {
$a->error = 404;
notice(t('Item not found.') . EOL);
}
return;
}

View file

@ -5,6 +5,8 @@
* @brief The notifications module
*/
use Friendica\App;
require_once("include/NotificationsManager.php");
require_once("include/contact_selectors.php");
require_once("include/network.php");
@ -223,6 +225,12 @@ function notifications_content(App $a) {
$header .= " (".network_to_name($it['network'], $it['url']).")";
if ($it['network'] != NETWORK_DIASPORA) {
$discard = t('Discard');
} else {
$discard = '';
}
$notif_content[] = replace_macros($tpl, array(
'$header' => htmlentities($header),
'$str_notifytype' => t('Notification type: '),
@ -255,7 +263,7 @@ function notifications_content(App $a) {
'$approve' => t('Approve'),
'$note' => $it['note'],
'$ignore' => t('Ignore'),
'$discard' => t('Discard'),
'$discard' => $discard,
));
break;

View file

@ -1,4 +1,7 @@
<?php
use Friendica\App;
require_once('include/NotificationsManager.php');
function notify_init(App $a) {

View file

@ -1,4 +1,7 @@
<?php
use Friendica\App;
require_once("include/oembed.php");
function oembed_content(App $a) {

View file

@ -1,4 +1,7 @@
<?php
use Friendica\App;
function oexchange_init(App $a) {
if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {

View file

@ -1,9 +1,9 @@
<?php
use Friendica\App;
require_once('library/openid.php');
function openid_content(App $a) {
$noid = get_config('system','no_openid');
@ -73,10 +73,10 @@ function openid_content(App $a) {
$first = notags(trim($v));
}
if($k === 'namePerson') {
$args .= '&username=' . notags(trim($v));
$args .= '&username=' . urlencode(notags(trim($v)));
}
if ($k === 'contact/email') {
$args .= '&email=' . notags(trim($v));
$args .= '&email=' . urlencode(notags(trim($v)));
}
if ($k === 'media/image/aspect11') {
$photosq = bin2hex(trim($v));
@ -87,22 +87,22 @@ function openid_content(App $a) {
}
}
if ($nick) {
$args .= '&nickname=' . $nick;
$args .= '&nickname=' . urlencode($nick);
}
elseif ($first) {
$args .= '&nickname=' . $first;
$args .= '&nickname=' . urlencode($first);
}
if ($photosq) {
$args .= '&photo=' . $photosq;
$args .= '&photo=' . urlencode($photosq);
}
elseif ($photo) {
$args .= '&photo=' . $photo;
$args .= '&photo=' . urlencode($photo);
}
$args .= '&openid_url=' . notags(trim($authid));
$args .= '&openid_url=' . urlencode(notags(trim($authid)));
goaway(App::get_baseurl() . '/register' . $args);
goaway(App::get_baseurl() . '/register?' . $args);
// NOTREACHED
}

View file

@ -1,18 +1,19 @@
<?php
function opensearch_content(App $a) {
$tpl = get_markup_template('opensearch.tpl');
use Friendica\App;
header("Content-type: application/opensearchdescription+xml");
function opensearch_content(App $a) {
$o = replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$nodename' => $a->get_hostname(),
));
$tpl = get_markup_template('opensearch.tpl');
echo $o;
header("Content-type: application/opensearchdescription+xml");
killme();
$o = replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$nodename' => $a->get_hostname(),
));
}
?>
echo $o;
killme();
}

View file

@ -1,7 +1,9 @@
<?php
require_once('include/Scrape.php');
require_once('include/follow.php');
use Friendica\App;
require_once 'include/probe.php';
require_once 'include/follow.php';
function ostatus_subscribe_content(App $a) {

View file

@ -2,6 +2,9 @@
/*
This file is part of the Diaspora protocol. It is used for fetching single public posts.
*/
use Friendica\App;
require_once("include/diaspora.php");
function p_init($a){

View file

@ -10,7 +10,8 @@
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
*/
use \Friendica\ParseUrl;
use Friendica\App;
use Friendica\ParseUrl;
require_once("include/items.php");

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/security.php');
require_once('include/Photo.php');

View file

@ -1,4 +1,9 @@
<?php
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Network\Probe;
require_once 'include/Photo.php';
require_once 'include/photos.php';
require_once 'include/items.php';
@ -8,9 +13,6 @@ require_once 'include/security.php';
require_once 'include/redir.php';
require_once 'include/tags.php';
require_once 'include/threads.php';
require_once 'include/Probe.php';
use \Friendica\Core\Config;
function photos_init(App $a) {
@ -980,9 +982,9 @@ function photos_content(App $a) {
return;
}
require_once('include/bbcode.php');
require_once('include/security.php');
require_once('include/conversation.php');
require_once 'include/bbcode.php';
require_once 'include/security.php';
require_once 'include/conversation.php';
if (! x($a->data,'user')) {
notice( t('No photos selected') . EOL );

View file

@ -1,5 +1,8 @@
<?php
require_once("include/datetime.php");
use Friendica\App;
require_once('include/datetime.php');
require_once('include/bbcode.php');
require_once('include/ForumManager.php');
require_once('include/group.php');
@ -305,8 +308,18 @@ function ping_init(App $a)
// sort notifications by $[]['date']
$sort_function = function($a, $b) {
$adate = date($a['date']);
$bdate = date($b['date']);
$adate = strtotime($a['date']);
$bdate = strtotime($b['date']);
// Unseen messages are kept at the top
// The value 31536000 means one year. This should be enough :-)
if (!$a['seen']) {
$adate += 31536000;
}
if (!$b['seen']) {
$bdate += 31536000;
}
if ($adate == $bdate) {
return 0;
}

View file

@ -1,13 +1,15 @@
<?php
// See here for a documentation for portable contacts:
// https://web.archive.org/web/20160405005550/http://portablecontacts.net/draft-spec.html
function poco_init(App $a) {
require_once("include/bbcode.php");
use Friendica\App;
use Friendica\Core\Config;
function poco_init(App $a) {
$system_mode = false;
if (intval(get_config('system','block_public')) || (get_config('system','block_local_dir'))) {
if (intval(Config::get('system', 'block_public')) || (Config::get('system', 'block_local_dir'))) {
http_status_exit(401);
}
@ -28,6 +30,7 @@ function poco_init(App $a) {
$global = false;
if ($a->argc > 1 && $a->argv[1] === '@server') {
require_once 'include/socgraph.php';
// List of all servers that this server knows
$ret = poco_serverlist();
header('Content-type: application/json');
@ -52,16 +55,16 @@ function poco_init(App $a) {
$cid = intval($a->argv[4]);
}
if (!$system_mode AND !$global) {
$r = q("SELECT `user`.*,`profile`.`hide-friends` from user left join profile on `user`.`uid` = `profile`.`uid`
if (! $system_mode AND ! $global) {
$users = q("SELECT `user`.*,`profile`.`hide-friends` from user left join profile on `user`.`uid` = `profile`.`uid`
where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1",
dbesc($user)
);
if (! dbm::is_result($r) || $r[0]['hidewall'] || $r[0]['hide-friends']) {
if (! dbm::is_result($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
http_status_exit(404);
}
$user = $r[0];
$user = $users[0];
}
if ($justme) {
@ -71,23 +74,23 @@ function poco_init(App $a) {
// $sql_extra = " AND `contact`.`self` = 0 ";
if ($cid) {
$sql_extra = sprintf(" AND `contact`.`id` = %d ",intval($cid));
$sql_extra = sprintf(" AND `contact`.`id` = %d ", intval($cid));
}
if (x($_GET,'updatedSince')) {
$update_limit = date("Y-m-d H:i:s",strtotime($_GET['updatedSince']));
if (x($_GET, 'updatedSince')) {
$update_limit = date("Y-m-d H:i:s", strtotime($_GET['updatedSince']));
}
if ($global) {
$r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `updated` >= `last_failure` AND NOT `hide` AND `network` IN ('%s', '%s', '%s')",
$contacts = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `updated` >= `last_failure` AND NOT `hide` AND `network` IN ('%s', '%s', '%s')",
dbesc($update_limit),
dbesc(NETWORK_DFRN),
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
} elseif ($system_mode) {
$r = q("SELECT count(*) AS `total` FROM `contact` WHERE `self` = 1
$contacts = q("SELECT count(*) AS `total` FROM `contact` WHERE `self` = 1
AND `uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) ");
} else {
$r = q("SELECT count(*) AS `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
$contacts = q("SELECT count(*) AS `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra",
intval($user['uid']),
@ -97,8 +100,8 @@ function poco_init(App $a) {
dbesc(NETWORK_STATUSNET)
);
}
if (dbm::is_result($r)) {
$totalResults = intval($r[0]['total']);
if (dbm::is_result($contacts)) {
$totalResults = intval($contacts[0]['total']);
} else {
$totalResults = 0;
}
@ -106,11 +109,11 @@ function poco_init(App $a) {
if (! $startIndex) {
$startIndex = 0;
}
$itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
$itemsPerPage = ((x($_GET, 'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
if ($global) {
logger("Start global query", LOGGER_DEBUG);
$r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
$contacts = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
ORDER BY `updated` DESC LIMIT %d, %d",
dbesc($update_limit),
dbesc(NETWORK_DFRN),
@ -121,7 +124,7 @@ function poco_init(App $a) {
);
} elseif ($system_mode) {
logger("Start system mode query", LOGGER_DEBUG);
$r = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`,
$contacts = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`,
`profile`.`gender` AS `pgender`, `profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`,
`profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type`
FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
@ -132,8 +135,8 @@ function poco_init(App $a) {
intval($itemsPerPage)
);
} else {
logger("Start query for user ".$user['nickname'], LOGGER_DEBUG);
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
logger("Start query for user " . $user['nickname'], LOGGER_DEBUG);
$contacts = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d",
intval($user['uid']),
@ -148,13 +151,13 @@ function poco_init(App $a) {
logger("Query done", LOGGER_DEBUG);
$ret = array();
if (x($_GET,'sorted')) {
if (x($_GET, 'sorted')) {
$ret['sorted'] = false;
}
if (x($_GET,'filtered')) {
if (x($_GET, 'filtered')) {
$ret['filtered'] = false;
}
if (x($_GET,'updatedSince') AND !$global) {
if (x($_GET, 'updatedSince') AND ! $global) {
$ret['updatedSince'] = false;
}
$ret['startIndex'] = (int) $startIndex;
@ -180,134 +183,135 @@ function poco_init(App $a) {
'generation' => false
);
if ((! x($_GET,'fields')) || ($_GET['fields'] === '@all')) {
if ((! x($_GET, 'fields')) || ($_GET['fields'] === '@all')) {
foreach ($fields_ret as $k => $v) {
$fields_ret[$k] = true;
}
} else {
$fields_req = explode(',',$_GET['fields']);
$fields_req = explode(',', $_GET['fields']);
foreach ($fields_req as $f) {
$fields_ret[trim($f)] = true;
}
}
if (is_array($r)) {
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if (!isset($rr['generation'])) {
if (is_array($contacts)) {
if (dbm::is_result($contacts)) {
foreach ($contacts as $contact) {
if (! isset($contact['generation'])) {
if ($global) {
$rr['generation'] = 3;
$contact['generation'] = 3;
} elseif ($system_mode) {
$rr['generation'] = 1;
$contact['generation'] = 1;
} else {
$rr['generation'] = 2;
$contact['generation'] = 2;
}
}
if (($rr['about'] == "") AND isset($rr['pabout'])) {
$rr['about'] = $rr['pabout'];
if (($contact['about'] == "") AND isset($contact['pabout'])) {
$contact['about'] = $contact['pabout'];
}
if ($rr['location'] == "") {
if (isset($rr['plocation'])) {
$rr['location'] = $rr['plocation'];
if ($contact['location'] == "") {
if (isset($contact['plocation'])) {
$contact['location'] = $contact['plocation'];
}
if (isset($rr['pregion']) AND ($rr['pregion'] != "")) {
if ($rr['location'] != "") {
$rr['location'] .= ", ";
if (isset($contact['pregion']) AND ( $contact['pregion'] != "")) {
if ($contact['location'] != "") {
$contact['location'] .= ", ";
}
$rr['location'] .= $rr['pregion'];
$contact['location'] .= $contact['pregion'];
}
if (isset($rr['pcountry']) AND ($rr['pcountry'] != "")) {
if ($rr['location'] != "") {
$rr['location'] .= ", ";
if (isset($contact['pcountry']) AND ( $contact['pcountry'] != "")) {
if ($contact['location'] != "") {
$contact['location'] .= ", ";
}
$rr['location'] .= $rr['pcountry'];
$contact['location'] .= $contact['pcountry'];
}
}
if (($rr['gender'] == "") AND isset($rr['pgender'])) {
$rr['gender'] = $rr['pgender'];
if (($contact['gender'] == "") AND isset($contact['pgender'])) {
$contact['gender'] = $contact['pgender'];
}
if (($rr['keywords'] == "") AND isset($rr['pub_keywords'])) {
$rr['keywords'] = $rr['pub_keywords'];
if (($contact['keywords'] == "") AND isset($contact['pub_keywords'])) {
$contact['keywords'] = $contact['pub_keywords'];
}
if (isset($rr['account-type'])) {
$rr['contact-type'] = $rr['account-type'];
if (isset($contact['account-type'])) {
$contact['contact-type'] = $contact['account-type'];
}
$about = Cache::get("about:".$rr['updated'].":".$rr['nurl']);
$about = Cache::get("about:" . $contact['updated'] . ":" . $contact['nurl']);
if (is_null($about)) {
$about = bbcode($rr['about'], false, false);
Cache::set("about:".$rr['updated'].":".$rr['nurl'],$about);
require_once 'include/bbcode.php';
$about = bbcode($contact['about'], false, false);
Cache::set("about:" . $contact['updated'] . ":" . $contact['nurl'], $about);
}
// Non connected persons can only see the keywords of a Diaspora account
if ($rr['network'] == NETWORK_DIASPORA) {
$rr['location'] = "";
if ($contact['network'] == NETWORK_DIASPORA) {
$contact['location'] = "";
$about = "";
$rr['gender'] = "";
$contact['gender'] = "";
}
$entry = array();
if ($fields_ret['id']) {
$entry['id'] = (int)$rr['id'];
$entry['id'] = (int)$contact['id'];
}
if ($fields_ret['displayName']) {
$entry['displayName'] = $rr['name'];
$entry['displayName'] = $contact['name'];
}
if ($fields_ret['aboutMe']) {
$entry['aboutMe'] = $about;
}
if ($fields_ret['currentLocation']) {
$entry['currentLocation'] = $rr['location'];
$entry['currentLocation'] = $contact['location'];
}
if ($fields_ret['gender']) {
$entry['gender'] = $rr['gender'];
$entry['gender'] = $contact['gender'];
}
if ($fields_ret['generation']) {
$entry['generation'] = (int)$rr['generation'];
$entry['generation'] = (int)$contact['generation'];
}
if ($fields_ret['urls']) {
$entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile'));
if ($rr['addr'] && ($rr['network'] !== NETWORK_MAIL)) {
$entry['urls'][] = array('value' => 'acct:' . $rr['addr'], 'type' => 'webfinger');
$entry['urls'] = array(array('value' => $contact['url'], 'type' => 'profile'));
if ($contact['addr'] && ($contact['network'] !== NETWORK_MAIL)) {
$entry['urls'][] = array('value' => 'acct:' . $contact['addr'], 'type' => 'webfinger');
}
}
if ($fields_ret['preferredUsername']) {
$entry['preferredUsername'] = $rr['nick'];
$entry['preferredUsername'] = $contact['nick'];
}
if ($fields_ret['updated']) {
if (!$global) {
$entry['updated'] = $rr['success_update'];
if (! $global) {
$entry['updated'] = $contact['success_update'];
if ($rr['name-date'] > $entry['updated']) {
$entry['updated'] = $rr['name-date'];
if ($contact['name-date'] > $entry['updated']) {
$entry['updated'] = $contact['name-date'];
}
if ($rr['uri-date'] > $entry['updated']) {
$entry['updated'] = $rr['uri-date'];
if ($contact['uri-date'] > $entry['updated']) {
$entry['updated'] = $contact['uri-date'];
}
if ($rr['avatar-date'] > $entry['updated']) {
$entry['updated'] = $rr['avatar-date'];
if ($contact['avatar-date'] > $entry['updated']) {
$entry['updated'] = $contact['avatar-date'];
}
} else {
$entry['updated'] = $rr['updated'];
$entry['updated'] = $contact['updated'];
}
$entry['updated'] = date("c", strtotime($entry['updated']));
}
if ($fields_ret['photos']) {
$entry['photos'] = array(array('value' => $rr['photo'], 'type' => 'profile'));
$entry['photos'] = array(array('value' => $contact['photo'], 'type' => 'profile'));
}
if ($fields_ret['network']) {
$entry['network'] = $rr['network'];
$entry['network'] = $contact['network'];
if ($entry['network'] == NETWORK_STATUSNET) {
$entry['network'] = NETWORK_OSTATUS;
}
if (($entry['network'] == "") AND ($rr['self'])) {
if (($entry['network'] == "") AND ($contact['self'])) {
$entry['network'] = NETWORK_DFRN;
}
}
if ($fields_ret['tags']) {
$tags = str_replace(","," ",$rr['keywords']);
$tags = str_replace(",", " ", $contact['keywords']);
$tags = explode(" ", $tags);
$cleaned = array();
@ -327,23 +331,23 @@ function poco_init(App $a) {
//if (isset($rr['paddress']))
// $entry['address']['streetAddress'] = $rr['paddress'];
if (isset($rr['plocation'])) {
$entry['address']['locality'] = $rr['plocation'];
if (isset($contact['plocation'])) {
$entry['address']['locality'] = $contact['plocation'];
}
if (isset($rr['pregion'])) {
$entry['address']['region'] = $rr['pregion'];
if (isset($contact['pregion'])) {
$entry['address']['region'] = $contact['pregion'];
}
// See above
//if (isset($rr['ppostalcode']))
// $entry['address']['postalCode'] = $rr['ppostalcode'];
if (isset($rr['pcountry'])) {
$entry['address']['country'] = $rr['pcountry'];
if (isset($contact['pcountry'])) {
$entry['address']['country'] = $contact['pcountry'];
}
}
if ($fields_ret['contactType']) {
$entry['contactType'] = intval($rr['contact-type']);
$entry['contactType'] = intval($contact['contact-type']);
}
$ret['entry'][] = $entry;
}
@ -357,7 +361,7 @@ function poco_init(App $a) {
if ($format === 'xml') {
header('Content-type: text/xml');
echo replace_macros(get_markup_template('poco_xml.tpl'),array_xmlify(array('$response' => $ret)));
echo replace_macros(get_markup_template('poco_xml.tpl'), array_xmlify(array('$response' => $ret)));
killme();
}
if ($format === 'json') {

View file

@ -1,7 +1,6 @@
<?php /** @file */
<?php
/**
*
* Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book
* This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or
* other web request. You must be logged in and connected to a profile.
@ -12,13 +11,15 @@
*
* private creates a private conversation with the recipient. Otherwise your profile's default post privacy is used.
*
* @file mod/poke.php
*/
use Friendica\App;
require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');
function poke_init(App $a) {
if (! local_user()) {

View file

@ -4,6 +4,7 @@
* Zot endpoint
*/
use Friendica\App;
require_once('include/salmon.php');
require_once('include/crypto.php');

View file

@ -1,22 +1,24 @@
<?php
use Friendica\App;
function pretheme_init(App $a) {
if($_REQUEST['theme']) {
if ($_REQUEST['theme']) {
$theme = $_REQUEST['theme'];
$info = get_theme_info($theme);
if($info) {
if ($info) {
// unfortunately there will be no translation for this string
$desc = $info['description'];
$version = $info['version'];
$credits = $info['credits'];
}
else {
} else {
$desc = '';
$version = '';
$credits = '';
}
echo json_encode(array('img' => get_theme_screenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits));
}
killme();
}

View file

@ -1,31 +1,32 @@
<?php
require_once('include/Scrape.php');
use Friendica\App;
require_once 'include/probe.php';
function probe_content(App $a) {
if (!local_user()) {
http_status_exit(403,
array("title" => t("Public access denied."),
"description" => t("Only logged in users are permitted to perform a probing.")));
http_status_exit(403, array("title" => t("Public access denied."),
"description" => t("Only logged in users are permitted to perform a probing.")));
killme();
}
$o .= '<h3>Probe Diagnostic</h3>';
$o .= '<form action="probe" method="get">';
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] . '" />';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br /><br />';
if(x($_GET,'addr')) {
if (x($_GET, 'addr')) {
$addr = trim($_GET['addr']);
$res = probe_url($addr);
$o .= '<pre>';
$o .= str_replace("\n",'<br />',print_r($res,true));
$o .= str_replace("\n", '<br />', print_r($res, true));
$o .= '</pre>';
}
return $o;
}

View file

@ -1,9 +1,10 @@
<?php
use Friendica\App;
require_once('include/contact_widgets.php');
require_once('include/redir.php');
function profile_init(App $a) {
if(! x($a->page,'aside'))
@ -149,6 +150,7 @@ function profile_content(App $a, $update = 0) {
}
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
$last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . remote_user();
if ($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
notice( t('Access to this profile has been restricted.') . EOL);
@ -195,9 +197,9 @@ function profile_content(App $a, $update = 0) {
'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'),
'profile_uid' => $a->profile['profile_uid'],
'acl_data' => ( $is_owner ? construct_acl_data($a, $a->user) : '' ), // For non-Javascript ACL selector
);
);
$o .= status_editor($a,$x);
$o .= status_editor($a,$x);
}
}
@ -209,6 +211,16 @@ function profile_content(App $a, $update = 0) {
if ($update) {
$last_updated = (x($_SESSION['last_updated'], $last_updated_key) ? $_SESSION['last_updated'][$last_updated_key] : 0);
// If the page user is the owner of the page we should query for unseen
// items. Otherwise use a timestamp of the last succesful update request.
if ($is_owner || !$last_updated) {
$sql_extra4 = " AND `item`.`unseen`";
} else {
$gmupdate = gmdate("Y-m-d H:i:s", $last_updated);
$sql_extra4 = " AND `item`.`received` > '" . $gmupdate . "'";
}
$r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network`, `item`.`created`
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
@ -217,13 +229,18 @@ function profile_content(App $a, $update = 0) {
(`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."'
OR item.verb = '" . ACTIVITY_DISLIKE . "' OR item.verb = '" . ACTIVITY_ATTEND . "'
OR item.verb = '" . ACTIVITY_ATTENDNO . "' OR item.verb = '" . ACTIVITY_ATTENDMAYBE . "')
AND `item`.`moderated` = 0 and `item`.`unseen` = 1
AND `item`.`moderated` = 0
AND `item`.`wall` = 1
$sql_extra4
$sql_extra
ORDER BY `item`.`created` DESC",
intval($a->profile['profile_uid'])
);
if (!dbm::is_result($r)) {
return '';
}
} else {
$sql_post_table = "";
@ -283,11 +300,16 @@ function profile_content(App $a, $update = 0) {
ORDER BY `thread`.`created` DESC $pager_sql",
intval($a->profile['profile_uid'])
);
}
$parents_arr = array();
$parents_str = '';
// Set a time stamp for this page. We will make use of it when we
// search for new items (update routine)
$_SESSION['last_updated'][$last_updated_key] = time();
if (dbm::is_result($r)) {
foreach($r as $rr)
$parents_arr[] = $rr['item_id'];

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once("include/Photo.php");
function profile_photo_init(App $a) {
@ -9,10 +11,8 @@ function profile_photo_init(App $a) {
}
profile_load($a,$a->user['nickname']);
}
function profile_photo_post(App $a) {
if (! local_user()) {

View file

@ -1,6 +1,9 @@
<?php
require_once("include/Contact.php");
require_once('include/Probe.php');
use Friendica\App;
use Friendica\Network\Probe;
require_once 'include/Contact.php';
function profiles_init(App $a) {
@ -501,7 +504,7 @@ function profiles_post(App $a) {
proc_run(PRIORITY_LOW, "include/directory.php", $url);
}
require_once('include/profile_update.php');
require_once 'include/profile_update.php';
profile_change();
// Update the global contact for the user
@ -526,7 +529,7 @@ function profile_activity($changed, $value) {
return;
}
require_once('include/items.php');
require_once 'include/items.php';
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval(local_user())
@ -620,7 +623,7 @@ function profiles_content(App $a) {
return;
}
require_once('include/profile_selectors.php');
require_once 'include/profile_selectors.php';
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function profperm_init(App $a) {
if (! local_user()) {

View file

@ -1,6 +1,8 @@
<?php
// Based upon "Privacy Image Cache" by Tobias Hößl <https://github.com/CatoTH/>
use Friendica\App;
define('PROXY_DEFAULT_TIME', 86400); // 1 Day
define('PROXY_SIZE_MICRO', 'micro');

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function hub_return($valid,$body) {
if($valid) {

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function post_var($name) {
return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
}
@ -158,5 +160,3 @@ function pubsubhubbub_init(App $a) {
killme();
}
?>

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function qsearch_init(App $a) {
if (! local_user()) {
@ -48,4 +50,3 @@ function qsearch_init(App $a) {
echo json_encode((object) $results);
killme();
}

View file

@ -1,5 +1,6 @@
<?php
use Friendica\App;
function randprof_init(App $a) {
require_once('include/Contact.php');

View file

@ -4,41 +4,34 @@
* Diaspora endpoint
*/
use Friendica\App;
require_once('include/salmon.php');
require_once('include/crypto.php');
require_once('include/diaspora.php');
function receive_post(App $a) {
$enabled = intval(get_config('system','diaspora_enabled'));
if(! $enabled) {
$enabled = intval(get_config('system', 'diaspora_enabled'));
if (!$enabled) {
logger('mod-diaspora: disabled');
http_status_exit(500);
}
$public = false;
if(($a->argc == 2) && ($a->argv[1] === 'public')) {
if (($a->argc == 2) && ($a->argv[1] === 'public')) {
$public = true;
}
else {
} else {
if($a->argc != 3 || $a->argv[1] !== 'users')
http_status_exit(500);
$guid = $a->argv[2];
$r = q("SELECT * FROM `user` WHERE `guid` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($guid)
);
if (! dbm::is_result($r)) {
if ($a->argc != 3 || $a->argv[1] !== 'users') {
http_status_exit(500);
}
$guid = $a->argv[2];
$importer = $r[0];
$importer = dba::select('user', array(), array('guid' => $guid, 'account_expired' => false, 'account_removed' => false), array('limit' => 1));
if (!dbm::is_result($importer)) {
http_status_exit(500);
}
}
// It is an application/x-www-form-urlencoded
@ -47,29 +40,34 @@ function receive_post(App $a) {
$xml = urldecode($_POST['xml']);
logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
if (!$xml) {
$postdata = file_get_contents("php://input");
if ($postdata == '') {
http_status_exit(500);
}
if(! $xml)
http_status_exit(500);
logger('mod-diaspora: message is okay', LOGGER_DEBUG);
$msg = Diaspora::decode($importer,$xml);
logger('mod-diaspora: message is in the new format', LOGGER_DEBUG);
$msg = Diaspora::decode_raw($importer, $postdata);
} else {
logger('mod-diaspora: message is in the old format', LOGGER_DEBUG);
$msg = Diaspora::decode($importer, $xml);
}
logger('mod-diaspora: decoded', LOGGER_DEBUG);
logger('mod-diaspora: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
logger('mod-diaspora: decoded msg: ' . print_r($msg, true), LOGGER_DATA);
if(! is_array($msg))
if (!is_array($msg)) {
http_status_exit(500);
}
logger('mod-diaspora: dispatching', LOGGER_DEBUG);
$ret = 0;
if($public) {
if ($public) {
Diaspora::dispatch_public($msg);
} else {
$ret = Diaspora::dispatch($importer,$msg);
$ret = Diaspora::dispatch($importer, $msg);
}
http_status_exit(($ret) ? $ret : 200);

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function redir_init(App $a) {
$url = ((x($_GET,'url')) ? $_GET['url'] : '');

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/enotify.php');
require_once('include/bbcode.php');
require_once('include/user.php');

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
require_once('include/enotify.php');
require_once('include/user.php');

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
function removeme_post(App $a) {
if (! local_user()) {

View file

@ -1,7 +1,9 @@
<?php
require_once('include/Scrape.php');
require_once('include/follow.php');
use Friendica\App;
require_once 'include/probe.php';
require_once 'include/follow.php';
function repair_ostatus_content(App $a) {

Some files were not shown because too many files have changed in this diff Show more