From 85b5715a44ee7e9b7075bfac5338bf8eadfe9a58 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 26 Dec 2018 00:36:43 -0500 Subject: [PATCH 1/2] Remove require include/* --- advancedcontentfilter/advancedcontentfilter.php | 4 ---- curweather/curweather.php | 2 -- forumdirectory/forumdirectory.php | 4 ---- fromgplus/fromgplus.php | 4 ---- ifttt/ifttt.php | 3 --- public_server/public_server.php | 1 - pumpio/pumpio.php | 1 - statusnet/statusnet.php | 8 -------- testdrive/testdrive.php | 2 -- twitter/twitter.php | 10 ---------- widgets/widget_like.php | 2 -- 11 files changed, 41 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index a00f2f07..d06dab51 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -52,10 +52,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Symfony\Component\ExpressionLanguage; -require_once 'boot.php'; -require_once 'include/conversation.php'; -require_once 'include/dba.php'; - require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; function advancedcontentfilter_install() diff --git a/curweather/curweather.php b/curweather/curweather.php index 9d4d42e7..d1ef63b8 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -9,8 +9,6 @@ * */ -require_once 'include/text.php'; - use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Cache; diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 0e2f0fe3..526a35fe 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -20,10 +20,6 @@ use Friendica\Model\Profile; use Friendica\Util\Strings; use Friendica\Util\Temporal; -require_once 'boot.php'; -require_once 'include/dba.php'; -require_once 'include/text.php'; - function forumdirectory_install() { Addon::registerHook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu'); diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 35f90ac0..79da93dc 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -23,8 +23,6 @@ use Friendica\Model\Item; require_once 'mod/share.php'; require_once 'mod/parse_url.php'; -require_once 'include/text.php'; - function fromgplus_install() { Addon::registerHook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); Addon::registerHook('connector_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); @@ -320,8 +318,6 @@ function fromgplus_cleantext($text) { } function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) { - require_once 'include/items.php'; - $post = ""; $quote = ""; $pagedata = []; diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 50fa119c..029db9a0 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -7,9 +7,6 @@ * Author: Michael Vogel */ require_once 'mod/item.php'; -require_once 'include/items.php'; -require_once 'include/text.php'; - use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; diff --git a/public_server/public_server.php b/public_server/public_server.php index 7e09806e..39b3f7fd 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -58,7 +58,6 @@ function public_server_cron($a, $b) { Logger::log("public_server: cron start"); - require_once('include/enotify.php'); $r = q("SELECT * FROM `user` WHERE `account_expires_on` < UTC_TIMESTAMP() + INTERVAL 5 DAY AND `account_expires_on` > '%s' AND `expire_notification_sent` <= '%s'", diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index fa0365ed..c550d924 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -30,7 +30,6 @@ use Friendica\Util\XML; require 'addon/pumpio/oauth/http.php'; require 'addon/pumpio/oauth/oauth_client.php'; -require_once 'include/enotify.php'; require_once "mod/share.php"; define('PUMPIO_DEFAULT_POLL_INTERVAL', 5); // given in minutes diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 28920dd6..8c9bee5f 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -36,8 +36,6 @@ define('STATUSNET_DEFAULT_POLL_INTERVAL', 5); // given in minutes require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'statusnetoauth.php'; -require_once 'include/enotify.php'; - use CodebirdSN\CodebirdSN; use Friendica\App; use Friendica\Content\OEmbed; @@ -827,8 +825,6 @@ function statusnet_fetchtimeline(App $a, $uid) $lastid = PConfig::get($uid, 'statusnet', 'lastid'); require_once 'mod/item.php'; - require_once 'include/items.php'; - // get the application name for the SN app // 1st try personal config, then system config and fallback to the // hostname of the node if neither one is set. @@ -1254,8 +1250,6 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) Logger::log("statusnet_fetchhometimeline: Fetching for user " . $uid, Logger::DEBUG); - require_once 'include/items.php'; - $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret); $own_contact = statusnet_fetch_own_contact($a, $uid); @@ -1441,8 +1435,6 @@ function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nic function statusnet_convertmsg(App $a, $body, $no_tags = false) { - require_once "include/items.php"; - $body = preg_replace("=\[url\=https?://([0-9]*).([0-9]*).([0-9]*).([0-9]*)/([0-9]*)\](.*?)\[\/url\]=ism", "$1.$2.$3.$4/$5", $body); $URLSearchString = "^\[\]"; diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index 6daf136e..9489c838 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -61,8 +61,6 @@ function testdrive_register_account($a,$b) { function testdrive_cron($a,$b) { - require_once('include/enotify.php'); - $r = q("select * from user where account_expires_on < UTC_TIMESTAMP() + INTERVAL 5 DAY and expire_notification_sent = '0000-00-00 00:00:00' "); diff --git a/twitter/twitter.php b/twitter/twitter.php index 43269a87..7f37bcaa 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -90,11 +90,6 @@ use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; use Friendica\Util\Strings; -require_once 'boot.php'; -require_once 'include/dba.php'; -require_once 'include/enotify.php'; -require_once 'include/text.php'; - require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes @@ -804,8 +799,6 @@ function twitter_expire(App $a) } DBA::close($r); - require_once "include/items.php"; - Logger::log('twitter_expire: expire_start'); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1' ORDER BY RAND()"); @@ -935,7 +928,6 @@ function twitter_fetchtimeline(App $a, $uid) $has_picture = false; require_once 'mod/item.php'; - require_once 'include/items.php'; require_once 'mod/share.php'; $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); @@ -1663,8 +1655,6 @@ function twitter_fetchhometimeline(App $a, $uid) $application_name = $a->getHostName(); } - require_once 'include/items.php'; - $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); try { diff --git a/widgets/widget_like.php b/widgets/widget_like.php index 9693d254..56ad1e5b 100644 --- a/widgets/widget_like.php +++ b/widgets/widget_like.php @@ -52,8 +52,6 @@ function like_widget_content(&$a, $conf){ $dislikes = $r[0]['c']; - require_once("include/conversation.php"); - $o = ""; # $t = file_get_contents( dirname(__file__). "/widget_like.tpl" ); -- 2.43.5 From 62c43ea2f8ebb701cc6342452a264eec13971372 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 27 Dec 2018 21:03:17 -0500 Subject: [PATCH 2/2] [various] Escape global function get_app calls --- ifttt/ifttt.php | 2 +- impressum/impressum.php | 2 +- widgets/widgets.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 50fa119c..302bc9c1 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -168,7 +168,7 @@ function ifttt_post(App $a) function ifttt_message($uid, $item) { - $a = get_app(); + $a = \get_app(); $_SESSION['authenticated'] = true; $_SESSION['uid'] = $uid; diff --git a/impressum/impressum.php b/impressum/impressum.php index c5a1c98d..d7cbc6d2 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -33,7 +33,7 @@ function impressum_uninstall() { function impressum_module() { } function impressum_content() { - $a = get_app(); + $a = \get_app(); $a->internalRedirect('friendica/'); } diff --git a/widgets/widgets.php b/widgets/widgets.php index 927d6746..64f6b62f 100644 --- a/widgets/widgets.php +++ b/widgets/widgets.php @@ -77,7 +77,7 @@ function widgets_module() { } function _abs_url($s){ - $a = get_app(); + $a = \get_app(); return preg_replace("|href=(['\"])([^h][^t][^t][^p])|", "href=\$1".$a->getBaseURL()."/\$2", $s); } -- 2.43.5