Cleanup /format pre-move

This commit is contained in:
Hypolite Petovan 2017-04-30 00:01:26 -04:00
commit 56ee734b00
85 changed files with 522 additions and 581 deletions

View file

@ -5,8 +5,8 @@
*
*/
use \Friendica\Core\Config;
use \Friendica\Core\PConfig;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
require_once("include/feed.php");
require_once('include/email.php');

View file

@ -6,7 +6,7 @@
* @todo Automatically detect if incoming data is HTML or BBCode
*/
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once 'include/HTTPExceptions.php';
require_once 'include/bbcode.php';

View file

@ -1,6 +1,6 @@
<?php
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once('include/security.php');
require_once('include/datetime.php');

View file

@ -32,6 +32,8 @@
*
*/
use Friendica\App;
if (sizeof($_SERVER["argv"]) == 0)
die();

View file

@ -1,5 +1,7 @@
<?php
use Friendica\App;
use League\HTMLToMarkdown\HtmlConverter;
require_once "include/oembed.php";

View file

@ -1,5 +1,6 @@
<?php
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once 'include/oembed.php';
require_once 'include/event.php';

View file

@ -1,6 +1,6 @@
<?php /** @file */
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once('boot.php');

View file

@ -3,7 +3,6 @@
require_once "include/bbcode.php";
require_once "include/acl_selectors.php";
/*
* Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
* is identical to the code in mod/message.php for 'item_extract_images' and

View file

@ -1,5 +1,6 @@
<?php
use \Friendica\Core\Config;
use Friendica\Core\Config;
function cronjobs_run(&$argv, &$argc){
global $a;

View file

@ -1,6 +1,6 @@
<?php
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once("boot.php");
require_once("include/text.php");

View file

@ -1,6 +1,6 @@
<?php
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once('include/queue_fn.php');
require_once('include/html2plain.php');

View file

@ -8,7 +8,7 @@
* This will change in the future.
*/
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once 'include/items.php';
require_once 'include/bb2diaspora.php';

View file

