]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #5877 from annando/issue-5859
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 10 Oct 2018 19:23:39 +0000 (15:23 -0400)
committerGitHub <noreply@github.com>
Wed, 10 Oct 2018 19:23:39 +0000 (15:23 -0400)
Issue 5859: Avoid returning empty arrays

94 files changed:
bin/worker.php
boot.php
include/api.php
include/enotify.php
include/items.php
include/text.php
index.php
mod/admin.php
mod/allfriends.php
mod/common.php
mod/community.php
mod/contacts.php
mod/dfrn_request.php
mod/directory.php
mod/dirfind.php
mod/display.php
mod/hcard.php
mod/home.php
mod/hostxrd.php
mod/match.php
mod/message.php
mod/network.php
mod/nodeinfo.php
mod/notes.php
mod/notifications.php
mod/notify.php
mod/openid.php
mod/opensearch.php
mod/photo.php
mod/photos.php
mod/ping.php
mod/profile.php
mod/profiles.php
mod/pubsubhubbub.php
mod/redir.php
mod/register.php
mod/settings.php
mod/videos.php
mod/viewcontacts.php
mod/xrd.php
src/App.php
src/Content/Nav.php
src/Content/Text/BBCode.php
src/Content/Text/Markdown.php
src/Core/Addon.php
src/Core/Cache.php
src/Core/Cache/AbstractCacheDriver.php
src/Core/Console/AutomaticInstallation.php
src/Core/Console/DocBloxErrorChecker.php
src/Core/Install.php
src/Core/NotificationsManager.php
src/Core/System.php
src/Core/Theme.php
src/Core/Worker.php
src/Database/DBA.php
src/Database/DBStructure.php
src/Model/Contact.php
src/Model/Item.php
src/Model/Photo.php
src/Model/Profile.php
src/Model/User.php
src/Module/Login.php
src/Module/Logout.php
src/Module/Magic.php
src/Module/Proxy.php
src/Network/Curl.php [new file with mode: 0644]
src/Network/Probe.php
src/Object/Image.php
src/Object/Post.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/Feed.php
src/Protocol/OStatus.php
src/Protocol/PortableContact.php
src/Protocol/Salmon.php
src/Render/FriendicaSmarty.php
src/Util/ExAuth.php
src/Util/HTTPSignature.php
src/Util/Network.php
src/Util/Proxy.php
src/Worker/Cron.php
src/Worker/CronJobs.php
src/Worker/Delivery.php
src/Worker/Notifier.php
src/Worker/OnePoll.php
src/Worker/PubSubPublish.php
tests/ApiTest.php
tests/DatabaseTest.php
tests/src/Core/Cache/MemoryCacheTest.php
view/theme/duepuntozero/theme.php
view/theme/frio/php/default.php
view/theme/frio/theme.php
view/theme/smoothly/theme.php
view/theme/vier/theme.php

index ceab479cea93064af9074e1664f73c43c25bd0a9..cb09a4929da9fe0c445baca4361445902687531f 100755 (executable)
@@ -45,7 +45,7 @@ if (Config::get('system', 'maintenance', false, true)) {
        return;
 }
 
-$a->set_baseurl(Config::get('system', 'url'));
+$a->setBaseURL(Config::get('system', 'url'));
 
 Addon::loadHooks();
 
index b1d5b593fd4619c64472786ca39f5e1fecd8f470..64741b176271fdb70de6fdc76092d8460e2d1ae5 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -556,7 +556,7 @@ function check_url(App $a)
        // and www.example.com vs example.com.
        // We will only change the url to an ip address if there is no existing setting
 
-       if (empty($url) || (!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname()))) {
+       if (empty($url) || (!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->getHostName()))) {
                Config::set('system', 'url', System::baseUrl());
        }
 
@@ -975,27 +975,27 @@ function get_temppath()
 
        $temppath = Config::get("system", "temppath");
 
-       if (($temppath != "") && App::directory_usable($temppath)) {
+       if (($temppath != "") && App::isDirectoryUsable($temppath)) {
                // We have a temp path and it is usable
-               return App::realpath($temppath);
+               return App::getRealPath($temppath);
        }
 
        // We don't have a working preconfigured temp path, so we take the system path.
        $temppath = sys_get_temp_dir();
 
        // Check if it is usable
-       if (($temppath != "") && App::directory_usable($temppath)) {
+       if (($temppath != "") && App::isDirectoryUsable($temppath)) {
                // Always store the real path, not the path through symlinks
-               $temppath = App::realpath($temppath);
+               $temppath = App::getRealPath($temppath);
 
                // To avoid any interferences with other systems we create our own directory
-               $new_temppath = $temppath . "/" . $a->get_hostname();
+               $new_temppath = $temppath . "/" . $a->getHostName();
                if (!is_dir($new_temppath)) {
                        /// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
                        mkdir($new_temppath);
                }
 
-               if (App::directory_usable($new_temppath)) {
+               if (App::isDirectoryUsable($new_temppath)) {
                        // The new path is usable, we are happy
                        Config::set("system", "temppath", $new_temppath);
                        return $new_temppath;
@@ -1077,8 +1077,8 @@ function get_itemcachepath()
        }
 
        $itemcache = Config::get('system', 'itemcache');
-       if (($itemcache != "") && App::directory_usable($itemcache)) {
-               return App::realpath($itemcache);
+       if (($itemcache != "") && App::isDirectoryUsable($itemcache)) {
+               return App::getRealPath($itemcache);
        }
 
        $temppath = get_temppath();
@@ -1089,7 +1089,7 @@ function get_itemcachepath()
                        mkdir($itemcache);
                }
 
-               if (App::directory_usable($itemcache)) {
+               if (App::isDirectoryUsable($itemcache)) {
                        Config::set("system", "itemcache", $itemcache);
                        return $itemcache;
                }
@@ -1105,7 +1105,7 @@ function get_itemcachepath()
 function get_spoolpath()
 {
        $spoolpath = Config::get('system', 'spoolpath');
-       if (($spoolpath != "") && App::directory_usable($spoolpath)) {
+       if (($spoolpath != "") && App::isDirectoryUsable($spoolpath)) {
                // We have a spool path and it is usable
                return $spoolpath;
        }
@@ -1120,7 +1120,7 @@ function get_spoolpath()
                        mkdir($spoolpath);
                }
 
-               if (App::directory_usable($spoolpath)) {
+               if (App::isDirectoryUsable($spoolpath)) {
                        // The new path is usable, we are happy
                        Config::set("system", "spoolpath", $spoolpath);
                        return $spoolpath;
index cab0290de33d23f020489ac1563ba980abdbb2cd..01cb93a3b8226f5f7940733a6502ac74e6470b8a 100644 (file)
@@ -3344,7 +3344,7 @@ function api_statusnet_config($type)
        $a = get_app();
 
        $name      = Config::get('config', 'sitename');
-       $server    = $a->get_hostname();
+       $server    = $a->getHostName();
        $logo      = System::baseUrl() . '/images/friendica-64.png';
        $email     = Config::get('config', 'admin_email');
        $closed    = intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 'true' : 'false';
index 70abce584547ea3986a25b2d6f89029dc0c99408..b184a6935e08add322c137ccfa63cba6c2c469ff 100644 (file)
@@ -61,7 +61,7 @@ function notification($params)
        }
 
        $sender_name = $sitename;
-       $hostname = $a->get_hostname();
+       $hostname = $a->getHostName();
        if (strpos($hostname, ':')) {
                $hostname = substr($hostname, 0, strpos($hostname, ':'));
        }
index e8e2a5da0df57394ec70885a38471085a4b4715f..236e63dd25e88e48783e7b3da76fa7b679cb6106 100644 (file)
@@ -318,7 +318,7 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub
 
        Network::post($url, $params);
 
-       logger('subscribe_to_hub: returns: ' . $a->get_curl_code(), LOGGER_DEBUG);
+       logger('subscribe_to_hub: returns: ' . Network::getCurl()->getCode(), LOGGER_DEBUG);
 
        return;
 
index 7013c2c91b493baeba1d2cb8b22e7e08e6a37573..5a18529d93ab68837560d1cb927fcbc131ff2bb7 100644 (file)
@@ -42,7 +42,7 @@ function replace_macros($s, $r) {
        // pass $baseurl to all templates
        $r['$baseurl'] = System::baseUrl();
 
-       $t = $a->template_engine();
+       $t = $a->getTemplateEngine();
        try {
                $output = $t->replaceMacros($s, $r);
        } catch (Exception $e) {
@@ -50,7 +50,7 @@ function replace_macros($s, $r) {
                killme();
        }
 
-       $a->save_timestamp($stamp1, "rendering");
+       $a->saveTimestamp($stamp1, "rendering");
 
        return $output;
 }
@@ -473,7 +473,7 @@ function get_markup_template($s, $root = '') {
        $stamp1 = microtime(true);
 
        $a = get_app();
-       $t = $a->template_engine();
+       $t = $a->getTemplateEngine();
        try {
                $template = $t->getTemplateFile($s, $root);
        } catch (Exception $e) {
@@ -481,7 +481,7 @@ function get_markup_template($s, $root = '') {
                killme();
        }
 
-       $a->save_timestamp($stamp1, "file");
+       $a->saveTimestamp($stamp1, "file");
 
        return $template;
 }
@@ -574,7 +574,7 @@ function logger($msg, $level = LOGGER_INFO) {
 
        $stamp1 = microtime(true);
        @file_put_contents($logfile, $logline, FILE_APPEND);
-       $a->save_timestamp($stamp1, "file");
+       $a->saveTimestamp($stamp1, "file");
 }
 
 /**
@@ -634,7 +634,7 @@ function dlogger($msg, $level = LOGGER_INFO) {
 
        $stamp1 = microtime(true);
        @file_put_contents($logfile, $logline, FILE_APPEND);
-       $a->save_timestamp($stamp1, "file");
+       $a->saveTimestamp($stamp1, "file");
 }
 
 
@@ -1414,7 +1414,7 @@ function get_plink($item) {
                        ];
 
                if (x($item, 'plink')) {
-                       $ret["href"] = $a->remove_baseurl($item['plink']);
+                       $ret["href"] = $a->removeBaseURL($item['plink']);
                        $ret["title"] = L10n::t('link to source');
                }
 
index 19b85b935601077fe8ab8e1a6d0ad6fc3951d702..7ec3485d84a6dff6362c7502abbbc4f2d4022a8b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -23,11 +23,9 @@ use Friendica\Module\Login;
 
 require_once 'boot.php';
 
-$a = new App(__DIR__);
-
 // We assume that the index.php is called by a frontend process
 // The value is set to "true" by default in boot.php
-$a->backend = false;
+$a = new App(__DIR__, false);
 
 /**
  * Try to open the database;
@@ -49,7 +47,7 @@ if ($a->isMaxProcessesReached() || $a->isMaxLoadReached()) {
 }
 
 if (!$a->getMode()->isInstall()) {
-       if (Config::get('system', 'force_ssl') && ($a->get_scheme() == "http")
+       if (Config::get('system', 'force_ssl') && ($a->getScheme() == "http")
                && (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)
                && (substr(System::baseUrl(), 0, 8) == "https://")
                && ($_SERVER['REQUEST_METHOD'] == 'GET')) {
@@ -78,10 +76,10 @@ L10n::loadTranslationTable($lang);
  */
 
 // Exclude the backend processes from the session management
-if (!$a->is_backend()) {
+if (!$a->isBackend()) {
        $stamp1 = microtime(true);
        session_start();
-       $a->save_timestamp($stamp1, "parser");
+       $a->saveTimestamp($stamp1, "parser");
 } else {
        $_SESSION = [];
        Worker::executeIfIdle();
index 77ac7eddf8ccf135a0cf6d37c3a0eead0a0f6998..bd5e9ecea384ab7be736b5bfe85df2744972cf39 100644 (file)
@@ -475,8 +475,8 @@ function admin_page_contactblock(App $a)
 
        $total = DBA::count('contact', $condition);
 
-       $a->set_pager_total($total);
-       $a->set_pager_itemspage(30);
+       $a->setPagerTotal($total);
+       $a->setPagerItemsPage(30);
 
        $statement = DBA::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
 
@@ -866,15 +866,15 @@ function admin_page_summary(App $a)
        // Legacy config file warning
        if (file_exists('.htconfig.php')) {
                $showwarning = true;
-               $warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.ini.php, please copy config/local-sample.ini.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->get_baseurl() . '/help/Config');
+               $warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.ini.php, please copy config/local-sample.ini.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config');
        }
 
        // Check server vitality
        if (!admin_page_server_vital()) {
                $showwarning = true;
-               $well_known = $a->get_baseurl() . '/.well-known/host-meta';
+               $well_known = $a->getBaseURL() . '/.well-known/host-meta';
                $warningtext[] = L10n::t('<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.',
-                       $well_known, $well_known, $a->get_baseurl() . '/help/Install');
+                       $well_known, $well_known, $a->getBaseURL() . '/help/Install');
        }
 
        $r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
@@ -1012,7 +1012,7 @@ function admin_page_site_post(App $a)
                // update config
                Config::set('system', 'hostname', parse_url($new_url,  PHP_URL_HOST));
                Config::set('system', 'url', $new_url);
-               $a->set_baseurl($new_url);
+               $a->setBaseURL($new_url);
 
                // send relocate
                $users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
@@ -1124,7 +1124,7 @@ function admin_page_site_post(App $a)
                Worker::add(PRIORITY_LOW, 'Directory');
        }
 
-       if ($a->get_path() != "") {
+       if ($a->getURLPath() != "") {
                $diaspora_enabled = false;
        }
        if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
@@ -1261,7 +1261,7 @@ function admin_page_site_post(App $a)
        Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
 
        if ($itemcache != '') {
-               $itemcache = App::realpath($itemcache);
+               $itemcache = App::getRealPath($itemcache);
        }
 
        Config::set('system', 'itemcache', $itemcache);
@@ -1269,13 +1269,13 @@ function admin_page_site_post(App $a)
        Config::set('system', 'max_comments', $max_comments);
 
        if ($temppath != '') {
-               $temppath = App::realpath($temppath);
+               $temppath = App::getRealPath($temppath);
        }
 
        Config::set('system', 'temppath', $temppath);
 
        if ($basepath != '') {
-               $basepath = App::realpath($basepath);
+               $basepath = App::getRealPath($basepath);
        }
 
        Config::set('system', 'basepath', $basepath);
@@ -1419,9 +1419,9 @@ function admin_page_site(App $a)
        ];
 
        if (empty(Config::get('config', 'hostname'))) {
-               Config::set('config', 'hostname', $a->get_hostname());
+               Config::set('config', 'hostname', $a->getHostName());
        }
-       $diaspora_able = ($a->get_path() == "");
+       $diaspora_able = ($a->getURLPath() == "");
 
        $optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
 
@@ -1801,8 +1801,8 @@ function admin_page_users(App $a)
        /* get users */
        $total = q("SELECT COUNT(*) AS `total` FROM `user` WHERE 1");
        if (count($total)) {
-               $a->set_pager_total($total[0]['total']);
-               $a->set_pager_itemspage(100);
+               $a->setPagerTotal($total[0]['total']);
+               $a->setPagerItemsPage(100);
        }
 
        /* ordering */
index 7623a9cd06ca4cbba5be8bb9e15d4fe547b6729b..b41d0c891be7ec7feceb100b80404882f5c7cbe4 100644 (file)
@@ -46,7 +46,7 @@ function allfriends_content(App $a)
 
        $total = GContact::countAllFriends(local_user(), $cid);
 
-       $a->set_pager_total($total);
+       $a->setPagerTotal($total);
 
        $r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
        if (!DBA::isResult($r)) {
index afe78ce460270fdd06a44bf2b02543883ac87042..d694527b8600979c4c74817e1663c39d07b8e4b2 100644 (file)
@@ -88,7 +88,7 @@ function common_content(App $a)
        }
 
        if ($t > 0) {
-               $a->set_pager_total($t);
+               $a->setPagerTotal($t);
        } else {
                notice(L10n::t('No contacts in common.') . EOL);
                return $o;
index 9c9fb4390038fed56110a1465f73e176f31c5c0f..d1432b7bbbf5c19dbd780a6f7eecbc59e7123063 100644 (file)
@@ -153,7 +153,7 @@ function community_content(App $a, $update = 0)
                $itemspage_network = $a->force_max_items;
        }
 
-       $a->set_pager_itemspage($itemspage_network);
+       $a->setPagerItemsPage($itemspage_network);
 
        $r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content, $accounttype);
 
index 7597fd6432ce7786800ce94cd9b01f5df2038afb..4e149ab74fa4c448cc0e1fcaa847e1551ce18dfb 100644 (file)
@@ -793,7 +793,7 @@ function contacts_content(App $a, $update = 0)
                intval($_SESSION['uid'])
        );
        if (DBA::isResult($r)) {
-               $a->set_pager_total($r[0]['total']);
+               $a->setPagerTotal($r[0]['total']);
                $total = $r[0]['total'];
        }
 
index 25fe69066fb3d51619c2de82353b927b9951e786..e611458281e8e64759882786ae7ec0233651f76d 100644 (file)
@@ -451,10 +451,10 @@ function dfrn_request_post(App $a)
                        // Diaspora needs the uri in the format user@domain.tld
                        // Diaspora will support the remote subscription in a future version
                        if ($network == Protocol::DIASPORA) {
-                               $uri = $nickname . '@' . $a->get_hostname();
+                               $uri = $nickname . '@' . $a->getHostName();
 
-                               if ($a->get_path()) {
-                                       $uri .= '/' . $a->get_path();
+                               if ($a->getURLPath()) {
+                                       $uri .= '/' . $a->getURLPath();
                                }
 
                                $uri = urlencode($uri);
@@ -609,7 +609,7 @@ function dfrn_request_content(App $a)
                } elseif (x($_GET, 'address') && ($_GET['address'] != "")) {
                        $myaddr = $_GET['address'];
                } elseif (local_user()) {
-                       if (strlen($a->urlpath)) {
+                       if (strlen($a->getURLPath())) {
                                $myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
                        } else {
                                $myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
index 411024dc1aace31a38e12b6f735d5a693a5a0fd7..202132e3667abeb7a86c4ae36153a8b4040eb1ab 100644 (file)
@@ -16,7 +16,7 @@ use Friendica\Util\Proxy as ProxyUtils;
 
 function directory_init(App $a)
 {
-       $a->set_pager_itemspage(60);
+       $a->setPagerItemsPage(60);
 
        if (local_user()) {
                $a->page['aside'] .= Widget::findPeople();
@@ -87,7 +87,7 @@ function directory_content(App $a)
                                LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
                                WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` $sql_extra");
        if (DBA::isResult($cnt)) {
-               $a->set_pager_total($cnt['total']);
+               $a->setPagerTotal($cnt['total']);
        }
 
        $order = " ORDER BY `name` ASC ";
index 4223bb6ecd34bb3e196f9c1a62acbee7ab536810..5fe9ae13af32adacf7b8d0e8c34fb25b10fcf1bf 100644 (file)
@@ -188,8 +188,8 @@ function dirfind_content(App $a, $prefix = "") {
                }
 
                if ($j->total) {
-                       $a->set_pager_total($j->total);
-                       $a->set_pager_itemspage($j->items_page);
+                       $a->setPagerTotal($j->total);
+                       $a->setPagerItemsPage($j->items_page);
                }
 
                if (!empty($j->results)) {
index fe8e960f9eb600aa3b971e258326713a0d8f3a29..a03b918372efd61636961fbbf488f486aec18ddc 100644 (file)
@@ -365,7 +365,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
        $title = trim(HTML::toPlaintext(BBCode::convert($item["title"], false), 0, true));
        $author_name = $item["author-name"];
 
-       $image = $a->remove_baseurl($item["author-avatar"]);
+       $image = $a->removeBaseURL($item["author-avatar"]);
 
        if ($title == "") {
                $title = $author_name;
index 0c046da54092d6c621a1e036328c5992beed0b51..7e5c2cc08add11cb7739eeafe7fe79cc4dbb0e18 100644 (file)
@@ -50,7 +50,7 @@ function hcard_init(App $a)
 
        $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
-       $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->urlpath) ? '/' . $a->urlpath : ''));
+       $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (($a->getURLPath()) ? '/' . $a->getURLPath() : ''));
        $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
        header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
 
index d28bf3cb43a9fc62b694fae2c2af0d59806b6c97..33d736a4e1cba2793efd62c8e576a90135f5740f 100644 (file)
@@ -38,8 +38,8 @@ function home_content(App $a) {
        $customhome = false;
        $defaultheader = '<h1>' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '</h1>';
 
-       $homefilepath = $a->basepath . "/home.html";
-       $cssfilepath = $a->basepath . "/home.css";
+       $homefilepath = $a->getBasePath() . "/home.html";
+       $cssfilepath = $a->getBasePath() . "/home.css";
        if (file_exists($homefilepath)) {
                $customhome = $homefilepath;
                if (file_exists($cssfilepath)) {
index 16f132fe092ff2a871fcc3a0e15fe67cffbe84c6..30343381c393c9ff119c4cc637a93bf121a17ac1 100644 (file)
@@ -23,7 +23,7 @@ function hostxrd_init(App $a)
 
        $tpl = get_markup_template('xrd_host.tpl');
        echo replace_macros($tpl, [
-               '$zhost' => $a->get_hostname(),
+               '$zhost' => $a->getHostName(),
                '$zroot' => System::baseUrl(),
                '$domain' => System::baseUrl(),
                '$bigkey' => Salmon::salmonKey(Config::get('system', 'site_pubkey'))]
index caa4c944cae6a660e0398098dc33836a1b16af22..bb1e4542aed0004eab693cdba92b3c10e4475291 100644 (file)
@@ -67,8 +67,8 @@ function match_content(App $a)
                $j = json_decode($x);
 
                if ($j->total) {
-                       $a->set_pager_total($j->total);
-                       $a->set_pager_itemspage($j->items_page);
+                       $a->setPagerTotal($j->total);
+                       $a->setPagerItemsPage($j->items_page);
                }
 
                if (count($j->results)) {
index bb3000736aac6f7721dfb4541f6c0a53b2313c77..f9c5c29ec773a934f3795453c8c6a15b257848f3 100644 (file)
@@ -279,7 +279,7 @@ function message_content(App $a)
                );
 
                if (DBA::isResult($r)) {
-                       $a->set_pager_total($r[0]['total']);
+                       $a->setPagerTotal($r[0]['total']);
                }
 
                $r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
index 58e147d1f70d4d97431c9161b562f5ef3d21b86c..fb0093849e1ef4b618641c51bf33de99cb65c905 100644 (file)
@@ -302,7 +302,7 @@ function networkPager($a, $update)
                $itemspage_network = $a->force_max_items;
        }
 
-       $a->set_pager_itemspage($itemspage_network);
+       $a->setPagerItemsPage($itemspage_network);
 
        return sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
 }
@@ -721,7 +721,7 @@ function networkThreadedView(App $a, $update, $parent)
                        if ($last_received != '') {
                                $last_date = $last_received;
                                $sql_range .= sprintf(" AND $sql_table.`received` < '%s'", DBA::escape($last_received));
-                               $a->set_pager_page(1);
+                               $a->setPagerPage(1);
                                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
                        }
                        break;
@@ -729,7 +729,7 @@ function networkThreadedView(App $a, $update, $parent)
                        if ($last_commented != '') {
                                $last_date = $last_commented;
                                $sql_range .= sprintf(" AND $sql_table.`commented` < '%s'", DBA::escape($last_commented));
-                               $a->set_pager_page(1);
+                               $a->setPagerPage(1);
                                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
                        }
                        break;
@@ -737,14 +737,14 @@ function networkThreadedView(App $a, $update, $parent)
                        if ($last_created != '') {
                                $last_date = $last_created;
                                $sql_range .= sprintf(" AND $sql_table.`created` < '%s'", DBA::escape($last_created));
-                               $a->set_pager_page(1);
+                               $a->setPagerPage(1);
                                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
                        }
                        break;
                case 'id':
                        if (($last_id > 0) && ($sql_table == '`thread`')) {
                                $sql_range .= sprintf(" AND $sql_table.`iid` < '%s'", DBA::escape($last_id));
-                               $a->set_pager_page(1);
+                               $a->setPagerPage(1);
                                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
                        }
                        break;
index 072986cc5ebf8a8e8203cef909dc1f9635ab9a5e..ed0166838fdc3df1733d15328234051a80a8a23e 100644 (file)
@@ -215,7 +215,7 @@ function nodeinfo_cron() {
        logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
 
        // Now trying to register
-       $url = 'http://the-federation.info/register/'.$a->get_hostname();
+       $url = 'http://the-federation.info/register/'.$a->getHostName();
        logger('registering url: '.$url, LOGGER_DEBUG);
        $ret = Network::fetchUrl($url);
        logger('registering answer: '.$ret, LOGGER_DEBUG);
index 01f283870ef8ec2ed119d84a458fd2db67d7e33d..da8352966e721e3f2c7698dc51668efa33db5967 100644 (file)
@@ -61,7 +61,7 @@ function notes_content(App $a, $update = false)
        $condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
                'wall' => false, 'contact-id'=> $a->contact['id']];
 
-       $a->set_pager_itemspage(40);
+       $a->setPagerItemsPage(40);
 
        $params = ['order' => ['created' => true],
                'limit' => [$a->pager['start'], $a->pager['itemspage']]];
index 867c7260da5550b881b33da07c534122abc6511b..1885f96447c9f7e54276cd059bd26cddcaa2482c 100644 (file)
@@ -120,7 +120,7 @@ function notifications_content(App $a)
        }
 
        // Set the pager
-       $a->set_pager_itemspage($perpage);
+       $a->setPagerItemsPage($perpage);
 
        // Add additional informations (needed for json output)
        $notifs['items_page'] = $a->pager['itemspage'];
index 458d0140a64130f28e2f383d392692b75da64f2e..a277e59813ecb53a11907a2a7e9736a609408cdb 100644 (file)
@@ -27,7 +27,7 @@ function notify_init(App $a)
                        $nm->setSeen($note);
 
                        // The friendica client has problems with the GUID. this is some workaround
-                       if ($a->is_friendica_app()) {
+                       if ($a->isFriendicaApp()) {
                                require_once("include/items.php");
                                $urldata = parse_url($note['link']);
                                $guid = basename($urldata["path"]);
index 41d45c1f608a887889abc087baa6119f40b67113..63b29684b3c5eded4a1fa651470a76ee192dc8b5 100644 (file)
@@ -19,7 +19,7 @@ function openid_content(App $a) {
 
        if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
 
-               $openid = new LightOpenID($a->get_hostname());
+               $openid = new LightOpenID($a->getHostName());
 
                if($openid->validate()) {
 
index 8a427908bc244277bfca2e10c7602102b5151bf4..541002410076f22c7409a5a6ef72b715b2a03e36 100644 (file)
@@ -11,7 +11,7 @@ function opensearch_content(App $a) {
 
        $o = replace_macros($tpl, [
                '$baseurl' => System::baseUrl(),
-               '$nodename' => $a->get_hostname(),
+               '$nodename' => $a->getHostName(),
        ]);
 
        echo $o;
index 6d456b349e9c496ff7168407bde68dcdf5ca9565..b1dd9a5c3a3c60863c5fb71b5c7fc2f194016581 100644 (file)
@@ -192,7 +192,7 @@ function photo_init(App $a)
        // If the photo is public and there is an existing photo directory store the photo there
        if ($public and $file != '') {
                // If the photo path isn't there, try to create it
-               $basepath = $a->get_basepath();
+               $basepath = $a->getBasePath();
                if (!is_dir($basepath . "/photo")) {
                        if (is_writable($basepath)) {
                                mkdir($basepath . "/photo");
index 568d6eb5371a7ffeaf73d44d7e43bbc5a1d4bc55..259209ed4041ede16cf179b0c688030eaf10d4a8 100644 (file)
@@ -1143,8 +1143,8 @@ function photos_content(App $a)
                        DBA::escape($album)
                );
                if (DBA::isResult($r)) {
-                       $a->set_pager_total(count($r));
-                       $a->set_pager_itemspage(20);
+                       $a->setPagerTotal(count($r));
+                       $a->setPagerItemsPage(20);
                }
 
                /// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
@@ -1393,7 +1393,7 @@ function photos_content(App $a)
                        $link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
 
                        $condition = ["`parent` = ? AND `parent` != `id`",  $link_item['parent']];
-                       $a->set_pager_total(DBA::count('item', $condition));
+                       $a->setPagerTotal(DBA::count('item', $condition));
 
                        $params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
                        $result = Item::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params);
@@ -1655,8 +1655,8 @@ function photos_content(App $a)
        );
 
        if (DBA::isResult($r)) {
-               $a->set_pager_total(count($r));
-               $a->set_pager_itemspage(20);
+               $a->setPagerTotal(count($r));
+               $a->setPagerItemsPage(20);
        }
 
        $r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
index 968751a7da1819c0d9e261a0b87cac95800218f7..ff0139f28f9d3b405f0b148ccf694b8ba03f0171 100644 (file)
@@ -350,7 +350,7 @@ function ping_init(App $a)
                        $regularnotifications = (!empty($_GET['uid']) && !empty($_GET['_']));
 
                        foreach ($notifs as $notif) {
-                               if ($a->is_friendica_app() || !$regularnotifications) {
+                               if ($a->isFriendicaApp() || !$regularnotifications) {
                                        $notif['message'] = str_replace("{0}", $notif['name'], $notif['message']);
                                }
 
index 5b306b20fb03ad1f92dc4df09b2cb53718b269e5..aa284d1669a0184a1e6fdf05c84074d76e02ce46 100644 (file)
@@ -91,7 +91,7 @@ function profile_init(App $a)
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
-       $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : ''));
+       $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . ($a->getURLPath() ? '/' . $a->getURLPath() : ''));
        $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
        header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
 
@@ -307,7 +307,7 @@ function profile_content(App $a, $update = 0)
                        $itemspage_network = $a->force_max_items;
                }
 
-               $a->set_pager_itemspage($itemspage_network);
+               $a->setPagerItemsPage($itemspage_network);
 
                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
 
index f41cb72af4ce86f0d7f5018b727137913cf5cc8f..3e6bd1cb0d0ff29bacf720540dcf125cd2132e1c 100644 (file)
@@ -667,7 +667,7 @@ function profiles_content(App $a) {
                        $profiles = '';
                        foreach ($r as $rr) {
                                $profiles .= replace_macros($tpl, [
-                                       '$photo'        => $a->remove_baseurl($rr['thumb']),
+                                       '$photo'        => $a->removeBaseURL($rr['thumb']),
                                        '$id'           => $rr['id'],
                                        '$alt'          => L10n::t('Profile Image'),
                                        '$profile_name' => $rr['profile-name'],
index 8f9478d8aa51d0a322e6299156cca5968b9751b3..5697be8305bdb1c94e6f7a3be99a656bbff2b25f 100644 (file)
@@ -105,7 +105,7 @@ function pubsubhubbub_init(App $a) {
                // Social/StatusNet doesn't honour it (yet)
 
                $body = Network::fetchUrl($hub_callback . "?" . $params);
-               $ret = $a->get_curl_code();
+               $ret = Network::getCurl()->getCode();
 
                // give up if the HTTP return code wasn't a success (2xx)
                if ($ret < 200 || $ret > 299) {
index 3acf960dab7b2556218dd2ed7a2a52d1501ff4fe..e989ad015a83045b5f98ce9e202e416bce03731a 100644 (file)
@@ -57,7 +57,7 @@ function redir_init(App $a) {
                }
 
                if (remote_user()) {
-                       $host = substr(System::baseUrl() . ($a->urlpath ? '/' . $a->urlpath : ''), strpos(System::baseUrl(), '://') + 3);
+                       $host = substr(System::baseUrl() . ($a->getURLPath() ? '/' . $a->getURLPath() : ''), strpos(System::baseUrl(), '://') + 3);
                        $remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
 
                        // On a local instance we have to check if the local user has already authenticated
index b851faf2d6225f471e5cec43e93270b4beab3978..454062d89b6c90c874f7511a1acd8d0ca003fc93 100644 (file)
@@ -274,7 +274,7 @@ function register_content(App $a)
                '$passwords' => $passwords,
                '$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
                '$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
-               '$nickdesc'  => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@%s</strong>\'.', $a->get_hostname()),
+               '$nickdesc'  => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@%s</strong>\'.', $a->getHostName()),
                '$nicklabel' => L10n::t('Choose a nickname: '),
                '$photo'     => $photo,
                '$publish'   => $profile_publish,
@@ -283,7 +283,7 @@ function register_content(App $a)
                '$email'     => $email,
                '$nickname'  => $nickname,
                '$license'   => $license,
-               '$sitename'  => $a->get_hostname(),
+               '$sitename'  => $a->getHostName(),
                '$importh'   => L10n::t('Import'),
                '$importt'   => L10n::t('Import your profile to this friendica instance'),
                '$showtoslink' => Config::get('system', 'tosdisplay'),
index 1e6ce1354e6676c04b11e49e05d706299b9b5da2..5632193e3bddcf4255713060a28ac05e2d98bbd8 100644 (file)
@@ -547,7 +547,7 @@ function settings_post(App $a)
        if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
                if (Network::isUrlValid($openid)) {
                        logger('updating openidserver');
-                       $open_id_obj = new LightOpenID($a->get_hostname());
+                       $open_id_obj = new LightOpenID($a->getHostName());
                        $open_id_obj->identity = $openid;
                        $openidserver = $open_id_obj->discover($open_id_obj->identity);
                } else {
@@ -1136,8 +1136,8 @@ function settings_content(App $a)
        $tpl_addr = get_markup_template('settings/nick_set.tpl');
 
        $prof_addr = replace_macros($tpl_addr,[
-               '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->get_hostname() . $a->get_path(), System::baseUrl() . '/profile/' . $nickname),
-               '$basepath' => $a->get_hostname()
+               '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname),
+               '$basepath' => $a->getHostName()
        ]);
 
        $stpl = get_markup_template('settings/settings.tpl');
index a0c9d0d16edfeb8cd4e761a2784f02104b212799..e52c78cab11f794a0b5f2e4fdd7ab30dfd35c2a0 100644 (file)
@@ -341,8 +341,8 @@ function videos_content(App $a)
        );
 
        if (DBA::isResult($r)) {
-               $a->set_pager_total(count($r));
-               $a->set_pager_itemspage(20);
+               $a->setPagerTotal(count($r));
+               $a->setPagerItemsPage(20);
        }
 
        $r = q("SELECT hash, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`created`) AS `created`,
index 9446470e1b03df21f2e9eeb649e4235504d21337..563c13c6d4ada9ccc0242731ff29f650147e38e3 100644 (file)
@@ -71,7 +71,7 @@ function viewcontacts_content(App $a)
                DBA::escape(Protocol::OSTATUS)
        );
        if (DBA::isResult($r)) {
-               $a->set_pager_total($r[0]['total']);
+               $a->setPagerTotal($r[0]['total']);
        }
 
        $r = q("SELECT * FROM `contact`
index 6a5fdbbdb9257b78476789762bd99b5774fa25ab..2626b0c791a1d156b7a913808bf9d7ba09d1b1ae 100644 (file)
@@ -55,9 +55,9 @@ function xrd_init(App $a)
 
        $alias = str_replace('/profile/', '/~', $profile_url);
 
-       $addr = 'acct:'.$user['nickname'].'@'.$a->get_hostname();
-       if ($a->get_path()) {
-               $addr .= '/'.$a->get_path();
+       $addr = 'acct:'.$user['nickname'].'@'.$a->getHostName();
+       if ($a->getURLPath()) {
+               $addr .= '/'.$a->getURLPath();
        }
 
        if ($mode == 'xml') {
index 61d7335f1ab9e09348055bdf3eb99240a1c36337..9bfb10f7ceeb7c188dcff8e8e77f60e9dfea4c30 100644 (file)
@@ -54,8 +54,6 @@ class App
        public $argc;
        public $module;
        public $strings;
-       public $basepath;
-       public $urlpath;
        public $hooks = [];
        public $timezone;
        public $interactive = true;
@@ -65,11 +63,9 @@ class App
        public $identities;
        public $is_mobile = false;
        public $is_tablet = false;
-       public $is_friendica_app;
        public $performance = [];
        public $callstack = [];
        public $theme_info = [];
-       public $backend = true;
        public $nav_sel;
        public $category;
        // Allow themes to control internal parameters
@@ -89,6 +85,31 @@ class App
         */
        private $mode;
 
+       /**
+        * @var string The App base path
+        */
+       private $basePath;
+
+       /**
+        * @var string The App URL path
+        */
+       private $urlPath;
+
+       /**
+        * @var bool true, if the call is from the Friendica APP, otherwise false
+        */
+       private $isFriendicaApp;
+
+       /**
+        * @var bool true, if the call is from an backend node (f.e. worker)
+        */
+       private $isBackend;
+
+       /**
+        * @var string The name of the current theme
+        */
+       private $currentTheme;
+
        /**
         * Register a stylesheet file path to be included in the <head> tag of every page.
         * Inclusion is done in App->initHead().
@@ -100,7 +121,7 @@ class App
         */
        public function registerStylesheet($path)
        {
-               $url = str_replace($this->get_basepath() . DIRECTORY_SEPARATOR, '', $path);
+               $url = str_replace($this->getBasePath() . DIRECTORY_SEPARATOR, '', $path);
 
                $this->stylesheets[] = trim($url, '/');
        }
@@ -116,7 +137,7 @@ class App
         */
        public function registerFooterScript($path)
        {
-               $url = str_replace($this->get_basepath() . DIRECTORY_SEPARATOR, '', $path);
+               $url = str_replace($this->getBasePath() . DIRECTORY_SEPARATOR, '', $path);
 
                $this->footerScripts[] = trim($url, '/');
        }
@@ -157,26 +178,26 @@ class App
        ];
        private $scheme;
        private $hostname;
-       private $curl_code;
-       private $curl_content_type;
-       private $curl_headers;
 
        /**
         * @brief App constructor.
         *
-        * @param string $basepath Path to the app base folder
+        * @param string $basePath Path to the app base folder
+        * @param bool $backend true, if the call is from backend, otherwise set to true (Default true)
         *
         * @throws Exception if the Basepath is not usable
         */
-       public function __construct($basepath)
+       public function __construct($basePath, $backend = true)
        {
-               if (!static::directory_usable($basepath, false)) {
-                       throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
+               if (!static::isDirectoryUsable($basePath, false)) {
+                       throw new Exception('Basepath ' . $basePath . ' isn\'t usable.');
                }
 
                BaseObject::setApp($this);
 
-               $this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
+               $this->basePath = rtrim($basePath, DIRECTORY_SEPARATOR);
+               $this->checkBackend($backend);
+               $this->checkFriendicaApp();
 
                $this->performance['start'] = microtime(true);
                $this->performance['database'] = 0;
@@ -199,7 +220,7 @@ class App
                $this->callstack['rendering'] = [];
                $this->callstack['parser'] = [];
 
-               $this->mode = new App\Mode($basepath);
+               $this->mode = new App\Mode($basePath);
 
                $this->reload();
 
@@ -230,9 +251,9 @@ class App
 
                set_include_path(
                        get_include_path() . PATH_SEPARATOR
-                       . $this->basepath . DIRECTORY_SEPARATOR . 'include' . PATH_SEPARATOR
-                       . $this->basepath . DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
-                       . $this->basepath);
+                       . $this->getBasePath() . DIRECTORY_SEPARATOR . 'include' . PATH_SEPARATOR
+                       . $this->getBasePath(). DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
+                       . $this->getBasePath());
 
                if ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 9) === 'pagename=') {
                        $this->query_string = substr($_SERVER['QUERY_STRING'], 9);
@@ -301,11 +322,8 @@ class App
                $this->is_mobile = $mobile_detect->isMobile();
                $this->is_tablet = $mobile_detect->isTablet();
 
-               // Friendica-Client
-               $this->is_friendica_app = isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'Apache-HttpClient/UNAVAILABLE (java 1.4)';
-
                // Register template engines
-               $this->register_template_engine('Friendica\Render\FriendicaSmartyEngine');
+               $this->registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
        }
 
        /**
@@ -334,9 +352,9 @@ class App
 
                $this->loadDatabase();
 
-               $this->getMode()->determine($this->basepath);
+               $this->getMode()->determine($this->getBasePath());
 
-               $this->determineUrlPath();
+               $this->determineURLPath();
 
                Config::load();
 
@@ -372,20 +390,20 @@ class App
         */
        private function loadConfigFiles()
        {
-               $this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.ini.php');
-               $this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.ini.php');
+               $this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.ini.php');
+               $this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.ini.php');
 
                // Legacy .htconfig.php support
-               if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
+               if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
                        $a = $this;
-                       include $this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php';
+                       include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php';
                }
 
                // Legacy .htconfig.php support
-               if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php')) {
+               if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htconfig.php')) {
                        $a = $this;
 
-                       include $this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php';
+                       include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htconfig.php';
 
                        $this->setConfigValue('database', 'hostname', $db_host);
                        $this->setConfigValue('database', 'username', $db_user);
@@ -413,8 +431,8 @@ class App
                        }
                }
 
-               if (file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
-                       $this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', true);
+               if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
+                       $this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', true);
                }
        }
 
@@ -432,7 +450,7 @@ class App
         * INI;
         * // Keep this line
         *
-        * @param type $filepath
+        * @param string $filepath
         * @param bool $overwrite Force value overwrite if the config key already exists
         * @throws Exception
         */
@@ -473,8 +491,8 @@ class App
                Core\Addon::callHooks('load_config');
 
                // Load the local addon config file to overwritten default addon config values
-               if (file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php')) {
-                       $this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php', true);
+               if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php')) {
+                       $this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php', true);
                }
        }
 
@@ -502,9 +520,9 @@ class App
        /**
         * Figure out if we are running at the top of a domain or in a sub-directory and adjust accordingly
         */
-       private function determineUrlPath()
+       private function determineURLPath()
        {
-               $this->urlpath = $this->getConfigValue('system', 'urlpath');
+               $this->urlPath = $this->getConfigValue('system', 'urlpath');
 
                /* SCRIPT_URL gives /path/to/friendica/module/parameter
                 * QUERY_STRING gives pagename=module/parameter
@@ -520,8 +538,8 @@ class App
                                $path = trim($_SERVER['SCRIPT_URL'], '/');
                        }
 
-                       if ($path && $path != $this->urlpath) {
-                               $this->urlpath = $path;
+                       if ($path && $path != $this->urlPath) {
+                               $this->urlPath = $path;
                        }
                }
        }
@@ -562,7 +580,7 @@ class App
                DBA::connect($db_host, $db_user, $db_pass, $db_data, $charset);
                unset($db_host, $db_user, $db_pass, $db_data, $charset);
 
-               $this->save_timestamp($stamp1, 'network');
+               $this->saveTimestamp($stamp1, 'network');
        }
 
        /**
@@ -573,9 +591,9 @@ class App
         *
         * @return string
         */
-       public function get_basepath()
+       public function getBasePath()
        {
-               $basepath = $this->basepath;
+               $basepath = $this->basePath;
 
                if (!$basepath) {
                        $basepath = Config::get('system', 'basepath');
@@ -589,7 +607,7 @@ class App
                        $basepath = $_SERVER['PWD'];
                }
 
-               return self::realpath($basepath);
+               return self::getRealPath($basepath);
        }
 
        /**
@@ -602,7 +620,7 @@ class App
         * @param string $path The path that is about to be normalized
         * @return string normalized path - when possible
         */
-       public static function realpath($path)
+       public static function getRealPath($path)
        {
                $normalized = realpath($path);
 
@@ -613,7 +631,7 @@ class App
                }
        }
 
-       public function get_scheme()
+       public function getScheme()
        {
                return $this->scheme;
        }
@@ -632,7 +650,7 @@ class App
         * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN
         * @return string Friendica server base URL
         */
-       public function get_baseurl($ssl = false)
+       public function getBaseURL($ssl = false)
        {
                $scheme = $this->scheme;
 
@@ -655,7 +673,7 @@ class App
                        $this->hostname = Config::get('config', 'hostname');
                }
 
-               return $scheme . '://' . $this->hostname . (!empty($this->urlpath) ? '/' . $this->urlpath : '' );
+               return $scheme . '://' . $this->hostname . (!empty($this->getURLPath()) ? '/' . $this->getURLPath() : '' );
        }
 
        /**
@@ -665,7 +683,7 @@ class App
         *
         * @param string $url
         */
-       public function set_baseurl($url)
+       public function setBaseURL($url)
        {
                $parsed = @parse_url($url);
                $hostname = '';
@@ -683,11 +701,11 @@ class App
                                $hostname .= ':' . $parsed['port'];
                        }
                        if (x($parsed, 'path')) {
-                               $this->urlpath = trim($parsed['path'], '\\/');
+                               $this->urlPath = trim($parsed['path'], '\\/');
                        }
 
-                       if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
-                               include $this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php';
+                       if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
+                               include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php';
                        }
 
                        if (Config::get('config', 'hostname') != '') {
@@ -700,7 +718,7 @@ class App
                }
        }
 
-       public function get_hostname()
+       public function getHostName()
        {
                if (Config::get('config', 'hostname') != '') {
                        $this->hostname = Config::get('config', 'hostname');
@@ -709,23 +727,23 @@ class App
                return $this->hostname;
        }
 
-       public function get_path()
+       public function getURLPath()
        {
-               return $this->urlpath;
+               return $this->urlPath;
        }
 
-       public function set_pager_total($n)
+       public function setPagerTotal($n)
        {
                $this->pager['total'] = intval($n);
        }
 
-       public function set_pager_itemspage($n)
+       public function setPagerItemsPage($n)
        {
                $this->pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0);
                $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
        }
 
-       public function set_pager_page($n)
+       public function setPagerPage($n)
        {
                $this->pager['page'] = $n;
                $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
@@ -791,7 +809,7 @@ class App
                 * being first
                 */
                $this->page['htmlhead'] = replace_macros($tpl, [
-                       '$baseurl'         => $this->get_baseurl(),
+                       '$baseurl'         => $this->getBaseURL(),
                        '$local_user'      => local_user(),
                        '$generator'       => 'Friendica' . ' ' . FRIENDICA_VERSION,
                        '$delitem'         => L10n::t('Delete this item?'),
@@ -847,58 +865,28 @@ class App
 
                $tpl = get_markup_template('footer.tpl');
                $this->page['footer'] = replace_macros($tpl, [
-                       '$baseurl' => $this->get_baseurl(),
+                       '$baseurl' => $this->getBaseURL(),
                        '$footerScripts' => $this->footerScripts,
                ]) . $this->page['footer'];
        }
 
-       public function set_curl_code($code)
-       {
-               $this->curl_code = $code;
-       }
-
-       public function get_curl_code()
-       {
-               return $this->curl_code;
-       }
-
-       public function set_curl_content_type($content_type)
-       {
-               $this->curl_content_type = $content_type;
-       }
-
-       public function get_curl_content_type()
-       {
-               return $this->curl_content_type;
-       }
-
-       public function set_curl_headers($headers)
-       {
-               $this->curl_headers = $headers;
-       }
-
-       public function get_curl_headers()
-       {
-               return $this->curl_headers;
-       }
-
        /**
         * @brief Removes the base url from an url. This avoids some mixed content problems.
         *
-        * @param string $orig_url
+        * @param string $origURL
         *
         * @return string The cleaned url
         */
-       public function remove_baseurl($orig_url)
+       public function removeBaseURL($origURL)
        {
                // Remove the hostname from the url if it is an internal link
-               $nurl = normalise_link($orig_url);
-               $base = normalise_link($this->get_baseurl());
+               $nurl = normalise_link($origURL);
+               $base = normalise_link($this->getBaseURL());
                $url = str_replace($base . '/', '', $nurl);
 
                // if it is an external link return the orignal value
-               if ($url == normalise_link($orig_url)) {
-                       return $orig_url;
+               if ($url == normalise_link($origURL)) {
+                       return $origURL;
                } else {
                        return $url;
                }
@@ -909,7 +897,7 @@ class App
         *
         * @param string $class
         */
-       private function register_template_engine($class)
+       private function registerTemplateEngine($class)
        {
                $v = get_class_vars($class);
                if (x($v, 'name')) {
@@ -929,7 +917,7 @@ class App
         *
         * @return object Template Engine instance
         */
-       public function template_engine()
+       public function getTemplateEngine()
        {
                $template_engine = 'smarty3';
                if (x($this->theme, 'template_engine')) {
@@ -954,35 +942,69 @@ class App
        /**
         * @brief Returns the active template engine.
         *
-        * @return string
+        * @return string the active template engine
         */
-       public function get_template_engine()
+       public function getActiveTemplateEngine()
        {
                return $this->theme['template_engine'];
        }
 
-       public function set_template_engine($engine = 'smarty3')
+       /**
+        * sets the active template engine
+        *
+        * @param string $engine the template engine (default is Smarty3)
+        */
+       public function setActiveTemplateEngine($engine = 'smarty3')
        {
                $this->theme['template_engine'] = $engine;
        }
 
-       public function get_template_ldelim($engine = 'smarty3')
+       /**
+        * Gets the right delimiter for a template engine
+        *
+        * Currently:
+        * Internal = ''
+        * Smarty3 = '{{'
+        *
+        * @param string $engine The template engine (default is Smarty3)
+        *
+        * @return string the right delimiter
+        */
+       public function getTemplateLeftDelimiter($engine = 'smarty3')
        {
                return $this->ldelim[$engine];
        }
 
-       public function get_template_rdelim($engine = 'smarty3')
+       /**
+        * Gets the left delimiter for a template engine
+        *
+        * Currently:
+        * Internal = ''
+        * Smarty3 = '}}'
+        *
+        * @param string $engine The template engine (default is Smarty3)
+        *
+        * @return string the left delimiter
+        */
+       public function getTemplateRightDelimiter($engine = 'smarty3')
        {
                return $this->rdelim[$engine];
        }
 
-       public function save_timestamp($stamp, $value)
+       /**
+        * Saves a timestamp for a value - f.e. a call
+        * Necessary for profiling Friendica
+        *
+        * @param int $timestamp the Timestamp
+        * @param string $value A value to profile
+        */
+       public function saveTimestamp($timestamp, $value)
        {
                if (!isset($this->config['system']['profiler']) || !$this->config['system']['profiler']) {
                        return;
                }
 
-               $duration = (float) (microtime(true) - $stamp);
+               $duration = (float) (microtime(true) - $timestamp);
 
                if (!isset($this->performance[$value])) {
                        // Prevent ugly E_NOTICE
@@ -1002,19 +1024,41 @@ class App
                $this->callstack[$value][$callstack] += (float) $duration;
        }
 
-       public function get_useragent()
+       /**
+        * Returns the current UserAgent as a String
+        *
+        * @return string the UserAgent as a String
+        */
+       public function getUserAgent()
        {
                return
                        FRIENDICA_PLATFORM . " '" .
                        FRIENDICA_CODENAME . "' " .
                        FRIENDICA_VERSION . '-' .
                        DB_UPDATE_VERSION . '; ' .
-                       $this->get_baseurl();
+                       $this->getBaseURL();
        }
 
-       public function is_friendica_app()
+       /**
+        * Checks, if the call is from the Friendica App
+        *
+        * Reason:
+        * The friendica client has problems with the GUID in the notify. this is some workaround
+        */
+       private function checkFriendicaApp()
        {
-               return $this->is_friendica_app;
+               // Friendica-Client
+               $this->isFriendicaApp = isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'Apache-HttpClient/UNAVAILABLE (java 1.4)';
+       }
+
+       /**
+        *      Is the call via the Friendica app? (not a "normale" call)
+        *
+        * @return bool true if it's from the Friendica app
+        */
+       public function isFriendicaApp()
+       {
+               return $this->isFriendicaApp;
        }
 
        /**
@@ -1023,10 +1067,10 @@ class App
         * This isn't a perfect solution. But we need this check very early.
         * So we cannot wait until the modules are loaded.
         *
-        * @return bool Is it a known backend?
+        * @param string $backend true, if the backend flag was set during App initialization
+        *
         */
-       public function is_backend()
-       {
+       private function checkBackend($backend) {
                static $backends = [
                        '_well_known',
                        'api',
@@ -1050,7 +1094,17 @@ class App
                ];
 
                // Check if current module is in backend or backend flag is set
-               return (in_array($this->module, $backends) || $this->backend);
+               $this->isBackend = (in_array($this->module, $backends) || $backend || $this->isBackend);
+       }
+
+       /**
+        * Returns true, if the call is from a backend node (f.e. from a worker)
+        *
+        * @return bool Is it a known backend?
+        */
+       public function isBackend()
+       {
+               return $this->isBackend;
        }
 
        /**
@@ -1098,7 +1152,7 @@ class App
         *
         * @return bool Is the memory limit reached?
         */
-       public function min_memory_reached()
+       public function isMinMemoryReached()
        {
                $min_memory = Config::get('system', 'min_memory', 0);
                if ($min_memory == 0) {
@@ -1144,7 +1198,7 @@ class App
         */
        public function isMaxLoadReached()
        {
-               if ($this->is_backend()) {
+               if ($this->isBackend()) {
                        $process = 'backend';
                        $maxsysload = intval(Config::get('system', 'maxloadavg'));
                        if ($maxsysload < 1) {
@@ -1193,14 +1247,14 @@ class App
                        }
                }
 
-               if ($this->min_memory_reached()) {
+               if ($this->isMinMemoryReached()) {
                        return;
                }
 
                if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
-                       $resource = proc_open('cmd /c start /b ' . $cmdline, [], $foo, $this->get_basepath());
+                       $resource = proc_open('cmd /c start /b ' . $cmdline, [], $foo, $this->getBasePath());
                } else {
-                       $resource = proc_open($cmdline . ' &', [], $foo, $this->get_basepath());
+                       $resource = proc_open($cmdline . ' &', [], $foo, $this->getBasePath());
                }
                if (!is_resource($resource)) {
                        logger('We got no resource for command ' . $cmdline, LOGGER_DEBUG);
@@ -1216,7 +1270,7 @@ class App
         *
         * @return string system username
         */
-       private static function systemuser()
+       private static function getSystemUser()
        {
                if (!function_exists('posix_getpwuid') || !function_exists('posix_geteuid')) {
                        return '';
@@ -1231,7 +1285,7 @@ class App
         *
         * @return boolean the directory is usable
         */
-       public static function directory_usable($directory, $check_writable = true)
+       public static function isDirectoryUsable($directory, $check_writable = true)
        {
                if ($directory == '') {
                        logger('Directory is empty. This shouldn\'t happen.', LOGGER_DEBUG);
@@ -1239,22 +1293,22 @@ class App
                }
 
                if (!file_exists($directory)) {
-                       logger('Path "' . $directory . '" does not exist for user ' . self::systemuser(), LOGGER_DEBUG);
+                       logger('Path "' . $directory . '" does not exist for user ' . self::getSystemUser(), LOGGER_DEBUG);
                        return false;
                }
 
                if (is_file($directory)) {
-                       logger('Path "' . $directory . '" is a file for user ' . self::systemuser(), LOGGER_DEBUG);
+                       logger('Path "' . $directory . '" is a file for user ' . self::getSystemUser(), LOGGER_DEBUG);
                        return false;
                }
 
                if (!is_dir($directory)) {
-                       logger('Path "' . $directory . '" is not a directory for user ' . self::systemuser(), LOGGER_DEBUG);
+                       logger('Path "' . $directory . '" is not a directory for user ' . self::getSystemUser(), LOGGER_DEBUG);
                        return false;
                }
 
                if ($check_writable && !is_writable($directory)) {
-                       logger('Path "' . $directory . '" is not writable for user ' . self::systemuser(), LOGGER_DEBUG);
+                       logger('Path "' . $directory . '" is not writable for user ' . self::getSystemUser(), LOGGER_DEBUG);
                        return false;
                }
 
@@ -1265,6 +1319,8 @@ class App
         * @param string $cat     Config category
         * @param string $k       Config key
         * @param mixed  $default Default value if it isn't set
+        *
+        * @return string Returns the value of the Config entry
         */
        public function getConfigValue($cat, $k, $default = null)
        {
@@ -1347,6 +1403,8 @@ class App
         * @param string $cat     Config category
         * @param string $k       Config key
         * @param mixed  $default Default value if key isn't set
+        *
+        * @return string The value of the config entry
         */
        public function getPConfigValue($uid, $cat, $k, $default = null)
        {
@@ -1408,7 +1466,7 @@ class App
        {
                $sender_email = Config::get('config', 'sender_email');
                if (empty($sender_email)) {
-                       $hostname = $this->get_hostname();
+                       $hostname = $this->getHostName();
                        if (strpos($hostname, ':')) {
                                $hostname = substr($hostname, 0, strpos($hostname, ':'));
                        }
@@ -1422,7 +1480,7 @@ class App
        /**
         * Returns the current theme name.
         *
-        * @return string
+        * @return string the name of the current theme
         */
        public function getCurrentTheme()
        {
@@ -1435,7 +1493,7 @@ class App
                /// https://github.com/friendica/friendica/issues/5092)
                $this->computeCurrentTheme();
 
-               return $this->current_theme;
+               return $this->currentTheme;
        }
 
        /**
@@ -1451,7 +1509,7 @@ class App
                }
 
                // Sane default
-               $this->current_theme = $system_theme;
+               $this->currentTheme = $system_theme;
 
                $allowed_themes = explode(',', Config::get('system', 'allowed_themes', $system_theme));
 
@@ -1490,7 +1548,7 @@ class App
                        && (file_exists('view/theme/' . $theme_name . '/style.css')
                        || file_exists('view/theme/' . $theme_name . '/style.php'))
                ) {
-                       $this->current_theme = $theme_name;
+                       $this->currentTheme = $theme_name;
                }
        }
 
index 99decc92bb2e645dbade209f754626ef02cd1056..7a1a149a2fffd0a88540da451ee37be1f4daa18e 100644 (file)
@@ -107,7 +107,7 @@ class Nav
                        // user info
                        $contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
                        $userinfo = [
-                               'icon' => (DBA::isResult($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'),
+                               'icon' => (DBA::isResult($contact) ? $a->removeBaseURL($contact['micro']) : 'images/person-48.jpg'),
                                'name' => $a->user['username'],
                        ];
                } else {
index c3453bcf727bda8baf6f51517838e4403e7d43a6..66f4190b287eca731fe8b465dea18da5504b0feb 100644 (file)
@@ -1060,11 +1060,11 @@ class BBCode extends BaseObject
                        $ch = @curl_init($match[1]);
                        @curl_setopt($ch, CURLOPT_NOBODY, true);
                        @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-                       @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
+                       @curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
                        @curl_exec($ch);
                        $curl_info = @curl_getinfo($ch);
 
-                       $a->save_timestamp($stamp1, "network");
+                       $a->saveTimestamp($stamp1, "network");
 
                        if (substr($curl_info["content_type"], 0, 6) == "image/") {
                                $text = "[url=" . $match[1] . "]" . $match[1] . "[/url]";
@@ -1119,11 +1119,11 @@ class BBCode extends BaseObject
                        $ch = @curl_init($match[1]);
                        @curl_setopt($ch, CURLOPT_NOBODY, true);
                        @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-                       @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
+                       @curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
                        @curl_exec($ch);
                        $curl_info = @curl_getinfo($ch);
 
-                       $a->save_timestamp($stamp1, "network");
+                       $a->saveTimestamp($stamp1, "network");
 
                        // if its a link to a picture then embed this picture
                        if (substr($curl_info["content_type"], 0, 6) == "image/") {
@@ -1946,7 +1946,7 @@ class BBCode extends BaseObject
                // unmask the special chars back to HTML
                $text = str_replace(['&\_lt\_;', '&\_gt\_;', '&\_amp\_;'], ['&lt;', '&gt;', '&amp;'], $text);
 
-               $a->save_timestamp($stamp1, "parser");
+               $a->saveTimestamp($stamp1, "parser");
 
                // Libertree has a problem with escaped hashtags.
                $text = str_replace(['\#'], ['#'], $text);
index 0687b5377b0e82bf408251bcecdc7562d2deb652..2289bee869ee5ca42b885eea7b0defb903ab974d 100644 (file)
@@ -35,7 +35,7 @@ class Markdown extends BaseObject
                $MarkdownParser->code_class_prefix = 'language-';
                $html = $MarkdownParser->transform($text);
 
-               self::getApp()->save_timestamp($stamp1, "parser");
+               self::getApp()->saveTimestamp($stamp1, "parser");
 
                return $html;
        }
index d5a7a6f1b4d853b7d96f810daa63ff1fb23b655c..d2f89ce279de91867fe1edf9de53c3a8c8514620 100644 (file)
@@ -197,7 +197,7 @@ class Addon extends BaseObject
         */
        public static function registerHook($hook, $file, $function, $priority = 0)
        {
-               $file = str_replace(self::getApp()->get_basepath() . DIRECTORY_SEPARATOR, '', $file);
+               $file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
 
                $condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
                $exists = DBA::exists('hook', $condition);
@@ -220,7 +220,7 @@ class Addon extends BaseObject
         */
        public static function unregisterHook($hook, $file, $function)
        {
-               $relative_file = str_replace(self::getApp()->get_basepath() . DIRECTORY_SEPARATOR, '', $file);
+               $relative_file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
 
                // This here is only needed for fixing a problem that existed on the develop branch
                $condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
@@ -368,7 +368,7 @@ class Addon extends BaseObject
 
                $stamp1 = microtime(true);
                $f = file_get_contents("addon/$addon/$addon.php");
-               $a->save_timestamp($stamp1, "file");
+               $a->saveTimestamp($stamp1, "file");
 
                $r = preg_match("|/\*.*\*/|msU", $f, $m);
 
index b239af7d60bad23a8459ec6858769fc94a0e5991..0fb328aaee8368f86c3e1ec3fbbc2853e453592e 100644 (file)
@@ -61,7 +61,7 @@ class Cache extends \Friendica\BaseObject
 
                $return = self::getDriver()->getAllKeys($prefix);
 
-               self::getApp()->save_timestamp($time, 'cache');
+               self::getApp()->saveTimestamp($time, 'cache');
 
                return $return;
        }
@@ -79,7 +79,7 @@ class Cache extends \Friendica\BaseObject
 
                $return = self::getDriver()->get($key);
 
-               self::getApp()->save_timestamp($time, 'cache');
+               self::getApp()->saveTimestamp($time, 'cache');
 
                return $return;
        }
@@ -101,7 +101,7 @@ class Cache extends \Friendica\BaseObject
 
                $return = self::getDriver()->set($key, $value, $duration);
 
-               self::getApp()->save_timestamp($time, 'cache_write');
+               self::getApp()->saveTimestamp($time, 'cache_write');
 
                return $return;
        }
@@ -119,7 +119,7 @@ class Cache extends \Friendica\BaseObject
 
                $return = self::getDriver()->delete($key);
 
-               self::getApp()->save_timestamp($time, 'cache_write');
+               self::getApp()->saveTimestamp($time, 'cache_write');
 
                return $return;
        }
index 1cdecf6ceb0ce6ff9473bdc8f0a8f4647e600298..c2628551ef47be5dee31908af0b883e0520a37e4 100644 (file)
@@ -20,7 +20,7 @@ abstract class AbstractCacheDriver extends BaseObject
        protected function getCacheKey($key)
        {
                // We fetch with the hostname as key to avoid problems with other applications
-               return self::getApp()->get_hostname() . ":" . $key;
+               return self::getApp()->getHostName() . ":" . $key;
        }
 
        /**
@@ -34,7 +34,7 @@ abstract class AbstractCacheDriver extends BaseObject
                } else {
                        // Keys are prefixed with the node hostname, let's remove it
                        array_walk($keys, function (&$value) {
-                               $value = preg_replace('/^' . self::getApp()->get_hostname() . ':/', '', $value);
+                               $value = preg_replace('/^' . self::getApp()->getHostName() . ':/', '', $value);
                        });
 
                        sort($keys);
index 9b6945ecd4204019ecc1e75d9afe1236bc955680..9cdb8a0ae233187c34c6dbed173e4ba681aa6977 100644 (file)
@@ -84,8 +84,8 @@ HELP;
                        if ($config_file != 'config' . DIRECTORY_SEPARATOR . 'local.ini.php') {
                                // Copy config file
                                $this->out("Copying config file...\n");
-                               if (!copy($a->basepath . DIRECTORY_SEPARATOR . $config_file, $a->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
-                                       throw new RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '$a->basepath" . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "local.ini.php' manually.\n");
+                               if (!copy($a->getBasePath() . DIRECTORY_SEPARATOR . $config_file, $a->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
+                                       throw new RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '" . $a->getBasePath() . "'"  . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "local.ini.php' manually.\n");
                                }
                        }
 
index b29f8e2baaf9e41e190f814077e95c35570df7a4..421f913bb8ab1d4f397180a6f470acd3bd97cb07 100644 (file)
@@ -60,7 +60,7 @@ HELP;
                }
 
                //return from util folder to frindica base dir
-               $dir = get_app()->get_basepath();
+               $dir = get_app()->getBasePath();
 
                //stack for dirs to search
                $dirstack = [];
index ba3a97ea6c376fb64f36a61bda128bd3bfb719e3..ba767f3f9b9d33bff2382171bce32ad0dd4ac5b9 100644 (file)
@@ -86,7 +86,7 @@ class Install extends BaseObject
 
                $app = self::getApp();
 
-               $result = file_put_contents($app->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', $txt);
+               $result = file_put_contents($app->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', $txt);
                if (!$result) {
                        $app->data['txt'] = $txt;
                }
index f8c4ee3f86dc9798fe2eac29867229f6292ec44c..fb77605730b1069501c751c382a4f2ee46448cfe 100644 (file)
@@ -631,7 +631,7 @@ class NotificationsManager extends BaseObject
                        // We have to distinguish between these two because they use different data.
                        // Contact suggestions
                        if ($it['fid']) {
-                               $return_addr = bin2hex(self::getApp()->user['nickname'] . '@' . self::getApp()->get_hostname() . ((self::getApp()->urlpath) ? '/' . self::getApp()->urlpath : ''));
+                               $return_addr = bin2hex(self::getApp()->user['nickname'] . '@' . self::getApp()->getHostName() . ((self::getApp()->getURLPath()) ? '/' . self::getApp()->getURLPath() : ''));
 
                                $intro = [
                                        'label' => 'friend_suggestion',
index b41f520d7792c614414cda5701ab8e8ab3ee22ed..cbffcdbef1c8efeb438128aaf1833ef960b5ba1f 100644 (file)
@@ -27,7 +27,7 @@ class System extends BaseObject
         */
        public static function baseUrl($ssl = false)
        {
-               return self::getApp()->get_baseurl($ssl);
+               return self::getApp()->getBaseURL($ssl);
        }
 
        /**
@@ -39,7 +39,7 @@ class System extends BaseObject
         */
        public static function removedBaseUrl($orig_url)
        {
-               return self::getApp()->remove_baseurl($orig_url);
+               return self::getApp()->removeBaseURL($orig_url);
        }
 
        /**
@@ -185,7 +185,7 @@ class System extends BaseObject
                if (is_bool($prefix) && !$prefix) {
                        $prefix = '';
                } elseif (empty($prefix)) {
-                       $prefix = hash('crc32', self::getApp()->get_hostname());
+                       $prefix = hash('crc32', self::getApp()->getHostName());
                }
 
                while (strlen($prefix) < ($size - 13)) {
index c64ed08d3babdd315dd570c041878c89b8ea644d..7e5b89d2f9c506146c2f8c96fd788c4627a0602f 100644 (file)
@@ -50,7 +50,7 @@ class Theme
                $a = get_app();
                $stamp1 = microtime(true);
                $theme_file = file_get_contents("view/theme/$theme/theme.php");
-               $a->save_timestamp($stamp1, "file");
+               $a->saveTimestamp($stamp1, "file");
 
                $result = preg_match("|/\*.*\*/|msU", $theme_file, $matches);
 
index 3400f00ae1755229a24a20e16fc6844f1c7592c5..870a5dfb248b2fa22be662ada9a8aac31f27c88e 100644 (file)
@@ -62,7 +62,7 @@ class Worker
                }
 
                // Do we have too few memory?
-               if ($a->min_memory_reached()) {
+               if ($a->isMinMemoryReached()) {
                        logger('Pre check: Memory limit reached, quitting.', LOGGER_DEBUG);
                        return;
                }
@@ -122,7 +122,7 @@ class Worker
                                }
 
                                // Check free memory
-                               if ($a->min_memory_reached()) {
+                               if ($a->isMinMemoryReached()) {
                                        logger('Memory limit reached, quitting.', LOGGER_DEBUG);
                                        Lock::release('worker');
                                        return;
index ab856ef9d05da6fd2c1205fcf07e2029d8fdce02..c33fa2152fb5aebfd5b9ad84ac04ed4dd3d57776 100644 (file)
@@ -570,7 +570,7 @@ class DBA
                        self::$errorno = $errorno;
                }
 
-               $a->save_timestamp($stamp1, 'database');
+               $a->saveTimestamp($stamp1, 'database');
 
                if ($a->getConfigValue('system', 'db_log')) {
                        $stamp2 = microtime(true);
@@ -641,7 +641,7 @@ class DBA
                        self::$errorno = $errorno;
                }
 
-               $a->save_timestamp($stamp, "database_write");
+               $a->saveTimestamp($stamp, "database_write");
 
                return $retval;
        }
@@ -809,7 +809,7 @@ class DBA
                                }
                }
 
-               $a->save_timestamp($stamp1, 'database');
+               $a->saveTimestamp($stamp1, 'database');
 
                return $columns;
        }
@@ -1547,7 +1547,7 @@ class DBA
                                break;
                }
 
-               $a->save_timestamp($stamp1, 'database');
+               $a->saveTimestamp($stamp1, 'database');
 
                return $ret;
        }
index d6cd66aafa94a02f8171ae549ba2a460e451b3e4..0472d753ddba2620a831ce6618fe85ed1fd57954 100644 (file)
@@ -842,7 +842,7 @@ class DBStructure
        public static function definition() {
                $a = \Friendica\BaseObject::getApp();
 
-               $filename = $a->get_basepath() . '/config/dbstructure.json';
+               $filename = $a->getBasePath() . '/config/dbstructure.json';
 
                if (!is_readable($filename)) {
                        throw new Exception('Missing database structure config file config/dbstructure.json');
index fa6966a0eff8c66144cc4eaffc7d00cc022429b9..23c31d0b17c40fb20962208a05dc6327c335058f 100644 (file)
@@ -1632,10 +1632,10 @@ class Contact extends BaseObject
 
                if (($ret['network'] === Protocol::DFRN) && !DBA::isResult($contact)) {
                        if ($interactive) {
-                               if (strlen($a->urlpath)) {
+                               if (strlen($a->getURLPath())) {
                                        $myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']);
                                } else {
-                                       $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
+                                       $myaddr = bin2hex($a->user['nickname'] . '@' . $a->getHostName());
                                }
 
                                goaway($ret['request'] . "&addr=$myaddr");
index f2d4a8981575b12631f3833eb078f695f3a0b445..c0c67352e4ddbe6884189ce0fa8772c127a3aa34 100644 (file)
@@ -1166,7 +1166,7 @@ class Item extends BaseObject
                if ($notify) {
                        // We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri.
                        // We add the hash of our own host because our host is the original creator of the post.
-                       $prefix_host = get_app()->get_hostname();
+                       $prefix_host = get_app()->getHostName();
                } else {
                        $prefix_host = '';
 
@@ -2361,7 +2361,7 @@ class Item extends BaseObject
                        $guid = System::createUUID();
                }
 
-               return self::getApp()->get_baseurl() . '/objects/' . $guid;
+               return self::getApp()->getBaseURL() . '/objects/' . $guid;
        }
 
        /**
@@ -2644,7 +2644,7 @@ class Item extends BaseObject
                }
 
                // Prevent to forward already forwarded posts
-               if ($datarray["app"] == $a->get_hostname()) {
+               if ($datarray["app"] == $a->getHostName()) {
                        logger('Already forwarded (second test)', LOGGER_DEBUG);
                        return false;
                }
index 555df80e63df689fea8f056f22586783857f0574..e64158e175ced54a67d79fecf190be2965c561b5 100644 (file)
@@ -146,7 +146,7 @@ class Photo
 
                        // Remove the cached photo
                        $a = get_app();
-                       $basepath = $a->get_basepath();
+                       $basepath = $a->getBasePath();
 
                        if (is_dir($basepath . "/photo")) {
                                $filename = $basepath . '/photo/' . $hash . '-4.' . $Image->getExt();
index cb2754cc80ce6a8ef218421ec7952ccb00327fed..a1274c1ae40a170a762a089b775550c2a2a01433 100644 (file)
@@ -162,7 +162,7 @@ class Profile
                * load/reload current theme info
                */
 
-               $a->set_template_engine(); // reset the template engine to the default in case the user's theme doesn't specify one
+               $a->setActiveTemplateEngine(); // reset the template engine to the default in case the user's theme doesn't specify one
 
                $theme_info_file = 'view/theme/' . $a->getCurrentTheme() . '/theme.php';
                if (file_exists($theme_info_file)) {
@@ -1116,7 +1116,7 @@ class Profile
 
                $a->contact = $arr['visitor'];
 
-               info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', $a->get_hostname(), $visitor['name']));
+               info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', $a->getHostName(), $visitor['name']));
 
                logger('OpenWebAuth: auth success from ' . $visitor['addr'], LOGGER_DEBUG);
        }
index 7432b75774b22516165ad664e1102fb4d3f97f91..b8b694de87194a6bd6e143c9672c4b49782e9e2d 100644 (file)
@@ -414,7 +414,7 @@ class User
                                $_SESSION['register'] = 1;
                                $_SESSION['openid'] = $openid_url;
 
-                               $openid = new LightOpenID($a->get_hostname());
+                               $openid = new LightOpenID($a->getHostName());
                                $openid->identity = $openid_url;
                                $openid->returnUrl = System::baseUrl() . '/openid';
                                $openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
index 25ddd135025d774a2edc5539e578ccd38cff3845..15505a38be61295c8118d9b449a4da51b2daed7b 100644 (file)
@@ -39,7 +39,7 @@ class Login extends BaseModule
                }
 
                if (local_user()) {
-                       goaway(self::getApp()->get_baseurl());
+                       goaway(self::getApp()->getBaseURL());
                }
 
                return self::form($_SESSION['return_url'], intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED);
@@ -86,18 +86,18 @@ class Login extends BaseModule
                // if it's an email address or doesn't resolve to a URL, fail.
                if ($noid || strpos($openid_url, '@') || !Network::isUrlValid($openid_url)) {
                        notice(L10n::t('Login failed.') . EOL);
-                       goaway(self::getApp()->get_baseurl());
+                       goaway(self::getApp()->getBaseURL());
                        // NOTREACHED
                }
 
                // Otherwise it's probably an openid.
                try {
                        $a = get_app();
-                       $openid = new LightOpenID($a->get_hostname());
+                       $openid = new LightOpenID($a->getHostName());
                        $openid->identity = $openid_url;
                        $_SESSION['openid'] = $openid_url;
                        $_SESSION['remember'] = $remember;
-                       $openid->returnUrl = self::getApp()->get_baseurl(true) . '/openid';
+                       $openid->returnUrl = self::getApp()->getBaseURL(true) . '/openid';
                        goaway($openid->authUrl());
                } catch (Exception $e) {
                        notice(L10n::t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . '<br /><br >' . L10n::t('The error message was:') . ' ' . $e->getMessage());
@@ -191,7 +191,7 @@ class Login extends BaseModule
                                        if ($data->hash != cookie_hash($user)) {
                                                logger("Hash for user " . $data->uid . " doesn't fit.");
                                                nuke_session();
-                                               goaway(self::getApp()->get_baseurl());
+                                               goaway(self::getApp()->getBaseURL());
                                        }
 
                                        // Renew the cookie
@@ -228,7 +228,7 @@ class Login extends BaseModule
                                        logger('Session address changed. Paranoid setting in effect, blocking session. ' .
                                                $_SESSION['addr'] . ' != ' . $_SERVER['REMOTE_ADDR']);
                                        nuke_session();
-                                       goaway(self::getApp()->get_baseurl());
+                                       goaway(self::getApp()->getBaseURL());
                                }
 
                                $user = DBA::selectFirst('user', [],
@@ -242,7 +242,7 @@ class Login extends BaseModule
                                );
                                if (!DBA::isResult($user)) {
                                        nuke_session();
-                                       goaway(self::getApp()->get_baseurl());
+                                       goaway(self::getApp()->getBaseURL());
                                }
 
                                // Make sure to refresh the last login time for the user if the user
@@ -297,7 +297,7 @@ class Login extends BaseModule
                        $a->page['htmlhead'] .= replace_macros(
                                get_markup_template('login_head.tpl'),
                                [
-                                       '$baseurl' => $a->get_baseurl(true)
+                                       '$baseurl' => $a->getBaseURL(true)
                                ]
                        );
 
@@ -308,7 +308,7 @@ class Login extends BaseModule
                $o .= replace_macros(
                        $tpl,
                        [
-                               '$dest_url'     => self::getApp()->get_baseurl(true) . '/login',
+                               '$dest_url'     => self::getApp()->getBaseURL(true) . '/login',
                                '$logout'       => L10n::t('Logout'),
                                '$login'        => L10n::t('Login'),
 
index bfa917a393fa427f3b574aa285a21246aabefbf6..cbfd245f302f47f276cff27f8ee1ab1e192d0459 100644 (file)
@@ -26,6 +26,6 @@ class Logout extends BaseModule
                Addon::callHooks("logging_out");
                nuke_session();
                info(L10n::t('Logged out.') . EOL);
-               goaway(self::getApp()->get_baseurl());
+               goaway(self::getApp()->getBaseURL());
        }
 }
index 0b4126e0e965528fba0c9170a725c2b2dec262c9..042a9581dfb27d4466d9c4df0d5d6c0ad6cf6fa3 100644 (file)
@@ -47,7 +47,7 @@ class Magic extends BaseModule
                $contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
 
                // Redirect if the contact is already authenticated on this site.
-               if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], normalise_link(self::getApp()->get_baseurl())) !== false) {
+               if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], normalise_link(self::getApp()->getBaseURL())) !== false) {
                        if ($test) {
                                $ret['success'] = true;
                                $ret['message'] .= 'Local site - you are already authenticated.' . EOL;
@@ -78,7 +78,7 @@ class Magic extends BaseModule
                                $headers = HTTPSignature::createSig(
                                        $headers,
                                        $user['prvkey'],
-                                       'acct:' . $user['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : '')
+                                       'acct:' . $user['nickname'] . '@' . $a->getHostName() . ($a->getURLPath() ? '/' . $a->getURLPath() : '')
                                );
 
                                // Try to get an authentication token from the other instance.
index 0de45b332518e433b58df1e0990f0242e257ab3a..14e842562f559b52947dfb6a3079f89ab99539a2 100644 (file)
@@ -71,7 +71,7 @@ class Proxy extends BaseModule
                $thumb = false;
                $size = 1024;
                $sizetype = '';
-               $basepath = $a->get_basepath();
+               $basepath = $a->getBasePath();
 
                // If the cache path isn't there, try to create it
                if (!is_dir($basepath . '/proxy') && is_writable($basepath)) {
@@ -196,7 +196,7 @@ class Proxy extends BaseModule
                        unlink($tempfile);
 
                        // If there is an error then return a blank image
-                       if ((substr($a->get_curl_code(), 0, 1) == '4') || (!$img_str)) {
+                       if ((substr(Network::getCurl()->getCode(), 0, 1) == '4') || (!$img_str)) {
                                $img_str = file_get_contents('images/blank.png');
                                $mime = 'image/png';
                                $cachefile = ''; // Clear the cachefile so that the dummy isn't stored
diff --git a/src/Network/Curl.php b/src/Network/Curl.php
new file mode 100644 (file)
index 0000000..bc04f6b
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+
+namespace Friendica\Network;
+
+
+/**
+ * A content class for Curl call results
+ */
+class Curl
+{
+       /**
+        * @var string the Code of the Curl call
+        */
+       private $code;
+
+       /**
+        * @var string the content type of the Curl call
+        */
+       private $contentType;
+
+       /**
+        * @var string the headers of the Curl call
+        */
+       private $headers;
+
+       public function __construct($code = '', $contentType = '', $headers = '')
+       {
+               $this->code = $code;
+               $this->contentType = $contentType;
+               $this->headers = $headers;
+       }
+
+       /**
+        * Sets the Curl Code
+        *
+        * @param string $code The Curl Code
+        */
+       public function setCode($code)
+       {
+               $this->code = $code;
+       }
+
+       /**
+        * Gets the Curl Code
+        *
+        * @return string The Curl Code
+        */
+       public function getCode()
+       {
+               return $this->code;
+       }
+
+       /**
+        * Sets the Curl Content Type
+        *
+        * @param string $content_type The Curl Content Type
+        */
+       public function setContentType($content_type)
+       {
+               $this->contentType = $content_type;
+       }
+
+       /**
+        * Returns the Curl Content Type
+        *
+        * @return string the Curl Content Type
+        */
+       public function getContentType()
+       {
+               return $this->contentType;
+       }
+
+       /**
+        * Sets the Curl headers
+        *
+        * @param string $headers the Curl headers
+        */
+       public function setHeaders($headers)
+       {
+               $this->headers = $headers;
+       }
+
+       /**
+        * Returns the Curl headers
+        *
+        * @return string the Curl headers
+        */
+       public function getHeaders()
+       {
+               return $this->headers;
+       }
+}
index 2c84ddb85a8312f42a6e3f5d5723051e56045161..5a03a71f7b871cf5c2bfd0cb26cdaee839de373e 100644 (file)
@@ -74,7 +74,7 @@ class Probe
         */
        private static function ownHost($host)
        {
-               $own_host = get_app()->get_hostname();
+               $own_host = get_app()->getHostName();
 
                $parts = parse_url($host);
 
index 620929df5104a4e4e07dc4f22378fb8ad4003405..166e150bf56366a44696d20b86e024596f77d17e 100644 (file)
@@ -655,7 +655,7 @@ class Image
 
                $stamp1 = microtime(true);
                file_put_contents($path, $string);
-               $a->save_timestamp($stamp1, "file");
+               $a->saveTimestamp($stamp1, "file");
        }
 
        /**
@@ -730,7 +730,7 @@ class Image
                if ($fromcurl) {
                        $a = get_app();
                        $headers=[];
-                       $h = explode("\n", $a->get_curl_headers());
+                       $h = explode("\n", Network::getCurl()->getHeaders());
                        foreach ($h as $l) {
                                $data = array_map("trim", explode(":", trim($l), 2));
                                if (count($data) > 1) {
@@ -799,7 +799,7 @@ class Image
                                        $a = get_app();
                                        $stamp1 = microtime(true);
                                        file_put_contents($tempfile, $img_str);
-                                       $a->save_timestamp($stamp1, "file");
+                                       $a->saveTimestamp($stamp1, "file");
 
                                        $data = getimagesize($tempfile);
                                        unlink($tempfile);
@@ -907,7 +907,7 @@ class Image
 
                        $stamp1 = microtime(true);
                        $imagedata = @file_get_contents($url);
-                       $a->save_timestamp($stamp1, "file");
+                       $a->saveTimestamp($stamp1, "file");
                }
 
                $maximagesize = Config::get('system', 'maximagesize');
@@ -921,7 +921,7 @@ class Image
 
                $stamp1 = microtime(true);
                file_put_contents($tempfile, $imagedata);
-               $a->save_timestamp($stamp1, "file");
+               $a->saveTimestamp($stamp1, "file");
 
                $data = getimagesize($tempfile);
 
index 35805e1fddb5112c55cd3c1b7a314f957c3c5a2a..48ffe65b74ed16b1b59fc8cd381d75a0604bfd2c 100644 (file)
@@ -368,7 +368,7 @@ class Post extends BaseObject
                        'profile_url'     => $profile_link,
                        'item_photo_menu' => item_photo_menu($item),
                        'name'            => $name_e,
-                       'thumb'           => $a->remove_baseurl(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
+                       'thumb'           => $a->removeBaseURL(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
                        'osparkle'        => $osparkle,
                        'sparkle'         => $sparkle,
                        'title'           => $title_e,
@@ -381,7 +381,7 @@ class Post extends BaseObject
                        'indent'          => $indent,
                        'shiny'           => $shiny,
                        'owner_url'       => $this->getOwnerUrl(),
-                       'owner_photo'     => $a->remove_baseurl(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
+                       'owner_photo'     => $a->removeBaseURL(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
                        'owner_name'      => htmlentities($owner_name_e),
                        'plink'           => get_plink($item),
                        'edpost'          => Feature::isEnabled($conv->getProfileOwner(), 'edit_posts') ? $edpost : '',
@@ -788,9 +788,9 @@ class Post extends BaseObject
                                '$parent'      => $this->getId(),
                                '$qcomment'    => $qcomment,
                                '$profile_uid' => $uid,
-                               '$mylink'      => $a->remove_baseurl($a->contact['url']),
+                               '$mylink'      => $a->removeBaseURL($a->contact['url']),
                                '$mytitle'     => L10n::t('This is you'),
-                               '$myphoto'     => $a->remove_baseurl($a->contact['thumb']),
+                               '$myphoto'     => $a->removeBaseURL($a->contact['thumb']),
                                '$comment'     => L10n::t('Comment'),
                                '$submit'      => L10n::t('Submit'),
                                '$edbold'      => L10n::t('Bold'),
index 4d61f9aee00bb36f2a27225070e04d17c7f7b333..ff468fb2c17db4d2fb476f03fe245d97d3b7eacc 100644 (file)
@@ -1220,7 +1220,7 @@ class DFRN
 
                $xml = $ret['body'];
 
-               $curl_stat = $a->get_curl_code();
+               $curl_stat = Network::getCurl()->getCode();
                if (empty($curl_stat)) {
                        Contact::markForArchival($contact);
                        return -3; // timed out
@@ -1372,13 +1372,13 @@ class DFRN
 
                logger('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA);
 
-               $curl_stat = $a->get_curl_code();
+               $curl_stat = Network::getCurl()->getCode();
                if (empty($curl_stat) || empty($xml)) {
                        Contact::markForArchival($contact);
                        return -9; // timed out
                }
 
-               if (($curl_stat == 503) && stristr($a->get_curl_headers(), 'retry-after')) {
+               if (($curl_stat == 503) && stristr(Network::getCurl()->getHeaders(), 'retry-after')) {
                        Contact::markForArchival($contact);
                        return -10;
                }
@@ -1469,14 +1469,14 @@ class DFRN
 
                $xml = Network::post($dest_url, $envelope, ["Content-Type: ".$content_type]);
 
-               $curl_stat = $a->get_curl_code();
+               $curl_stat = Network::getCurl()->getCode();
                if (empty($curl_stat) || empty($xml)) {
                        logger('Empty answer from ' . $contact['id'] . ' - ' . $dest_url);
                        Contact::markForArchival($contact);
                        return -9; // timed out
                }
 
-               if (($curl_stat == 503) && (stristr($a->get_curl_headers(), 'retry-after'))) {
+               if (($curl_stat == 503) && (stristr(Network::getCurl()->getHeaders(), 'retry-after'))) {
                        Contact::markForArchival($contact);
                        return -10;
                }
@@ -2496,7 +2496,7 @@ class DFRN
 
                /// @todo Do we really need this check for HTML elements? (It was copied from the old function)
                if ((strpos($item['body'], '<') !== false) && (strpos($item['body'], '>') !== false)) {
-                       $base_url = get_app()->get_baseurl();
+                       $base_url = get_app()->getBaseURL();
                        $item['body'] = reltoabs($item['body'], $base_url);
 
                        $item['body'] = html2bb_video($item['body']);
index b5ecfcefcc9d16f1b934fdd7d8d87e735249e1b2..ebdc84ce7fdd049278d5b2b082ed33ad2442f931 100644 (file)
@@ -3080,7 +3080,7 @@ class Diaspora
                                $content_type = (($public_batch) ? "application/magic-envelope+xml" : "application/json");
 
                                Network::post($dest_url."/", $envelope, ["Content-Type: ".$content_type]);
-                               $return_code = $a->get_curl_code();
+                               $return_code = Network::getCurl()->getCode();
                        } else {
                                logger("test_mode");
                                return 200;
@@ -3089,7 +3089,7 @@ class Diaspora
 
                logger("transmit: ".$logid."-".$guid." to ".$dest_url." returns: ".$return_code);
 
-               if (!$return_code || (($return_code == 503) && (stristr($a->get_curl_headers(), "retry-after")))) {
+               if (!$return_code || (($return_code == 503) && (stristr(Network::getCurl()->getHeaders(), "retry-after")))) {
                        if (!$no_queue && !empty($contact['contact-type']) && ($contact['contact-type'] != Contact::ACCOUNT_TYPE_RELAY)) {
                                logger("queue message");
                                // queue message for redelivery
index 0709a9550ea23b44c20468930c1d30369f1b65ea..39b272a42210bda09c4339ecafba228be96324ba 100644 (file)
@@ -430,7 +430,7 @@ class Feed {
                                // Distributed items should have a well formatted URI.
                                // Additionally we have to avoid conflicts with identical URI between imported feeds and these items.
                                if ($notify) {
-                                       $item['guid'] = Item::guidFromUri($orig_plink, $a->get_hostname());
+                                       $item['guid'] = Item::guidFromUri($orig_plink, $a->getHostName());
                                        unset($item['uri']);
                                        unset($item['parent-uri']);
 
index d56bacc67512d45fd81561ed189657bc08ed8a53..b9090d0e440c22392e9b14c79b5b220a5e68edc3 100644 (file)
@@ -1830,7 +1830,7 @@ class OStatus
                }
 
                $item["uri"] = $item['parent-uri'] = $item['thr-parent']
-                               = 'tag:'.get_app()->get_hostname().
+                               = 'tag:'.get_app()->getHostName().
                                ','.date('Y-m-d').':'.$action.':'.$owner['uid'].
                                ':person:'.$connect_id.':'.$item['created'];
 
index 280dbe72c2a2afe151b5c5d47dd8e11a561fc182..a5932e158b69b93cc58b4eae2624b4fdc5c0b57a 100644 (file)
@@ -90,9 +90,9 @@ class PortableContact
 
                logger('load: returns ' . $s, LOGGER_DATA);
 
-               logger('load: return code: ' . $a->get_curl_code(), LOGGER_DEBUG);
+               logger('load: return code: ' . Network::getCurl()->getCode(), LOGGER_DEBUG);
 
-               if (($a->get_curl_code() > 299) || (! $s)) {
+               if ((Network::getCurl()->getCode() > 299) || (! $s)) {
                        return;
                }
 
index f30488ce140eeef304b7dd99eb8258707c11c014..b71be6e2fa55b590fa936e0ac782cb1aae6495a5 100644 (file)
@@ -139,7 +139,7 @@ class Salmon
                ]);
 
                $a = get_app();
-               $return_code = $a->get_curl_code();
+               $return_code = Network::getCurl()->getCode();
 
                // check for success, e.g. 2xx
 
@@ -163,7 +163,7 @@ class Salmon
                                'Content-type: application/magic-envelope+xml',
                                'Content-length: ' . strlen($salmon)
                        ]);
-                       $return_code = $a->get_curl_code();
+                       $return_code = Network::getCurl()->getCode();
                }
 
                if ($return_code > 299) {
@@ -185,7 +185,7 @@ class Salmon
                        Network::post($url, $salmon, [
                                'Content-type: application/magic-envelope+xml',
                                'Content-length: ' . strlen($salmon)]);
-                       $return_code = $a->get_curl_code();
+                       $return_code = Network::getCurl()->getCode();
                }
 
                logger('slapper for '.$url.' returned ' . $return_code);
@@ -194,7 +194,7 @@ class Salmon
                        return -1;
                }
 
-               if (($return_code == 503) && (stristr($a->get_curl_headers(), 'retry-after'))) {
+               if (($return_code == 503) && (stristr(Network::getCurl()->getHeaders(), 'retry-after'))) {
                        return -1;
                }
 
index f4c6a8ed27623372428db861cf8a35634c3b51c0..2052aa9e87a6f5627948d99d18b6464dcb3af8a9 100644 (file)
@@ -38,8 +38,8 @@ class FriendicaSmarty extends Smarty
                $this->setConfigDir('view/smarty3/config/');
                $this->setCacheDir('view/smarty3/cache/');
 
-               $this->left_delimiter = $a->get_template_ldelim('smarty3');
-               $this->right_delimiter = $a->get_template_rdelim('smarty3');
+               $this->left_delimiter = $a->getTemplateLeftDelimiter('smarty3');
+               $this->right_delimiter = $a->getTemplateRightDelimiter('smarty3');
 
                // Don't report errors so verbosely
                $this->error_reporting = E_ALL & ~E_NOTICE;
index 92f3f56f85eac0abd4574d92dbb337a404e18638..de5d52d895ad7c55d03e7dab547ebba0c6195a98 100644 (file)
@@ -141,7 +141,7 @@ class ExAuth
                $sUser = str_replace(['%20', '(a)'], [' ', '@'], $aCommand[1]);
 
                // Does the hostname match? So we try directly
-               if ($a->get_hostname() == $aCommand[2]) {
+               if ($a->getHostName() == $aCommand[2]) {
                        $this->writeLog(LOG_INFO, 'internal user check for ' . $sUser . '@' . $aCommand[2]);
                        $found = DBA::exists('user', ['nickname' => $sUser]);
                } else {
@@ -221,7 +221,7 @@ class ExAuth
                $sUser = str_replace(['%20', '(a)'], [' ', '@'], $aCommand[1]);
 
                // Does the hostname match? So we try directly
-               if ($a->get_hostname() == $aCommand[2]) {
+               if ($a->getHostName() == $aCommand[2]) {
                        $this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
 
                        $aUser = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
index 234d896078a6b1710df1885348ad25fdece2e610..247e554f00d83868b712d09dae4f7c40c1497d8a 100644 (file)
@@ -303,7 +303,7 @@ class HTTPSignature
                $headers[] = 'Content-Type: application/activity+json';
 
                Network::post($target, $content, $headers);
-               $return_code = BaseObject::getApp()->get_curl_code();
+               $return_code = Network::getCurl()->getCode();
 
                logger('Transmit to ' . $target . ' returned ' . $return_code);
        }
index 0de96618597cae89b0408677329d18c8720729b1..163be21d3a427ae152fdfbc30096ba535ff022b8 100644 (file)
@@ -4,19 +4,34 @@
  */
 namespace Friendica\Util;
 
-use Friendica\App;
 use Friendica\Core\Addon;
-use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Config;
-use Friendica\Network\Probe;
-use Friendica\Object\Image;
-use Friendica\Util\XML;
+use Friendica\Network\Curl;
 use DOMDocument;
 use DomXPath;
 
 class Network
 {
+       /**
+        * @var Curl The latest Curl output
+        */
+       private static $curl;
+
+       /**
+        * Returns the latest Curl output
+        *
+        * @return Curl The latest Curl output
+        */
+       public static function getCurl()
+       {
+               if (empty(self::$curl)) {
+                       self::$curl = new Curl();
+               }
+
+               return self::$curl;
+       }
+
        /**
         * Curl wrapper
         *
@@ -35,7 +50,7 @@ class Network
         *
         * @return string The fetched content
         */
-       public static function fetchUrl($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = 0)
+       public static function fetchUrl($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '')
        {
                $ret = self::fetchUrlFull($url, $binary, $redirects, $timeout, $accept_content, $cookiejar);
 
@@ -59,7 +74,7 @@ class Network
         *
         * @return array With all relevant information, 'body' contains the actual fetched content.
         */
-       public static function fetchUrlFull($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = 0)
+       public static function fetchUrlFull($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '')
        {
                return self::curl(
                        $url,
@@ -145,7 +160,7 @@ class Network
                }
 
                @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-               @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
+               @curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
 
                $range = intval(Config::get('system', 'curl_range_bytes', 0));
 
@@ -203,8 +218,6 @@ class Network
                        @curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
                }
 
-               $a->set_curl_code(0);
-
                // don't let curl abort the entire application
                // if it throws any errors.
 
@@ -242,9 +255,7 @@ class Network
                        $base = substr($base, strlen($chunk));
                }
 
-               $a->set_curl_code($http_code);
-               $a->set_curl_content_type($curl_info['content_type']);
-               $a->set_curl_headers($header);
+               self::$curl = new Curl($http_code, (isset($curl_info['content_type']) ? $curl_info['content_type'] : ''), $header);
 
                if ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
                        $new_location_info = @parse_url($curl_info['redirect_url']);
@@ -277,8 +288,10 @@ class Network
                        }
                }
 
-               $a->set_curl_code($http_code);
-               $a->set_curl_content_type($curl_info['content_type']);
+               self::$curl->setCode($http_code);
+               if (isset($curl_info['content_type'])) {
+                       self::$curl->setContentType($curl_info['content_type']);
+               }
 
                $rc = intval($http_code);
                $ret['return_code'] = $rc;
@@ -301,7 +314,7 @@ class Network
 
                @curl_close($ch);
 
-               $a->save_timestamp($stamp1, 'network');
+               $a->saveTimestamp($stamp1, 'network');
 
                return($ret);
        }
@@ -339,7 +352,7 @@ class Network
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
-               curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
+               curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
 
                if (Config::get('system', 'ipv4_resolve', false)) {
                        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
@@ -384,7 +397,7 @@ class Network
                        }
                }
 
-               $a->set_curl_code(0);
+               self::getCurl()->setCode(0);
 
                // don't let curl abort the entire application
                // if it throws any errors.
@@ -427,15 +440,15 @@ class Network
                        }
                }
 
-               $a->set_curl_code($http_code);
+               self::getCurl()->setCode($http_code);
 
                $body = substr($s, strlen($header));
 
-               $a->set_curl_headers($header);
+               self::getCurl()->setHeaders($header);
 
                curl_close($ch);
 
-               $a->save_timestamp($stamp1, 'network');
+               $a->saveTimestamp($stamp1, 'network');
 
                logger('post_url: end ' . $url, LOGGER_DATA);
 
@@ -729,14 +742,14 @@ class Network
                curl_setopt($ch, CURLOPT_NOBODY, 1);
                curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-               curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
+               curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
 
                curl_exec($ch);
                $curl_info = @curl_getinfo($ch);
                $http_code = $curl_info['http_code'];
                curl_close($ch);
 
-               $a->save_timestamp($stamp1, "network");
+               $a->saveTimestamp($stamp1, "network");
 
                if ($http_code == 0) {
                        return $url;
@@ -773,12 +786,12 @@ class Network
                curl_setopt($ch, CURLOPT_NOBODY, 0);
                curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-               curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
+               curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
 
                $body = curl_exec($ch);
                curl_close($ch);
 
-               $a->save_timestamp($stamp1, "network");
+               $a->saveTimestamp($stamp1, "network");
 
                if (trim($body) == "") {
                        return $url;
index 3473e8d167ddf9b578d8390f02d5b4d3fe7af83a..0bb7537f78bda42a52edb9535d43a4eea453ab7a 100644 (file)
@@ -91,7 +91,7 @@ class Proxy
                $url = html_entity_decode($url, ENT_NOQUOTES, 'utf-8');
 
                // Creating a sub directory to reduce the amount of files in the cache directory
-               $basepath = $a->get_basepath() . '/proxy';
+               $basepath = $a->getBasePath() . '/proxy';
 
                $shortpath = hash('md5', $url);
                $longpath = substr($shortpath, 0, 2);
index 61077ae734f2d69a20498f905a7f6c466b61ed2c..b6dd896cd77e9770c54354e62a92caeaee8f6ddc 100644 (file)
@@ -115,7 +115,7 @@ class Cron
 
                // Ensure to have a .htaccess file.
                // this is a precaution for systems that update automatically
-               $basepath = $a->get_basepath();
+               $basepath = $a->getBasePath();
                if (!file_exists($basepath . '/.htaccess')) {
                        copy($basepath . '/.htaccess-dist', $basepath . '/.htaccess');
                }
index 098bce4d96a0407a19be9bdbb3a2b20323fef4ea..bd34449729392f575ad53169dc1750cb590ce5ad 100644 (file)
@@ -157,14 +157,14 @@ class CronJobs
                clear_cache();
 
                // clear cache for photos
-               clear_cache($a->get_basepath(), $a->get_basepath() . "/photo");
+               clear_cache($a->getBasePath(), $a->getBasePath() . "/photo");
 
                // clear smarty cache
-               clear_cache($a->get_basepath() . "/view/smarty3/compiled", $a->get_basepath() . "/view/smarty3/compiled");
+               clear_cache($a->getBasePath() . "/view/smarty3/compiled", $a->getBasePath() . "/view/smarty3/compiled");
 
                // clear cache for image proxy
                if (!Config::get("system", "proxy_disabled")) {
-                       clear_cache($a->get_basepath(), $a->get_basepath() . "/proxy");
+                       clear_cache($a->getBasePath(), $a->getBasePath() . "/proxy");
 
                        $cachetime = Config::get('system', 'proxy_cache_time');
 
index 3585b39989d0cefbef1e0c1b6617db5fc2278350..f2951cce1ff2bf13deb7aec6e112f16bfcb655f8 100644 (file)
@@ -112,7 +112,7 @@ class Delivery extends BaseObject
                        // if $parent['wall'] == 1 we will already have the parent message in our array
                        // and we will relay the whole lot.
 
-                       $localhost = self::getApp()->get_hostname();
+                       $localhost = self::getApp()->getHostName();
                        if (strpos($localhost, ':')) {
                                $localhost = substr($localhost, 0, strpos($localhost, ':'));
                        }
@@ -435,7 +435,7 @@ class Delivery extends BaseObject
                                $headers  = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8').' <' . $local_user['email'] . '>' . "\n";
                        }
                } else {
-                       $headers  = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' <noreply@' . self::getApp()->get_hostname() . '>' . "\n";
+                       $headers  = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' <noreply@' . self::getApp()->getHostName() . '>' . "\n";
                }
 
                $headers .= 'Message-Id: <' . Email::iri2msgid($target_item['uri']) . '>' . "\n";
index 6bfd2bc3b3f9aabe8368c22f5e5a04feba564306..ad33c3245d4be9d33e1381cb9d1cb00b40851842 100644 (file)
@@ -194,7 +194,7 @@ class Notifier
                        // if $parent['wall'] == 1 we will already have the parent message in our array
                        // and we will relay the whole lot.
 
-                       $localhost = str_replace('www.','',$a->get_hostname());
+                       $localhost = str_replace('www.','',$a->getHostName());
                        if (strpos($localhost,':')) {
                                $localhost = substr($localhost,0,strpos($localhost,':'));
                        }
index 01b63e98e03a494478dca3fb00995562c49aa642..21e3b44b3e7345ba98c79361c8f5e92902c6d567 100644 (file)
@@ -196,7 +196,7 @@ class OnePoll
 
                        $handshake_xml = $ret['body'];
 
-                       $html_code = $a->get_curl_code();
+                       $html_code = Network::getCurl()->getCode();
 
                        logger('handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA);
 
@@ -507,7 +507,7 @@ class OnePoll
                                                                }
                                                        }
 
-                                                       $fromarr = imap_rfc822_parse_adrlist($fromdecoded, $a->get_hostname());
+                                                       $fromarr = imap_rfc822_parse_adrlist($fromdecoded, $a->getHostName());
 
                                                        $frommail = $fromarr[0]->mailbox."@".$fromarr[0]->host;
 
index 1e18b4ccfa097b81aedcfb364e60754bc18a545d..07023e824793a1c8332d35fb4cd3ff3b4db855d0 100644 (file)
@@ -57,7 +57,7 @@ class PubSubPublish
                logger('POST ' . print_r($headers, true) . "\n" . $params, LOGGER_DATA);
 
                Network::post($subscriber['callback_url'], $params, $headers);
-               $ret = $a->get_curl_code();
+               $ret = Network::getCurl()->getCode();
 
                $condition = ['id' => $subscriber['id']];
 
index cbc6f7e0b4412a0e196e78259bd2c2d56cb5d8a8..11c61f9fbb40a46990838ddbd6534d58ad4e1b6b 100644 (file)
@@ -75,9 +75,8 @@ class ApiTest extends DatabaseTest
        {
                parent::tearDown();
 
-               $app = get_app();
-               $app->argc = 1;
-               $app->argv = ['home'];
+               $this->app->argc = 1;
+               $this->app->argv = ['home'];
        }
 
        /**
index 52ca3f68d37f098df050af42e878e6be6f563881..acd0b7ac184d1adbe8a563f1754869103961754c 100644 (file)
@@ -5,6 +5,7 @@
 
 namespace Friendica\Test;
 
+use Friendica\App;
 use Friendica\BaseObject;
 use Friendica\Core\Config;
 use Friendica\Database\DBA;
@@ -18,7 +19,14 @@ use PHPUnit_Extensions_Database_DB_IDatabaseConnection;
  */
 abstract class DatabaseTest extends TestCase
 {
-       public function setUp()
+       use TestCaseTrait;
+
+       /**
+        * @var App The Friendica App
+        */
+       protected $app;
+
+       protected function setUp()
        {
                // Reusable App object
                $this->app = BaseObject::getApp();
index 0f3f6192b232baddca9f797529e32e5384c31364..b6889a65134956f40c52fe8f8e869067bb73ee63 100644 (file)
@@ -11,7 +11,7 @@ abstract class MemoryCacheTest extends CacheTest
         */
        protected $instance;
 
-       function setUp()
+       protected function setUp()
        {
                parent::setUp();
                if (!($this->instance instanceof IMemoryCacheDriver)) {
index 02882ca943ca91afe73c03c96a77e0f6d3e916e5..588a6fa463468281fd4e51777c5f0be722e64335 100644 (file)
@@ -6,7 +6,7 @@ use Friendica\Core\PConfig;
 
 function duepuntozero_init(App $a) {
 
-$a->set_template_engine('smarty3');
+$a->setActiveTemplateEngine('smarty3');
 
     $colorset = PConfig::get( local_user(), 'duepuntozero','colorset');
     if (!$colorset)
index d9ecb7cf0dac0341eebfda149940e38c946f3808..aa86c9723880c8b383c26e2d5ebd091105c65b6b 100644 (file)
@@ -26,7 +26,7 @@ if (!isset($minimal)) {
                <script  type="text/javascript">var baseurl = "<?php echo System::baseUrl(); ?>";</script>
                <script type="text/javascript">var frio = "<?php echo 'view/theme/frio'; ?>";</script>
 <?php
-               $basepath = $a->urlpath ? "/" . $a->urlpath . "/" : "/";
+               $basepath = $a->getURLPath() ? "/" . $a->getURLPath() . "/" : "/";
                $frio = "view/theme/frio";
 
                // Because we use minimal for modals the header and the included js stuff should be only loaded
index 72e5ab0b6140b693464ec8d8170e19281d008bdd..18fb98cc9d158b1f9700c69946770208d447db4f 100644 (file)
@@ -28,7 +28,7 @@ function frio_init(App $a)
        $a->theme_events_in_profile = false;
        $a->videowidth = 622;
 
-       $a->set_template_engine('smarty3');
+       $a->setActiveTemplateEngine('smarty3');
 
        $baseurl = System::baseUrl();
 
@@ -241,7 +241,7 @@ function frio_remote_nav($a, &$nav)
                // user info
                $r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self`", intval($a->user['uid']));
 
-               $r[0]['photo'] = (DBA::isResult($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg');
+               $r[0]['photo'] = (DBA::isResult($r) ? $a->removeBaseURL($r[0]['micro']) : 'images/person-48.jpg');
                $r[0]['name'] = $a->user['username'];
        } elseif (!local_user() && remote_user()) {
                $r = q("SELECT `name`, `nick`, `micro` AS `photo` FROM `contact` WHERE `id` = %d", intval(remote_user()));
index 555b65eed31c5c0509d9c256167f78b0c7d525a5..e961146f6a941dd0d7aac1760a01706130641a54 100644 (file)
@@ -14,7 +14,7 @@ use Friendica\App;
 use Friendica\Core\System;
 
 function smoothly_init(App $a) {
-       $a->set_template_engine('smarty3');
+       $a->setActiveTemplateEngine('smarty3');
 
        $cssFile = null;
        $ssl_state = null;
index 2533e50a8916630b75c49f2ab2b6fc8954b0d604..887ef1c1298a32e2e5840870ef56a8d4f4e5ecbe 100644 (file)
@@ -25,7 +25,7 @@ function vier_init(App $a)
 {
        $a->theme_events_in_profile = false;
 
-       $a->set_template_engine('smarty3');
+       $a->setActiveTemplateEngine('smarty3');
 
        if (!empty($a->argv[0]) && $a->argv[0] . defaults($a->argv, 1, '') === "profile".$a->user['nickname'] || $a->argv[0] === "network" && local_user()) {
                vier_community_info();
@@ -184,7 +184,7 @@ function vier_community_info()
                                $entry = replace_macros($tpl, [
                                        '$id' => $rr['id'],
                                        '$profile_link' => $profile_link,
-                                       '$photo' => $a->remove_baseurl($rr['thumb']),
+                                       '$photo' => $a->removeBaseURL($rr['thumb']),
                                        '$alt_text' => $rr['name']]);
                                $aside['$lastusers_items'][] = $entry;
                        }