@ -535,7 +535,7 @@ function get_event_strings() {
*
* @param array $dates Array of possibly duplicated events
* @return array Cleaned events
*
*
* @todo We should replace this with a separate update function if there is some time left
*/
function event_remove_duplicates($dates) {

View file

@ -4,7 +4,7 @@
* @file include/items.php
*/
use \Friendica\ParseUrl;
use Friendica\ParseUrl;
require_once 'include/bbcode.php';
require_once 'include/oembed.php';
@ -339,7 +339,7 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) {
* Adds a "lang" specification in a "postopts" element of given $arr,
* if possible and not already present.
* Expects "body" element to exist in $arr.
*
*
* @todo Add a parameter to request forcing override
*/
function item_add_language_opt(&$arr) {

View file

@ -1,8 +1,6 @@
<?php
// send a private message
// send a private message
function send_message($recipient=0, $body='', $subject='', $replyto=''){

View file

@ -4,7 +4,7 @@
* @file include/network.php
*/
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once("include/xml.php");
require_once('include/Probe.php');

View file

@ -1,6 +1,6 @@
<?php
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once('include/queue_fn.php');
require_once('include/html2plain.php');

View file

@ -61,13 +61,13 @@ class FKOAuthDataStore extends OAuthDataStore {
logger(__function__.":".$consumer.", ". $callback);
$key = $this->gen_token();
$sec = $this->gen_token();
if ($consumer->key){
$k = $consumer->key;
} else {
$k = $consumer;
}
$r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP()+%d)",
dbesc($key),
dbesc($sec),
@ -80,19 +80,19 @@ class FKOAuthDataStore extends OAuthDataStore {
function new_access_token($token, $consumer, $verifier = null) {
logger(__function__.":".$token.", ". $consumer.", ". $verifier);
// return a new access token attached to this consumer
// for the user associated with this token if the request token
// is authorized
// should also invalidate the request token
$ret=Null;
// get user for this verifier
$uverifier = get_config("oauth", $verifier);
logger(__function__.":".$verifier.",".$uverifier);
if (is_null($verifier) || ($uverifier!==false)){
$key = $this->gen_token();
$sec = $this->gen_token();
$r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP()+%d, %d)",
@ -103,13 +103,13 @@ class FKOAuthDataStore extends OAuthDataStore {
intval(ACCESS_TOKEN_DURATION),
intval($uverifier));
if ($r)
$ret = new OAuthToken($key,$sec);
$ret = new OAuthToken($key,$sec);
}
q("DELETE FROM tokens WHERE id='%s'", $token->key);
if (!is_null($ret) && $uverifier!==false){
del_config("oauth", $verifier);
/* $apps = get_pconfig($uverifier, "oauth", "apps");
@ -117,9 +117,9 @@ class FKOAuthDataStore extends OAuthDataStore {
$apps[] = $consumer->key;
set_pconfig($uverifier, "oauth", "apps", $apps);*/
}
return $ret;
}
}
@ -172,9 +172,9 @@ class FKOAuth1 extends OAuthServer {
intval($_SESSION['uid'])
);
call_hooks('logged_in', $a->user);
call_hooks('logged_in', $a->user);
}
}
/*
class FKOAuth2 extends OAuth2 {
@ -190,13 +190,13 @@ class FKOAuth2 extends OAuth2 {
dbesc($client_secret),
dbesc($redirect_uri)
);
return $r;
}
protected function checkClientCredentials($client_id, $client_secret = NULL) {
$client_secret = $this->db_secret($client_secret);
$r = q("SELECT pw FROM clients WHERE client_id = '%s'",
dbesc($client_id));
@ -218,21 +218,21 @@ class FKOAuth2 extends OAuth2 {
protected function getAccessToken($oauth_token) {
$r = q("SELECT client_id, expires, scope FROM tokens WHERE id = '%s'",
dbesc($oauth_token));
if (dbm::is_result($r))
return $r[0];
return null;
}
protected function setAccessToken($oauth_token, $client_id, $expires, $scope = NULL) {
$r = q("INSERT INTO tokens (id, client_id, expires, scope) VALUES ('%s', '%s', %d, '%s')",
dbesc($oauth_token),
dbesc($client_id),
intval($expires),
dbesc($scope));
return $r;
}
@ -246,23 +246,23 @@ class FKOAuth2 extends OAuth2 {
protected function getAuthCode($code) {
$r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'",
dbesc($code));
if (dbm::is_result($r))
return $r[0];
return null;
}
protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) {
$r = q("INSERT INTO auth_codes
(id, client_id, redirect_uri, expires, scope) VALUES
$r = q("INSERT INTO auth_codes
(id, client_id, redirect_uri, expires, scope) VALUES
('%s', '%s', '%s', %d, '%s')",
dbesc($code),
dbesc($client_id),
dbesc($redirect_uri),
intval($expires),
dbesc($scope));
return $r;
}
return $r;
}
}
*/

View file

@ -4,8 +4,8 @@
* @file include/oembed.php
*/
use \Friendica\ParseUrl;
use \Friendica\Core\Config;
use Friendica\ParseUrl;
use Friendica\Core\Config;
function oembed_replacecb($matches){
$embedurl=$matches[1];

View file

@ -4,7 +4,7 @@
* @file include/plaintext.php
*/
use \Friendica\ParseUrl;
use Friendica\ParseUrl;
require_once("include/Photo.php");
require_once("include/bbcode.php");

View file

@ -1,7 +1,7 @@
<?php
/**
* @file include/plugin.php
*
*
* @brief Some functions to handle addons and themes.
*/
@ -164,7 +164,7 @@ function register_hook($hook,$file,$function,$priority=0) {
/**
* @brief unregisters a hook.
*
*
* @param string $hook the name of the hook
* @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook called
@ -325,7 +325,7 @@ function get_plugin_info($plugin){
/**
* @brief Parse theme comment in search of theme infos.
*
*
* like
* \code
* ..* Name: My Theme
@ -545,11 +545,11 @@ function upgrade_bool_message($bbcode = false) {
/**
* @brief Get the full path to relevant theme files by filename
*
*
* This function search in the theme directory (and if not present in global theme directory)
* if there is a directory with the file extension and for a file with the given
* filename.
*
* filename.
*
* @param string $file Filename
* @param string $root Full root path
* @return string Path to the file or empty string if the file isn't found

View file

@ -1,4 +1,7 @@
<?php
use Friendica\Core\Config;
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
$directory = dirname($_SERVER["argv"][0]);
@ -10,8 +13,6 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
chdir($directory);
}
use \Friendica\Core\Config;
require_once("boot.php");
function poller_run($argv, $argc){

View file

@ -1,5 +1,6 @@
<?php
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once('include/items.php');
require_once('include/ostatus.php');

View file

@ -1,6 +1,6 @@
<?php
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once("boot.php");
require_once("include/threads.php");

View file

@ -1,13 +1,13 @@
<?php
/**
* @file include/socgraph.php
*
*
* @todo Move GNU Social URL schemata (http://server.tld/user/number) to http://server.tld/username
* @todo Fetch profile data from profile page for Redmatrix users
* @todo Detect if it is a forum
*/
use \Friendica\Core\Config;
use Friendica\Core\Config;
require_once('include/datetime.php');
require_once("include/Scrape.php");
@ -1430,7 +1430,7 @@ function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = fal
$r = q("SELECT `gcontact`.*
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`zcid` = %d
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
$sql_extra limit %d, %d",
intval($zcid),
intval($uid),

View file

@ -6,7 +6,6 @@ require_once("include/Smilies.php");
require_once("include/map.php");
require_once("mod/proxy.php");
if(! function_exists('replace_macros')) {
/**
* This is our template processor

View file

@ -1,11 +1,5 @@
<?php
/**
* import account file exported from mod/uexport
* args:
* $a App Friendica App Class
* $file Array array from $_FILES
*/
require_once("include/Photo.php");
define("IMPORT_DEBUG", False);
@ -75,6 +69,12 @@ function import_cleanup($newuid) {
q("DELETE FROM `pconfig` WHERE uid = %d", $newuid);
}
/**
* @brief Import account file exported from mod/uexport
*
* @param App $a Friendica App Class
* @param array $file array from $_FILES
*/
function import_account(App $a, $file) {
logger("Start user import from " . $file['tmp_name']);
/*
@ -255,10 +255,6 @@ function import_account(App $a, $file) {
}
}
foreach ($account['photo'] as &$photo) {
$photo['uid'] = $newuid;
$photo['data'] = hex2bin($photo['data']);