]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'develop' into improvement/move-app-to-src-2
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 7 May 2017 16:58:11 +0000 (12:58 -0400)
committerGitHub <noreply@github.com>
Sun, 7 May 2017 16:58:11 +0000 (12:58 -0400)
319 files changed:
boot.php
composer.lock
doc/Composer.md
doc/Developer-How-To-Move-Classes-to-src.md [new file with mode: 0644]
doc/Developers-Intro.md
doc/Home.md
doc/autoloader.md
include/Contact.php
include/Emailer.php
include/ForumManager.php
include/NotificationsManager.php
include/Photo.php
include/Probe.php
include/Smilies.php
include/acl_selectors.php
include/api.php
include/auth.php
include/auth_ejabberd.php
include/bb2diaspora.php
include/bbcode.php
include/cache.php
include/cli_startup.php
include/config.php
include/contact_widgets.php
include/conversation.php
include/create_shadowentry.php
include/cron.php
include/cronhooks.php
include/cronjobs.php
include/datetime.php
include/dbclean.php
include/dbm.php
include/dbstructure.php
include/dbupdate.php
include/delivery.php
include/dfrn.php
include/diaspora.php
include/directory.php
include/discover_poco.php
include/enotify.php
include/event.php
include/expire.php
include/feed.php
include/files.php
include/follow.php
include/gprobe.php
include/html2bbcode.php
include/html2plain.php
include/identity.php
include/items.php
include/like.php
include/message.php
include/msgclean.php
include/nav.php
include/network.php
include/notifier.php
include/oauth.php
include/oembed.php
include/onepoll.php
include/ostatus.php
include/pgettext.php
include/photos.php
include/pidfile.php
include/plaintext.php
include/plugin.php
include/poller.php
include/post_update.php
include/pubsubpublish.php
include/queue.php
include/quoteconvert.php
include/redir.php
include/remove_contact.php
include/security.php
include/shadowupdate.php
include/socgraph.php
include/spool_post.php
include/tags.php
include/text.php
include/threads.php
include/uimport.php
include/update_gcontact.php
index.php
mod/_well_known.php
mod/acctlink.php
mod/acl.php
mod/admin.php
mod/allfriends.php
mod/amcd.php
mod/api.php
mod/apps.php
mod/attach.php
mod/babel.php
mod/bookmarklet.php
mod/cal.php
mod/cb.php
mod/common.php
mod/community.php
mod/contactgroup.php
mod/contacts.php
mod/content.php
mod/credits.php
mod/crepair.php
mod/delegate.php
mod/dfrn_confirm.php
mod/dfrn_notify.php
mod/dfrn_poll.php
mod/dfrn_request.php
mod/directory.php
mod/dirfind.php
mod/display.php
mod/editpost.php
mod/events.php
mod/fbrowser.php
mod/fetch.php
mod/filer.php
mod/filerm.php
mod/follow.php
mod/friendica.php
mod/fsuggest.php
mod/group.php
mod/hcard.php
mod/help.php
mod/home.php
mod/hostxrd.php
mod/hovercard.php
mod/ignored.php
mod/install.php
mod/invite.php
mod/item.php
mod/like.php
mod/localtime.php
mod/lockview.php
mod/login.php
mod/lostpass.php
mod/maintenance.php
mod/manage.php
mod/manifest.php
mod/match.php
mod/message.php
mod/modexp.php
mod/mood.php
mod/msearch.php
mod/navigation.php
mod/network.php
mod/newmember.php
mod/nodeinfo.php
mod/nogroup.php
mod/noscrape.php
mod/notes.php
mod/notice.php
mod/notifications.php
mod/notify.php
mod/oembed.php
mod/oexchange.php
mod/openid.php
mod/opensearch.php
mod/ostatus_subscribe.php
mod/p.php
mod/parse_url.php
mod/photo.php
mod/photos.php
mod/ping.php
mod/poco.php
mod/poke.php
mod/post.php
mod/pretheme.php
mod/probe.php
mod/profile.php
mod/profile_photo.php
mod/profiles.php
mod/profperm.php
mod/proxy.php
mod/pubsub.php
mod/pubsubhubbub.php
mod/qsearch.php
mod/randprof.php
mod/receive.php
mod/redir.php
mod/register.php
mod/regmod.php
mod/removeme.php
mod/repair_ostatus.php
mod/robots_txt.php
mod/rsd_xml.php
mod/salmon.php
mod/search.php
mod/session.php
mod/settings.php
mod/share.php
mod/smilies.php
mod/starred.php
mod/statistics_json.php
mod/subthread.php
mod/suggest.php
mod/tagger.php
mod/tagrm.php
mod/toggle_mobile.php
mod/uexport.php
mod/uimport.php
mod/update_community.php
mod/update_display.php
mod/update_network.php
mod/update_notes.php
mod/update_profile.php
mod/videos.php
mod/viewcontacts.php
mod/viewsrc.php
mod/wall_attach.php
mod/wall_upload.php
mod/wallmessage.php
mod/webfinger.php
mod/worker.php
mod/xrd.php
object/BaseObject.php
object/Conversation.php
object/Item.php
src/App.php [new file with mode: 0644]
src/ParseUrl.php
tests/xss_filter_test.php
util/createdoxygen.php
util/daemon.php
util/db_update.php
util/maintenance.php
util/php2po.php
util/typo.php [changed mode: 0644->0755]
vendor/composer/autoload_classmap.php
vendor/composer/autoload_static.php
vendor/composer/include_paths.php
vendor/composer/installed.json
vendor/pear-pear.php.net/PEAR/OS/Guess.php
vendor/pear-pear.php.net/PEAR/PEAR.php
vendor/pear-pear.php.net/PEAR/PEAR/Builder.php
vendor/pear-pear.php.net/PEAR/PEAR/ChannelFile.php
vendor/pear-pear.php.net/PEAR/PEAR/ChannelFile/Parser.php
vendor/pear-pear.php.net/PEAR/PEAR/Command.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Auth.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Build.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Channels.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Common.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Config.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Install.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Mirror.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Package.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Pickle.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Registry.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Remote.php
vendor/pear-pear.php.net/PEAR/PEAR/Command/Test.php
vendor/pear-pear.php.net/PEAR/PEAR/Common.php
vendor/pear-pear.php.net/PEAR/PEAR/Config.php
vendor/pear-pear.php.net/PEAR/PEAR/Dependency2.php
vendor/pear-pear.php.net/PEAR/PEAR/DependencyDB.php
vendor/pear-pear.php.net/PEAR/PEAR/Downloader.php
vendor/pear-pear.php.net/PEAR/PEAR/Downloader/Package.php
vendor/pear-pear.php.net/PEAR/PEAR/ErrorStack.php
vendor/pear-pear.php.net/PEAR/PEAR/Exception.php
vendor/pear-pear.php.net/PEAR/PEAR/Frontend.php
vendor/pear-pear.php.net/PEAR/PEAR/Frontend/CLI.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Cfg.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Common.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Data.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Doc.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Ext.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Man.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Php.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Script.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Src.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Test.php
vendor/pear-pear.php.net/PEAR/PEAR/Installer/Role/Www.php
vendor/pear-pear.php.net/PEAR/PEAR/PackageFile.php
vendor/pear-pear.php.net/PEAR/PEAR/PackageFile/Generator/v1.php
vendor/pear-pear.php.net/PEAR/PEAR/PackageFile/Generator/v2.php
vendor/pear-pear.php.net/PEAR/PEAR/PackageFile/v1.php
vendor/pear-pear.php.net/PEAR/PEAR/PackageFile/v2.php
vendor/pear-pear.php.net/PEAR/PEAR/PackageFile/v2/Validator.php
vendor/pear-pear.php.net/PEAR/PEAR/PackageFile/v2/rw.php
vendor/pear-pear.php.net/PEAR/PEAR/Packager.php
vendor/pear-pear.php.net/PEAR/PEAR/REST.php
vendor/pear-pear.php.net/PEAR/PEAR/REST/10.php
vendor/pear-pear.php.net/PEAR/PEAR/REST/11.php
vendor/pear-pear.php.net/PEAR/PEAR/REST/13.php
vendor/pear-pear.php.net/PEAR/PEAR/Registry.php
vendor/pear-pear.php.net/PEAR/PEAR/RunTest.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Common.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Postinstallscript.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Postinstallscript/rw.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Replace.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Replace/rw.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Unixeol.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Unixeol/rw.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Windowseol.php
vendor/pear-pear.php.net/PEAR/PEAR/Task/Windowseol/rw.php
vendor/pear-pear.php.net/PEAR/PEAR/Validate.php
vendor/pear-pear.php.net/PEAR/PEAR/Validator/PECL.php
vendor/pear-pear.php.net/PEAR/PEAR/XMLParser.php
vendor/pear-pear.php.net/PEAR/System.php
vendor/pear-pear.php.net/PEAR/pearcmd.php
view/php/default.php
view/php/minimal.php
view/theme/duepuntozero/config.php
view/theme/duepuntozero/style.php
view/theme/duepuntozero/theme.php
view/theme/frio/config.php
view/theme/frio/css/style.css
view/theme/frio/php/default.php
view/theme/frio/php/frio_boot.php
view/theme/frio/php/standard.php
view/theme/frio/theme.php
view/theme/frost-mobile/php/default.php
view/theme/frost-mobile/theme.php
view/theme/frost/php/default.php
view/theme/frost/theme.php
view/theme/quattro/config.php
view/theme/quattro/theme.php
view/theme/smoothly/php/default.php
view/theme/smoothly/theme.php
view/theme/vier/config.php
view/theme/vier/theme.php

index 45029fecd2eaf174bf877cd5ffcd19b7f3cd5f13..5815b8db1d12b23a8eefb9c8fca455cfbb5d9935 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1,4 +1,5 @@
 <?php
+
 /** @file boot.php
  *
  * This file defines some global constants and includes the central App class.
  * easily as email does today.
  */
 
-require_once(__DIR__ . DIRECTORY_SEPARATOR. 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
+require_once(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
-require_once('include/config.php');
-require_once('include/network.php');
-require_once('include/plugin.php');
-require_once('include/text.php');
-require_once('include/datetime.php');
-require_once('include/pgettext.php');
-require_once('include/nav.php');
-require_once('include/cache.php');
-require_once('include/features.php');
-require_once('include/identity.php');
-require_once('update.php');
-require_once('include/dbstructure.php');
+require_once 'include/config.php';
+require_once 'include/network.php';
+require_once 'include/plugin.php';
+require_once 'include/text.php';
+require_once 'include/datetime.php';
+require_once 'include/pgettext.php';
+require_once 'include/nav.php';
+require_once 'include/cache.php';
+require_once 'include/features.php';
+require_once 'include/identity.php';
+require_once 'update.php';
+require_once 'include/dbstructure.php';
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Asparagus');
@@ -50,7 +52,6 @@ define ( 'DB_UPDATE_VERSION',      1224      );
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
 
-
 /**
  * @brief Image storage quality.
  *
@@ -61,8 +62,8 @@ define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
  * below about 50
  *
  */
-
 define ( 'JPEG_QUALITY',            100  );
+
 /**
  * $a->config['system']['png_quality'] from 0 (uncompressed) to 9
  */
@@ -86,12 +87,10 @@ define ( 'PNG_QUALITY',             8  );
  */
 define ( 'MAX_IMAGE_LENGTH',        -1  );
 
-
 /**
  * Not yet used
  */
-
-define ( 'DEFAULT_DB_ENGINE',  'MyISAM'  );
+define ( 'DEFAULT_DB_ENGINE',  'InnoDB' );
 
 /**
  * @name SSL Policy
@@ -165,7 +164,6 @@ define ( 'UPDATE_SUCCESS', 0);
 define ( 'UPDATE_FAILED',  1);
 /** @}*/
 
-
 /**
  * @name page/profile types
  *
@@ -291,20 +289,16 @@ $netgroup_ids = array(
        NETWORK_PHANTOM  => (-127),
 );
 
-
 /**
  * Maximum number of "people who like (or don't like) this"  that we will list by name
  */
-
 define ( 'MAX_LIKERS',    75);
 
 /**
  * Communication timeout
  */
-
 define ( 'ZCURL_TIMEOUT' , (-1));
 
-
 /**
  * @name Notify
  *
@@ -345,8 +339,6 @@ define ( 'TERM_CONVERSATION', 7 );
 define ( 'TERM_OBJ_POST',  1 );
 define ( 'TERM_OBJ_PHOTO', 2 );
 
-
-
 /**
  * @name Namespaces
  *
@@ -458,14 +450,13 @@ define('SR_SCOPE_TAGS', 'tags');
 /**
  * Lowest possible date time value
  */
-
 define ('NULL_DATE', '0001-01-01 00:00:00');
 
-
 // Normally this constant is defined - but not if "pcntl" isn't installed
 if (!defined("SIGTERM")) {
        define("SIGTERM", 15);
 }
+
 /**
  *
  * Reverse the effect of magic_quotes_gpc if it is enabled.
@@ -473,9 +464,7 @@ if (!defined("SIGTERM")) {
  * See http://php.net/manual/en/security.magicquotes.disabling.php
  *
  */
-
 function startup() {
-
        error_reporting(E_ERROR | E_WARNING | E_PARSE);
 
        set_time_limit(0);
@@ -483,7 +472,6 @@ function startup() {
        // This has to be quite large to deal with embedded private photos
        ini_set('pcre.backtrack_limit', 500000);
 
-
        if (get_magic_quotes_gpc()) {
                $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
                while (list($key, $val) = each($process)) {
@@ -499,989 +487,6 @@ function startup() {
                }
                unset($process);
        }
-
-}
-
-/**
- *
- * class: App
- *
- * @brief Our main application structure for the life of this page.
- *
- * Primarily deals with the URL that got us here
- * and tries to make some sense of it, and
- * stores our page contents and config storage
- * and anything else that might need to be passed around
- * before we spit the page out.
- *
- */
-class App {
-
-       /// @TODO decide indending as a colorful mixure is ahead ...
-       public  $module_loaded = false;
-       public  $query_string;
-       public  $config;
-       public  $page;
-       public  $profile;
-       public  $profile_uid;
-       public  $user;
-       public  $cid;
-       public  $contact;
-       public  $contacts;
-       public  $page_contact;
-       public  $content;
-       public  $data = array();
-       public  $error = false;
-       public  $cmd;
-       public  $argv;
-       public  $argc;
-       public  $module;
-       public  $pager;
-       public  $strings;
-       public  $path;
-       public  $hooks;
-       public  $timezone;
-       public  $interactive = true;
-       public  $plugins;
-       public  $apps = array();
-       public  $identities;
-       public  $is_mobile = false;
-       public  $is_tablet = false;
-       public  $is_friendica_app;
-       public  $performance = array();
-       public  $callstack = array();
-       public  $theme_info = array();
-       public  $backend = true;
-
-       public $nav_sel;
-
-       public $category;
-
-
-       // Allow themes to control internal parameters
-       // by changing App values in theme.php
-
-       public  $sourcename = '';
-       public  $videowidth = 425;
-       public  $videoheight = 350;
-       public  $force_max_items = 0;
-       public  $theme_thread_allow = true;
-       public  $theme_events_in_profile = true;
-
-       /**
-        * @brief An array for all theme-controllable parameters
-        *
-        * Mostly unimplemented yet. Only options 'template_engine' and
-        * beyond are used.
-        */
-       public  $theme = array(
-               'sourcename'      => '',
-               'videowidth'      => 425,
-               'videoheight'     => 350,
-               'force_max_items' => 0,
-               'thread_allow'    => true,
-               'stylesheet'      => '',
-               'template_engine' => 'smarty3',
-       );
-
-       /**
-        * @brief An array of registered template engines ('name'=>'class name')
-        */
-       public $template_engines = array();
-       /**
-        * @brief An array of instanced template engines ('name'=>'instance')
-        */
-       public $template_engine_instance = array();
-
-       public $process_id;
-
-       private $ldelim = array(
-               'internal' => '',
-               'smarty3' => '{{'
-       );
-       private $rdelim = array(
-               'internal' => '',
-               'smarty3' => '}}'
-       );
-
-       private $scheme;
-       private $hostname;
-       private $db;
-
-       private $curl_code;
-       private $curl_content_type;
-       private $curl_headers;
-
-       private $cached_profile_image;
-       private $cached_profile_picdate;
-
-       private static $a;
-
-       /**
-        * @brief App constructor.
-        */
-       function __construct() {
-
-               global $default_timezone;
-
-               $hostname = "";
-
-               if (file_exists(".htpreconfig.php")) {
-                       include ".htpreconfig.php";
-               }
-
-               $this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
-
-               date_default_timezone_set($this->timezone);
-
-               $this->performance["start"] = microtime(true);
-               $this->performance["database"] = 0;
-               $this->performance["database_write"] = 0;
-               $this->performance["network"] = 0;
-               $this->performance["file"] = 0;
-               $this->performance["rendering"] = 0;
-               $this->performance["parser"] = 0;
-               $this->performance["marktime"] = 0;
-               $this->performance["markstart"] = microtime(true);
-
-               $this->callstack["database"] = array();
-               $this->callstack["database_write"] = array();
-               $this->callstack["network"] = array();
-               $this->callstack["file"] = array();
-               $this->callstack["rendering"] = array();
-               $this->callstack["parser"] = array();
-
-               $this->config = array();
-               $this->page = array();
-               $this->pager= array();
-
-               $this->query_string = '';
-
-               $this->process_id = uniqid("log", true);
-
-               startup();
-
-               set_include_path(
-                               get_include_path() . PATH_SEPARATOR
-                               . 'include' . PATH_SEPARATOR
-                               . 'library' . PATH_SEPARATOR
-                               . 'library/langdet' . PATH_SEPARATOR
-                               . '.' );
-
-               $this->scheme = 'http';
-
-               if ((x($_SERVER, 'HTTPS') && $_SERVER['HTTPS']) ||
-                               (x($_SERVER, 'HTTP_FORWARDED') && preg_match("/proto=https/", $_SERVER['HTTP_FORWARDED'])) ||
-                               (x($_SERVER, 'HTTP_X_FORWARDED_PROTO') && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ||
-                               (x($_SERVER, 'HTTP_X_FORWARDED_SSL') && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ||
-                               (x($_SERVER, 'FRONT_END_HTTPS') && $_SERVER['FRONT_END_HTTPS'] == 'on') ||
-                               (x($_SERVER, 'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) // XXX: reasonable assumption, but isn't this hardcoding too much?
-                               ) {
-                       $this->scheme = 'https';
-               }
-
-               if (x($_SERVER, 'SERVER_NAME')) {
-                       $this->hostname = $_SERVER['SERVER_NAME'];
-
-                       if (x($_SERVER, 'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
-                               $this->hostname .= ':' . $_SERVER['SERVER_PORT'];
-                       }
-                       /*
-                        * Figure out if we are running at the top of a domain
-                        * or in a sub-directory and adjust accordingly
-                        */
-
-                       /// @TODO This kind of escaping breaks syntax-highlightning on CoolEdit (Midnight Commander)
-                       $path = trim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
-                       if (isset($path) && strlen($path) && ($path != $this->path)) {
-                               $this->path = $path;
-                       }
-               }
-
-               if ($hostname != "") {
-                       $this->hostname = $hostname;
-               }
-
-               if (is_array($_SERVER["argv"]) && $_SERVER["argc"] > 1 && substr(end($_SERVER["argv"]), 0, 4) == "http" ) {
-                       $this->set_baseurl(array_pop($_SERVER["argv"]));
-                       $_SERVER["argc"] --;
-               }
-
-               if ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 9) === "pagename=") {
-                       $this->query_string = substr($_SERVER['QUERY_STRING'], 9);
-
-                       // removing trailing / - maybe a nginx problem
-                       $this->query_string = ltrim($this->query_string, '/');
-               } elseif ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === "q=") {
-                       $this->query_string = substr($_SERVER['QUERY_STRING'], 2);
-
-                       // removing trailing / - maybe a nginx problem
-                       $this->query_string = ltrim($this->query_string, '/');
-               }
-
-               if (x($_GET, 'pagename')) {
-                       $this->cmd = trim($_GET['pagename'], '/\\');
-               } elseif (x($_GET, 'q')) {
-                       $this->cmd = trim($_GET['q'], '/\\');
-               }
-
-
-               // fix query_string
-               $this->query_string = str_replace($this->cmd . "&", $this->cmd . "?", $this->query_string);
-
-               // unix style "homedir"
-               if (substr($this->cmd, 0, 1) === '~') {
-                       $this->cmd = 'profile/' . substr($this->cmd, 1);
-               }
-
-               // Diaspora style profile url
-               if (substr($this->cmd, 0, 2) === 'u/') {
-                       $this->cmd = 'profile/' . substr($this->cmd, 2);
-               }
-
-
-               /*
-                * Break the URL path into C style argc/argv style arguments for our
-                * modules. Given "http://example.com/module/arg1/arg2", $this->argc
-                * will be 3 (integer) and $this->argv will contain:
-                *   [0] => 'module'
-                *   [1] => 'arg1'
-                *   [2] => 'arg2'
-                *
-                *
-                * There will always be one argument. If provided a naked domain
-                * URL, $this->argv[0] is set to "home".
-                */
-
-               $this->argv = explode('/', $this->cmd);
-               $this->argc = count($this->argv);
-               if ((array_key_exists('0', $this->argv)) && strlen($this->argv[0])) {
-                       $this->module = str_replace(".", "_", $this->argv[0]);
-                       $this->module = str_replace("-", "_", $this->module);
-               } else {
-                       $this->argc = 1;
-                       $this->argv = array('home');
-                       $this->module = 'home';
-               }
-
-               /*
-                * See if there is any page number information, and initialise
-                * pagination
-                */
-
-               $this->pager['page'] = ((x($_GET, 'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1);
-               $this->pager['itemspage'] = 50;
-               $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
-
-               if ($this->pager['start'] < 0) {
-                       $this->pager['start'] = 0;
-               }
-               $this->pager['total'] = 0;
-
-               /*
-                * Detect mobile devices
-                */
-
-               $mobile_detect = new Mobile_Detect();
-               $this->is_mobile = $mobile_detect->isMobile();
-               $this->is_tablet = $mobile_detect->isTablet();
-
-               // Friendica-Client
-               $this->is_friendica_app = ($_SERVER['HTTP_USER_AGENT'] == "Apache-HttpClient/UNAVAILABLE (java 1.4)");
-
-               /*
-                * register template engines
-                */
-               $dc = get_declared_classes();
-               foreach ($dc as $k) {
-                       if (in_array("ITemplateEngine", class_implements($k))){
-                               $this->register_template_engine($k);
-                       }
-               }
-
-               self::$a = $this;
-
-       }
-
-       public static function get_basepath() {
-
-               $basepath = get_config("system", "basepath");
-
-               if ($basepath == "") {
-                       $basepath = dirname(__FILE__);
-               }
-
-               if ($basepath == "") {
-                       $basepath = $_SERVER["DOCUMENT_ROOT"];
-               }
-
-               if ($basepath == "") {
-                       $basepath = $_SERVER["PWD"];
-               }
-
-               return $basepath;
-       }
-
-       function get_scheme() {
-               return $this->scheme;
-       }
-
-       /**
-        * @brief Retrieves the Friendica instance base URL
-        *
-        * This function assembles the base URL from multiple parts:
-        * - Protocol is determined either by the request or a combination of
-        * system.ssl_policy and the $ssl parameter.
-        * - Host name is determined either by system.hostname or inferred from request
-        * - Path is inferred from SCRIPT_NAME
-        *
-        * Note: $ssl parameter value doesn't directly correlate with the resulting protocol
-        *
-        * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN
-        * @return string Friendica server base URL
-        */
-       function get_baseurl($ssl = false) {
-
-               // Is the function called statically?
-               if (!(isset($this) && get_class($this) == __CLASS__)) {
-                       return self::$a->get_baseurl($ssl);
-               }
-
-               $scheme = $this->scheme;
-
-               if (Config::get('system', 'ssl_policy') == SSL_POLICY_FULL) {
-                       $scheme = 'https';
-               }
-
-               //      Basically, we have $ssl = true on any links which can only be seen by a logged in user
-               //      (and also the login link). Anything seen by an outsider will have it turned off.
-
-               if (Config::get('system', 'ssl_policy') == SSL_POLICY_SELFSIGN) {
-                       if ($ssl) {
-                               $scheme = 'https';
-                       } else {
-                               $scheme = 'http';
-                       }
-               }
-
-               if (Config::get('config', 'hostname') != '') {
-                       $this->hostname = Config::get('config', 'hostname');
-               }
-
-               return $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
-       }
-
-       /**
-        * @brief Initializes the baseurl components
-        *
-        * Clears the baseurl cache to prevent inconstistencies
-        *
-        * @param string $url
-        */
-       function set_baseurl($url) {
-               $parsed = @parse_url($url);
-
-               if ($parsed) {
-                       $this->scheme = $parsed['scheme'];
-
-                       $hostname = $parsed['host'];
-                       if (x($parsed, 'port')) {
-                               $hostname .= ':' . $parsed['port'];
-                       }
-                       if (x($parsed, 'path')) {
-                               $this->path = trim($parsed['path'], '\\/');
-                       }
-
-                       if (file_exists(".htpreconfig.php")) {
-                               include ".htpreconfig.php";
-                       }
-
-                       if (get_config('config', 'hostname') != '') {
-                               $this->hostname = get_config('config', 'hostname');
-                       }
-
-                       if (!isset($this->hostname) OR ($this->hostname == '')) {
-                               $this->hostname = $hostname;
-                       }
-               }
-       }
-
-       function get_hostname() {
-               if (get_config('config', 'hostname') != "") {
-                       $this->hostname = get_config('config', 'hostname');
-               }
-
-               return $this->hostname;
-       }
-
-       function set_hostname($h) {
-               $this->hostname = $h;
-       }
-
-       function set_path($p) {
-               $this->path = trim(trim($p), '/');
-       }
-
-       function get_path() {
-               return $this->path;
-       }
-
-       function set_pager_total($n) {
-               $this->pager['total'] = intval($n);
-       }
-
-       function set_pager_itemspage($n) {
-               $this->pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0);
-               $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
-       }
-
-       function set_pager_page($n) {
-               $this->pager['page'] = $n;
-               $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
-       }
-
-       function init_pagehead() {
-               $interval = ((local_user()) ? get_pconfig(local_user(),'system','update_interval') : 40000);
-
-               // If the update is "deactivated" set it to the highest integer number (~24 days)
-               if ($interval < 0) {
-                       $interval = 2147483647;
-               }
-
-               if ($interval < 10000) {
-                       $interval = 40000;
-               }
-
-               // compose the page title from the sitename and the
-               // current module called
-               if (!$this->module == '') {
-                   $this->page['title'] = $this->config['sitename'] . ' (' . $this->module . ')';
-               } else {
-                       $this->page['title'] = $this->config['sitename'];
-               }
-
-               /* put the head template at the beginning of page['htmlhead']
-                * since the code added by the modules frequently depends on it
-                * being first
-                */
-               if (!isset($this->page['htmlhead'])) {
-                       $this->page['htmlhead'] = '';
-               }
-
-               // If we're using Smarty, then doing replace_macros() will replace
-               // any unrecognized variables with a blank string. Since we delay
-               // replacing $stylesheet until later, we need to replace it now
-               // with another variable name
-               if ($this->theme['template_engine'] === 'smarty3') {
-                       $stylesheet = $this->get_template_ldelim('smarty3') . '$stylesheet' . $this->get_template_rdelim('smarty3');
-               } else {
-                       $stylesheet = '$stylesheet';
-               }
-
-               $shortcut_icon = get_config("system", "shortcut_icon");
-               if ($shortcut_icon == "") {
-                       $shortcut_icon = "images/friendica-32.png";
-               }
-
-               $touch_icon = get_config("system", "touch_icon");
-               if ($touch_icon == "") {
-                       $touch_icon = "images/friendica-128.png";
-               }
-
-               // get data wich is needed for infinite scroll on the network page
-               $invinite_scroll = infinite_scroll_data($this->module);
-
-               $tpl = get_markup_template('head.tpl');
-               $this->page['htmlhead'] = replace_macros($tpl,array(
-                       '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
-                       '$local_user' => local_user(),
-                       '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
-                       '$delitem' => t('Delete this item?'),
-                       '$showmore' => t('show more'),
-                       '$showfewer' => t('show fewer'),
-                       '$update_interval' => $interval,
-                       '$shortcut_icon' => $shortcut_icon,
-                       '$touch_icon' => $touch_icon,
-                       '$stylesheet' => $stylesheet,
-                       '$infinite_scroll' => $invinite_scroll,
-               )) . $this->page['htmlhead'];
-       }
-
-       function init_page_end() {
-               if (!isset($this->page['end'])) {
-                       $this->page['end'] = '';
-               }
-               $tpl = get_markup_template('end.tpl');
-               $this->page['end'] = replace_macros($tpl,array(
-                       '$baseurl' => $this->get_baseurl() // FIXME for z_path!!!!
-               )) . $this->page['end'];
-       }
-
-       function set_curl_code($code) {
-               $this->curl_code = $code;
-       }
-
-       function get_curl_code() {
-               return $this->curl_code;
-       }
-
-       function set_curl_content_type($content_type) {
-               $this->curl_content_type = $content_type;
-       }
-
-       function get_curl_content_type() {
-               return $this->curl_content_type;
-       }
-
-       function set_curl_headers($headers) {
-               $this->curl_headers = $headers;
-       }
-
-       function get_curl_headers() {
-               return $this->curl_headers;
-       }
-
-       function get_cached_avatar_image($avatar_image){
-               return $avatar_image;
-       }
-
-
-       /**
-        * @brief Removes the baseurl from an url. This avoids some mixed content problems.
-        *
-        * @param string $orig_url
-        *
-        * @return string The cleaned url
-        */
-       function remove_baseurl($orig_url){
-
-               // Is the function called statically?
-               if (!(isset($this) && get_class($this) == __CLASS__)) {
-                       return self::$a->remove_baseurl($orig_url);
-               }
-
-               // Remove the hostname from the url if it is an internal link
-               $nurl = normalise_link($orig_url);
-               $base = normalise_link($this->get_baseurl());
-               $url = str_replace($base."/", "", $nurl);
-
-               // if it is an external link return the orignal value
-               if ($url == normalise_link($orig_url)) {
-                       return $orig_url;
-               } else {
-                       return $url;
-               }
-       }
-
-       /**
-        * @brief Register template engine class
-        *
-        * If $name is "", is used class static property $class::$name
-        *
-        * @param string $class
-        * @param string $name
-        */
-       function register_template_engine($class, $name = '') {
-               /// @TODO Really === and not just == ?
-               if ($name === "") {
-                       $v = get_class_vars( $class );
-                       if (x($v,"name")) $name = $v['name'];
-               }
-               if ($name === "") {
-                       echo "template engine <tt>$class</tt> cannot be registered without a name.\n";
-                       killme();
-               }
-               $this->template_engines[$name] = $class;
-       }
-
-       /**
-        * @brief Return template engine instance.
-        *
-        * If $name is not defined, return engine defined by theme,
-        * or default
-        *
-        * @param strin $name Template engine name
-        * @return object Template Engine instance
-        */
-       function template_engine($name = '') {
-               /// @TODO really type-check included?
-               if ($name !== "") {
-                       $template_engine = $name;
-               } else {
-                       $template_engine = 'smarty3';
-                       if (x($this->theme, 'template_engine')) {
-                               $template_engine = $this->theme['template_engine'];
-                       }
-               }
-
-               if (isset($this->template_engines[$template_engine])){
-                       if (isset($this->template_engine_instance[$template_engine])){
-                               return $this->template_engine_instance[$template_engine];
-                       } else {
-                               $class = $this->template_engines[$template_engine];
-                               $obj = new $class;
-                               $this->template_engine_instance[$template_engine] = $obj;
-                               return $obj;
-                       }
-               }
-
-               echo "template engine <tt>$template_engine</tt> is not registered!\n"; killme();
-       }
-
-       /**
-        * @brief Returns the active template engine.
-        *
-        * @return string
-        */
-       function get_template_engine() {
-               return $this->theme['template_engine'];
-       }
-
-       function set_template_engine($engine = 'smarty3') {
-               $this->theme['template_engine'] = $engine;
-       }
-
-       function get_template_ldelim($engine = 'smarty3') {
-               return $this->ldelim[$engine];
-       }
-
-       function get_template_rdelim($engine = 'smarty3') {
-               return $this->rdelim[$engine];
-       }
-
-       function save_timestamp($stamp, $value) {
-               if (!isset($this->config['system']['profiler']) || !$this->config['system']['profiler']) {
-                       return;
-               }
-
-               $duration = (float)(microtime(true)-$stamp);
-
-               if (!isset($this->performance[$value])) {
-                       // Prevent ugly E_NOTICE
-                       $this->performance[$value] = 0;
-               }
-
-               $this->performance[$value] += (float)$duration;
-               $this->performance["marktime"] += (float)$duration;
-
-               $callstack = $this->callstack();
-
-               if (!isset($this->callstack[$value][$callstack])) {
-                       // Prevent ugly E_NOTICE
-                       $this->callstack[$value][$callstack] = 0;
-               }
-
-               $this->callstack[$value][$callstack] += (float)$duration;
-
-       }
-
-       /**
-        * @brief Log active processes into the "process" table
-        */
-       function start_process() {
-               $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
-
-               $command = basename($trace[0]["file"]);
-
-               $this->remove_inactive_processes();
-
-               q("START TRANSACTION");
-
-               $r = q("SELECT `pid` FROM `process` WHERE `pid` = %d", intval(getmypid()));
-               if (!dbm::is_result($r)) {
-                       q("INSERT INTO `process` (`pid`,`command`,`created`) VALUES (%d, '%s', '%s')",
-                               intval(getmypid()),
-                               dbesc($command),
-                               dbesc(datetime_convert()));
-               }
-               q("COMMIT");
-       }
-
-       /**
-        * @brief Remove inactive processes
-        */
-       function remove_inactive_processes() {
-               q("START TRANSACTION");
-
-               $r = q("SELECT `pid` FROM `process`");
-               if (dbm::is_result($r)) {
-                       foreach ($r AS $process) {
-                               if (!posix_kill($process["pid"], 0)) {
-                                       q("DELETE FROM `process` WHERE `pid` = %d", intval($process["pid"]));
-                               }
-                       }
-               }
-               q("COMMIT");
-       }
-
-       /**
-        * @brief Remove the active process from the "process" table
-        */
-       function end_process() {
-               q("DELETE FROM `process` WHERE `pid` = %d", intval(getmypid()));
-       }
-
-       /**
-        * @brief Returns a string with a callstack. Can be used for logging.
-        *
-        * @return string
-        */
-       function callstack() {
-               $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 6);
-
-               // We remove the first two items from the list since they contain data that we don't need.
-               array_shift($trace);
-               array_shift($trace);
-
-               $callstack = array();
-               foreach ($trace AS $func) {
-                       $callstack[] = $func["function"];
-               }
-
-               return implode(", ", $callstack);
-       }
-
-       function get_useragent() {
-               return
-                       FRIENDICA_PLATFORM . " '" .
-                       FRIENDICA_CODENAME . "' " .
-                       FRIENDICA_VERSION . "-" .
-                       DB_UPDATE_VERSION . "; " .
-                       $this->get_baseurl();
-       }
-
-       function is_friendica_app() {
-               return $this->is_friendica_app;
-       }
-
-       /**
-        * @brief Checks if the site is called via a backend process
-        *
-        * 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?
-        */
-       function is_backend() {
-               static $backends = array();
-               $backends[] = "_well_known";
-               $backends[] = "api";
-               $backends[] = "dfrn_notify";
-               $backends[] = "fetch";
-               $backends[] = "hcard";
-               $backends[] = "hostxrd";
-               $backends[] = "nodeinfo";
-               $backends[] = "noscrape";
-               $backends[] = "p";
-               $backends[] = "poco";
-               $backends[] = "post";
-               $backends[] = "proxy";
-               $backends[] = "pubsub";
-               $backends[] = "pubsubhubbub";
-               $backends[] = "receive";
-               $backends[] = "rsd_xml";
-               $backends[] = "salmon";
-               $backends[] = "statistics_json";
-               $backends[] = "xrd";
-
-               // Check if current module is in backend or backend flag is set
-               return (in_array($this->module, $backends) || $this->backend);
-       }
-
-       /**
-        * @brief Checks if the maximum number of database processes is reached
-        *
-        * @return bool Is the limit reached?
-        */
-       function max_processes_reached() {
-
-               if ($this->is_backend()) {
-                       $process = "backend";
-                       $max_processes = get_config('system', 'max_processes_backend');
-                       if (intval($max_processes) == 0) {
-                               $max_processes = 5;
-                       }
-               } else {
-                       $process = "frontend";
-                       $max_processes = get_config('system', 'max_processes_frontend');
-                       if (intval($max_processes) == 0) {
-                               $max_processes = 20;
-                       }
-               }
-
-               $processlist = dbm::processlist();
-               if ($processlist["list"] != "") {
-                       logger("Processcheck: Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
-
-                       if ($processlist["amount"] > $max_processes) {
-                               logger("Processcheck: Maximum number of processes for ".$process." tasks (".$max_processes.") reached.", LOGGER_DEBUG);
-                               return true;
-                       }
-               }
-               return false;
-       }
-
-       /**
-        * @brief Checks if the minimal memory is reached
-        *
-        * @return bool Is the memory limit reached?
-        */
-       public function min_memory_reached() {
-               $min_memory = Config::get('system', 'min_memory', 0);
-               if ($min_memory == 0) {
-                       return false;
-               }
-
-               if (!is_readable("/proc/meminfo")) {
-                       return false;
-               }
-
-               $memdata = explode("\n", file_get_contents('/proc/meminfo'));
-
-               $meminfo = array();
-               foreach ($memdata as $line) {
-                       list($key, $val) = explode(":", $line);
-                       $meminfo[$key] = (int)trim(str_replace("kB", "", $val));
-                       $meminfo[$key] = (int)($meminfo[$key] / 1024);
-               }
-
-               if (!isset($meminfo['MemAvailable']) OR !isset($meminfo['MemFree'])) {
-                       return false;
-               }
-
-               $free = $meminfo['MemAvailable'] + $meminfo['MemFree'];
-
-               $reached = ($free < $min_memory);
-
-               if ($reached) {
-                       logger('Minimal memory reached: '.$free.'/'.$meminfo['MemTotal'].' - limit '.$min_memory, LOGGER_DEBUG);
-               }
-
-               return $reached;
-       }
-
-       /**
-        * @brief Checks if the maximum load is reached
-        *
-        * @return bool Is the load reached?
-        */
-       function maxload_reached() {
-
-               if ($this->is_backend()) {
-                       $process = "backend";
-                       $maxsysload = intval(get_config('system', 'maxloadavg'));
-                       if ($maxsysload < 1) {
-                               $maxsysload = 50;
-                       }
-               } else {
-                       $process = "frontend";
-                       $maxsysload = intval(get_config('system','maxloadavg_frontend'));
-                       if ($maxsysload < 1) {
-                               $maxsysload = 50;
-                       }
-               }
-
-               $load = current_load();
-               if ($load) {
-                       if (intval($load) > $maxsysload) {
-                               logger('system: load '.$load.' for '.$process.' tasks ('.$maxsysload.') too high.');
-                               return true;
-                       }
-               }
-               return false;
-       }
-
-       function proc_run($args) {
-
-               if (!function_exists("proc_open")) {
-                       return;
-               }
-
-               // If the last worker fork was less than 10 seconds before then don't fork another one.
-               // This should prevent the forking of masses of workers.
-               $cachekey = "app:proc_run:started";
-               $result = Cache::get($cachekey);
-
-               if (!is_null($result) AND (time() - $result) < 10) {
-                       return;
-               }
-
-               // Set the timestamp of the last proc_run
-               Cache::set($cachekey, time(), CACHE_MINUTE);
-
-               array_unshift($args, ((x($this->config,'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php'));
-
-               // add baseurl to args. cli scripts can't construct it
-               $args[] = $this->get_baseurl();
-
-               for ($x = 0; $x < count($args); $x ++) {
-                       $args[$x] = escapeshellarg($args[$x]);
-               }
-
-               $cmdline = implode($args, " ");
-
-               if ($this->min_memory_reached()) {
-                       return;
-               }
-
-               if (get_config('system', 'proc_windows')) {
-                       $resource = proc_open('cmd /c start /b ' . $cmdline, array(), $foo, dirname(__FILE__));
-               } else {
-                       $resource = proc_open($cmdline . " &", array(), $foo, dirname(__FILE__));
-               }
-               if (!is_resource($resource)) {
-                       logger('We got no resource for command '.$cmdline, LOGGER_DEBUG);
-                       return;
-               }
-               proc_close($resource);
-       }
-
-       /**
-        * @brief Returns the system user that is executing the script
-        *
-        * This mostly returns something like "www-data".
-        *
-        * @return string system username
-        */
-       static function systemuser() {
-               if (!function_exists('posix_getpwuid') OR !function_exists('posix_geteuid')) {
-                       return '';
-               }
-
-               $processUser = posix_getpwuid(posix_geteuid());
-               return $processUser['name'];
-       }
-
-       /**
-        * @brief Checks if a given directory is usable for the system
-        *
-        * @return boolean the directory is usable
-        */
-       static function directory_usable($directory) {
-
-               if ($directory == '') {
-                       logger("Directory is empty. This shouldn't happen.", LOGGER_DEBUG);
-                       return false;
-               }
-
-               if (!file_exists($directory)) {
-                       logger('Path "'.$directory.'" does not exist for user '.self::systemuser(), LOGGER_DEBUG);
-                       return false;
-               }
-               if (is_file($directory)) {
-                       logger('Path "'.$directory.'" is a file for user '.self::systemuser(), LOGGER_DEBUG);
-                       return false;
-               }
-               if (!is_dir($directory)) {
-                       logger('Path "'.$directory.'" is not a directory for user '.self::systemuser(), LOGGER_DEBUG);
-                       return false;
-               }
-               if (!is_writable($directory)) {
-                       logger('Path "'.$directory.'" is not writable for user '.self::systemuser(), LOGGER_DEBUG);
-                       return false;
-               }
-               return true;
-       }
 }
 
 /**
@@ -1494,7 +499,6 @@ function get_app() {
        return $a;
 }
 
-
 /**
  * @brief Multi-purpose function to check variable state.
  *
@@ -1509,7 +513,7 @@ function get_app() {
  *
  * @return bool|int
  */
-function x($s,$k = NULL) {
+function x($s, $k = NULL) {
        if ($k != NULL) {
                if ((is_array($s)) && (array_key_exists($k, $s))) {
                        if ($s[$k]) {
@@ -1529,7 +533,6 @@ function x($s,$k = NULL) {
        }
 }
 
-
 /**
  * @brief Called from db initialisation if db is dead.
  */
@@ -1539,7 +542,6 @@ function system_unavailable() {
        killme();
 }
 
-
 function clean_urls() {
        $a = get_app();
        return true;
@@ -1548,7 +550,7 @@ function clean_urls() {
 function z_path() {
        $base = App::get_baseurl();
 
-       if (! clean_urls()) {
+       if (!clean_urls()) {
                $base .= '/?q=';
        }
 
@@ -1575,7 +577,7 @@ function z_root() {
  * @return string
  */
 function absurl($path) {
-       if (strpos($path,'/') === 0) {
+       if (strpos($path, '/') === 0) {
                return z_path() . $path;
        }
        return $path;
@@ -1592,25 +594,23 @@ function is_ajax() {
 
 function check_db() {
 
-       $build = get_config('system','build');
-       if (! x($build)) {
-               set_config('system','build',DB_UPDATE_VERSION);
+       $build = get_config('system', 'build');
+       if (!x($build)) {
+               set_config('system', 'build', DB_UPDATE_VERSION);
                $build = DB_UPDATE_VERSION;
        }
        if ($build != DB_UPDATE_VERSION) {
                proc_run(PRIORITY_CRITICAL, 'include/dbupdate.php');
        }
-
 }
 
-
 /**
  * Sets the base url for use in cmdline programs which don't have
  * $_SERVER variables
  */
 function check_url(App $a) {
 
-       $url = get_config('system','url');
+       $url = get_config('system', 'url');
 
        // if the url isn't set or the stored url is radically different
        // than the currently visited url, store the current value accordingly.
@@ -1618,24 +618,23 @@ 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 (! x($url)) {
-               $url = set_config('system','url',App::get_baseurl());
+       if (!x($url)) {
+               $url = set_config('system', 'url', App::get_baseurl());
        }
-       if ((! link_compare($url,App::get_baseurl())) && (! preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$a->get_hostname))) {
-               $url = set_config('system','url',App::get_baseurl());
+       if ((!link_compare($url, App::get_baseurl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname))) {
+               $url = set_config('system', 'url', App::get_baseurl());
        }
 
        return;
 }
 
-
 /**
  * @brief Automatic database updates
  */
 function update_db(App $a) {
-       $build = get_config('system','build');
-       if (! x($build)) {
-               $build = set_config('system','build',DB_UPDATE_VERSION);
+       $build = get_config('system', 'build');
+       if (!x($build)) {
+               $build = set_config('system', 'build', DB_UPDATE_VERSION);
        }
 
        if ($build != DB_UPDATE_VERSION) {
@@ -1646,7 +645,6 @@ function update_db(App $a) {
 
                        // We're reporting a different version than what is currently installed.
                        // Run any existing update scripts to bring the database up to current.
-
                        // make sure that boot.php and update.php are the same release, we might be
                        // updating right this very second and the correct version of the update.php
                        // file may not be here yet. This can happen on a very busy site.
@@ -1654,12 +652,12 @@ function update_db(App $a) {
                        if (DB_UPDATE_VERSION == UPDATE_VERSION) {
                                // Compare the current structure with the defined structure
 
-                               $t = get_config('database','dbupdate_'.DB_UPDATE_VERSION);
+                               $t = get_config('database', 'dbupdate_' . DB_UPDATE_VERSION);
                                if ($t !== false) {
                                        return;
                                }
 
-                               set_config('database','dbupdate_'.DB_UPDATE_VERSION, time());
+                               set_config('database', 'dbupdate_' . DB_UPDATE_VERSION, time());
 
                                // run old update routine (wich could modify the schema and
                                // conflits with new routine)
@@ -1683,7 +681,7 @@ function update_db(App $a) {
                                        );
                                        return;
                                } else {
-                                       set_config('database','dbupdate_'.DB_UPDATE_VERSION, 'success');
+                                       set_config('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
                                }
 
                                // run any left update_nnnn functions in update.php
@@ -1707,15 +705,14 @@ function run_update_function($x) {
                // We want exactly one process to run the update command.
                // So store the fact that we're taking responsibility
                // after first checking to see if somebody else already has.
-
                // If the update fails or times-out completely you may need to
                // delete the config entry to try again.
 
-               $t = get_config('database','update_' . $x);
+               $t = get_config('database', 'update_' . $x);
                if ($t !== false) {
                        return false;
                }
-               set_config('database','update_' . $x, time());
+               set_config('database', 'update_' . $x, time());
 
                // call the specific update
 
@@ -1730,13 +727,13 @@ function run_update_function($x) {
                        );
                        return false;
                } else {
-                       set_config('database','update_' . $x, 'success');
-                       set_config('system','build', $x + 1);
+                       set_config('database', 'update_' . $x, 'success');
+                       set_config('system', 'build', $x + 1);
                        return true;
                }
        } else {
-               set_config('database','update_' . $x, 'success');
-               set_config('system','build', $x + 1);
+               set_config('database', 'update_' . $x, 'success');
+               set_config('system', 'build', $x + 1);
                return true;
        }
        return true;
@@ -1765,11 +762,11 @@ function check_plugins(App $a) {
                $installed = array();
        }
 
-       $plugins = get_config('system','addon');
+       $plugins = get_config('system', 'addon');
        $plugins_arr = array();
 
        if ($plugins) {
-               $plugins_arr = explode(',',str_replace(' ', '',$plugins));
+               $plugins_arr = explode(',', str_replace(' ', '', $plugins));
        }
 
        $a->plugins = $plugins_arr;
@@ -1778,7 +775,7 @@ function check_plugins(App $a) {
 
        if (count($installed)) {
                foreach ($installed as $i) {
-                       if (! in_array($i['name'],$plugins_arr)) {
+                       if (!in_array($i['name'], $plugins_arr)) {
                                uninstall_plugin($i['name']);
                        } else {
                                $installed_arr[] = $i['name'];
@@ -1788,20 +785,18 @@ function check_plugins(App $a) {
 
        if (count($plugins_arr)) {
                foreach ($plugins_arr as $p) {
-                       if (! in_array($p,$installed_arr)) {
+                       if (!in_array($p, $installed_arr)) {
                                install_plugin($p);
                        }
                }
        }
 
-
        load_hooks();
 
        return;
 }
 
-function get_guid($size=16, $prefix = "") {
-
+function get_guid($size = 16, $prefix = "") {
        if ($prefix == "") {
                $a = get_app();
                $prefix = hash("crc32", $a->get_hostname());
@@ -1834,7 +829,7 @@ function get_guid($size=16, $prefix = "") {
  * @hooks 'login_hook'
  *     string $o
  */
-function login($register = false, $hiddens=false) {
+function login($register = false, $hiddens = false) {
        $a = get_app();
        $o = "";
        $reg = false;
@@ -1845,14 +840,14 @@ function login($register = false, $hiddens=false) {
                );
        }
 
-       $noid = get_config('system','no_openid');
+       $noid = get_config('system', 'no_openid');
 
        $dest_url = $a->query_string;
 
        if (local_user()) {
                $tpl = get_markup_template("logout.tpl");
        } else {
-               $a->page['htmlhead'] .= replace_macros(get_markup_template("login_head.tpl"),array(
+               $a->page['htmlhead'] .= replace_macros(get_markup_template("login_head.tpl"), array(
                        '$baseurl' => $a->get_baseurl(true)
                ));
 
@@ -1886,10 +881,9 @@ function login($register = false, $hiddens=false) {
 
                '$privacytitle' => t('Website Privacy Policy'),
                '$privacylink'  => t('privacy policy'),
-
        ));
 
-       call_hooks('login_hook',$o);
+       call_hooks('login_hook', $o);
 
        return $o;
 }
@@ -1898,7 +892,6 @@ function login($register = false, $hiddens=false) {
  * @brief Used to end the current process, after saving session state.
  */
 function killme() {
-
        if (!get_app()->is_backend()) {
                session_write_close();
        }
@@ -1911,14 +904,13 @@ function killme() {
  */
 function goaway($s) {
        if (!strstr(normalise_link($s), "http://")) {
-               $s = App::get_baseurl()."/".$s;
+               $s = App::get_baseurl() . "/" . $s;
        }
 
        header("Location: $s");
        killme();
 }
 
-
 /**
  * @brief Returns the user id of locally logged in user or false.
  *
@@ -1960,7 +952,7 @@ function public_contact() {
  * @return int|bool visitor_id or false
  */
 function remote_user() {
-       if ((x($_SESSION,'authenticated')) && (x($_SESSION,'visitor_id'))) {
+       if ((x($_SESSION, 'authenticated')) && (x($_SESSION, 'visitor_id'))) {
                return intval($_SESSION['visitor_id']);
        }
        return false;
@@ -1975,7 +967,7 @@ function remote_user() {
  */
 function notice($s) {
        $a = get_app();
-       if (! x($_SESSION,'sysmsg')) {
+       if (!x($_SESSION, 'sysmsg')) {
                $_SESSION['sysmsg'] = array();
        }
        if ($a->interactive) {
@@ -1993,11 +985,11 @@ function notice($s) {
 function info($s) {
        $a = get_app();
 
-       if (local_user() AND get_pconfig(local_user(),'system','ignore_info')) {
+       if (local_user() AND get_pconfig(local_user(), 'system', 'ignore_info')) {
                return;
        }
 
-       if (! x($_SESSION,'sysmsg_info')) {
+       if (!x($_SESSION, 'sysmsg_info')) {
                $_SESSION['sysmsg_info'] = array();
        }
        if ($a->interactive) {
@@ -2005,7 +997,6 @@ function info($s) {
        }
 }
 
-
 /**
  * @brief Wrapper around config to limit the text length of an incoming message
  *
@@ -2013,12 +1004,12 @@ function info($s) {
  */
 function get_max_import_size() {
        $a = get_app();
-       return ((x($a->config,'max_import_size')) ? $a->config['max_import_size'] : 0 );
+       return ((x($a->config, 'max_import_size')) ? $a->config['max_import_size'] : 0 );
 }
 
 /**
  * @brief Wrap calls to proc_close(proc_open()) and call hook
- *     so plugins can take part in process :)
+ *     so plugins can take part in process :)
  *
  * @param (integer|array) priority or parameter array, $cmd atrings are deprecated and are ignored
  *
@@ -2029,9 +1020,9 @@ function get_max_import_size() {
  * @note $cmd and string args are surrounded with ""
  *
  * @hooks 'proc_run'
- *     array $arr
+ *     array $arr
  */
-function proc_run($cmd){
+function proc_run($cmd) {
 
        $a = get_app();
 
@@ -2064,7 +1055,7 @@ function proc_run($cmd){
        $arr = array('args' => $args, 'run_cmd' => true);
 
        call_hooks("proc_run", $arr);
-       if (!$arr['run_cmd'] OR !count($args)) {
+       if (!$arr['run_cmd'] OR ! count($args)) {
                return;
        }
 
@@ -2086,8 +1077,7 @@ function proc_run($cmd){
        array_shift($argv);
 
        $parameters = json_encode($argv);
-       $found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'",
-               dbesc($parameters));
+       $found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'", dbesc($parameters));
 
        if (!dbm::is_result($found)) {
                q("INSERT INTO `workerqueue` (`parameter`, `created`, `priority`)
@@ -2123,7 +1113,7 @@ function proc_run($cmd){
        $a->proc_run($args);
 }
 
-function current_theme(){
+function current_theme() {
        $app_base_themes = array('duepuntozero', 'dispy', 'quattro');
 
        $a = get_app();
@@ -2145,7 +1135,7 @@ function current_theme(){
        // This works only if the user is on the same server
 
        if ($page_theme && local_user() && (local_user() != $a->profile_uid)) {
-               if (get_pconfig(local_user(),'system','always_my_theme')) {
+               if (get_pconfig(local_user(), 'system', 'always_my_theme')) {
                        $page_theme = null;
                }
        }
@@ -2155,7 +1145,7 @@ function current_theme(){
        $is_mobile = $a->is_mobile || $a->is_tablet;
 
        $standard_system_theme = Config::get('system', 'theme', '');
-       $standard_theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $standard_system_theme);
+       $standard_theme_name = ((isset($_SESSION) && x($_SESSION, 'theme')) ? $_SESSION['theme'] : $standard_system_theme);
 
        if ($is_mobile) {
                if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
@@ -2166,7 +1156,7 @@ function current_theme(){
                        if ($system_theme == '') {
                                $system_theme = $standard_system_theme;
                        }
-                       $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
+                       $theme_name = ((isset($_SESSION) && x($_SESSION, 'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
 
                        if ($theme_name === '---') {
                                // user has selected to have the mobile theme be the same as the normal one
@@ -2188,21 +1178,21 @@ function current_theme(){
        }
 
        if ($theme_name &&
-                       (file_exists('view/theme/' . $theme_name . '/style.css') ||
-                                       file_exists('view/theme/' . $theme_name . '/style.php'))) {
+               (file_exists('view/theme/' . $theme_name . '/style.css') ||
+               file_exists('view/theme/' . $theme_name . '/style.php'))) {
                return($theme_name);
        }
 
        foreach ($app_base_themes as $t) {
                if (file_exists('view/theme/' . $t . '/style.css') ||
-                               file_exists('view/theme/' . $t . '/style.php')) {
+                       file_exists('view/theme/' . $t . '/style.php')) {
                        return($t);
                }
        }
 
-       $fallback = array_merge(glob('view/theme/*/style.css'),glob('view/theme/*/style.php'));
+       $fallback = array_merge(glob('view/theme/*/style.css'), glob('view/theme/*/style.php'));
        if (count($fallback)) {
-               return (str_replace('view/theme/','', substr($fallback[0],0,-10)));
+               return (str_replace('view/theme/', '', substr($fallback[0], 0, -10)));
        }
 
        /// @TODO No final return statement?
@@ -2222,13 +1212,13 @@ function current_theme_url() {
 
        $opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : '');
        if (file_exists('view/theme/' . $t . '/style.php')) {
-               return('view/theme/'.$t.'/style.pcss'.$opts);
+               return('view/theme/' . $t . '/style.pcss' . $opts);
        }
 
-       return('view/theme/'.$t.'/style.css');
+       return('view/theme/' . $t . '/style.css');
 }
 
-function feed_birthday($uid,$tz) {
+function feed_birthday($uid, $tz) {
 
        /**
         *
@@ -2248,11 +1238,9 @@ function feed_birthday($uid,$tz) {
         * 6:00PM the day before, but that will correspond to midnight to the birthday person.
         *
         */
-
-
        $birthday = '';
 
-       if (! strlen($tz)) {
+       if (!strlen($tz)) {
                $tz = 'UTC';
        }
 
@@ -2261,16 +1249,16 @@ function feed_birthday($uid,$tz) {
        );
 
        if (dbm::is_result($p)) {
-               $tmp_dob = substr($p[0]['dob'],5);
+               $tmp_dob = substr($p[0]['dob'], 5);
                if (intval($tmp_dob)) {
-                       $y = datetime_convert($tz,$tz,'now','Y');
+                       $y = datetime_convert($tz, $tz, 'now', 'Y');
                        $bd = $y . '-' . $tmp_dob . ' 00:00';
                        $t_dob = strtotime($bd);
-                       $now = strtotime(datetime_convert($tz,$tz,'now'));
+                       $now = strtotime(datetime_convert($tz, $tz, 'now'));
                        if ($t_dob < $now) {
                                $bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
                        }
-                       $birthday = datetime_convert($tz,'UTC',$bd,ATOM_TIME);
+                       $birthday = datetime_convert($tz, 'UTC', $bd, ATOM_TIME);
                }
        }
 
@@ -2288,7 +1276,7 @@ function is_site_admin() {
        $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
 
        //if(local_user() && x($a->user,'email') && x($a->config,'admin_email') && ($a->user['email'] === $a->config['admin_email']))
-       if (local_user() && x($a->user,'email') && x($a->config,'admin_email') && in_array($a->user['email'], $adminlist)) {
+       if (local_user() && x($a->user, 'email') && x($a->config, 'admin_email') && in_array($a->user['email'], $adminlist)) {
                return true;
        }
        return false;
@@ -2310,7 +1298,7 @@ function build_querystring($params, $name = null) {
                        if ($name == null) {
                                $ret .= build_querystring($val, $key);
                        } else {
-                               $ret .= build_querystring($val, $name."[$key]");
+                               $ret .= build_querystring($val, $name . "[$key]");
                        }
                } else {
                        $val = urlencode($val);
@@ -2358,10 +1346,10 @@ function explode_querystring($query) {
 }
 
 /**
-* Returns the complete URL of the current page, e.g.: http(s)://something.com/network
-*
-* Taken from http://webcheatsheet.com/php/get_current_page_url.php
-*/
+ * Returns the complete URL of the current page, e.g.: http(s)://something.com/network
+ *
+ * Taken from http://webcheatsheet.com/php/get_current_page_url.php
+ */
 function curPageURL() {
        $pageURL = 'http';
        if ($_SERVER["HTTPS"] == "on") {
@@ -2371,9 +1359,9 @@ function curPageURL() {
        $pageURL .= "://";
 
        if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
-               $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
+               $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
        } else {
-               $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
+               $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
        }
        return $pageURL;
 }
@@ -2382,7 +1370,7 @@ function random_digits($digits) {
        $rn = '';
        for ($i = 0; $i < $digits; $i++) {
                /// @TODO rand() is different to mt_rand() and maybe lesser "random"
-               $rn .= rand(0,9);
+               $rn .= rand(0, 9);
        }
        return $rn;
 }
@@ -2400,7 +1388,7 @@ function get_server() {
 function get_cachefile($file, $writemode = true) {
        $cache = get_itemcachepath();
 
-       if ((! $cache) || (! is_dir($cache))) {
+       if ((!$cache) || (!is_dir($cache))) {
                return("");
        }
 
@@ -2433,15 +1421,15 @@ function clear_cache($basepath = "", $path = "") {
                return;
        }
 
-       $cachetime = (int)get_config('system','itemcache_duration');
+       $cachetime = (int) get_config('system', 'itemcache_duration');
        if ($cachetime == 0) {
                $cachetime = 86400;
        }
 
-       if (is_writable($path)){
+       if (is_writable($path)) {
                if ($dh = opendir($path)) {
                        while (($file = readdir($dh)) !== false) {
-                               $fullpath = $path."/".$file;
+                               $fullpath = $path . "/" . $file;
                                if ((filetype($fullpath) == "dir") and ($file != ".") and ($file != "..")) {
                                        clear_cache($basepath, $fullpath);
                                }
@@ -2456,12 +1444,12 @@ function clear_cache($basepath = "", $path = "") {
 
 function get_itemcachepath() {
        // Checking, if the cache is deactivated
-       $cachetime = (int)get_config('system','itemcache_duration');
+       $cachetime = (int) get_config('system', 'itemcache_duration');
        if ($cachetime < 0) {
                return "";
        }
 
-       $itemcache = get_config('system','itemcache');
+       $itemcache = get_config('system', 'itemcache');
        if (($itemcache != "") AND App::directory_usable($itemcache)) {
                return $itemcache;
        }
@@ -2469,7 +1457,7 @@ function get_itemcachepath() {
        $temppath = get_temppath();
 
        if ($temppath != "") {
-               $itemcache = $temppath."/itemcache";
+               $itemcache = $temppath . "/itemcache";
                if (!file_exists($itemcache) && !is_dir($itemcache)) {
                        mkdir($itemcache);
                }
@@ -2488,7 +1476,7 @@ function get_itemcachepath() {
  * @return string Spool path
  */
 function get_spoolpath() {
-       $spoolpath = get_config('system','spoolpath');
+       $spoolpath = get_config('system', 'spoolpath');
        if (($spoolpath != "") AND App::directory_usable($spoolpath)) {
                // We have a spool path and it is usable
                return $spoolpath;
@@ -2499,7 +1487,7 @@ function get_spoolpath() {
 
        if ($temppath != "") {
                // To avoid any interferences with other systems we create our own directory
-               $spoolpath = $temppath."/spool";
+               $spoolpath = $temppath . "/spool";
                if (!is_dir($spoolpath)) {
                        mkdir($spoolpath);
                }
@@ -2535,7 +1523,7 @@ function get_temppath() {
        // Check if it is usable
        if (($temppath != "") AND App::directory_usable($temppath)) {
                // To avoid any interferences with other systems we create our own directory
-               $new_temppath = $temppath."/".$a->get_hostname();
+               $new_temppath = $temppath . "/" . $a->get_hostname();
                if (!is_dir($new_temppath)) {
                        /// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
                        mkdir($new_temppath);
@@ -2581,7 +1569,7 @@ function validate_include(&$file) {
                return false;
        }
 
-       $file = str_replace(getcwd()."/", "", $file, $count);
+       $file = str_replace(getcwd() . "/", "", $file, $count);
        if ($count != 1) {
                return false;
        }
@@ -2633,7 +1621,7 @@ function argc() {
  * @return string Value of the argv key
  */
 function argv($x) {
-       if (array_key_exists($x,get_app()->argv)) {
+       if (array_key_exists($x, get_app()->argv)) {
                return get_app()->argv[$x];
        }
 
@@ -2650,12 +1638,12 @@ function argv($x) {
  *
  * @param string $module The name of the module (e.g. "network")
  * @return array Of infinite scroll data
- *     'pageno' => $pageno The number of the actual page
- *     'reload_uri' => $reload_uri The URI of the content we have to load
+ *     'pageno' => $pageno The number of the actual page
+ *     'reload_uri' => $reload_uri The URI of the content we have to load
  */
 function infinite_scroll_data($module) {
 
-       if (get_pconfig(local_user(),'system','infinite_scroll')
+       if (get_pconfig(local_user(), 'system', 'infinite_scroll')
                AND ($module == "network") AND ($_GET["mode"] != "minimal")) {
 
                // get the page number
@@ -2674,7 +1662,7 @@ function infinite_scroll_data($module) {
                        }
                }
 
-               if (($a->page_offset != "") AND !strstr($reload_uri, "&offset=")) {
+               if (($a->page_offset != "") AND ! strstr($reload_uri, "&offset=")) {
                        $reload_uri .= "&offset=" . urlencode($a->page_offset);
                }
 
index b46614f6e3a74bb810bc79bd950da32dc9e7192b..f057d0cec76078a7b471eb49f26ac384f64374c6 100644 (file)
         },
         {
             "name": "pear-pear.php.net/PEAR",
-            "version": "1.10.3",
+            "version": "1.10.4",
             "dist": {
                 "type": "file",
-                "url": "https://pear.php.net/get/PEAR-1.10.3.tgz",
+                "url": "https://pear.php.net/get/PEAR-1.10.4.tgz",
                 "reference": null,
                 "shasum": null
             },
                 "pear-pear.php.net/pear_frontend_web": "<=0.4.0.0"
             },
             "replace": {
-                "pear-pear/pear": "== 1.10.3.0"
+                "pear-pear/pear": "== 1.10.4.0"
             },
             "type": "pear-library",
             "autoload": {
index 8310baf3f0cfa67bd3ed7150c68f2f5cce1a5365..02ce61639cda4fabaad0ba8ec4e55a6844d1d002 100644 (file)
@@ -113,3 +113,8 @@ For Composer, this would be:
 ````
 $> COMPOSER_HOME=/var/tmp/composer sudo -u [web user] util/composer.phar [mode]
 ````
+
+## Related
+
+* [Class autoloading](help/autoloader)
+* [How To Move Classes to `src`](help/Developer-How-To-Move-Classes-to-src)
diff --git a/doc/Developer-How-To-Move-Classes-to-src.md b/doc/Developer-How-To-Move-Classes-to-src.md
new file mode 100644 (file)
index 0000000..25eb393
--- /dev/null
@@ -0,0 +1,108 @@
+How To Move Classes to `src`
+==============
+
+* [Home](help)
+  * [Developer Intro](help/Developers-Intro)
+
+Friendica uses [Composer](help/Composer) to manage autoloading.
+This means that all the PHP class files moved to the `src` folder will be [automatically included](help/autoloader) when the class it defines is first used in the flow.
+This is an improvement over the current `require` usage since files will be included on an actual usage basis instead of the presence of a `require` call.
+
+However, there are a significant number of items to check when moving a class file from the `include` folder to the `src` folder, and this page is there to list them.
+
+## Decide the namespace
+
+This isn't the most technical decision of them all, but it has long lasting consequences as it will be the name that will be used to refer to this class from now on.
+There is [a shared Ethercalc sheet](https://ethercalc.org/friendica_classes) to suggest namespace/class names that lists all the already moved class files for inspiration.
+
+A few pointers though:
+* `Friendica` is the base namespace for all classes in the `src` folder
+* Namespaces match the directory structure, with `Friendica` namespace being the base `src` directory. The `Config` class set in the `Friendica\Core` namespace is expected to be found at `src/Core/Config.php`.
+* Namespaces can help group classes with a similar purpose or relevant to a particular feature
+
+When you're done deciding the namespace, it's time to use it.
+Let's say we choose `Friendica\Core` for the `Config` class.
+
+## Use the namespace
+
+To declare the namespace, the file `src/Core/Config.php` must start with the following statement:
+
+````php
+namespace Friendica\Core;
+````
+
+From now on, the `Config` class can be referred to as `Friendica\Core\Config`, however it isn't very practical, especially when the class was previously used as `Config`.
+Thankfully, PHP provides namespace shortcuts through `use`.
+
+This language construct just provides a different naming scheme for a namespace or a class, but doesn't trigger the autoload mechanism on its own.
+Here are the different ways you can use `use`:
+
+````php
+// No use
+$config = new Friendica\Core\Config();
+````
+````php
+// Namespace shortcut
+use Friendica\Core;
+
+$config = new Core\Config();
+````
+````php
+// Class name shortcut
+use Friendica\Core\Config;
+
+$config = new Config();
+````
+````php
+// Aliasing
+use Friendica\Core\Config as Cfg;
+
+$config = new Cfg();
+````
+
+Whatever the style chosen, a repository-wide search has to be done to find all the class name usage and either use the fully-qualified class name (including the namespace) or add a `use` statement at the start of each relevant file.
+
+## Escape non-namespace classes
+
+The class file you just moved is now in the `Friendica` namespace, but it probably isn't the case for all the classes referenced in this file.
+Since we added a `namespace Friendica\Core;` to the file, all the class names still declared in `include` will be implicitly understood as `Friendica\Core\ClassName`, which is rarely what we expect.
+
+To avoid `Class Friendica\Core\ClassName not found` errors, all the `include`-declared class names have to be prepended with a `\`, it tells the autoloader not to look for the class in the namespace but in the global space where non-namespaced classes are set.
+If there are only a handful of references to a single non-namespaced class, just prepending `\` is enough. However, if there are many instance, we can use `use` again.
+
+````php
+namespace Friendica\Core;
+...
+if (\dbm::is_result($r)) {
+    ...
+}
+````
+````php
+namespace Friendica\Core;
+
+use \dbm;
+
+if (dbm::is_result($r)) {
+    ...
+}
+````
+
+## Remove any useless `require`
+
+Now that you successfully moved your class to the autoloaded `src` folder, there's no need to include this file anywhere in the app ever again.
+Please remove all the `require_once` mentions of the former file, as they will provoke a Fatal Error even if the class isn't used.
+
+## Miscellaneous tips
+
+When you are done with moving the class, please run `php util/typo.php` from the Friendica base directory to check for obvious mistakes.
+Howevever, this tool isn't bullet-proof, and a staging install of Friendica is recommended to test your class move without impairing your production server if you host one.
+
+Most of Friendica processes are run in the background, so make sure to turn on your debug log to check for errors that wouldn't show up while simply browsing Friendica.
+
+Check the class file for any magic constant `__FILE__` or `__DIR__`, as their value changed since you moved the class in the file tree.
+Most of the time it's used for debugging purposes but there can be instances where it's used to create cache folders for example.
+
+## Related
+
+* [Class autoloading](help/autoloader)
+* [Using Composer](help/Composer)
\ No newline at end of file
index 5568afeb5da9e64b04eed0005ba0b1141d4717bb..3cda8ab4662b96bac0a3a5c75b3c5df025cfe9e3 100644 (file)
@@ -52,7 +52,9 @@ Friendica uses [Composer](https://getcomposer.org) to manage dependencies librar
 
 It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application through `boot.php`.
 
+* [Class autoloading](help/autoloader)
 * [Using Composer](help/Composer)
+* [How To Move Classes to `src`](help/Developer-How-To-Move-Classes-to-src)
 
 ###Coding standards
 
index 5490d171f8f02c47a7ec35c2a379562399838117..4cecec44e3f2b46c095731426110af3ac390aef7 100644 (file)
@@ -36,21 +36,25 @@ Friendica Documentation and Resources
 
 **Developer Manual**
 
-* [Where to get started?](help/Developers-Intro)
-* [Help on Github](help/Github)
-* [Help on Vagrant](help/Vagrant)
-* [How to translate Friendica](help/translations)
-* [Bugs and Issues](help/Bugs-and-Issues)
-* [Plugin Development](help/Plugins)
-* [Theme Development](help/themes)
-* [Smarty 3 Templates](help/smarty3-templates)
-* [Protocol Documentation](help/Protocol)
-* [Database schema documantation](help/database)
-* [Class Autoloading](help/autoloader)
-* [Using Composer](help/Composer)
-* [Code - Reference(Doxygen generated - sets cookies)](doc/html/)
-* [Twitter/GNU Social API Functions](help/api)
-
+* [Get started](help/Developers-Intro)
+* Set up development environment
+       * [Help on Github](help/Github)
+       * [Help on Vagrant](help/Vagrant)
+       * [Bugs and Issues](help/Bugs-and-Issues)
+* Code structure
+       * [Plugin Development](help/Plugins)
+       * [Theme Development](help/themes)
+       * [Smarty 3 Templates](help/smarty3-templates)
+* How To
+       * [Translate Friendica](help/translations)
+       * [Use Composer](help/Composer)
+       * [Move classes to `src`](help/Developer-How-To-Move-Classes-to-src)
+* Reference
+       * [Twitter/GNU Social API Functions](help/api)
+       * [Code (Doxygen generated - sets cookies)](doc/html/)
+       * [Protocol Documentation](help/Protocol)
+       * [Database schema documantation](help/database)
+       * [Class Autoloading](help/autoloader)
 
 **External Resources**
 
index 83f1010440694cf0fb2109afcf86a11dedcc38ce..af76cf329969dafb3d02cc5d126f136306869557 100644 (file)
@@ -24,14 +24,14 @@ For more info about PHP autoloading, please refer to the [official PHP documenta
 Let's say you have a PHP file in `src/` that define a very useful class:\r
 \r
 ```php\r
-       // src/ItemsManager.php\r
-       <?php\r
-       namespace \Friendica;\r
-\r
-       class ItemsManager {\r
-               public function getAll() { ... }\r
-               public function getByID($id) { ... }\r
-       }\r
+// src/ItemsManager.php\r
+<?php\r
+namespace Friendica;\r
+\r
+class ItemsManager {\r
+       public function getAll() { ... }\r
+       public function getByID($id) { ... }\r
+}\r
 ```\r
 \r
 The class `ItemsManager` has been declared in the `Friendica` namespace.\r
@@ -43,16 +43,16 @@ In order for the Composer autoloader to work, it must first be included. In Frie
 The code will be something like:\r
 \r
 ```php\r
-       // mod/network.php\r
-       <?php\r
+// mod/network.php\r
+<?php\r
 \r
-       function network_content(App $a) {\r
-               $itemsmanager = new \Friendica\ItemsManager();\r
-               $items = $itemsmanager->getAll();\r
+function network_content(App $a) {\r
+       $itemsmanager = new Friendica\ItemsManager();\r
+       $items = $itemsmanager->getAll();\r
 \r
-               // pass $items to template\r
-               // return result\r
-       }\r
+       // pass $items to template\r
+       // return result\r
+}\r
 ```\r
 \r
 That's a quite simple example, but look: no `require()`!\r
@@ -61,132 +61,137 @@ If you need to use a class, you can simply use it and you don't need to do anyth
 Going further: now we have a bunch of `*Manager` classes that cause some code duplication, let's define a `BaseManager` class, where we move all common code between all managers:\r
 \r
 ```php\r
-       // src/BaseManager.php\r
-       <?php\r
-       namespace \Friendica;\r
+// src/BaseManager.php\r
+<?php\r
+namespace Friendica;\r
 \r
-       class BaseManager {\r
-               public function thatFunctionEveryManagerUses() { ... }\r
-       }\r
+class BaseManager {\r
+       public function thatFunctionEveryManagerUses() { ... }\r
+}\r
 ```\r
 \r
 and then let's change the ItemsManager class to use this code\r
 \r
 ```php\r
-       // src/ItemsManager.php\r
-       <?php\r
-       namespace \Friendica;\r
-\r
-       class ItemsManager extends BaseManager {\r
-               public function getAll() { ... }\r
-               public function getByID($id) { ... }\r
-       }\r
+// src/ItemsManager.php\r
+<?php\r
+namespace Friendica;\r
+\r
+class ItemsManager extends BaseManager {\r
+       public function getAll() { ... }\r
+       public function getByID($id) { ... }\r
+}\r
 ```\r
 \r
 Even though we didn't explicitly include the `src/BaseManager.php` file, the autoloader will when this class is first defined, because it is referenced as a parent class.\r
 It works with the "BaseManager" example here and it works when we need to call static methods:\r
 \r
 ```php\r
-       // src/Dfrn.php\r
-       <?php\r
-       namespace \Friendica;\r
+// src/Dfrn.php\r
+<?php\r
+namespace Friendica;\r
 \r
-       class Dfrn {\r
-               public static function  mail($item, $owner) { ... }\r
-       }\r
+class Dfrn {\r
+       public static function  mail($item, $owner) { ... }\r
+}\r
 ```\r
 \r
 ```php\r
-       // mod/mail.php\r
-       <?php\r
-\r
-       mail_post($a){\r
-               ...\r
-               \Friendica\dfrn::mail($item, $owner);\r
-               ...\r
-       }\r
+// mod/mail.php\r
+<?php\r
+\r
+mail_post($a){\r
+       ...\r
+       Friendica\dfrn::mail($item, $owner);\r
+       ...\r
+}\r
 ```\r
 \r
 If your code is in same namespace as the class you need, you don't need to prepend it:\r
 \r
 ```php\r
-       // include/delivery.php\r
-       <?php\r
-\r
-       namespace \Friendica;\r
-\r
-       // this is the same content of current include/delivery.php,\r
-       // but has been declared to be in "Friendica" namespace\r
-\r
-       [...]\r
-       switch($contact['network']) {\r
-               case NETWORK_DFRN:\r
-                       if ($mail) {\r
-                               $item['body'] = ...\r
-                               $atom = Dfrn::mail($item, $owner);\r
-                       } elseif ($fsuggest) {\r
-                               $atom = Dfrn::fsuggest($item, $owner);\r
-                               q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id']));\r
-                       } elseif ($relocate)\r
-                               $atom = Dfrn::relocate($owner, $uid);\r
-       [...]\r
+// include/delivery.php\r
+<?php\r
+\r
+namespace Friendica;\r
+\r
+// this is the same content of current include/delivery.php,\r
+// but has been declared to be in "Friendica" namespace\r
+\r
+[...]\r
+switch($contact['network']) {\r
+       case NETWORK_DFRN:\r
+               if ($mail) {\r
+                       $item['body'] = ...\r
+                       $atom = Dfrn::mail($item, $owner);\r
+               } elseif ($fsuggest) {\r
+                       $atom = Dfrn::fsuggest($item, $owner);\r
+                       q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id']));\r
+               } elseif ($relocate)\r
+                       $atom = Dfrn::relocate($owner, $uid);\r
+[...]\r
 ```\r
 \r
 This is the current code of `include/delivery.php`, and since the code is declared to be in the "Friendica" namespace, you don't need to write it when you need to use the "Dfrn" class.\r
 But if you want to use classes from another library, you need to use the full namespace, e.g.\r
 \r
 ```php\r
-       // src/Diaspora.php\r
-       <?php\r
+// src/Diaspora.php\r
+<?php\r
 \r
-       namespace \Friendica;\r
+namespace Friendica;\r
 \r
-       class Diaspora {\r
-               public function md2bbcode() {\r
-                       $html = \Michelf\MarkdownExtra::defaultTransform($text);\r
-               }\r
+class Diaspora {\r
+       public function md2bbcode() {\r
+               $html = \Michelf\MarkdownExtra::defaultTransform($text);\r
        }\r
+}\r
 ```\r
 \r
 if you use that class in many places of the code and you don't want to write the full path to the class every time, you can use the "use" PHP keyword\r
 \r
 ```php\r
-       // src/Diaspora.php\r
-       <?php\r
-       namespace \Friendica;\r
+// src/Diaspora.php\r
+<?php\r
+namespace Friendica;\r
 \r
-       use \Michelf\MarkdownExtra;\r
+use \Michelf\MarkdownExtra;\r
 \r
-       class Diaspora {\r
-               public function md2bbcode() {\r
-                       $html = MarkdownExtra::defaultTransform($text);\r
-               }\r
+class Diaspora {\r
+       public function md2bbcode() {\r
+               $html = MarkdownExtra::defaultTransform($text);\r
        }\r
+}\r
 ```\r
 \r
 Note that namespaces are like paths in filesystem, separated by "\", with the first "\" being the global scope.\r
 You can go deeper if you want to, like:\r
 \r
 ```\r
-       // src/Network/Dfrn.php\r
-    <?php\r
-    namespace \Friendica\Network;\r
+// src/Network/Dfrn.php\r
+<?php\r
+namespace Friendica\Network;\r
 \r
-    class Dfrn {\r
-    }\r
+class Dfrn {\r
+}\r
 ```\r
 \r
-Please note that the location of the file defining the class must be placed in the appropriate sub-folders of `src` if the namespace isn't plain `\Friendica`.\r
+Please note that the location of the file defining the class must be placed in the appropriate sub-folders of `src` if the namespace isn't plain `Friendica`.\r
 \r
 or\r
 \r
 ```\r
-       // src/Dba/Mysql\r
-    <?php\r
-    namespace \Friendica\Dba;\r
+// src/Dba/Mysql\r
+<?php\r
+namespace Friendica\Dba;\r
 \r
-    class Mysql {\r
-    }\r
+class Mysql {\r
+}\r
 ```\r
 \r
 So you can think of namespaces as folders in a Unix file system, with global scope as the root ("\").\r
+\r
+## Related\r
+\r
+* [Using Composer](help/Composer)\r
+* [How To Move Classes to `src`](help/Developer-How-To-Move-Classes-to-src)
\ No newline at end of file
index 6f662cdf151bb13ad620dfc1487290e5b9dd08f7..d8971abc35d5493cc9892ed33c08424ec58e941f 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 // Included here for completeness, but this is a very dangerous operation.
 // It is the caller's responsibility to confirm the requestor's intent and
 // authorisation to do this.
@@ -852,4 +854,3 @@ function account_type($contact) {
 
        return $account_type;
 }
-?>
index b0cdc3fe63b556ad6dc0a67a61efd427b0b4622b..9df6ac36c9dab238b3b2d61eb17ddb9b4eef3474 100644 (file)
@@ -81,4 +81,3 @@ class Emailer {
                return $res;
        }
 }
-?>
index c2a20df29faf069bd0b3fc987b33e3d12b918e7f..8f38ed3a38eac9e5f81d1f325c74abab2eeb4b58 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 /**
  * @file include/ForumManager.php
  * @brief ForumManager class with its methods related to forum functionality *
index 611860f9d08b68e9e115dc46d55d9cf6beb96230..bce65a092d94c08f24e186b7bb2a990ab952fbae 100644 (file)
@@ -24,7 +24,7 @@ class NotificationsManager {
         *
         * @param array $notes array of note arrays from db
         * @return array Copy of input array with added properties
-        * 
+        *
         * Set some extra properties to note array from db:
         *  - timestamp as int in default TZ
         *  - date_rel : relative date string
@@ -143,8 +143,7 @@ class NotificationsManager {
 
        /**
         * @brief List of pages for the Notifications TabBar
-        * 
-        * @param app $a The 
+        *
         * @return array with with notifications TabBar data
         */
        public function getTabs() {
@@ -191,7 +190,7 @@ class NotificationsManager {
 
        /**
         * @brief Format the notification query in an usable array
-        * 
+        *
         * @param array $notifs The array from the db query
         * @param string $ident The notifications identifier (e.g. network)
         * @return array
@@ -360,7 +359,7 @@ class NotificationsManager {
        }
 
        /**
-        * @brief Total number of network notifications 
+        * @brief Total number of network notifications
         * @param int|string $seen
         *      If 0 only include notifications into the query
         *      which aren't marked as "seen"
@@ -388,13 +387,13 @@ class NotificationsManager {
 
        /**
         * @brief Get network notifications
-        * 
+        *
         * @param int|string $seen
         *      If 0 only include notifications into the query
         *      which aren't marked as "seen"
         * @param int $start Start the query at this point
         * @param int $limit Maximum number of query results
-        * 
+        *
         * @return array with
         *      string 'ident' => Notification identifier
         *      int 'total' => Total number of available network notifications
@@ -436,7 +435,7 @@ class NotificationsManager {
        }
 
        /**
-        * @brief Total number of system notifications 
+        * @brief Total number of system notifications
         * @param int|string $seen
         *      If 0 only include notifications into the query
         *      which aren't marked as "seen"
@@ -460,13 +459,13 @@ class NotificationsManager {
 
        /**
         * @brief Get system notifications
-        * 
+        *
         * @param int|string $seen
         *      If 0 only include notifications into the query
         *      which aren't marked as "seen"
         * @param int $start Start the query at this point
         * @param int $limit Maximum number of query results
-        * 
+        *
         * @return array with
         *      string 'ident' => Notification identifier
         *      int 'total' => Total number of available system notifications
@@ -502,7 +501,7 @@ class NotificationsManager {
 
        /**
         * @brief Addional SQL query string for the personal notifications
-        * 
+        *
         * @return string The additional sql query
         */
        private function _personal_sql_extra() {
@@ -520,7 +519,7 @@ class NotificationsManager {
        }
 
        /**
-        * @brief Total number of personal notifications 
+        * @brief Total number of personal notifications
         * @param int|string $seen
         *      If 0 only include notifications into the query
         *      which aren't marked as "seen"
@@ -550,13 +549,13 @@ class NotificationsManager {
 
        /**
         * @brief Get personal notifications
-        * 
+        *
         * @param int|string $seen
         *      If 0 only include notifications into the query
         *      which aren't marked as "seen"
         * @param int $start Start the query at this point
         * @param int $limit Maximum number of query results
-        * 
+        *
         * @return array with
         *      string 'ident' => Notification identifier
         *      int 'total' => Total number of available personal notifications
@@ -573,13 +572,13 @@ class NotificationsManager {
                        $sql_seen = " AND `item`.`unseen` = 1 ";
 
                $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, `item`.`unseen`,
-                               `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` AS `object`, 
-                               `pitem`.`author-name` AS `pname`, `pitem`.`author-link` AS `plink`, `pitem`.`guid` AS `pguid` 
+                               `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` AS `object`,
+                               `pitem`.`author-name` AS `pname`, `pitem`.`author-link` AS `plink`, `pitem`.`guid` AS `pguid`
                        FROM `item` INNER JOIN `item` AS `pitem` ON  `pitem`.`id`=`item`.`parent`
                        WHERE `item`.`visible` = 1
                                $sql_extra
                                $sql_seen
-                               AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 
+                               AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0
                        ORDER BY `item`.`created` DESC LIMIT %d, %d " ,
                                intval(local_user()),
                                intval($start),
@@ -588,7 +587,7 @@ class NotificationsManager {
 
                if (dbm::is_result($r))
                        $notifs = $this->formatNotifs($r, $ident);
-               
+
                $arr = array (
                        'notifications' => $notifs,
                        'ident' => $ident,
@@ -599,7 +598,7 @@ class NotificationsManager {
        }
 
        /**
-        * @brief Total number of home notifications 
+        * @brief Total number of home notifications
         * @param int|string $seen
         *      If 0 only include notifications into the query
         *      which aren't marked as "seen"
@@ -626,13 +625,13 @@ class NotificationsManager {
 
        /**
         * @brief Get home notifications
-        * 
+        *
         * @param int|string $seen
         *      If 0 only include notifications into the query
         *      which aren't marked as "seen"
         * @param int $start Start the query at this point
         * @param int $limit Maximum number of query results
-        * 
+        *
         * @return array with
         *      string 'ident' => Notification identifier
         *      int 'total' => Total number of available home notifications
@@ -673,7 +672,7 @@ class NotificationsManager {
        }
 
        /**
-        * @brief Total number of introductions 
+        * @brief Total number of introductions
         * @param bool $all
         *      If false only include introductions into the query
         *      which aren't marked as ignored
@@ -698,13 +697,13 @@ class NotificationsManager {
 
        /**
         * @brief Get introductions
-        * 
+        *
         * @param bool $all
         *      If false only include introductions into the query
         *      which aren't marked as ignored
         * @param int $start Start the query at this point
         * @param int $limit Maximum number of query results
-        * 
+        *
         * @return array with
         *      string 'ident' => Notification identifier
         *      int 'total' => Total number of available introductions
@@ -749,7 +748,7 @@ class NotificationsManager {
 
        /**
         * @brief Format the notification query in an usable array
-        * 
+        *
         * @param array $intros The array from the db query
         * @return array with the introductions
         */
index 828dce82d7a33088c4bae02e1c350104a6e58114..504f7e94218b4288d1a987bea296e201b4a6c336 100644 (file)
@@ -4,6 +4,8 @@
  * @brief This file contains the Photo class for image processing
  */
 
+use Friendica\App;
+
 require_once("include/photos.php");
 
 class Photo {
index bed13fdf3df175c7e5d24f9c849b02aafdea55e0..85f64d29bc2e8a4f6d64842a5dc39e819e5daa42 100644 (file)
@@ -5,8 +5,9 @@
  *
  */
 
-use \Friendica\Core\Config;
-use \Friendica\Core\PConfig;
+use Friendica\App;
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
 
 require_once("include/feed.php");
 require_once('include/email.php');
@@ -1261,4 +1262,3 @@ class Probe {
        }
 
 }
-?>
index d67b92d8b00f60a4e38ab0664510adb794b336ae..f4de32f8f8db4f3609594461e4575bb091d9f98c 100644 (file)
@@ -5,6 +5,8 @@
  * @brief This file contains the Smilies class which contains functions to handle smiles
  */
 
+use Friendica\App;
+
 /**
  * This class contains functions to handle smiles
  */
@@ -13,13 +15,13 @@ class Smilies {
 
        /**
         * @brief Function to list all smilies
-        * 
+        *
         * Get an array of all smilies, both internal and from addons.
-        * 
+        *
         * @return array
         *      'texts' => smilie shortcut
         *      'icons' => icon in html
-        * 
+        *
         * @hook smilie ('texts' => smilies texts array, 'icons' => smilies html array)
         */
        public static function get_list() {
@@ -64,41 +66,41 @@ class Smilies {
                );
 
                $icons = array(
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-heart.gif" alt="&lt;3" title="&lt;3" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-brokenheart.gif" alt="&lt;/3" title="&lt;/3" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-brokenheart.gif" alt="&lt;\\3" title="&lt;\\3" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-smile.gif" alt=":-)" title=":-)" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-wink.gif" alt=";-)" title=";-)" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-frown.gif" alt=":-(" title=":-(" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" title=":-P" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-p" title=":-P" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" title=":-x" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" title=":-X" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" title=":-D"  />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" title="8-|" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" title="8-O" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" title="8-O" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" title="\\o/" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" title="o.O" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" title="O.o" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-Oo.gif" alt="o_O" title="o_O" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-Oo.gif" alt="O_o" title="O_o" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" title=":\'("/>',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" title=":-!" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" title=":-/" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-embarassed.gif" alt=":-[" title=":-[" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-cool.gif" alt="8-)" title="8-)" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/beer_mug.gif" alt=":beer" title=":beer" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" title=":homebrew" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/coffee.gif" alt=":coffee" title=":coffee" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" title=":facepalm" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/like.gif" alt=":like" title=":like" />',
-               '<img class="smiley" src="' . app::get_baseurl() . '/images/dislike.gif" alt=":dislike" title=":dislike" />',
-               '<a href="http://friendica.com">~friendica <img class="smiley" src="' . app::get_baseurl() . '/images/friendica-16.png" alt="~friendica" title="~friendica" /></a>',
-               '<a href="http://redmatrix.me/">red<img class="smiley" src="' . app::get_baseurl() . '/images/rm-16.png" alt="red#" title="red#" />matrix</a>',
-               '<a href="http://redmatrix.me/">red<img class="smiley" src="' . app::get_baseurl() . '/images/rm-16.png" alt="red#matrix" title="red#matrix" />matrix</a>'
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-heart.gif" alt="&lt;3" title="&lt;3" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-brokenheart.gif" alt="&lt;/3" title="&lt;/3" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-brokenheart.gif" alt="&lt;\\3" title="&lt;\\3" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-smile.gif" alt=":-)" title=":-)" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-wink.gif" alt=";-)" title=";-)" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-frown.gif" alt=":-(" title=":-(" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" title=":-P" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-p" title=":-P" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" title=":-x" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" title=":-X" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" title=":-D"  />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" title="8-|" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" title="8-O" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" title="8-O" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" title="\\o/" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" title="o.O" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" title="O.o" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-Oo.gif" alt="o_O" title="o_O" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-Oo.gif" alt="O_o" title="O_o" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" title=":\'("/>',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" title=":-!" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" title=":-/" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-embarassed.gif" alt=":-[" title=":-[" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-cool.gif" alt="8-)" title="8-)" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/beer_mug.gif" alt=":beer" title=":beer" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" title=":homebrew" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/coffee.gif" alt=":coffee" title=":coffee" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" title=":facepalm" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/like.gif" alt=":like" title=":like" />',
+               '<img class="smiley" src="' . App::get_baseurl() . '/images/dislike.gif" alt=":dislike" title=":dislike" />',
+               '<a href="http://friendica.com">~friendica <img class="smiley" src="' . App::get_baseurl() . '/images/friendica-16.png" alt="~friendica" title="~friendica" /></a>',
+               '<a href="http://redmatrix.me/">red<img class="smiley" src="' . App::get_baseurl() . '/images/rm-16.png" alt="red#" title="red#" />matrix</a>',
+               '<a href="http://redmatrix.me/">red<img class="smiley" src="' . App::get_baseurl() . '/images/rm-16.png" alt="red#matrix" title="red#matrix" />matrix</a>'
                );
 
                $params = array('texts' => $texts, 'icons' => $icons);
@@ -121,7 +123,7 @@ class Smilies {
         *
         * @param string $s
         * @param boolean $sample
-        * 
+        *
         * @return string HML Output of the Smilie
         */
        public static function replace($s, $sample = false) {
@@ -166,7 +168,7 @@ class Smilies {
         *
         * @param string $x
         * @return string HTML Output
-        * 
+        *
         * @todo: Rework because it doesn't work correctly
         */
        private function preg_heart($x) {
@@ -174,7 +176,7 @@ class Smilies {
                        return $x[0];
                $t = '';
                for($cnt = 0; $cnt < strlen($x[1]); $cnt ++)
-                       $t .= '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-heart.gif" alt="&lt;3" />';
+                       $t .= '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-heart.gif" alt="&lt;3" />';
                $r =  str_replace($x[0],$t,$x[0]);
                return $r;
        }
index fbe5d1e6929910fef54479bedcad7638327996ae..c7c6bb206aaf5a6d12ba1940792e9657586ee90e 100644 (file)
@@ -4,6 +4,8 @@
  * @file include/acl_selectors.php
  */
 
+use Friendica\App;
+
 require_once "include/contact_selectors.php";
 require_once "include/contact_widgets.php";
 require_once "include/DirSearch.php";
index f68c1bb9e662340b82818eb052de2c2813bb1cd7..fc38f1bc80198329a28e2a1044eae3062b58c1cc 100644 (file)
@@ -6,7 +6,8 @@
  * @todo Automatically detect if incoming data is HTML or BBCode
  */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once 'include/HTTPExceptions.php';
 require_once 'include/bbcode.php';
index c1a6120dbbcf6258e66458b2950ef5bb63c29724..5dfe9d3e062aa7865ab5a9f8db87412d438b986f 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once('include/security.php');
 require_once('include/datetime.php');
index 8ee3af8e2be23148342d2eb84bcffb6707ba8da4..9211c5baf091b782119b5da50382ad3e8f7a16b6 100755 (executable)
@@ -32,6 +32,8 @@
  *
  */
 
+use Friendica\App;
+
 if (sizeof($_SERVER["argv"]) == 0)
        die();
 
@@ -47,8 +49,9 @@ require_once("boot.php");
 
 global $a, $db;
 
-if (is_null($a))
-       $a = new App;
+if (is_null($a)) {
+       $a = new App(dirname(__DIR__));
+}
 
 if (is_null($db)) {
        @include(".htconfig.php");
@@ -332,4 +335,3 @@ class exAuth {
                        fclose($this->rLogFile);
        }
 }
-?>
index a07a583538e4ac5e88b1613ff765c50837c83846..1dc775887ebf3e2936c2c0fbbc2bbd98c92a36ed 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 use League\HTMLToMarkdown\HtmlConverter;
 
 require_once "include/oembed.php";
index 2715334e46b0712f39aa5e2f514eedc81599c81c..d891f23dae4c07f5c4c8091e0a2a5e898130d544 100644 (file)
@@ -1,5 +1,7 @@
 <?php
-use \Friendica\Core\Config;
+
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once 'include/oembed.php';
 require_once 'include/event.php';
index 98799bcf40ff904c70c7b08910b72005b221be63..b56906c54492d95033e073df544ab61505b6029a 100644 (file)
@@ -5,8 +5,8 @@
  * @brief Class for storing data for a short time
  */
 
-use \Friendica\Core\Config;
-use \Friendica\Core\PConfig;
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
 
 class Cache {
        /**
@@ -121,9 +121,9 @@ class Cache {
 
        /**
         * @brief Put data in the cache according to the key
-        * 
+        *
         * The input $value can have multiple formats.
-        * 
+        *
         * @param string $key The key to the cached data
         * @param mixed $valie The value that is about to be stored
         * @param integer $duration The cache lifespan
index 557d08c28874aaed1a0dff85d46883fb46a504f1..01ee90f421b538a9e3231e57c67e7f8f38087965 100644 (file)
@@ -1,6 +1,7 @@
 <?php /** @file */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once('boot.php');
 
@@ -11,7 +12,7 @@ function cli_startup() {
        global $a, $db;
 
        if (is_null($a)) {
-               $a = new App;
+               $a = new App(dirname(__DIR__));
        }
 
        if (is_null($db)) {
index c51db4ec7b1f7fc9f550bdf3818014553a5e9ec1..1c8b119bcc989ee8be13fa656198d09abc7a83fc 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * @file include/config.php
- * 
+ *
  *  @brief (Deprecated) Arbitrary configuration storage
  * Note:
  * Please do not store booleans - convert to 0/1 integer values
@@ -12,8 +12,8 @@
  * configurations need to be fixed as of 10/08/2011.
  */
 
-use \Friendica\Core\Config;
-use \Friendica\Core\PConfig;
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
 
 /**
  * @brief (Deprecated) Loads all configuration values of family into a cached storage.
index 5dd3a8bb4b163996d597902adff6f99b741f07a3..db077b420ff32ca441690fcd4c6431b08b9c1b22 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function follow_widget($value = "") {
 
        return replace_macros(get_markup_template('follow.tpl'), array(
index 64204c696fd7afbb99635001e03cace994a98a60..27f9578ed8009b9f7bfc3fe8ff0df801a2c64cd3 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 
+use Friendica\App;
+
 require_once "include/bbcode.php";
 require_once "include/acl_selectors.php";
 
-
 /*
  * Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
  * is identical to the code in mod/message.php for 'item_extract_images' and
index 98db23f9effb1cd14aad0263d6e63941e359b07c..29222de5e76cf8b497f9236721136f7956072c4f 100644 (file)
@@ -17,4 +17,3 @@ function create_shadowentry_run($argv, $argc) {
 
        add_shadow_entry($message_id);
 }
-?>
index c4299dd4c2eea874671b6fc0df4baf69ad2daf01..bac9c8a3d8827e40b678dde262aeaeedbd3e9120 100644 (file)
@@ -1,5 +1,6 @@
 <?php
-use \Friendica\Core\Config;
+
+use Friendica\Core\Config;
 
 function cron_run(&$argv, &$argc){
        global $a;
index a519dee22433650e5839d6e4ed71e53f06dcd408..2c378aa39c059b71822238573f4de3bd25fafca7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 function cronhooks_run(&$argv, &$argc) {
        global $a;
index 79ee32bb37f0224f4be80e76b0a2ea1fba160c01..ee1ac517acbe91d3038bdbbc3716c0e4efd545aa 100644 (file)
@@ -1,5 +1,7 @@
 <?php
-use \Friendica\Core\Config;
+
+use Friendica\App;
+use Friendica\Core\Config;
 
 function cronjobs_run(&$argv, &$argc){
        global $a;
index a840aa0a58492a6f49ce34d794d6b841d614e68c..3578698240053115ea3c5f9738ee98deb082bdd0 100644 (file)
@@ -4,7 +4,7 @@
  * @brief Some functions for date and time related tasks.
  */
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 /**
  * @brief Two-level sort for timezones.
@@ -34,7 +34,7 @@ function timezone_cmp($a, $b) {
 
 /**
  * @brief Emit a timezone selector grouped (primarily) by continent
- * 
+ *
  * @param string $current Timezone
  * @return string Parsed HTML output
  */
@@ -81,17 +81,17 @@ function select_timezone($current = 'America/Los_Angeles') {
 
 /**
  * @brief Generating a Timezone selector
- * 
+ *
  * Return a select using 'field_select_raw' template, with timezones
  * groupped (primarily) by continent
  * arguments follow convetion as other field_* template array:
  * 'name', 'label', $value, 'help'
- * 
+ *
  * @param string $name Name of the selector
  * @param string $label Label for the selector
  * @param string $current Timezone
  * @param string $help Help text
- * 
+ *
  * @return string Parsed HTML
  */
 function field_timezone($name='timezone', $label='', $current = 'America/Los_Angeles', $help){
@@ -114,7 +114,7 @@ function field_timezone($name='timezone', $label='', $current = 'America/Los_Ang
  * @param string $s Some parseable date/time string
  * @param string $fmt Output format recognised from php's DateTime class
  *   http://www.php.net/manual/en/datetime.format.php
- * 
+ *
  * @return string Formatted date according to given format
  */
 function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d H:i:s") {
@@ -212,7 +212,7 @@ function dob($dob) {
 
 /**
  * @brief Returns a date selector
- * 
+ *
  * @param string $format
  *  Format string, e.g. 'ymd' or 'mdy'. Not currently supported
  * @param string $min
@@ -223,7 +223,7 @@ function dob($dob) {
  *  Unix timestamp of default date
  * @param string $id
  *  ID and name of datetimepicker (defaults to "datetimepicker")
- * 
+ *
  * @return string Parsed HTML output.
  */
 function datesel($format, $min, $max, $default, $id = 'datepicker') {
@@ -232,7 +232,7 @@ function datesel($format, $min, $max, $default, $id = 'datepicker') {
 
 /**
  * @brief Returns a time selector
- * 
+ *
  * @param string $format
  *  Format string, e.g. 'ymd' or 'mdy'. Not currently supported
  * @param $h
@@ -241,7 +241,7 @@ function datesel($format, $min, $max, $default, $id = 'datepicker') {
  *  Already selected minute
  * @param string $id
  *  ID and name of datetimepicker (defaults to "timepicker")
- * 
+ *
  * @return string Parsed HTML output.
  */
 function timesel($format, $h, $m, $id = 'timepicker') {
@@ -270,7 +270,7 @@ function timesel($format, $h, $m, $id = 'timepicker') {
  * @param $maxfrom
  *  set maximum date from picker with id $maxfrom (none by default)
  * @param bool $required default false
- * 
+ *
  * @return string Parsed HTML output.
  *
  * @todo Once browser support is better this could probably be replaced with
@@ -417,7 +417,7 @@ function relative_date($posted_date, $format = null) {
  * @param string $dob Date of Birth
  * @param string $owner_tz (optional) Timezone of the person of interest
  * @param string $viewer_tz (optional) Timezone of the person viewing
- * 
+ *
  * @return int Age in years
  */
 function age($dob, $owner_tz = '', $viewer_tz = '') {
@@ -452,7 +452,7 @@ function age($dob, $owner_tz = '', $viewer_tz = '') {
  *
  * @param int $y Year
  * @param int $m Month (1=January, 12=December)
- * 
+ *
  * @return int Number of days in the given month
  */
 function get_dim($y, $m) {
@@ -477,7 +477,7 @@ function get_dim($y, $m) {
  *
  * @param int $y Year
  * @param int $m Month (1=January, 12=December)
- * 
+ *
  * @return string day 0 = Sunday through 6 = Saturday
  */
 function get_first_dim($y,$m) {
@@ -498,7 +498,7 @@ function get_first_dim($y,$m) {
  * @param int $m Month
  * @param bool $links (default false)
  * @param string $class
- * 
+ *
  * @return string
  *
  * @todo Provide (prev,next) links, define class variations for different size calendars
index 64ceb51d37bc58060c29f53b06ad1b9457e86345..f31bfef8abbb91ff0136d947ae58b8e2ac7085d5 100644 (file)
@@ -4,7 +4,7 @@
  * @brief The script is called from time to time to clean the database entries and remove orphaned data.
  */
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 function dbclean_run(&$argv, &$argc) {
        if (!Config::get('system', 'dbclean', false)) {
@@ -149,4 +149,3 @@ function remove_orphans($stage = 0) {
        }
 
 }
-?>
index 3430577da6a05665b0e93445f0b973c9745e216f..db50dae89c95eefe8796aeb4ddd835491278b75e 100644 (file)
@@ -110,4 +110,3 @@ class dbm {
                return date('Y-m-d H:i:s', $timestamp);
        }
 }
-?>
index 993ddad40fcf7948eb7bebba14728b7d51958d24..6a14220c241bcdef90757555074e3a0a000da964 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once("boot.php");
 require_once("include/text.php");
@@ -1745,7 +1746,7 @@ function dbstructure_run(&$argv, &$argc) {
        global $a, $db;
 
        if (is_null($a)) {
-               $a = new App;
+               $a = new App(dirname(__DIR__));
        }
 
        if (is_null($db)) {
index 725eca737045865d85ff2ec2ecf55ecbad250b68..799ca262c837b4229b80b3b464bd3bf5f6ac1624 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 function dbupdate_run(&$argv, &$argc) {
        global $a;
index faa1cad6745d45667f4a3e393006f92f6a06772d..3aecf3b7233bbc8fa362e5319ad93f1ef427131a 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once('include/queue_fn.php');
 require_once('include/html2plain.php');
index 5977ed9a0c254c044516c70035bb1acf1b0a963a..7e4d7af2bcceabe423bbe911fab8739b9eca6b2b 100644 (file)
@@ -7,6 +7,8 @@
  * https://github.com/friendica/friendica/blob/master/spec/dfrn2.pdf
  */
 
+use Friendica\App;
+
 require_once("include/Contact.php");
 require_once("include/ostatus.php");
 require_once("include/enotify.php");
@@ -370,7 +372,7 @@ class dfrn {
                $ext = Photo::supportedTypes();
 
                foreach ($rp as $p) {
-                       $photos[$p['scale']] = app::get_baseurl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
+                       $photos[$p['scale']] = App::get_baseurl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
                }
 
                unset($rp, $ext);
@@ -431,7 +433,7 @@ class dfrn {
                $root->setAttribute("xmlns:ostatus", NAMESPACE_OSTATUS);
                $root->setAttribute("xmlns:statusnet", NAMESPACE_STATUSNET);
 
-               xml::add_element($doc, $root, "id", app::get_baseurl()."/profile/".$owner["nick"]);
+               xml::add_element($doc, $root, "id", App::get_baseurl()."/profile/".$owner["nick"]);
                xml::add_element($doc, $root, "title", $owner["name"]);
 
                $attributes = array("uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION);
@@ -448,13 +450,13 @@ class dfrn {
                        // DFRN itself doesn't uses this. But maybe someone else wants to subscribe to the public feed.
                        ostatus::hublinks($doc, $root);
 
-                       $attributes = array("rel" => "salmon", "href" => app::get_baseurl()."/salmon/".$owner["nick"]);
+                       $attributes = array("rel" => "salmon", "href" => App::get_baseurl()."/salmon/".$owner["nick"]);
                        xml::add_element($doc, $root, "link", "", $attributes);
 
-                       $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => app::get_baseurl()."/salmon/".$owner["nick"]);
+                       $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => App::get_baseurl()."/salmon/".$owner["nick"]);
                        xml::add_element($doc, $root, "link", "", $attributes);
 
-                       $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => app::get_baseurl()."/salmon/".$owner["nick"]);
+                       $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => App::get_baseurl()."/salmon/".$owner["nick"]);
                        xml::add_element($doc, $root, "link", "", $attributes);
                }
 
@@ -511,7 +513,7 @@ class dfrn {
                }
 
                xml::add_element($doc, $author, "name", $owner["name"], $attributes);
-               xml::add_element($doc, $author, "uri", app::get_baseurl().'/profile/'.$owner["nickname"], $attributes);
+               xml::add_element($doc, $author, "uri", App::get_baseurl().'/profile/'.$owner["nickname"], $attributes);
                xml::add_element($doc, $author, "dfrn:handle", $owner["addr"], $attributes);
 
                $attributes = array("rel" => "photo", "type" => "image/jpeg",
@@ -812,7 +814,7 @@ class dfrn {
                        $parent = q("SELECT `guid` FROM `item` WHERE `id` = %d", intval($item["parent"]));
                        $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
                        $attributes = array("ref" => $parent_item, "type" => "text/html",
-                                               "href" => app::get_baseurl().'/display/'.$parent[0]['guid'],
+                                               "href" => App::get_baseurl().'/display/'.$parent[0]['guid'],
                                                "dfrn:diaspora_guid" => $parent[0]['guid']);
                        xml::add_element($doc, $entry, "thr:in-reply-to", "", $attributes);
                }
@@ -854,7 +856,7 @@ class dfrn {
 
                // We save this value in "plink". Maybe we should read it from there as well?
                xml::add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html",
-                                                               "href" => app::get_baseurl()."/display/".$item["guid"]));
+                                                               "href" => App::get_baseurl()."/display/".$item["guid"]));
 
                // "comment-allow" is some old fashioned stuff for old Friendica versions.
                // It is included in the rewritten code for completeness
index 0c3ff68da46c0cba78f7123149da574ee82ee1ec..51b496f86f6e6157436bf4efeba5553d21e53c97 100644 (file)
@@ -8,7 +8,8 @@
  * This will change in the future.
  */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once 'include/items.php';
 require_once 'include/bb2diaspora.php';
@@ -3819,4 +3820,3 @@ class Diaspora {
                return true;
        }
 }
-?>
index 41a3dd784c0b1876807ab81a9d9e06cd83098843..e507a939f8cd36ef37e3ed7cceec44bd49253b99 100644 (file)
@@ -1,9 +1,9 @@
 <?php
-/// @TODO no longer used?
-use \Friendica\Core\Config;
+
+use Friendica\Core\Config;
 
 function directory_run(&$argv, &$argc){
-       $dir = get_config('system', 'directory');
+       $dir = Config::get('system', 'directory');
 
        if (!strlen($dir)) {
                return;
index ff97b0e592913a6b1bdce9bba502d6e461497eef..e371080d19f99eed9bb8dff9b4353d6dd1aa954f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 require_once('include/socgraph.php');
 require_once('include/datetime.php');
index f86174bd40109826025f5fe96f7b57a6f9e6087c..e351f0d115c37ec41c5f5bdb842fce45a37de59f 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once('include/Emailer.php');
 require_once('include/email.php');
 require_once('include/bbcode.php');
index 64b1ebddc3c4a4008ce11e2f4c82c5050063622a..afb8ea755bc8bc04649a4802c08005ac7a6dd3a4 100644 (file)
@@ -4,6 +4,8 @@
  * @brief functions specific to event handling
  */
 
+use Friendica\App;
+
 require_once 'include/bbcode.php';
 require_once 'include/map.php';
 require_once 'include/datetime.php';
@@ -535,7 +537,7 @@ function get_event_strings() {
  *
  * @param array $dates Array of possibly duplicated events
  * @return array Cleaned events
- * 
+ *
  * @todo We should replace this with a separate update function if there is some time left
  */
 function event_remove_duplicates($dates) {
index 098125a79864efb3315fe75ebd2319b6eca5a0de..da121157d21d5ed22454b33d4e76b26dea7d767e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 function expire_run(&$argv, &$argc){
        global $a;
index 32044e663e7113f8eda3834ef986579de5378df9..cfef6d4ad03deb12b562840dfec395a827601eb9 100644 (file)
@@ -366,4 +366,3 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
                return array("header" => $author, "items" => $items);
        }
 }
-?>
index c20a6d832d6898b3356eef1f705cc27a77d392ca..0ac0078c859272b99f0db46b26d8c04866cd9193 100644 (file)
@@ -47,4 +47,3 @@ function update_files_for_items() {
                create_files_from_item($message["id"]);
        }
 }
-?>
index 57520abe602291011acfb8ca67eeb931442f698c..161e669e949bb26480e07521528aa02b9820125d 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once("include/Scrape.php");
 require_once("include/socgraph.php");
 require_once('include/group.php');
index e79cc64764a3265211bf4f4458cbaeb39e77aff8..55ce4c70615a37b628a5bff563d95fdd93773bcd 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 require_once('include/Scrape.php');
 require_once('include/socgraph.php');
index c14629b895ed52bff01ab0f8b5788fdf55bdd736..1deab951958ac3a6750ac956a2289af6be3581e5 100644 (file)
@@ -325,4 +325,3 @@ function html2bbcode($message)
 
        return $message;
 }
-?>
index dc2cb137c49358e986f513860c5dda7d8f2b049e..ed338ce71002672c6fbf217941e98eba125efc96 100644 (file)
@@ -233,4 +233,3 @@ function html2plain($html, $wraplength = 75, $compact = false)
 
        return(trim($message));
 }
-?>
index 1fea5b25d659880ed1e07cb4c501f53c364b4d62..dea044b48ee1f40cb5e233a63bf16a54b339a7e9 100644 (file)
@@ -3,6 +3,8 @@
  * @file include/identity.php
  */
 
+use Friendica\App;
+
 require_once('include/ForumManager.php');
 require_once('include/bbcode.php');
 require_once("mod/proxy.php");
index 5eac12d8914df6300969614a304dda8d214e04e5..3c5e88a38ac8cff30a7ad8e85de6b4990515b322 100644 (file)
@@ -4,7 +4,8 @@
  * @file include/items.php
  */
 
-use \Friendica\ParseUrl;
+use Friendica\App;
+use Friendica\ParseUrl;
 
 require_once 'include/bbcode.php';
 require_once 'include/oembed.php';
@@ -339,7 +340,7 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) {
  * Adds a "lang" specification in a "postopts" element of given $arr,
  * if possible and not already present.
  * Expects "body" element to exist in $arr.
- * 
+ *
  * @todo Add a parameter to request forcing override
  */
 function item_add_language_opt(&$arr) {
index a53b90c0398ce11f215ad1b9d660eb6fbf0c2c01..4f26002719dcb1fabd5f143dddfce320d7ee3d3b 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once("include/diaspora.php");
 
 /**
index 3d5d4d33ab97daaafe07576260ecc7a77c7dfcab..b857bd604b9bafab31bfde24842563ec8fe21a42 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 
-       // send a private message
-
-
+// send a private message
 
+use Friendica\App;
 
 function send_message($recipient=0, $body='', $subject='', $replyto=''){
 
index 3b5ed5487de87d1837cba6c4c7db3259b572244f..50eb46368fd56730b711ae66e206f62f9a2a5dd6 100644 (file)
@@ -187,7 +187,7 @@ function removelinebreak($message)
                                (substr(trim($nextline), 0, 7) == 'http://') or
                                (substr(trim($nextline), 0, 8) == 'https://'));
 
-               if (!$specialchars) 
+               if (!$specialchars)
                        $specialchars = ((substr(rtrim($line), -1) == '-') or
                                        (substr(rtrim($line), -1) == '=') or
                                        (substr(rtrim($line), -1) == '*') or
@@ -222,4 +222,3 @@ function removelinebreak($message)
        return(implode("\n", $lines));
 
 }
-?>
index fe4c50818ea583c3e02768b8b4ead0866fdb9422..e2633be0af5eb3dc2ea18d3fa5b2dbc1f0b3a521 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function nav(App $a) {
 
        /*
index 752920e424bff876df359d87bf6fb4db882378bb..72d3ce626c14c473913785e963cc033e40d89f49 100644 (file)
@@ -4,7 +4,8 @@
  * @file include/network.php
  */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once("include/xml.php");
 require_once('include/Probe.php');
index 370611b4eb438aaf69509aee01622e80d15436a9..ad89eacb6d8eb4c99c6f61b281790275a376678d 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once('include/queue_fn.php');
 require_once('include/html2plain.php');
index 3d4533d3e0061da5a4a8e1af01d9c2d0629ee82a..f67e3d2b704df539e39cfd320ead71c555948562 100644 (file)
@@ -5,6 +5,8 @@
  *
  */
 
+use Friendica\App;
+
 define('REQUEST_TOKEN_DURATION', 300);
 define('ACCESS_TOKEN_DURATION', 31536000);
 
@@ -61,13 +63,13 @@ class FKOAuthDataStore extends OAuthDataStore {
                logger(__function__.":".$consumer.", ". $callback);
                $key = $this->gen_token();
                $sec = $this->gen_token();
-               
+
                if ($consumer->key){
                        $k = $consumer->key;
                } else {
                        $k = $consumer;
                }
-               
+
                $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP()+%d)",
                                dbesc($key),
                                dbesc($sec),
@@ -80,19 +82,19 @@ class FKOAuthDataStore extends OAuthDataStore {
 
   function new_access_token($token, $consumer, $verifier = null) {
     logger(__function__.":".$token.", ". $consumer.", ". $verifier);
-    
+
     // return a new access token attached to this consumer
     // for the user associated with this token if the request token
     // is authorized
     // should also invalidate the request token
-    
+
     $ret=Null;
-    
+
     // get user for this verifier
     $uverifier = get_config("oauth", $verifier);
     logger(__function__.":".$verifier.",".$uverifier);
     if (is_null($verifier) || ($uverifier!==false)){
-               
+
                $key = $this->gen_token();
                $sec = $this->gen_token();
                $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP()+%d, %d)",
@@ -103,13 +105,13 @@ class FKOAuthDataStore extends OAuthDataStore {
                                intval(ACCESS_TOKEN_DURATION),
                                intval($uverifier));
                if ($r)
-                       $ret = new OAuthToken($key,$sec);               
+                       $ret = new OAuthToken($key,$sec);
        }
-               
-               
+
+
        q("DELETE FROM tokens WHERE id='%s'", $token->key);
-       
-       
+
+
        if (!is_null($ret) && $uverifier!==false){
                del_config("oauth", $verifier);
        /*      $apps = get_pconfig($uverifier, "oauth", "apps");
@@ -117,9 +119,9 @@ class FKOAuthDataStore extends OAuthDataStore {
                $apps[] = $consumer->key;
                set_pconfig($uverifier, "oauth", "apps", $apps);*/
        }
-               
+
     return $ret;
-    
+
   }
 }
 
@@ -172,9 +174,9 @@ class FKOAuth1 extends OAuthServer {
                        intval($_SESSION['uid'])
                );
 
-               call_hooks('logged_in', $a->user);              
+               call_hooks('logged_in', $a->user);
        }
-       
+
 }
 /*
 class FKOAuth2 extends OAuth2 {
@@ -190,13 +192,13 @@ class FKOAuth2 extends OAuth2 {
                        dbesc($client_secret),
                        dbesc($redirect_uri)
                );
-                 
+
                return $r;
        }
 
        protected function checkClientCredentials($client_id, $client_secret = NULL) {
                $client_secret = $this->db_secret($client_secret);
-               
+
                $r = q("SELECT pw FROM clients WHERE client_id = '%s'",
                        dbesc($client_id));
 
@@ -218,21 +220,21 @@ class FKOAuth2 extends OAuth2 {
        protected function getAccessToken($oauth_token) {
                $r = q("SELECT client_id, expires, scope FROM tokens WHERE id = '%s'",
                                dbesc($oauth_token));
-       
+
                if (dbm::is_result($r))
                        return $r[0];
                return null;
        }
 
 
-       
+
        protected function setAccessToken($oauth_token, $client_id, $expires, $scope = NULL) {
                $r = q("INSERT INTO tokens (id, client_id, expires, scope) VALUES ('%s', '%s', %d, '%s')",
                                dbesc($oauth_token),
                                dbesc($client_id),
                                intval($expires),
                                dbesc($scope));
-                               
+
                return $r;
        }
 
@@ -246,23 +248,23 @@ class FKOAuth2 extends OAuth2 {
        protected function getAuthCode($code) {
                $r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'",
                                dbesc($code));
-               
+
                if (dbm::is_result($r))
                        return $r[0];
                return null;
        }
 
        protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) {
-               $r = q("INSERT INTO auth_codes 
-                                       (id, client_id, redirect_uri, expires, scope) VALUES 
+               $r = q("INSERT INTO auth_codes
+                                       (id, client_id, redirect_uri, expires, scope) VALUES
                                        ('%s', '%s', '%s', %d, '%s')",
                                dbesc($code),
                                dbesc($client_id),
                                dbesc($redirect_uri),
                                intval($expires),
                                dbesc($scope));
-               return $r;        
-       }       
-       
+               return $r;
+       }
+
 }
 */
index 0b8b713667e7aa1faede525a5a08db1b07b03c0b..80b49fbf046c7095c9724a1e550bc75ed890ab91 100755 (executable)
@@ -4,8 +4,9 @@
  * @file include/oembed.php
  */
 
-use \Friendica\ParseUrl;
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\ParseUrl;
+use Friendica\Core\Config;
 
 function oembed_replacecb($matches){
        $embedurl=$matches[1];
index 5227b61a1ab118a3066247d631b7b8677776c584..3483d24930cec6b3fe61c43797c6768deab467b9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 require_once('include/follow.php');
 
index 7644eacc094ab434f72fd74c209a2958574b06b0..c3bdadf55b9522a714dc8ceaceb32ddc53d69d61 100644 (file)
@@ -3,7 +3,8 @@
  * @file include/ostatus.php
  */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once("include/Contact.php");
 require_once("include/threads.php");
@@ -2192,7 +2193,7 @@ class ostatus {
        /**
         * @brief Creates the XML feed for a given nickname
         *
-        * @param app $a The application class
+        * @param App $a The application class
         * @param string $owner_nick Nickname of the feed owner
         * @param string $last_update Date of the last update
         *
@@ -2288,4 +2289,3 @@ class ostatus {
                return(trim($doc->saveXML()));
        }
 }
-?>
index b42dcec119c76ca02af9e738627df22e2db60fb4..9b541e8e3c77f6fe1cc3bd776a0490145af3ffe7 100644 (file)
@@ -10,7 +10,7 @@
  *
  */
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 require_once("include/dba.php");
 
index e872532a481ae78dd882f5532c6fb36a8fb77c6f..38cda3f2bab189399d1c437f33fa10fa27be788e 100644 (file)
@@ -4,8 +4,8 @@
  * @brief Functions related to photo handling.
  */
 
-use \Friendica\Core\Config;
-use \Friendica\Core\PConfig;
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
 
 function getGps($exifCoord, $hemi) {
        $degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0;
index 3093e149aeb869acc2c35ca0a49e9087642e7cb6..dda6b3e9c130827c3469e5ef650bd15177bdb7bf 100644 (file)
@@ -38,4 +38,3 @@ class pidfile {
                        return(posix_kill(file_get_contents($this->_file), SIGTERM));
        }
 }
-?>
index 6ab4ec77d6c9120adcd6213e65b40d2b02d13246..215d9f3db726a2e722a2da8f67400462c61fd08c 100644 (file)
@@ -4,7 +4,8 @@
  * @file include/plaintext.php
  */
 
-use \Friendica\ParseUrl;
+use Friendica\App;
+use Friendica\ParseUrl;
 
 require_once("include/Photo.php");
 require_once("include/bbcode.php");
@@ -431,4 +432,3 @@ function plaintext(App $a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2
 
        return($post);
 }
-?>
index 83f6f1ab9502a1f5b34e8c0039169b0d007d959a..336b213aa3491324db2582196159a628822dbdb3 100644 (file)
@@ -1,10 +1,11 @@
 <?php
 /**
  * @file include/plugin.php
- * 
+ *
  * @brief Some functions to handle addons and themes.
  */
 
+use Friendica\App;
 
 /**
  * @brief uninstalls an addon.
@@ -164,7 +165,7 @@ function register_hook($hook,$file,$function,$priority=0) {
 
 /**
  * @brief unregisters a hook.
- * 
+ *
  * @param string $hook the name of the hook
  * @param string $file the name of the file that hooks into
  * @param string $function the name of the function that the hook called
@@ -325,7 +326,7 @@ function get_plugin_info($plugin){
 
 /**
  * @brief Parse theme comment in search of theme infos.
- * 
+ *
  * like
  * \code
  * ..* Name: My Theme
@@ -545,11 +546,11 @@ function upgrade_bool_message($bbcode = false) {
 
 /**
  * @brief Get the full path to relevant theme files by filename
- * 
+ *
  * This function search in the theme directory (and if not present in global theme directory)
  * if there is a directory with the file extension and  for a file with the given
- * filename. 
- * 
+ * filename.
+ *
  * @param string $file Filename
  * @param string $root Full root path
  * @return string Path to the file or empty string if the file isn't found
index 8f9f5aa24debfd6599916d713cdeb26f9c04db2e..08e71fd486b69c23b68b52ee3e560b715e25c2e8 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+
+use Friendica\App;
+use Friendica\Core\Config;
+
 if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
        $directory = dirname($_SERVER["argv"][0]);
 
@@ -10,15 +14,13 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
        chdir($directory);
 }
 
-use \Friendica\Core\Config;
-
 require_once("boot.php");
 
 function poller_run($argv, $argc){
        global $a, $db;
 
-       if(is_null($a)) {
-               $a = new App;
+       if (is_null($a)) {
+               $a = new App(dirname(__DIR__));
        }
 
        if(is_null($db)) {
@@ -89,7 +91,6 @@ function poller_run($argv, $argc){
                if (time() > ($starttime + 3600))
                        return;
        }
-
 }
 
 /**
@@ -687,4 +688,3 @@ if (array_search(__file__,get_included_files())===0){
 
        killme();
 }
-?>
index f9649961d9ca0d087d6b9a8eeea1dde591ac7305..9d18b27b4f3c16a8d42ea52372e1eecf33eb2c40 100644 (file)
@@ -258,5 +258,3 @@ function post_update_1206() {
        logger("Done", LOGGER_DEBUG);
        return true;
 }
-
-?>
index 1e47c3085b40c74c2b46a79b64fd6d230f91ceae..24d7b6963792eebde36b51b18288cb0d561d1288 100644 (file)
@@ -1,5 +1,7 @@
 <?php
-use \Friendica\Core\Config;
+
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once('include/items.php');
 require_once('include/ostatus.php');
index c0c73cda61b7f7b75370ac655521cae0f018729d..b21bf676bae999e7f80e9a120f4f8de206853555 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 require_once('include/queue_fn.php');
 require_once('include/dfrn.php');
index 2a6d28370a3910cbb4a34fc470526fb48a20eb16..4473fa99befbdd659af74d789df48109d7518d3a 100644 (file)
@@ -129,4 +129,3 @@ function removetofu($message)
 
        return($message);
 }
-?>
index 76e30a6eaca2325950db232bfd119fda8f765d38..36f982b12cd6f76b5293ee6cb4344e6656f5188b 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function auto_redir(App $a, $contact_nick) {
 
        // prevent looping
index bb110a284b9283123ec0c2f78c090aff87d8a673..a3938ad8ecbe390a7d52b612efea226963607d0a 100644 (file)
@@ -4,7 +4,7 @@
  * @brief Removes orphaned data from deleted contacts
  */
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 function remove_contact_run($argv, $argc) {
        if ($argc != 2) {
@@ -22,4 +22,3 @@ function remove_contact_run($argv, $argc) {
        // Now we delete all the depending table entries
        dba::delete('contact', array('id' => $id));
 }
-?>
index 05371f71ca55d1a44559480ffc2c350197cc3add..09ac03c35e9cbfe2cfd64c96b04bda169b90ccf8 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 /**
  * @brief Calculate the hash that is needed for the "Friendica" cookie
  *
index 5b0a1b94b0af3f9b530a36db860163d576f71667..756f220ec823d67a4265738b2b624fb6baec6d34 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once("boot.php");
 require_once("include/threads.php");
@@ -9,7 +10,7 @@ function shadowupdate_run(&$argv, &$argc){
        global $a, $db;
 
        if (is_null($a)) {
-               $a = new App;
+               $a = new App(dirname(__DIR__));
        }
 
        if (is_null($db)) {
index 1d9f2adebabe9f5b2c9688ba5474597157815de7..03bd14359d1ba27d434b4726e481e85d68d8653b 100644 (file)
@@ -1,13 +1,14 @@
 <?php
 /**
  * @file include/socgraph.php
- * 
+ *
  * @todo Move GNU Social URL schemata (http://server.tld/user/number) to http://server.tld/username
  * @todo Fetch profile data from profile page for Redmatrix users
  * @todo Detect if it is a forum
  */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once('include/datetime.php');
 require_once("include/Scrape.php");
@@ -1425,7 +1426,7 @@ function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = fal
        $r = q("SELECT `gcontact`.*
                FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
                where `glink`.`zcid` = %d
-               and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) 
+               and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
                $sql_extra limit %d, %d",
                intval($zcid),
                intval($uid),
@@ -2340,4 +2341,3 @@ function poco_serverlist() {
        }
        return $r;
 }
-?>
index f64b39e4b687bda0e0b42434ed88c2872367c463..2b21e41965eea15b494ef2a53786c5a7b529c39d 100644 (file)
@@ -4,7 +4,7 @@
  * @brief Posts items that wer spooled because they couldn't be posted.
  */
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 require_once("include/items.php");
 
@@ -55,4 +55,3 @@ function spool_post_run($argv, $argc) {
                }
        }
 }
-?>
index d809da2bf5e0115c2f4ce36fc503ae9bd33fec62..6067f3f4b93c58b2c41308412fbf18b4f9a264c2 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 function create_tags_from_item($itemid) {
        $profile_base = App::get_baseurl();
        $profile_data = parse_url($profile_base);
@@ -145,4 +148,3 @@ function update_items() {
 
        dba::close($messages);
 }
-?>
index 01873bff24bd873c75848d81e50d3cfc6c17f6ff..c9babba940f8f06e31770f638407bb5a3839b169 100644 (file)
@@ -1,12 +1,13 @@
 <?php
 
+use Friendica\App;
+
 require_once("include/template_processor.php");
 require_once("include/friendica_smarty.php");
 require_once("include/Smilies.php");
 require_once("include/map.php");
 require_once("mod/proxy.php");
 
-
 if(! function_exists('replace_macros')) {
 /**
  * This is our template processor
index 3d0aa05c3c08646abbd9031894a1817d0d9f7f8a..66622e8746c6c40cefee9fe732d1857a22f480f2 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 function add_thread($itemid, $onlyshadow = false) {
        $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`,
                        `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
@@ -293,4 +296,3 @@ function update_shadow_copy() {
 
        dba::close($messages);
 }
-?>
index 4cc5b6c04b3f14d17b87c6c9d254968f4bdd54fc..0ee15952af56ae0ca0d22312eaef250f0c356b47 100644 (file)
@@ -1,11 +1,7 @@
 <?php\r
 \r
-/**\r
- * import account file exported from mod/uexport\r
- * args:\r
- *  $a       App     Friendica App Class\r
- *  $file   Array   array from $_FILES\r
- */\r
+use Friendica\App;\r
+\r
 require_once("include/Photo.php");\r
 define("IMPORT_DEBUG", False);\r
 \r
@@ -75,6 +71,12 @@ function import_cleanup($newuid) {
        q("DELETE FROM `pconfig` WHERE uid = %d", $newuid);\r
 }\r
 \r
+/**\r
+ * @brief Import account file exported from mod/uexport\r
+ *\r
+ * @param App $a Friendica App Class\r
+ * @param array $file array from $_FILES\r
+ */\r
 function import_account(App $a, $file) {\r
        logger("Start user import from " . $file['tmp_name']);\r
        /*\r
@@ -255,10 +257,6 @@ function import_account(App $a, $file) {
                }\r
        }\r
 \r
-\r
-\r
-\r
-\r
        foreach ($account['photo'] as &$photo) {\r
                $photo['uid'] = $newuid;\r
                $photo['data'] = hex2bin($photo['data']);\r
index 883a22989508eb4080c114f09472e030065adee0..7a3e48937ecc2241162c645d726464a976befbb8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 function update_gcontact_run(&$argv, &$argc) {
        global $a;
index efaf07c1a0b24a7957ba47acc81753f33245a8ac..639437017a09696a445045fbf2e511e8887fc7dc 100644 (file)
--- a/index.php
+++ b/index.php
  *
  */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
-require_once('boot.php');
-require_once('object/BaseObject.php');
+require_once 'boot.php';
+require_once 'object/BaseObject.php';
 
-$a = new App;
+$a = new App(__DIR__);
 BaseObject::set_app($a);
 
 // We assume that the index.php is called by a frontend process
@@ -73,7 +74,7 @@ if (!$install) {
                exit();
        }
 
-       require_once("include/session.php");
+       require_once 'include/session.php';
        load_hooks();
        call_hooks('init_1');
 
@@ -486,7 +487,7 @@ header("X-Friendica-Version: " . FRIENDICA_VERSION);
 header("Content-type: text/html; charset=utf-8");
 
 /*
- * We use $_GET["mode"] for special page templates. So we will check if we have 
+ * We use $_GET["mode"] for special page templates. So we will check if we have
  * to load another page template than the default one.
  * The page templates are located in /view/php/ or in the theme directory.
  */
index 622d7fd93f647e9838e29af57f3649b8f5f02828..45c1da494cc785da79f753ea3546a6705c1847ff 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once("mod/hostxrd.php");
 require_once("mod/nodeinfo.php");
index 892b59655f01dea4cab10ca8e2b9fbe7d036ebac..bb59d7b94f0feccaaad105f576d0b90a2d22eab9 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/Scrape.php');
 
 function acctlink_init(App $a) {
index 9220bc77a9097198aed0bc2c5b7e3800eaf245a7..e04a3fbc7e1d243727ae7a13a6d973497de15005 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 /* ACL selector json backend */
 
+use Friendica\App;
+
 require_once 'include/acl_selectors.php';
 
 function acl_init(App $a) {
index 9dbbd4f3f8e8c7b4bb0df88377340a945e2a3ee7..d9f2d95760d3449b71f550887e0ff00dd85e3113 100644 (file)
@@ -6,7 +6,8 @@
  * @brief Friendica admin
  */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once("include/enotify.php");
 require_once("include/text.php");
index f51070bbe86d472216892b3685cc34fb19680520..fe3013a7c4af5fef7bef783e1fcaa151ac2aded5 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/socgraph.php');
 require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
index 5f9f97e3f13507c12e1d0bf2d40043b3185b652f..0eb295a816058a771a8ab18e51995a9cdd0bb182 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 
+use Friendica\App;
+
 function amcd_content(App $a) {
-//header("Content-type: text/json");
-echo <<< EOT
+       echo <<< JSON
 {
   "version":1,
   "sessionstatus":{
@@ -44,6 +45,6 @@ echo <<< EOT
     }
   }
 }
-EOT;
-killme();
+JSON;
+       killme();
 }
\ No newline at end of file
index 3916636cfd32f02bbdbdbfa1d28d4a1251db792a..cd5d5241f86c8faa231407c51b9e6540ce17ac7e 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/api.php');
 
 function oauth_get_client($request){
@@ -106,8 +108,6 @@ function api_content(App $a) {
                        '$no'   => t('No'),
                ));
 
-               //echo "<pre>"; var_dump($app); killme();
-
                return $o;
        }
 
index 199ce0f9188021b27e93d99391d5e2d9103d5774..0c0df76544ed6ca2a3fb97e05653bef278593a45 100644 (file)
@@ -1,25 +1,25 @@
 <?php
 
-function apps_content(App $a) {
-    $privateaddons = get_config('config','private_addons');
-      if ($privateaddons === "1") {
-       if((! (local_user())))  {
-       info( t("You must be logged in to use addons. "));
-      return;};
-}
+use Friendica\App;
 
-      $title = t('Applications');
+function apps_content(App $a) {
+       $privateaddons = get_config('config', 'private_addons');
+       if ($privateaddons === "1") {
+               if (! local_user()) {
+                       info(t('You must be logged in to use addons. '));
+                       return;
+               };
+       }
 
-       if(count($a->apps)==0)
-               notice( t('No installed applications.') . EOL);
+       $title = t('Applications');
 
+       if (count($a->apps) == 0) {
+               notice(t('No installed applications.') . EOL);
+       }
 
-       $tpl = get_markup_template("apps.tpl");
+       $tpl = get_markup_template('apps.tpl');
        return replace_macros($tpl, array(
                '$title' => $title,
                '$apps' => $a->apps,
        ));
-
-
-
 }
index dd7154dfe1a61033c370e3ea9cd8fea02111d26d..6155a3f99e9853c723acd623c64a375367eeb9b0 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/security.php');
 
 function attach_init(App $a) {
index f71863bdedaf2253720fb6b3d90ac8aeb8957ac0..0e38dc5750ab41e5ae456418e3f0fa46ca2531c2 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once 'include/bbcode.php';
 require_once 'library/markdown.php';
 require_once 'include/bb2diaspora.php';
index c4ef8457044ed64913eb15f3af0c385a69f5c74d..f7dd256775c4e478a79d62ec4f37646f15aa213f 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/conversation.php');
 require_once('include/items.php');
 
index 7398426bc3dc5256370f1e2dbff7f7b5c3a2ecb1..cd884e50e4b000b02f62512048cd73e7afa43909 100644 (file)
@@ -6,6 +6,8 @@
  *     of the profile owner
  */
 
+use Friendica\App;
+
 require_once('include/event.php');
 require_once('include/redir.php');
 
index 3c5df6e38ba12a861c3fba117ff786d6a9d111e4..030bea4d31849c068a8969c8929fae21530ff421 100644 (file)
@@ -4,6 +4,7 @@
  * General purpose landing page for plugins/addons
  */
 
+use Friendica\App;
 
 function cb_init(App $a) {
        call_hooks('cb_init');
index 5a40663f9eb6445e48f44d5c4e82ac08639e9dc9..87e305e68d0b9ffc09f5d3914dbc215f73a9cfc7 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/socgraph.php');
 require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
index 45326e291d01236b304b53e5614cefe8591e2778..5c71667bdcc197c0c83dd1909c2a405e0a70e747 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 function community_init(App $a) {
        if (! local_user()) {
@@ -9,7 +10,6 @@ function community_init(App $a) {
        }
 }
 
-
 function community_content(App $a, $update = 0) {
 
        $o = '';
index 5c4cd79868ef63a43a3c1c40a74a05204c7f9cf9..2a44e2889655d33254819aefe2a711391c5f6232 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/group.php');
 
 function contactgroup_content(App $a) {
-
-
        if (! local_user()) {
                killme();
        }
index 4f7ccd18248dfa7a6aa0f6bd787a054b8e98cd97..41d10cc9e2b2d264bd9ba00de8891e3a98cf22e7 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/Contact.php');
 require_once('include/socgraph.php');
 require_once('include/contact_selectors.php');
@@ -828,7 +830,7 @@ function contacts_content(App $a) {
  *
  * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
  *
- * @param app $a
+ * @param App $a
  * @param int $contact_id The ID of the contact
  * @param int $active_tab 1 if tab should be marked as active
  *
index 43f3fc2ba686e9acfb39d119c114262a4700a95c..a8c3130333aa6770d7e63f42227702e65c0f50d6 100644 (file)
@@ -15,6 +15,7 @@
 // fast - e.g. one or two milliseconds to fetch parent items for the current content,
 // and 10-20 milliseconds to fetch all the child items.
 
+use Friendica\App;
 
 function content_content(App $a, $update = 0) {
 
index f5c34b6105037f094f0098701c4b1a876252853f..e0e834388fdaf602d4567229a3a9758faa508521 100644 (file)
@@ -1,20 +1,23 @@
 <?php
+
 /**
  * Show a credits page for all the developers who helped with the project
  * (only contributors to the git repositories for friendica core and the
  * addons repository will be listed though ATM)
  */
 
-function credits_content (App $a) {
-    /* fill the page with credits */
-    $f = fopen('util/credits.txt','r');
-    $names = fread($f, filesize('util/credits.txt'));
-    $arr = explode("\n", htmlspecialchars($names));
-    fclose($f);
-    $tpl = get_markup_template('credits.tpl');
-    return replace_macros( $tpl, array(
-       '$title'                => t('Credits'),
-       '$thanks'               => t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
-       '$names'         => $arr,
-    ));
+use Friendica\App;
+
+function credits_content(App $a) {
+       /* fill the page with credits */
+       $f = fopen('util/credits.txt', 'r');
+       $names = fread($f, filesize('util/credits.txt'));
+       $arr = explode("\n", htmlspecialchars($names));
+       fclose($f);
+       $tpl = get_markup_template('credits.tpl');
+       return replace_macros($tpl, array(
+               '$title'  => t('Credits'),
+               '$thanks' => t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
+               '$names'  => $arr,
+       ));
 }
index 902a129303972a7e18b7c426f84aff37231c5fc8..59ac620a374cf1dc4730ef3b1455b3e198ce2182 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once("include/contact_selectors.php");
 require_once("mod/contacts.php");
 
index 4212ec9b132a4b8ff1a4d4e72d746a9074906ecb..e99734a33b32f14509d075f53212cf52b661adcc 100644 (file)
@@ -1,11 +1,13 @@
 <?php
+
+use Friendica\App;
+
 require_once('mod/settings.php');
 
 function delegate_init(App $a) {
        return settings_init($a);
 }
 
-
 function delegate_content(App $a) {
 
        if (! local_user()) {
index 001fa446891b28eaf205b763d8168dff26005a1f..6ebde734e6ace3dfae9c610c521371afcaab1300 100644 (file)
@@ -18,6 +18,8 @@
  *    https://github.com/friendica/friendica/blob/master/spec/dfrn2_contact_confirmation.png
  */
 
+use Friendica\App;
+
 require_once('include/enotify.php');
 require_once('include/group.php');
 require_once('include/Probe.php');
index b42ef9b70a82cee1bc669945d2bd8c3c9fba0a27..44e016599e486862c0d4493499ba10e331838e33 100644 (file)
@@ -5,6 +5,9 @@
  * @brief The dfrn notify endpoint
  * @see PDF with dfrn specs: https://github.com/friendica/friendica/blob/master/spec/dfrn2.pdf
  */
+
+use Friendica\App;
+
 require_once('include/items.php');
 require_once('include/dfrn.php');
 require_once('include/event.php');
index 506f9f162f2159dc1cd8fc75229cff93d11f202c..91fa49618a7713bdd443be67b5a0591fe1043b3f 100644 (file)
@@ -1,12 +1,12 @@
 <?php
+
+use Friendica\App;
+
 require_once('include/items.php');
 require_once('include/auth.php');
 require_once('include/dfrn.php');
 
-
 function dfrn_poll_init(App $a) {
-
-
        $dfrn_id         = ((x($_GET,'dfrn_id'))         ? $_GET['dfrn_id']              : '');
        $type            = ((x($_GET,'type'))            ? $_GET['type']                 : 'data');
        $last_update     = ((x($_GET,'last_update'))     ? $_GET['last_update']          : '');
index 5a25c27f6ae72a25a7ec964b9680dbcc60540a06..18a6b7ebdb21e6b0ae3db8c659b0b22af81b5b8f 100644 (file)
@@ -12,6 +12,8 @@
  *    https://github.com/friendica/friendica/blob/master/spec/dfrn2_contact_request.png
  */
 
+use Friendica\App;
+
 require_once('include/enotify.php');
 require_once('include/Scrape.php');
 require_once('include/Probe.php');
index ba48bb3926c737a91e03587fa9fc3c008c8be8f8..cb0b1f4cd115d18af37ba4bbd55faf796d02132c 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function directory_init(App $a) {
        $a->set_pager_itemspage(60);
 
@@ -9,24 +11,18 @@ function directory_init(App $a) {
                $a->page['aside'] .= findpeople_widget();
 
                $a->page['aside'] .= follow_widget();
-
        }
        else {
                unset($_SESSION['theme']);
                unset($_SESSION['mobile-theme']);
        }
-
-
 }
 
-
 function directory_post(App $a) {
        if(x($_POST,'search'))
                $a->data['search'] = $_POST['search'];
 }
 
-
-
 function directory_content(App $a) {
        global $db;
 
index c5844d13dfa742689c0e202a7a9cd92a9772fd68..c24ab9dbdb346257e1eed003ffad9f5f96e7a479 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once('include/contact_widgets.php');
 require_once('include/socgraph.php');
 require_once('include/Contact.php');
@@ -21,8 +24,6 @@ function dirfind_init(App $a) {
        $a->page['aside'] .= follow_widget();
 }
 
-
-
 function dirfind_content(App $a, $prefix = "") {
 
        $community = false;
index 1f1fd112048f63e31077448ebde723341f39bdf9..ca6809eba14c6fb9b34c359d2f4db172ce83417f 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function display_init(App $a) {
 
        if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
@@ -106,7 +108,6 @@ function display_init(App $a) {
        }
 
        profile_load($a, $nick, 0, $profiledata);
-
 }
 
 function display_fetchauthor($a, $item) {
index f3746317a14ba25e7cf70b9fd2aa8b2c0f925480..c0d903d0c3f8fda06541739af9cd7cc9c6eb41b6 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/acl_selectors.php');
 
 function editpost_content(App $a) {
index 60e7b9f39076bf40c7b361afc05ebe9e987b7d5b..876727608d033937ea542cefcd79570b3188d11b 100644 (file)
@@ -3,6 +3,9 @@
  * @file mod/events.php
  * @brief The events module
  */
+
+use Friendica\App;
+
 require_once 'include/bbcode.php';
 require_once 'include/datetime.php';
 require_once 'include/event.php';
index 9a0e9244c1cbb617511187d7273f58f853e077db..21b9b2e7b416605842ee36378cb24a0d9587247a 100644 (file)
@@ -5,6 +5,8 @@
  * @author             Fabio Comuni <fabrixxm@kirgroup.com>
  */
 
+use Friendica\App;
+
 require_once('include/Photo.php');
 
 /**
index b87fc0e8e025248ada5f1d5bb7fc32dc89153d47..0afd7af1070a9e33ce9d217a7be50b7f289aea38 100644 (file)
@@ -2,6 +2,9 @@
 /*
 This file is part of the Diaspora protocol. It is used for fetching single public posts.
 */
+
+use Friendica\App;
+
 require_once("include/crypto.php");
 require_once("include/diaspora.php");
 require_once("include/xml.php");
index 47c4aa5e4cbc6fc05139174415d2f5485a97f7fb..6259879de2ae9d6d31ad8ac722b9a4747e77ca88 100644 (file)
@@ -1,10 +1,11 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/security.php');
 require_once('include/bbcode.php');
 require_once('include/items.php');
 
-
 function filer_content(App $a) {
 
        if (! local_user()) {
index 7dd7df2f5ad47fadf6d74702732b757866841903..71e0af08d4543fd77607e9c1836e72ff4a716b06 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function filerm_content(App $a) {
 
        if (! local_user()) {
index 6e1f9069472040cf56b51ad262bbc2f31467235f..c59af73ee7b39c907d5eec8ed92e790f455de1fc 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/Scrape.php');
 require_once('include/follow.php');
 require_once('include/Contact.php');
index 7bfb7c86915e5524898ecb3f3f4f8111715e3fa5..bbfdbfe09688e7c651b1b00f9089b1b6e19566a7 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 function friendica_init(App $a) {
        if ($a->argv[1] == "json"){
index b3d5439712f5e7e9b9b1410ddee75cc056bf6d1e..32ed63b4c20ae75ed3207ab99df74b541848b500 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\App;
 
 function fsuggest_post(App $a) {
 
index 81477c32986b7a14ba570d6cbeb5e1b724d5e027..c01d1cf550c193f77a4f2d981584abdd92fe4f79 100644 (file)
@@ -5,6 +5,7 @@
  *     remove contacts to the contact groups
  */
 
+use Friendica\App;
 
 function group_init(App $a) {
        if (local_user()) {
index 07eb291510653b3d4fd1add4e7b413bba2315dc8..229939a4a347991050c3402c68c65bd54115ffdc 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function hcard_init(App $a) {
 
        $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
index c380aa39138267de91eca27a5c2919e3d5f36fab..1d5c831ef45ba32dab6297d22fcac25e8d609207 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once('library/markdown.php');
 
 if (!function_exists('load_doc_file')) {
@@ -87,7 +90,7 @@ function help_content(App $a) {
                for($k=0;$k<$lastlevel; $k++) $toc.="</ul>";
                $html = implode("\n",$lines);
 
-               $a->page['aside'] = $toc.$a->page['aside'];
+               $a->page['aside'] = '<section class="help-aside-wrapper">' . $toc . $a->page['aside'] . '</section>';
        }
 
        $html = "
index b1708d80a2f02e36fe78b650841581508323a316..bd77a840d0db221cca2c04043c2f2719e95f8814 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 if(! function_exists('home_init')) {
 function home_init(App $a) {
 
index 27dc349db2df12977e428b9cedee672be9e8b281..c9f870a08c1d3235c4c3431cee64d33cfb7f203f 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/crypto.php');
 
 function hostxrd_init(App $a) {
index 65b03f2b9470f96163c9f3b67cc819548df0a092..1420aae4ef0e118772fa367c2c278036eeb1a5f9 100644 (file)
@@ -8,6 +8,8 @@
  * License: GNU AFFERO GENERAL PUBLIC LICENSE (Version 3)
  */
 
+use Friendica\App;
+
 require_once("include/socgraph.php");
 require_once("include/Contact.php");
 
@@ -15,6 +17,7 @@ function hovercard_init(App $a) {
        // Just for testing purposes
        $_GET["mode"] = "minimal";
 }
+
 function hovercard_content() {
        $profileurl     =       (x($_REQUEST,'profileurl')      ? $_REQUEST['profileurl']       : "");
        $datatype       =       (x($_REQUEST,'datatype')        ?$_REQUEST['datatype']          : "json");
index 0065d51c58e3b8386b53ac93ea095d1ceca5b76d..a7c3ba6e1d37fdf3bb30263019b70274739bd8a1 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\App;
 
 function ignored_init(App $a) {
 
index d1d2fd07792bdb00cddee716b1fb23d9919b4d79..aa891dba752b390c495702afa61bb8b93d2d33b8 100755 (executable)
@@ -1,8 +1,10 @@
 <?php
-require_once "include/Photo.php";
 
-$install_wizard_pass=1;
+use Friendica\App;
+
+require_once "include/Photo.php";
 
+$install_wizard_pass = 1;
 
 function install_init(App $a) {
 
index f5c60e1ed393713c30e87c7f526492f135cb3ddd..67cd23de745ea34979ac245c17b79edbc2c26c2a 100644 (file)
@@ -7,6 +7,8 @@
  *
  */
 
+use Friendica\App;
+
 require_once('include/email.php');
 
 function invite_post(App $a) {
index d8be579ff95df947234483e6e5c910ddf5d6bae7..4744ec4ad50e380b2d3f5883f4f8676bfa94acf2 100644 (file)
@@ -15,6 +15,8 @@
  * posting categories go through item_store() instead of this function.
  */
 
+use Friendica\App;
+
 require_once 'include/crypto.php';
 require_once 'include/enotify.php';
 require_once 'include/email.php';
index 1f6a233f3dc26599f8a37152ea71f0fef276952b..c542a540abce6a3ae174d844c8c9f67b4768d082 100755 (executable)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/security.php');
 require_once('include/bbcode.php');
 require_once('include/items.php');
index 535308903153af6d3cf81ef4d310ccc8705034db..c32f67976bd4ff37a0003663be40ed74fcfe658f 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 
-require_once('include/datetime.php');
+use Friendica\App;
 
+require_once('include/datetime.php');
 
 function localtime_post(App $a) {
 
index 38a308634e772467381468fe322dd76840cd980a..48227cc1eaf47aa0d973e71a621f34e134f71ebf 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\App;
 
 function lockview_content(App $a) {
 
index 8fd28c72304c9015a3261635d7a2dd5b558026e7..79bd04862effc17f0b6091e8028c549681fa2889 100644 (file)
@@ -1,13 +1,18 @@
 <?php
 
+use Friendica\App;
+
 function login_content(App $a) {
-       if(x($_SESSION,'theme'))
+       if (x($_SESSION, 'theme')) {
                unset($_SESSION['theme']);
-       if(x($_SESSION,'mobile-theme'))
+       }
+       if (x($_SESSION, 'mobile-theme')) {
                unset($_SESSION['mobile-theme']);
+       }
 
-       if(local_user())
+       if (local_user()) {
                goaway(z_root());
+       }
+       
        return login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
-
 }
index 455a9b1e2eed697580cd17fb8e4dcfe2b53da43d..37ef3e2f82f6a461bc78d7a38381309a35d67486 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/email.php');
 require_once('include/enotify.php');
 require_once('include/text.php');
index c4839de79213503490372d9881fd8900850827d2..2258fc5ce29337029df97a8fe60389d0659cc5f0 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 function maintenance_content(App $a) {
 
index e85561acfb350fc3d64f462efe8d4d929ae50556..a6ab32c2d8428c713398dc61b6f816d504826b57 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 
-require_once("include/text.php");
+use Friendica\App;
 
+require_once("include/text.php");
 
 function manage_post(App $a) {
 
index 6dc0d10a21f5d3340862f54e0fd33615be65b83e..d38dcb8d922026143e32996e04d5552d04c06b2f 100644 (file)
@@ -1,26 +1,26 @@
 <?php
-    use Friendica\Core\Config;
 
-    function manifest_content(App $a) {
+use Friendica\App;
+use Friendica\Core\Config;
 
-               $tpl = get_markup_template('manifest.tpl');
+function manifest_content(App $a) {
 
-               header('Content-type: application/manifest+json');
+       $tpl = get_markup_template('manifest.tpl');
 
-               $touch_icon = Config::get('system', 'touch_icon', 'images/friendica-128.png');
-               if ($touch_icon == '') {
-                       $touch_icon = 'images/friendica-128.png';
-               }
+       header('Content-type: application/manifest+json');
 
-               $o = replace_macros($tpl, array(
-                       '$baseurl' => App::get_baseurl(),
-                       '$touch_icon' => $touch_icon,
-                       '$title' => Config::get('config', 'sitename', 'Friendica'),
-               ));
+       $touch_icon = Config::get('system', 'touch_icon', 'images/friendica-128.png');
+       if ($touch_icon == '') {
+               $touch_icon = 'images/friendica-128.png';
+       }
 
-               echo $o;
+       $o = replace_macros($tpl, array(
+               '$baseurl' => App::get_baseurl(),
+               '$touch_icon' => $touch_icon,
+               '$title' => Config::get('config', 'sitename', 'Friendica'),
+       ));
 
-               killme();
+       echo $o;
 
-       }
-?>
+       killme();
+}
index 44f5141ad889e10df007195db88874743dfb1fff..4119bf8e84315c8b8cbeed8b0dd0c337edf36820 100644 (file)
@@ -1,5 +1,8 @@
 <?php
-include_once('include/text.php');
+
+use Friendica\App;
+
+require_once('include/text.php');
 require_once('include/socgraph.php');
 require_once('include/contact_widgets.php');
 require_once('mod/proxy.php');
index beaa7b1df666af66b426d01f821f0b790f7765d8..c32d5f1dd928c057bfa2b66378f309f4eedd6fc0 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/acl_selectors.php');
 require_once('include/message.php');
 require_once('include/Smilies.php');
index 4cc9522479c182767b60a013ade77205863f0287..3c5d1e35818bfc11658e20cf289d18324bd25d6d 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('library/asn1.php');
 
 function modexp_init(App $a) {
index e80a7f0976e6550ac60c20e6b48db9fe63856472..c693e7cdc980872949842a11634544ee60ee143b 100644 (file)
@@ -1,10 +1,11 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/security.php');
 require_once('include/bbcode.php');
 require_once('include/items.php');
 
-
 function mood_init(App $a) {
 
        if (! local_user()) {
index 277242afff803f19eecc1241600f849b75ccafdf..460b9c303919074332576f861e48b770370368a2 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function msearch_post(App $a) {
 
        $perpage = (($_POST['n']) ? $_POST['n'] : 80);
index be1b522e9cba1b20d851f1a0ceb03254230c9729..31b20e8913769bb56671ae58a1af37e606ec6475 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once("include/nav.php");
 
 function navigation_content(App $a) {
index db4bb91309d84b874850432c7461104c74ba62b6..0d37d4d2e25db10b2a0e4afe46992f507580da16 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 function network_init(App $a) {
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -792,7 +795,7 @@ function network_content(App $a, $update = 0) {
 /**
  * @brief Get the network tabs menu
  *
- * @param app $a The global App
+ * @param App $a The global App
  * @return string Html of the networktab
  */
 function network_tabs(App $a) {
index a5e41f1e2444204dd95e174b3390b83eaf59b248..f470327cded444638b9d1eb092f82bde91bcf82e 100644 (file)
@@ -1,83 +1,54 @@
 <?php
 
-function newmember_content(App $a) {
+use Friendica\App;
 
+function newmember_content(App $a) {
 
        $o = '<h1>' . t('Welcome to Friendica') . '</h1>';
-
        $o .= '<h3>' . t('New Member Checklist') . '</h3>';
-
        $o .= '<div style="font-size: 120%;">';
-
        $o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
-
        $o .= '<h4>' . t('Getting Started') . '</h4>';
-
        $o .= '<ul>';
-
        $o .= '<li> ' . '<a target="newmember" href="help/guide">' . t('Friendica Walk-Through') . '</a><br />' . t('On your <em>Quick Start</em> page - find a brief introduction to your profile and network tabs, make some new connections, and find some groups to join.') . '</li>' . EOL;
-
        $o .= '</ul>';
-
        $o .= '<h4>' . t('Settings') . '</h4>';
-
        $o .= '<ul>';
-
        $o .= '<li>' . '<a target="newmember" href="settings">' . t('Go to Your Settings') . '</a><br />' . t('On your <em>Settings</em> page -  change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</li>' . EOL;
-
        $o .= '<li>' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</li>' . EOL;
-
        $o .= '</ul>';
-
        $o .= '<h4>' . t('Profile') . '</h4>';
-
        $o .= '<ul>';
-
        $o .= '<li>' . '<a target="newmember" href="profile_photo">' . t('Upload Profile Photo') . '</a><br />' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</li>' . EOL;
-
        $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Edit Your Profile') . '</a><br />' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</li>' . EOL;
-
        $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Profile Keywords') . '</a><br />' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</li>' . EOL;
-
        $o .= '</ul>';
-
        $o .= '<h4>' . t('Connecting') . '</h4>';
-
        $o .= '<ul>';
 
-    $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
+       $mail_disabled = ((function_exists('imap_open') && (!get_config('system', 'imap_disabled'))) ? 0 : 1);
 
-       if(! $mail_disabled)
+       if (!$mail_disabled) {
                $o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Importing Emails') . '</a><br />' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL;
+       }
 
        $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Go to Your Contacts Page') . '</a><br />' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL;
-
        $o .= '<li>' . '<a target="newmember" href="directory">' . t("Go to Your Site's Directory") . '</a><br />' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL;
-
        $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Finding New People') . '</a><br />' . t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</li>' . EOL;
-
        $o .= '</ul>';
-
        $o .= '<h4>' . t('Groups') . '</h4>';
-
        $o .= '<ul>';
-
        $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Group Your Contacts') . '</a><br />' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL;
 
-       if(get_config('system', 'newuser_private')) {
+       if (get_config('system', 'newuser_private')) {
                $o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . t("Why Aren't My Posts Public?") . '</a><br />' . t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL;
        }
 
        $o .= '</ul>';
-
        $o .= '<h4>' . t('Getting Help') . '</h4>';
-
        $o .= '<ul>';
-
        $o .= '<li>' . '<a target="newmember" href="help">' . t('Go to the Help Section') . '</a><br />' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</li>' . EOL;
-
        $o .= '</ul>';
-
        $o .= '</div>';
 
        return $o;
index 7f010cee416afbf5e75b8b63ead69ccb51a2b7b5..5d8e8f2a20f434f0bb74e7f0b49431da206aba8e 100644 (file)
@@ -5,7 +5,8 @@
  * Documentation: http://nodeinfo.diaspora.software/schema.html
 */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once 'include/plugin.php';
 
@@ -251,5 +252,3 @@ function nodeinfo_cron() {
         logger('cron_end');
        Config::set('nodeinfo', 'last_calucation', time());
 }
-
-?>
index 11b7bdc7aa486c0e512dee4782c159a97090fc24..ecbfb9176e1397be548ec5ddb3be1bf8620194fd 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/Contact.php');
 require_once('include/socgraph.php');
 require_once('include/contact_selectors.php');
index 83ab71ce15884f90cb423172f638eab0e6dba000..a269d7369af90b21ff7f518528afb75caf898e43 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function noscrape_init(App $a) {
 
        if($a->argc > 1)
index c7cfe8d70f1a2d3e13f98249785b6fcf9073a7b1..835627586cada10d58b75113a1783e4a852f4386 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function notes_init(App $a) {
 
        if (! local_user()) {
index b7029397b5f145c55970dbbb9ff4803b64d35b78..1114b9a5a452ed4eec5a5a70048c4ab8755623c3 100644 (file)
@@ -1,20 +1,21 @@
 <?php
-       /* identi.ca -> friendica items permanent-url compatibility */
 
-       function notice_init(App $a) {
-               $id = $a->argv[1];
-               $r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
-                               intval($id)
-                               );
-               if (dbm::is_result($r)){
-                       $nick = $r[0]['nickname'];
-                       $url = App::get_baseurl()."/display/$nick/$id";
-                       goaway($url);
-               } else {
-                       $a->error = 404;
-                       notice( t('Item not found.') . EOL);
+/* identi.ca -> friendica items permanent-url compatibility */
 
-               }
-               return;
+use Friendica\App;
 
+function notice_init(App $a) {
+
+       $id = $a->argv[1];
+       $r = q("SELECT `user`.`nickname` FROM `user` LEFT JOIN `item` ON `item`.`uid` = `user`.`uid` WHERE `item`.`id` = %d", intval($id));
+       if (dbm::is_result($r)) {
+               $nick = $r[0]['nickname'];
+               $url = App::get_baseurl() . "/display/$nick/$id";
+               goaway($url);
+       } else {
+               $a->error = 404;
+               notice(t('Item not found.') . EOL);
        }
+
+       return;
+}
index fdaec05ccd2449a5916b593906da4bebf754f2bc..396361e91b5bda012716767d3c2f677a8d2c6e29 100644 (file)
@@ -5,6 +5,8 @@
  * @brief The notifications module
  */
 
+use Friendica\App;
+
 require_once("include/NotificationsManager.php");
 require_once("include/contact_selectors.php");
 require_once("include/network.php");
index 0026f5ca6eb6f66556c35326966604e81d6f9899..e3806819342b12dcf67c8cd6c73ea7f2d48b9c5b 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once('include/NotificationsManager.php');
 
 function notify_init(App $a) {
index 7770c62fb0300356dd26476090638e32d88c16c2..3266ad963e110a0956a69a36844252e13f2f0397 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once("include/oembed.php");
 
 function oembed_content(App $a) {
index 4f2d7e0eb8449e97a0c48f8e1332367b05f46d97..930caac7e459f2e2a19aa92d46d4fe2266780c7d 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 function oexchange_init(App $a) {
 
        if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
index 60de55a5098af3e9700d2b7a4a051d6ba5fd081a..5707b1b72891cc7e28874869aeabc48110a15a8f 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
+use Friendica\App;
 
 require_once('library/openid.php');
 
-
 function openid_content(App $a) {
 
        $noid = get_config('system','no_openid');
index a599ddc1eddadfea648c9d755ed7a6ca1783a6a8..dc7adeb05c264eb98e627c5745bf64725d4b76e3 100644 (file)
@@ -1,18 +1,19 @@
 <?php
-    function opensearch_content(App $a) {
 
-               $tpl = get_markup_template('opensearch.tpl');
+use Friendica\App;
 
-               header("Content-type: application/opensearchdescription+xml");
+function opensearch_content(App $a) {
 
-               $o = replace_macros($tpl, array(
-                       '$baseurl' => App::get_baseurl(),
-                       '$nodename' => $a->get_hostname(),
-               ));
+       $tpl = get_markup_template('opensearch.tpl');
 
-               echo $o;
+       header("Content-type: application/opensearchdescription+xml");
 
-               killme();
+       $o = replace_macros($tpl, array(
+               '$baseurl' => App::get_baseurl(),
+               '$nodename' => $a->get_hostname(),
+       ));
 
-       }
-?>
\ No newline at end of file
+       echo $o;
+
+       killme();
+}
index a9f7c3a909111ed329904b990807db31b1355bda..a36821aa2ef7569a8c5c82fc4b6058b9aaf481c6 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/Scrape.php');
 require_once('include/follow.php');
 
index 3cd7a9eb7d4676b7c631014e581d50a9eab17943..f66dd43a23e41a0c74e35a79b8ba3baec3fb90dc 100644 (file)
--- a/mod/p.php
+++ b/mod/p.php
@@ -2,6 +2,9 @@
 /*
 This file is part of the Diaspora protocol. It is used for fetching single public posts.
 */
+
+use Friendica\App;
+
 require_once("include/diaspora.php");
 
 function p_init($a){
index 77529714f20f56a83cadcee7e075be5b8d07b2aa..4fe9256349fe9a863509984d77995fd13c7e7945 100644 (file)
@@ -10,7 +10,8 @@
  * @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
 */
 
-use \Friendica\ParseUrl;
+use Friendica\App;
+use Friendica\ParseUrl;
 
 require_once("include/items.php");
 
index 6562599ca3cf0ccc5b19e997b2734fcbdd408e0d..7506834cf502b27513371e42ec4dc6831adbd8de 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/security.php');
 require_once('include/Photo.php');
 
index a22f919c89f70168a7e8a6fad8b712e481d66f9f..8d6d54ac88c2991c832d0c61ab36ad8579be59d8 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+
+use Friendica\App;
+use Friendica\Core\Config;
+
 require_once 'include/Photo.php';
 require_once 'include/photos.php';
 require_once 'include/items.php';
@@ -10,8 +14,6 @@ require_once 'include/tags.php';
 require_once 'include/threads.php';
 require_once 'include/Probe.php';
 
-use \Friendica\Core\Config;
-
 function photos_init(App $a) {
 
        if ($a->argc > 1) {
index dcef73ffb252d96a1a7412d7e031aae4477d2837..17180c74ee98dc0bdcdbe454ec4eeb7af2befd91 100644 (file)
@@ -1,5 +1,8 @@
 <?php
-require_once("include/datetime.php");
+
+use Friendica\App;
+
+require_once('include/datetime.php');
 require_once('include/bbcode.php');
 require_once('include/ForumManager.php');
 require_once('include/group.php');
index 30648acab67c05159721ab1d4279b9181428d6e0..7dcf3b4a02e3794a2d2dbbb17a76aa72a751f60a 100644 (file)
@@ -2,6 +2,8 @@
 // See here for a documentation for portable contacts:
 // https://web.archive.org/web/20160405005550/http://portablecontacts.net/draft-spec.html
 
+use Friendica\App;
+
 function poco_init(App $a) {
        require_once("include/bbcode.php");
 
index 5161129b31c38f2c9dec070cd98f4b290a75e2fa..83f3bf1c735894fcfd37b058f45975387ad55e09 100644 (file)
@@ -1,7 +1,6 @@
-<?php /** @file */
+<?php
 
 /**
- *
  * Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book
  * This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or
  * other web request. You must be logged in and connected to a profile.
  *
  * private creates a private conversation with the recipient. Otherwise your profile's default post privacy is used.
  *
+ * @file mod/poke.php
  */
 
+use Friendica\App;
+
 require_once('include/security.php');
 require_once('include/bbcode.php');
 require_once('include/items.php');
 
-
 function poke_init(App $a) {
 
        if (! local_user()) {
index c8a88e66cd329c5bd853084f638a33a52e29e1fb..bfdc62ab7942706b84485281c98aaef8986a3eb7 100644 (file)
@@ -4,6 +4,7 @@
  * Zot endpoint
  */
 
+use Friendica\App;
 
 require_once('include/salmon.php');
 require_once('include/crypto.php');
index 6dd6b781ac3837e25db989ea261f6650be9d739d..e5bebc4eb7e24e0d230669ca4adedf554790d7fd 100644 (file)
@@ -1,22 +1,24 @@
 <?php
 
+use Friendica\App;
+
 function pretheme_init(App $a) {
 
-       if($_REQUEST['theme']) {
+       if ($_REQUEST['theme']) {
                $theme = $_REQUEST['theme'];
                $info = get_theme_info($theme);
-               if($info) {
+               if ($info) {
                        // unfortunately there will be no translation for this string
                        $desc = $info['description'];
                        $version = $info['version'];
                        $credits = $info['credits'];
-               }
-               else {
+               } else {
                        $desc = '';
                        $version = '';
                        $credits = '';
                }
                echo json_encode(array('img' => get_theme_screenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits));
        }
+       
        killme();
 }
index 8c951a7fcfd62f63f9c3fbe5bda5a02af735ad65..2911bc05c7fbbdecbd26517f2f39f2062ca759fc 100644 (file)
@@ -1,31 +1,32 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/Scrape.php');
 
 function probe_content(App $a) {
 
        if (!local_user()) {
-               http_status_exit(403,
-                               array("title" => t("Public access denied."),
-                                       "description" => t("Only logged in users are permitted to perform a probing.")));
+               http_status_exit(403, array("title" => t("Public access denied."),
+                       "description" => t("Only logged in users are permitted to perform a probing.")));
                killme();
        }
 
        $o .= '<h3>Probe Diagnostic</h3>';
 
        $o .= '<form action="probe" method="get">';
-       $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
+       $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] . '" />';
        $o .= '<input type="submit" name="submit" value="Submit" /></form>';
 
        $o .= '<br /><br />';
 
-       if(x($_GET,'addr')) {
-
+       if (x($_GET, 'addr')) {
                $addr = trim($_GET['addr']);
                $res = probe_url($addr);
                $o .= '<pre>';
-               $o .= str_replace("\n",'<br />',print_r($res,true));
+               $o .= str_replace("\n", '<br />', print_r($res, true));
                $o .= '</pre>';
        }
+
        return $o;
 }
index 838a550944dc8a80120bedc8f4ee6e4b48a86a6d..7a11e9bc6b1fe80a261b5328ac77400afecf8bc8 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/contact_widgets.php');
 require_once('include/redir.php');
 
-
 function profile_init(App $a) {
 
        if(! x($a->page,'aside'))
index f9bf60cf543605b0322a01903d115669baa3bd24..b2bf6e3b157899a17d1c948d9be0c5b71f3a6e5e 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once("include/Photo.php");
 
 function profile_photo_init(App $a) {
@@ -9,10 +11,8 @@ function profile_photo_init(App $a) {
        }
 
        profile_load($a,$a->user['nickname']);
-
 }
 
-
 function profile_photo_post(App $a) {
 
        if (! local_user()) {
index bd57f106d72c451409324c920ba05c9df0e1a9d0..42699e5e0c7aab57f376bdb3c39489d09151ebbd 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once("include/Contact.php");
 require_once('include/Probe.php');
 
index a414d8947bf35369a819b9966239585468889b59..c67a0202e057921882477fbf9d55fcec0d726c60 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function profperm_init(App $a) {
 
        if (! local_user()) {
index 8046e4e9639eabc0fd9331d13792543a60908134..9311e55a96c02e4e6be68b50b323bef4906ba5d3 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 // Based upon "Privacy Image Cache" by Tobias Hößl <https://github.com/CatoTH/>
 
+use Friendica\App;
+
 define('PROXY_DEFAULT_TIME', 86400); // 1 Day
 
 define('PROXY_SIZE_MICRO', 'micro');
index 2ba1958a25050cbce35e075d04d6081aa5d71907..ba5e05b0eec4fd9c8dfb499a86cfbd6b100393bd 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function hub_return($valid,$body) {
 
        if($valid) {
index dceb16ae1f260cf9415e9e7378e54582a35ee182..da2f94748943887d7fe3c3dc8a710ac0ce820209 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function post_var($name) {
        return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
 }
@@ -158,5 +160,3 @@ function pubsubhubbub_init(App $a) {
 
        killme();
 }
-
-?>
index 8512bea51e622aaf52ed1dd4d210b4f3815867dc..ba62fce0d7bddc829c884e117f862ef1bb85dcc1 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function qsearch_init(App $a) {
 
        if (! local_user()) {
@@ -48,4 +50,3 @@ function qsearch_init(App $a) {
        echo json_encode((object) $results);
        killme();
 }
-
index d8cffb380ccd46de6552fb72b12cd576b45de058..8d9083ada484019506231cdeaf7c5db6c789a5ca 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\App;
 
 function randprof_init(App $a) {
        require_once('include/Contact.php');
index 15c9f1d412796b1de5e2cd08664bdb36dba59d15..9048642174706bd486689bc9fdbca5907c425902 100644 (file)
@@ -4,12 +4,12 @@
  * Diaspora endpoint
  */
 
+use Friendica\App;
 
 require_once('include/salmon.php');
 require_once('include/crypto.php');
 require_once('include/diaspora.php');
 
-
 function receive_post(App $a) {
        $enabled = intval(get_config('system', 'diaspora_enabled'));
        if (!$enabled) {
index 12f53900a7528c8826788aad408b384c23f4d176..366c398867682def7fe2dd0a3694eee81eedd539 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function redir_init(App $a) {
 
        $url = ((x($_GET,'url')) ? $_GET['url'] : '');
index 5e8da4685a0f61d342d180fe68b4d45c0bbfa193..71c13ef396815909c2335eab191f668333397c90 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/enotify.php');
 require_once('include/bbcode.php');
 require_once('include/user.php');
index 1983ca0899ddbf0608b43bcccb601046c355d44b..884790458127285eba43016e92f0e31abb3968e3 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/enotify.php');
 require_once('include/user.php');
 
index 40033624d8889ac330a8be2c7f725febef8e2cfc..639c9be9f457bafcf704ecaa0e23252e5a377bad 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function removeme_post(App $a) {
 
        if (! local_user()) {
index 3e9130e0e8e42a233b5bd5090a383adc3ff599ff..a690680d1f520ea2d416f40f2c606725fa829855 100755 (executable)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/Scrape.php');
 require_once('include/follow.php');
 
index d150ff3de6741d3e97ca7b84d89ebc893eda70a1..8327329bf56f2cce9f46a22c52303817db77d602 100644 (file)
@@ -1,10 +1,12 @@
 <?php
+
 /**
  * @file mod/robots_text.php
  * @brief Module which returns the default robots.txt
  * @version 0.1.2
  */
 
+use Friendica\App;
 
 /**
  * @brief Return default robots.txt when init
@@ -13,7 +15,6 @@
  */
 function robots_txt_init(App $a)
 {
-
        $allDisalloweds = array(
                '/settings/',
                '/admin/',
@@ -21,9 +22,9 @@ function robots_txt_init(App $a)
        );
 
        header('Content-Type: text/plain');
-       echo 'User-agent: *'.PHP_EOL;
+       echo 'User-agent: *' . PHP_EOL;
        foreach ($allDisalloweds as $disallowed) {
-               echo 'Disallow: '.$disallowed.PHP_EOL;
+               echo 'Disallow: ' . $disallowed . PHP_EOL;
        }
        killme();
 }
index 3b74a143df7d9b32394b81f92d73ce4b2f1ebf85..1417e9646a2825bafc274be396716a5ed8c0d29a 100644 (file)
@@ -1,24 +1,25 @@
 <?php
 
+use Friendica\App;
 
-
-function rsd_xml_content(App $a) {
+function rsd_xml_content(App $a)
+{
        header ("Content-Type: text/xml");
        echo '<?xml version="1.0" encoding="UTF-8"?>
- <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
-   <service>
-     <engineName>Friendica</engineName>
-     <engineLink>http://friendica.com/</engineLink>
-     <apis>
-       <api name="Twitter" preferred="true" apiLink="'.App::get_baseurl().'/api/" blogID="">
-         <settings>
-           <docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
-           <setting name="OAuth">false</setting>
-         </settings>
-       </api>
-     </apis>
-   </service>
- </rsd>
-       ';
-die();
+<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
+  <service>
+    <engineName>Friendica</engineName>
+    <engineLink>http://friendica.com/</engineLink>
+    <apis>
+      <api name="Twitter" preferred="true" apiLink="'.App::get_baseurl().'/api/" blogID="">
+        <settings>
+          <docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
+          <setting name="OAuth">false</setting>
+        </settings>
+      </api>
+    </apis>
+  </service>
+</rsd>';
+
+       killme();
 }
\ No newline at end of file
index 10b1046b02d1924e9b65d956bcb7191e8e4934d0..f42e05deaa76f207848c1e214ad5854fd78c54a6 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/salmon.php');
 require_once('include/ostatus.php');
 require_once('include/crypto.php');
index a804ca32e0b2e80603a1c5a01ab08c050ae9806a..fd1212ceec2854ae88273e9fc1c5d7f8c7f9bd9b 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once("include/bbcode.php");
 require_once('include/security.php');
 require_once('include/conversation.php');
index a73bcc78fabce3938c021534d5c20c8e52f03873..783d6f306c8593ac7c30d4356ab043d4b335dceb 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function session_content(App $a) {
 
 }
index 1d83251d4b327054c61e481aca3a86ad5361555e..ff05724fed74b2048a9391bac3358be08b956688 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/group.php');
 require_once('include/socgraph.php');
 
index 36a4d5945fcb4cc7b7bb07d8e862324104fa083b..7ddca0f30be8256df542c7c909d500caf51e9f6e 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 function share_init(App $a) {
 
        $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
index 4d8ab6bcaa55fcdb3dbd2d1929efc01a8296fd63..289ad887f96bf5e5bfa87e92cbfdf0ded9e86264 100644 (file)
@@ -3,19 +3,19 @@
 /**
  * @file mod/smilies.php
  */
+use Friendica\App;
 
 require_once("include/Smilies.php");
 
 function smilies_content(App $a) {
-       if ($a->argv[1]==="json"){
+       if ($a->argv[1] === "json") {
                $tmp = Smilies::get_list();
                $results = array();
-               for($i = 0; $i < count($tmp['texts']); $i++) {
+               for ($i = 0; $i < count($tmp['texts']); $i++) {
                        $results[] = array('text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]);
                }
                json_return_and_die($results);
-       }
-       else {
-               return Smilies::replace('',true);
+       } else {
+               return Smilies::replace('', true);
        }
 }
index 46d3fcff66835644c0b802bfb98db8a8d3a06edf..e1b38cfc4c9133edf547eeb59303ec81f2b24aec 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\App;
 
 function starred_init(App $a) {
 
index 07444d2bb525f7facb01e51ba9f77ce6146fde7d..3b9e9c49667e8b396d416b47e6b1dfd6ea705b2e 100644 (file)
@@ -1,27 +1,30 @@
 <?php
+
 /**
  * @file mod/statistics_json.php
  */
 
+use Friendica\App;
+
 require_once("include/plugin.php");
 
 function statistics_json_init(App $a) {
 
-        if (!get_config("system", "nodeinfo")) {
-                http_status_exit(404);
-                killme();
-        }
+       if (!get_config("system", "nodeinfo")) {
+               http_status_exit(404);
+               killme();
+       }
 
        $statistics = array(
-                       "name" => $a->config["sitename"],
-                       "network" => FRIENDICA_PLATFORM,
-                       "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION,
-                       "registrations_open" => ($a->config['register_policy'] != 0),
-                       "total_users" => get_config('nodeinfo','total_users'),
-                       "active_users_halfyear" => get_config('nodeinfo','active_users_halfyear'),
-                       "active_users_monthly" => get_config('nodeinfo','active_users_monthly'),
-                       "local_posts" => get_config('nodeinfo','local_posts')
-                       );
+               "name" => $a->config["sitename"],
+               "network" => FRIENDICA_PLATFORM,
+               "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION,
+               "registrations_open" => ($a->config['register_policy'] != 0),
+               "total_users" => get_config('nodeinfo', 'total_users'),
+               "active_users_halfyear" => get_config('nodeinfo', 'active_users_halfyear'),
+               "active_users_monthly" => get_config('nodeinfo', 'active_users_monthly'),
+               "local_posts" => get_config('nodeinfo', 'local_posts')
+       );
 
        $statistics["services"] = array();
        $statistics["services"]["appnet"] = plugin_enabled("appnet");
@@ -53,7 +56,7 @@ function statistics_json_init(App $a) {
        $statistics["wordpress"] = $statistics["services"]["wordpress"];
 
        header("Content-Type: application/json");
-       echo json_encode($statistics, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
-       logger("statistics_init: printed ".print_r($statistics, true), LOGGER_DATA);
+       echo json_encode($statistics, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
+       logger("statistics_init: printed " . print_r($statistics, true), LOGGER_DATA);
        killme();
 }
index 646a4230c5f486819100624ddf754231b52814d1..0745fc0eef4948a204f61581aedc7994a0e045c5 100644 (file)
@@ -1,10 +1,11 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/security.php');
 require_once('include/bbcode.php');
 require_once('include/items.php');
 
-
 function subthread_content(App $a) {
 
        if(! local_user() && ! remote_user()) {
index dd24fc0a2a3a01a120557f7bf659d638c30440cf..a82dca7945d87614da9f90f4fceccb57d38390a6 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/socgraph.php');
 require_once('include/contact_widgets.php');
 
index 50099ac69ca4e85627748c6b30736a3d4f4f5b32..e6619f9fe2d37a148724da85467a21fcca81176f 100644 (file)
@@ -1,10 +1,11 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/security.php');
 require_once('include/bbcode.php');
 require_once('include/items.php');
 
-
 function tagger_content(App $a) {
 
        if(! local_user() && ! remote_user()) {
index 2e7f8b97082436e8061998997f0150d666147fcb..ea1ab7909dd851102a1215235f10bb48321bb0eb 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/bbcode.php');
 
 function tagrm_post(App $a) {
index f858d8913e9c26fc2cea16a967439ca139560bf9..12a61152733033bb66de307e19e4748592d6a991 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function toggle_mobile_init(App $a) {
 
        if (isset($_GET['off'])) {
@@ -16,4 +18,3 @@ function toggle_mobile_init(App $a) {
 
        goaway($address);
 }
-
index 77a45f8a39379296d5d8b259432d5a3648aadabc..b00f9bdf927e44188e3b8c8aea2f84a77b08ac75 100644 (file)
@@ -1,7 +1,9 @@
 <?php
 
+use Friendica\App;
+
 function uexport_init(App $a) {
-       if (! local_user()) {
+       if (!local_user()) {
                killme();
        }
 
@@ -9,13 +11,12 @@ function uexport_init(App $a) {
        settings_init($a);
 }
 
-/// @TODO Change space -> tab where wanted
 function uexport_content(App $a) {
 
        if ($a->argc > 1) {
                header("Content-type: application/json");
-               header('Content-Disposition: attachment; filename="'.$a->user['nickname'].'.'.$a->argv[1].'"');
-               switch($a->argv[1]) {
+               header('Content-Disposition: attachment; filename="' . $a->user['nickname'] . '.' . $a->argv[1] . '"');
+               switch ($a->argv[1]) {
                        case "backup":
                                uexport_all($a);
                                killme();
@@ -51,9 +52,9 @@ function _uexport_multirow($query) {
        $result = array();
        $r = q($query);
        if (dbm::is_result($r)) {
-               foreach($r as $rr){
+               foreach ($r as $rr) {
                        $p = array();
-                       foreach($rr as $k => $v) {
+                       foreach ($rr as $k => $v) {
                                $p[$k] = $v;
                        }
                        $result[] = $p;
@@ -66,8 +67,8 @@ function _uexport_row($query) {
        $result = array();
        $r = q($query);
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
-                       foreach($rr as $k => $v) {
+               foreach ($r as $rr) {
+                       foreach ($rr as $k => $v) {
                                $result[$k] = $v;
                        }
                }
@@ -75,39 +76,38 @@ function _uexport_row($query) {
        return $result;
 }
 
-
-function uexport_account($a){
+function uexport_account($a) {
 
        $user = _uexport_row(
-               sprintf( "SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval(local_user()) )
+               sprintf("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval(local_user()))
        );
 
        $contact = _uexport_multirow(
-               sprintf( "SELECT * FROM `contact` WHERE `uid` = %d ",intval(local_user()) )
+               sprintf("SELECT * FROM `contact` WHERE `uid` = %d ", intval(local_user()))
        );
 
 
-       $profile =_uexport_multirow(
-               sprintf( "SELECT * FROM `profile` WHERE `uid` = %d ", intval(local_user()) )
+       $profile = _uexport_multirow(
+               sprintf("SELECT * FROM `profile` WHERE `uid` = %d ", intval(local_user()))
        );
 
        $photo = _uexport_multirow(
-               sprintf( "SELECT * FROM `photo` WHERE uid = %d AND profile = 1", intval(local_user()) )
+               sprintf("SELECT * FROM `photo` WHERE uid = %d AND profile = 1", intval(local_user()))
        );
        foreach ($photo as &$p) {
                $p['data'] = bin2hex($p['data']);
        }
 
        $pconfig = _uexport_multirow(
-               sprintf( "SELECT * FROM `pconfig` WHERE uid = %d",intval(local_user()) )
+               sprintf("SELECT * FROM `pconfig` WHERE uid = %d", intval(local_user()))
        );
 
        $group = _uexport_multirow(
-               sprintf( "SELECT * FROM `group` WHERE uid = %d",intval(local_user()) )
+               sprintf("SELECT * FROM `group` WHERE uid = %d", intval(local_user()))
        );
 
        $group_member = _uexport_multirow(
-               sprintf( "SELECT * FROM `group_member` WHERE uid = %d",intval(local_user()) )
+               sprintf("SELECT * FROM `group_member` WHERE uid = %d", intval(local_user()))
        );
 
        $output = array(
@@ -150,13 +150,8 @@ function uexport_all(App $a) {
                        intval($x),
                        intval(500)
                );
-               /*if (dbm::is_result($r)) {
-                       foreach($r as $rr)
-                               foreach($rr as $k => $v)
-                                       $item[][$k] = $v;
-               }*/
 
                $output = array('item' => $r);
-               echo json_encode($output)."\n";
+               echo json_encode($output) . "\n";
        }
 }
index 336ec1c2dd74e131b4e12af37b22d5ce979023cf..127933b96e507efe6f8f2801cc0c6ee48f0c9fc5 100644 (file)
@@ -1,35 +1,37 @@
 <?php\r
+\r
 /**\r
  * View for user import\r
- * @TODO This file has DOS line endings!\r
  */\r
 \r
+use Friendica\App;\r
+\r
 require_once("include/uimport.php");\r
 \r
 function uimport_post(App $a) {\r
-       switch($a->config['register_policy']) {\r
-       case REGISTER_OPEN:\r
-               $blocked = 0;\r
-               $verified = 1;\r
-               break;\r
+       switch ($a->config['register_policy']) {\r
+               case REGISTER_OPEN:\r
+                       $blocked = 0;\r
+                       $verified = 1;\r
+                       break;\r
 \r
-       case REGISTER_APPROVE:\r
-               $blocked = 1;\r
-               $verified = 0;\r
-               break;\r
+               case REGISTER_APPROVE:\r
+                       $blocked = 1;\r
+                       $verified = 0;\r
+                       break;\r
 \r
-       default:\r
-       case REGISTER_CLOSED:\r
-               if ((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {\r
-                       notice( t('Permission denied.') . EOL );\r
-                       return;\r
-               }\r
-               $blocked = 1;\r
-               $verified = 0;\r
-               break;\r
+               default:\r
+               case REGISTER_CLOSED:\r
+                       if ((!x($_SESSION, 'authenticated') && (!x($_SESSION, 'administrator')))) {\r
+                               notice(t('Permission denied.') . EOL);\r
+                               return;\r
+                       }\r
+                       $blocked = 1;\r
+                       $verified = 0;\r
+                       break;\r
        }\r
 \r
-       if (x($_FILES,'accountfile')){\r
+       if (x($_FILES, 'accountfile')) {\r
                /// @TODO Pass $blocked / $verified, send email to admin on REGISTER_APPROVE\r
                import_account($a, $_FILES['accountfile']);\r
                return;\r
@@ -38,26 +40,26 @@ function uimport_post(App $a) {
 \r
 function uimport_content(App $a) {\r
 \r
-       if ((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {\r
+       if ((!local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {\r
                notice("Permission denied." . EOL);\r
                return;\r
        }\r
 \r
-       $max_dailies = intval(get_config('system','max_daily_registrations'));\r
+       $max_dailies = intval(get_config('system', 'max_daily_registrations'));\r
        if ($max_dailies) {\r
                $r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");\r
                if ($r && $r[0]['total'] >= $max_dailies) {\r
                        logger('max daily registrations exceeded.');\r
-                       notice( t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);\r
+                       notice(t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);\r
                        return;\r
                }\r
        }\r
 \r
 \r
-       if (x($_SESSION,'theme')) {\r
+       if (x($_SESSION, 'theme')) {\r
                unset($_SESSION['theme']);\r
        }\r
-       if (x($_SESSION,'mobile-theme')) {\r
+       if (x($_SESSION, 'mobile-theme')) {\r
                unset($_SESSION['mobile-theme']);\r
        }\r
 \r
@@ -65,11 +67,11 @@ function uimport_content(App $a) {
        return replace_macros($tpl, array(\r
                '$regbutt' => t('Import'),\r
                '$import' => array(\r
-               'title' => t("Move account"),\r
-               'intro' => t("You can import an account from another Friendica server."),\r
-               'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),\r
-               'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),\r
-               'field' => array('accountfile', t('Account file'),'<input id="id_accountfile" name="accountfile" type="file">', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')),\r
+                       'title' => t("Move account"),\r
+                       'intro' => t("You can import an account from another Friendica server."),\r
+                       'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),\r
+                       'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),\r
+                       'field' => array('accountfile', t('Account file'), '<input id="id_accountfile" name="accountfile" type="file">', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')),\r
                ),\r
        ));\r
 }\r
index 9a39489dcfb822a39143b235b506a0d8c3905fec..f0e96af48c1a519167eeb27c5e8ea7dd683cc18e 100644 (file)
@@ -2,6 +2,8 @@
 
 // See update_profile.php for documentation
 
+use Friendica\App;
+
 require_once("mod/community.php");
 
 function update_community_content(App $a) {
index 86f4db8259f83c4db9fdd580666c91da42060c16..b8538a256bc99ab17eaee30d38c91660d0024358 100644 (file)
@@ -2,6 +2,8 @@
 
 // See update_profile.php for documentation
 
+use Friendica\App;
+
 require_once("mod/display.php");
 require_once("include/group.php");
 
index 869973ace4f07af1b8c2750103849a36f6f85f5d..42172486d83634c2b6e1af4227531fc4dcd1be94 100644 (file)
@@ -2,6 +2,8 @@
 
 // See update_profile.php for documentation
 
+use Friendica\App;
+
 require_once("mod/network.php");
 require_once("include/group.php");
 
index d27cc4ca9672bfcfe1007b2289bfd9bcb14dc71c..9fc886155159b318355ed8e780fbf4a613d080a8 100644 (file)
@@ -5,6 +5,8 @@
  * Purpose: AJAX synchronisation of notes page
  */
 
+use Friendica\App;
+
 require_once("mod/notes.php");
 
 function update_notes_content(App $a) {
index b77a9cdcfc5e4d40755c38bb22172364f9cdb7fb..5b15f06d30360f9f5211abd1a5be0b89e218870a 100644 (file)
@@ -5,6 +5,8 @@
  * Purpose: AJAX synchronisation of profile page
  */
 
+use Friendica\App;
+
 require_once("mod/profile.php");
 
 function update_profile_content(App $a) {
index 269d537854c5467f4fbb9ceef166a15017735168..2ee73c211d438c1787432bebb2069e1f7fe312b2 100644 (file)
@@ -1,11 +1,13 @@
 <?php
+
+use Friendica\App;
+
 require_once('include/items.php');
 require_once('include/acl_selectors.php');
 require_once('include/bbcode.php');
 require_once('include/security.php');
 require_once('include/redir.php');
 
-
 function videos_init(App $a) {
 
        if($a->argc > 1)
index 5912f6cc773f8d398135dcc6072e983e22cffb52..f7bf912fdffea333da38b0ed67236dc98b74962a 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 
index a3f0affb531971cfc1eb63e06fd02d073ce34b74..09158959065afb264d5fff39b936a78688fabd29 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\App;
 
 function viewsrc_content(App $a) {
 
index 0fc8b8a6a3aae79a60dc1bf70459de1bde6bed01..8bf1fdbf19d6293b0bada256d2bc4362fc4debae 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/attach.php');
 require_once('include/datetime.php');
 
index d29efecc6ad2319eb86365a7fae727e9fa3f0e36..a35e86a5297a098d75aa9d2a89e861e4bcc9470c 100644 (file)
@@ -3,17 +3,17 @@
 /**
  * @file mod/wall_upload.php
  * @brief Module for uploading a picture to the profile wall
- * 
+ *
  * By default the picture will be stored in the photo album with the name Wall Photos.
  * You can specify a different album by adding an optional query string "album="
  * to the url
  */
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once 'include/Photo.php';
 
-
 function wall_upload_post(App $a, $desktopmode = true) {
 
        logger("wall upload: starting new upload", LOGGER_DEBUG);
index ff90e0dbcf510b6ec6c97eaf762578fb19f97f64..72897c0657f77adc057bc738085d91d1bf9e79d2 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/message.php');
 
 function wallmessage_post(App $a) {
index d823bd2dc217b988c8f5d41839ee22f77bfde8a8..a831fc12cd44937fe07824ec7161bead7a0148f3 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once("include/Probe.php");
 
 function webfinger_content(App $a) {
index 4949b830f4866c4863eb5fe99d363e35e06077a6..62f9bd3dde232d8611a150101b41a78adccd1e0c 100644 (file)
@@ -5,8 +5,8 @@
  */
 require_once("include/poller.php");
 
-use \Friendica\Core\Config;
-use \Friendica\Core\PConfig;
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
 
 function worker_init($a){
 
index 7b812a7f9d94610d804515ba2e454cdf855762b0..c51f41946c59237a493fc60682c0e717e5bf60e3 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 require_once('include/crypto.php');
 
 function xrd_init(App $a) {
index 2666dc1de572816a01ec53d4522288392e8c5424..15c7d8dc652dbd0bcc05dcce1ac2ad5db6cc123b 100644 (file)
@@ -14,7 +14,7 @@ class BaseObject {
 
        /**
         * Get the app
-        * 
+        *
         * Same as get_app from boot.php
         */
        public function get_app() {
@@ -33,4 +33,3 @@ class BaseObject {
                self::$app = $app;
        }
 }
-?>
index eb5b3b9b486985fe67bc0c8958cb3f33912293c8..f03b3b1c1bc00cfbada58c7f0a93495d3394bd78 100644 (file)
@@ -164,4 +164,3 @@ class Conversation extends BaseObject {
                return false;
        }
 }
-?>
index b693520b93d8cb2e932af589a6b5da94cb51a46a..0042e070a9da9b3bc73b02606f68328e880c44a2 100644 (file)
@@ -112,7 +112,7 @@ class Item extends BaseObject {
 
                $conv = $this->get_conversation();
 
-               $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
+               $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
                        || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
                        ? t('Private Message')
                        : false);
@@ -754,20 +754,20 @@ class Item extends BaseObject {
                                        if ((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) {
 
                                                // The author url doesn't match the owner (typically the contact)
-                                               // and also doesn't match the contact alias. 
-                                               // The name match is a hack to catch several weird cases where URLs are 
+                                               // and also doesn't match the contact alias.
+                                               // The name match is a hack to catch several weird cases where URLs are
                                                // all over the park. It can be tricked, but this prevents you from
                                                // seeing "Bob Smith to Bob Smith via Wall-to-wall" and you know darn
-                                               // well that it's the same Bob Smith. 
+                                               // well that it's the same Bob Smith.
 
-                                               // But it could be somebody else with the same name. It just isn't highly likely. 
+                                               // But it could be somebody else with the same name. It just isn't highly likely.
 
 
                                                $this->owner_photo = $this->get_data_value('owner-avatar');
                                                $this->owner_name = $this->get_data_value('owner-name');
                                                $this->wall_to_wall = true;
                                                // If it is our contact, use a friendly redirect link
-                                               if ((link_compare($this->get_data_value('owner-link'),$this->get_data_value('url'))) 
+                                               if ((link_compare($this->get_data_value('owner-link'),$this->get_data_value('url')))
                                                        && ($this->get_data_value('network') === NETWORK_DFRN)) {
                                                        $this->owner_url = $this->get_redirect_url();
                                                } else {
@@ -807,5 +807,3 @@ class Item extends BaseObject {
        }
 
 }
-/// @TODO These are discouraged and should be removed:
-?>
diff --git a/src/App.php b/src/App.php
new file mode 100644 (file)
index 0000000..efb60c0
--- /dev/null
@@ -0,0 +1,980 @@
+<?php\r
+\r
+namespace Friendica;\r
+\r
+use Friendica\Core\Config;\r
+use Friendica\Core\PConfig;\r
+\r
+/**\r
+ *\r
+ * class: App\r
+ *\r
+ * @brief Our main application structure for the life of this page.\r
+ *\r
+ * Primarily deals with the URL that got us here\r
+ * and tries to make some sense of it, and\r
+ * stores our page contents and config storage\r
+ * and anything else that might need to be passed around\r
+ * before we spit the page out.\r
+ *\r
+ */\r
+class App {\r
+\r
+       public $module_loaded = false;\r
+       public $query_string;\r
+       public $config;\r
+       public $page;\r
+       public $profile;\r
+       public $profile_uid;\r
+       public $user;\r
+       public $cid;\r
+       public $contact;\r
+       public $contacts;\r
+       public $page_contact;\r
+       public $content;\r
+       public $data = array();\r
+       public $error = false;\r
+       public $cmd;\r
+       public $argv;\r
+       public $argc;\r
+       public $module;\r
+       public $pager;\r
+       public $strings;\r
+       public $basepath;\r
+       public $path;\r
+       public $hooks;\r
+       public $timezone;\r
+       public $interactive = true;\r
+       public $plugins;\r
+       public $apps = array();\r
+       public $identities;\r
+       public $is_mobile = false;\r
+       public $is_tablet = false;\r
+       public $is_friendica_app;\r
+       public $performance = array();\r
+       public $callstack = array();\r
+       public $theme_info = array();\r
+       public $backend = true;\r
+       public $nav_sel;\r
+       public $category;\r
+       // Allow themes to control internal parameters\r
+       // by changing App values in theme.php\r
+\r
+       public $sourcename = '';\r
+       public $videowidth = 425;\r
+       public $videoheight = 350;\r
+       public $force_max_items = 0;\r
+       public $theme_thread_allow = true;\r
+       public $theme_events_in_profile = true;\r
+\r
+       /**\r
+        * @brief An array for all theme-controllable parameters\r
+        *\r
+        * Mostly unimplemented yet. Only options 'template_engine' and\r
+        * beyond are used.\r
+        */\r
+       public $theme = array(\r
+               'sourcename' => '',\r
+               'videowidth' => 425,\r
+               'videoheight' => 350,\r
+               'force_max_items' => 0,\r
+               'thread_allow' => true,\r
+               'stylesheet' => '',\r
+               'template_engine' => 'smarty3',\r
+       );\r
+\r
+       /**\r
+        * @brief An array of registered template engines ('name'=>'class name')\r
+        */\r
+       public $template_engines = array();\r
+\r
+       /**\r
+        * @brief An array of instanced template engines ('name'=>'instance')\r
+        */\r
+       public $template_engine_instance = array();\r
+       public $process_id;\r
+       private $ldelim = array(\r
+               'internal' => '',\r
+               'smarty3' => '{{'\r
+       );\r
+       private $rdelim = array(\r
+               'internal' => '',\r
+               'smarty3' => '}}'\r
+       );\r
+       private $scheme;\r
+       private $hostname;\r
+       private $db;\r
+       private $curl_code;\r
+       private $curl_content_type;\r
+       private $curl_headers;\r
+       private $cached_profile_image;\r
+       private $cached_profile_picdate;\r
+       private static $a;\r
+\r
+       /**\r
+        * @brief App constructor.\r
+        *\r
+        * @param string $basepath Path to the app base folder\r
+        */\r
+       function __construct($basepath) {\r
+\r
+               global $default_timezone;\r
+\r
+               $hostname = '';\r
+\r
+               if (file_exists('.htpreconfig.php')) {\r
+                       include '.htpreconfig.php';\r
+               }\r
+\r
+               $this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');\r
+\r
+               date_default_timezone_set($this->timezone);\r
+\r
+               $this->performance['start'] = microtime(true);\r
+               $this->performance['database'] = 0;\r
+               $this->performance['database_write'] = 0;\r
+               $this->performance['network'] = 0;\r
+               $this->performance['file'] = 0;\r
+               $this->performance['rendering'] = 0;\r
+               $this->performance['parser'] = 0;\r
+               $this->performance['marktime'] = 0;\r
+               $this->performance['markstart'] = microtime(true);\r
+\r
+               $this->callstack['database'] = array();\r
+               $this->callstack['database_write'] = array();\r
+               $this->callstack['network'] = array();\r
+               $this->callstack['file'] = array();\r
+               $this->callstack['rendering'] = array();\r
+               $this->callstack['parser'] = array();\r
+\r
+               $this->config = array();\r
+               $this->page = array();\r
+               $this->pager = array();\r
+\r
+               $this->query_string = '';\r
+\r
+               $this->process_id = uniqid('log', true);\r
+\r
+               startup();\r
+\r
+               $this->scheme = 'http';\r
+\r
+               if ((x($_SERVER, 'HTTPS') && $_SERVER['HTTPS']) ||\r
+                       (x($_SERVER, 'HTTP_FORWARDED') && preg_match('/proto=https/', $_SERVER['HTTP_FORWARDED'])) ||\r
+                       (x($_SERVER, 'HTTP_X_FORWARDED_PROTO') && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ||\r
+                       (x($_SERVER, 'HTTP_X_FORWARDED_SSL') && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ||\r
+                       (x($_SERVER, 'FRONT_END_HTTPS') && $_SERVER['FRONT_END_HTTPS'] == 'on') ||\r
+                       (x($_SERVER, 'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) // XXX: reasonable assumption, but isn't this hardcoding too much?\r
+               ) {\r
+                       $this->scheme = 'https';\r
+               }\r
+\r
+               if (x($_SERVER, 'SERVER_NAME')) {\r
+                       $this->hostname = $_SERVER['SERVER_NAME'];\r
+\r
+                       if (x($_SERVER, 'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {\r
+                               $this->hostname .= ':' . $_SERVER['SERVER_PORT'];\r
+                       }\r
+                       /*\r
+                        * Figure out if we are running at the top of a domain\r
+                        * or in a sub-directory and adjust accordingly\r
+                        */\r
+\r
+                       /// @TODO This kind of escaping breaks syntax-highlightning on CoolEdit (Midnight Commander)\r
+                       $path = trim(dirname($_SERVER['SCRIPT_NAME']), '/\\');\r
+                       if (isset($path) && strlen($path) && ($path != $this->path)) {\r
+                               $this->path = $path;\r
+                       }\r
+               }\r
+\r
+               if ($hostname != '') {\r
+                       $this->hostname = $hostname;\r
+               }\r
+\r
+               if (! static::directory_usable($basepath)) {\r
+                       throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');\r
+               }\r
+\r
+               $this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);\r
+\r
+               set_include_path(\r
+                       get_include_path() . PATH_SEPARATOR\r
+                       . $this->basepath . DIRECTORY_SEPARATOR . 'include' . PATH_SEPARATOR\r
+                       . $this->basepath . DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR\r
+                       . $this->basepath . DIRECTORY_SEPARATOR . 'library/langdet' . PATH_SEPARATOR\r
+                       . $this->basepath);\r
+\r
+\r
+               if (is_array($_SERVER['argv']) && $_SERVER['argc'] > 1 && substr(end($_SERVER['argv']), 0, 4) == 'http') {\r
+                       $this->set_baseurl(array_pop($_SERVER['argv']));\r
+                       $_SERVER['argc'] --;\r
+               }\r
+\r
+               if ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 9) === 'pagename=') {\r
+                       $this->query_string = substr($_SERVER['QUERY_STRING'], 9);\r
+\r
+                       // removing trailing / - maybe a nginx problem\r
+                       $this->query_string = ltrim($this->query_string, '/');\r
+               } elseif ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === 'q=') {\r
+                       $this->query_string = substr($_SERVER['QUERY_STRING'], 2);\r
+\r
+                       // removing trailing / - maybe a nginx problem\r
+                       $this->query_string = ltrim($this->query_string, '/');\r
+               }\r
+\r
+               if (x($_GET, 'pagename')) {\r
+                       $this->cmd = trim($_GET['pagename'], '/\\');\r
+               } elseif (x($_GET, 'q')) {\r
+                       $this->cmd = trim($_GET['q'], '/\\');\r
+               }\r
+\r
+               // fix query_string\r
+               $this->query_string = str_replace($this->cmd . '&', $this->cmd . '?', $this->query_string);\r
+\r
+               // unix style "homedir"\r
+               if (substr($this->cmd, 0, 1) === '~') {\r
+                       $this->cmd = 'profile/' . substr($this->cmd, 1);\r
+               }\r
+\r
+               // Diaspora style profile url\r
+               if (substr($this->cmd, 0, 2) === 'u/') {\r
+                       $this->cmd = 'profile/' . substr($this->cmd, 2);\r
+               }\r
+\r
+               /*\r
+                * Break the URL path into C style argc/argv style arguments for our\r
+                * modules. Given "http://example.com/module/arg1/arg2", $this->argc\r
+                * will be 3 (integer) and $this->argv will contain:\r
+                *   [0] => 'module'\r
+                *   [1] => 'arg1'\r
+                *   [2] => 'arg2'\r
+                *\r
+                *\r
+                * There will always be one argument. If provided a naked domain\r
+                * URL, $this->argv[0] is set to "home".\r
+                */\r
+\r
+               $this->argv = explode('/', $this->cmd);\r
+               $this->argc = count($this->argv);\r
+               if ((array_key_exists('0', $this->argv)) && strlen($this->argv[0])) {\r
+                       $this->module = str_replace('.', '_', $this->argv[0]);\r
+                       $this->module = str_replace('-', '_', $this->module);\r
+               } else {\r
+                       $this->argc = 1;\r
+                       $this->argv = array('home');\r
+                       $this->module = 'home';\r
+               }\r
+\r
+               // See if there is any page number information, and initialise pagination\r
+               $this->pager['page'] = ((x($_GET, 'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1);\r
+               $this->pager['itemspage'] = 50;\r
+               $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];\r
+\r
+               if ($this->pager['start'] < 0) {\r
+                       $this->pager['start'] = 0;\r
+               }\r
+               $this->pager['total'] = 0;\r
+\r
+               // Detect mobile devices\r
+               $mobile_detect = new \Mobile_Detect();\r
+               $this->is_mobile = $mobile_detect->isMobile();\r
+               $this->is_tablet = $mobile_detect->isTablet();\r
+\r
+               // Friendica-Client\r
+               $this->is_friendica_app = ($_SERVER['HTTP_USER_AGENT'] == 'Apache-HttpClient/UNAVAILABLE (java 1.4)');\r
+\r
+               // Register template engines\r
+               $dc = get_declared_classes();\r
+               foreach ($dc as $k) {\r
+                       if (in_array('ITemplateEngine', class_implements($k))) {\r
+                               $this->register_template_engine($k);\r
+                       }\r
+               }\r
+\r
+               self::$a = $this;\r
+       }\r
+\r
+       /**\r
+        * @brief Returns the base filesystem path of the App\r
+        *\r
+        * It first checks for the internal variable, then for DOCUMENT_ROOT and\r
+        * finally for PWD\r
+        *\r
+        * @return string\r
+        */\r
+       public static function get_basepath() {\r
+               if (isset($this)) {\r
+                       $basepath = $this->basepath;\r
+               }\r
+\r
+               if (! $basepath) {\r
+                       $basepath = Config::get('system', 'basepath');\r
+               }\r
+\r
+               if (! $basepath && x($_SERVER, 'DOCUMENT_ROOT')) {\r
+                       $basepath = $_SERVER['DOCUMENT_ROOT'];\r
+               }\r
+\r
+               if (! $basepath && x($_SERVER, 'PWD')) {\r
+                       $basepath = $_SERVER['PWD'];\r
+               }\r
+\r
+               return $basepath;\r
+       }\r
+\r
+       function get_scheme() {\r
+               return $this->scheme;\r
+       }\r
+\r
+       /**\r
+        * @brief Retrieves the Friendica instance base URL\r
+        *\r
+        * This function assembles the base URL from multiple parts:\r
+        * - Protocol is determined either by the request or a combination of\r
+        * system.ssl_policy and the $ssl parameter.\r
+        * - Host name is determined either by system.hostname or inferred from request\r
+        * - Path is inferred from SCRIPT_NAME\r
+        *\r
+        * Note: $ssl parameter value doesn't directly correlate with the resulting protocol\r
+        *\r
+        * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN\r
+        * @return string Friendica server base URL\r
+        */\r
+       function get_baseurl($ssl = false) {\r
+               // Is the function called statically?\r
+               if (!(isset($this) && get_class($this) == __CLASS__)) {\r
+                       return self::$a->get_baseurl($ssl);\r
+               }\r
+\r
+               $scheme = $this->scheme;\r
+\r
+               if (Config::get('system', 'ssl_policy') == SSL_POLICY_FULL) {\r
+                       $scheme = 'https';\r
+               }\r
+\r
+               //      Basically, we have $ssl = true on any links which can only be seen by a logged in user\r
+               //      (and also the login link). Anything seen by an outsider will have it turned off.\r
+\r
+               if (Config::get('system', 'ssl_policy') == SSL_POLICY_SELFSIGN) {\r
+                       if ($ssl) {\r
+                               $scheme = 'https';\r
+                       } else {\r
+                               $scheme = 'http';\r
+                       }\r
+               }\r
+\r
+               if (Config::get('config', 'hostname') != '') {\r
+                       $this->hostname = Config::get('config', 'hostname');\r
+               }\r
+\r
+               return $scheme . '://' . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );\r
+       }\r
+\r
+       /**\r
+        * @brief Initializes the baseurl components\r
+        *\r
+        * Clears the baseurl cache to prevent inconstistencies\r
+        *\r
+        * @param string $url\r
+        */\r
+       function set_baseurl($url) {\r
+               $parsed = @parse_url($url);\r
+\r
+               if ($parsed) {\r
+                       $this->scheme = $parsed['scheme'];\r
+\r
+                       $hostname = $parsed['host'];\r
+                       if (x($parsed, 'port')) {\r
+                               $hostname .= ':' . $parsed['port'];\r
+                       }\r
+                       if (x($parsed, 'path')) {\r
+                               $this->path = trim($parsed['path'], '\\/');\r
+                       }\r
+\r
+                       if (file_exists('.htpreconfig.php')) {\r
+                               include '.htpreconfig.php';\r
+                       }\r
+\r
+                       if (Config::get('config', 'hostname') != '') {\r
+                               $this->hostname = Config::get('config', 'hostname');\r
+                       }\r
+\r
+                       if (!isset($this->hostname) OR ( $this->hostname == '')) {\r
+                               $this->hostname = $hostname;\r
+                       }\r
+               }\r
+       }\r
+\r
+       function get_hostname() {\r
+               if (Config::get('config', 'hostname') != '') {\r
+                       $this->hostname = Config::get('config', 'hostname');\r
+               }\r
+\r
+               return $this->hostname;\r
+       }\r
+\r
+       function set_hostname($h) {\r
+               $this->hostname = $h;\r
+       }\r
+\r
+       function set_path($p) {\r
+               $this->path = trim(trim($p), '/');\r
+       }\r
+\r
+       function get_path() {\r
+               return $this->path;\r
+       }\r
+\r
+       function set_pager_total($n) {\r
+               $this->pager['total'] = intval($n);\r
+       }\r
+\r
+       function set_pager_itemspage($n) {\r
+               $this->pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0);\r
+               $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];\r
+       }\r
+\r
+       function set_pager_page($n) {\r
+               $this->pager['page'] = $n;\r
+               $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];\r
+       }\r
+\r
+       function init_pagehead() {\r
+               $interval = ((local_user()) ? PConfig::get(local_user(), 'system', 'update_interval') : 40000);\r
+\r
+               // If the update is 'deactivated' set it to the highest integer number (~24 days)\r
+               if ($interval < 0) {\r
+                       $interval = 2147483647;\r
+               }\r
+\r
+               if ($interval < 10000) {\r
+                       $interval = 40000;\r
+               }\r
+\r
+               // compose the page title from the sitename and the\r
+               // current module called\r
+               if (!$this->module == '') {\r
+                       $this->page['title'] = $this->config['sitename'] . ' (' . $this->module . ')';\r
+               } else {\r
+                       $this->page['title'] = $this->config['sitename'];\r
+               }\r
+\r
+               /* put the head template at the beginning of page['htmlhead']\r
+                * since the code added by the modules frequently depends on it\r
+                * being first\r
+                */\r
+               if (!isset($this->page['htmlhead'])) {\r
+                       $this->page['htmlhead'] = '';\r
+               }\r
+\r
+               // If we're using Smarty, then doing replace_macros() will replace\r
+               // any unrecognized variables with a blank string. Since we delay\r
+               // replacing $stylesheet until later, we need to replace it now\r
+               // with another variable name\r
+               if ($this->theme['template_engine'] === 'smarty3') {\r
+                       $stylesheet = $this->get_template_ldelim('smarty3') . '$stylesheet' . $this->get_template_rdelim('smarty3');\r
+               } else {\r
+                       $stylesheet = '$stylesheet';\r
+               }\r
+\r
+               $shortcut_icon = Config::get('system', 'shortcut_icon');\r
+               if ($shortcut_icon == '') {\r
+                       $shortcut_icon = 'images/friendica-32.png';\r
+               }\r
+\r
+               $touch_icon = Config::get('system', 'touch_icon');\r
+               if ($touch_icon == '') {\r
+                       $touch_icon = 'images/friendica-128.png';\r
+               }\r
+\r
+               // get data wich is needed for infinite scroll on the network page\r
+               $invinite_scroll = infinite_scroll_data($this->module);\r
+\r
+               $tpl = get_markup_template('head.tpl');\r
+               $this->page['htmlhead'] = replace_macros($tpl, array(\r
+                               '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!\r
+                               '$local_user' => local_user(),\r
+                               '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,\r
+                               '$delitem' => t('Delete this item?'),\r
+                               '$showmore' => t('show more'),\r
+                               '$showfewer' => t('show fewer'),\r
+                               '$update_interval' => $interval,\r
+                               '$shortcut_icon' => $shortcut_icon,\r
+                               '$touch_icon' => $touch_icon,\r
+                               '$stylesheet' => $stylesheet,\r
+                               '$infinite_scroll' => $invinite_scroll,\r
+                       )) . $this->page['htmlhead'];\r
+       }\r
+\r
+       function init_page_end() {\r
+               if (!isset($this->page['end'])) {\r
+                       $this->page['end'] = '';\r
+               }\r
+               $tpl = get_markup_template('end.tpl');\r
+               $this->page['end'] = replace_macros($tpl, array(\r
+                               '$baseurl' => $this->get_baseurl() // FIXME for z_path!!!!\r
+                       )) . $this->page['end'];\r
+       }\r
+\r
+       function set_curl_code($code) {\r
+               $this->curl_code = $code;\r
+       }\r
+\r
+       function get_curl_code() {\r
+               return $this->curl_code;\r
+       }\r
+\r
+       function set_curl_content_type($content_type) {\r
+               $this->curl_content_type = $content_type;\r
+       }\r
+\r
+       function get_curl_content_type() {\r
+               return $this->curl_content_type;\r
+       }\r
+\r
+       function set_curl_headers($headers) {\r
+               $this->curl_headers = $headers;\r
+       }\r
+\r
+       function get_curl_headers() {\r
+               return $this->curl_headers;\r
+       }\r
+\r
+       function get_cached_avatar_image($avatar_image) {\r
+               return $avatar_image;\r
+       }\r
+\r
+       /**\r
+        * @brief Removes the baseurl from an url. This avoids some mixed content problems.\r
+        *\r
+        * @param string $orig_url\r
+        *\r
+        * @return string The cleaned url\r
+        */\r
+       function remove_baseurl($orig_url) {\r
+\r
+               // Is the function called statically?\r
+               if (!(isset($this) && get_class($this) == __CLASS__)) {\r
+                       return self::$a->remove_baseurl($orig_url);\r
+               }\r
+\r
+               // Remove the hostname from the url if it is an internal link\r
+               $nurl = normalise_link($orig_url);\r
+               $base = normalise_link($this->get_baseurl());\r
+               $url = str_replace($base . '/', '', $nurl);\r
+\r
+               // if it is an external link return the orignal value\r
+               if ($url == normalise_link($orig_url)) {\r
+                       return $orig_url;\r
+               } else {\r
+                       return $url;\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @brief Register template engine class\r
+        *\r
+        * If $name is '', is used class static property $class::$name\r
+        *\r
+        * @param string $class\r
+        * @param string $name\r
+        */\r
+       function register_template_engine($class, $name = '') {\r
+               /// @TODO Really === and not just == ?\r
+               if ($name === '') {\r
+                       $v = get_class_vars($class);\r
+                       if (x($v, 'name'))\r
+                               $name = $v['name'];\r
+               }\r
+               if ($name === '') {\r
+                       echo "template engine <tt>$class</tt> cannot be registered without a name.\n";\r
+                       killme();\r
+               }\r
+               $this->template_engines[$name] = $class;\r
+       }\r
+\r
+       /**\r
+        * @brief Return template engine instance.\r
+        *\r
+        * If $name is not defined, return engine defined by theme,\r
+        * or default\r
+        *\r
+        * @param strin $name Template engine name\r
+        * @return object Template Engine instance\r
+        */\r
+       function template_engine($name = '') {\r
+               /// @TODO really type-check included?\r
+               if ($name !== '') {\r
+                       $template_engine = $name;\r
+               } else {\r
+                       $template_engine = 'smarty3';\r
+                       if (x($this->theme, 'template_engine')) {\r
+                               $template_engine = $this->theme['template_engine'];\r
+                       }\r
+               }\r
+\r
+               if (isset($this->template_engines[$template_engine])) {\r
+                       if (isset($this->template_engine_instance[$template_engine])) {\r
+                               return $this->template_engine_instance[$template_engine];\r
+                       } else {\r
+                               $class = $this->template_engines[$template_engine];\r
+                               $obj = new $class;\r
+                               $this->template_engine_instance[$template_engine] = $obj;\r
+                               return $obj;\r
+                       }\r
+               }\r
+\r
+               echo "template engine <tt>$template_engine</tt> is not registered!\n";\r
+               killme();\r
+       }\r
+\r
+       /**\r
+        * @brief Returns the active template engine.\r
+        *\r
+        * @return string\r
+        */\r
+       function get_template_engine() {\r
+               return $this->theme['template_engine'];\r
+       }\r
+\r
+       function set_template_engine($engine = 'smarty3') {\r
+               $this->theme['template_engine'] = $engine;\r
+       }\r
+\r
+       function get_template_ldelim($engine = 'smarty3') {\r
+               return $this->ldelim[$engine];\r
+       }\r
+\r
+       function get_template_rdelim($engine = 'smarty3') {\r
+               return $this->rdelim[$engine];\r
+       }\r
+\r
+       function save_timestamp($stamp, $value) {\r
+               if (!isset($this->config['system']['profiler']) || !$this->config['system']['profiler']) {\r
+                       return;\r
+               }\r
+\r
+               $duration = (float) (microtime(true) - $stamp);\r
+\r
+               if (!isset($this->performance[$value])) {\r
+                       // Prevent ugly E_NOTICE\r
+                       $this->performance[$value] = 0;\r
+               }\r
+\r
+               $this->performance[$value] += (float) $duration;\r
+               $this->performance['marktime'] += (float) $duration;\r
+\r
+               $callstack = $this->callstack();\r
+\r
+               if (!isset($this->callstack[$value][$callstack])) {\r
+                       // Prevent ugly E_NOTICE\r
+                       $this->callstack[$value][$callstack] = 0;\r
+               }\r
+\r
+               $this->callstack[$value][$callstack] += (float) $duration;\r
+       }\r
+\r
+       /**\r
+        * @brief Log active processes into the "process" table\r
+        */\r
+       function start_process() {\r
+               $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);\r
+\r
+               $command = basename($trace[0]['file']);\r
+\r
+               $this->remove_inactive_processes();\r
+\r
+               q('START TRANSACTION');\r
+\r
+               $r = q('SELECT `pid` FROM `process` WHERE `pid` = %d', intval(getmypid()));\r
+               if (!\dbm::is_result($r)) {\r
+                       q("INSERT INTO `process` (`pid`,`command`,`created`) VALUES (%d, '%s', '%s')", intval(getmypid()), dbesc($command), dbesc(datetime_convert()));\r
+               }\r
+               q('COMMIT');\r
+       }\r
+\r
+       /**\r
+        * @brief Remove inactive processes\r
+        */\r
+       function remove_inactive_processes() {\r
+               q('START TRANSACTION');\r
+\r
+               $r = q('SELECT `pid` FROM `process`');\r
+               if (\dbm::is_result($r)) {\r
+                       foreach ($r AS $process) {\r
+                               if (!posix_kill($process['pid'], 0)) {\r
+                                       q('DELETE FROM `process` WHERE `pid` = %d', intval($process['pid']));\r
+                               }\r
+                       }\r
+               }\r
+               q('COMMIT');\r
+       }\r
+\r
+       /**\r
+        * @brief Remove the active process from the "process" table\r
+        */\r
+       function end_process() {\r
+               q('DELETE FROM `process` WHERE `pid` = %d', intval(getmypid()));\r
+       }\r
+\r
+       /**\r
+        * @brief Returns a string with a callstack. Can be used for logging.\r
+        *\r
+        * @return string\r
+        */\r
+       function callstack() {\r
+               $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 6);\r
+\r
+               // We remove the first two items from the list since they contain data that we don't need.\r
+               array_shift($trace);\r
+               array_shift($trace);\r
+\r
+               $callstack = array();\r
+               foreach ($trace AS $func) {\r
+                       $callstack[] = $func['function'];\r
+               }\r
+\r
+               return implode(', ', $callstack);\r
+       }\r
+\r
+       function get_useragent() {\r
+               return\r
+                       FRIENDICA_PLATFORM . " '" .\r
+                       FRIENDICA_CODENAME . "' " .\r
+                       FRIENDICA_VERSION . '-' .\r
+                       DB_UPDATE_VERSION . '; ' .\r
+                       $this->get_baseurl();\r
+       }\r
+\r
+       function is_friendica_app() {\r
+               return $this->is_friendica_app;\r
+       }\r
+\r
+       /**\r
+        * @brief Checks if the site is called via a backend process\r
+        *\r
+        * This isn't a perfect solution. But we need this check very early.\r
+        * So we cannot wait until the modules are loaded.\r
+        *\r
+        * @return bool Is it a known backend?\r
+        */\r
+       function is_backend() {\r
+               static $backends = array();\r
+               $backends[] = '_well_known';\r
+               $backends[] = 'api';\r
+               $backends[] = 'dfrn_notify';\r
+               $backends[] = 'fetch';\r
+               $backends[] = 'hcard';\r
+               $backends[] = 'hostxrd';\r
+               $backends[] = 'nodeinfo';\r
+               $backends[] = 'noscrape';\r
+               $backends[] = 'p';\r
+               $backends[] = 'poco';\r
+               $backends[] = 'post';\r
+               $backends[] = 'proxy';\r
+               $backends[] = 'pubsub';\r
+               $backends[] = 'pubsubhubbub';\r
+               $backends[] = 'receive';\r
+               $backends[] = 'rsd_xml';\r
+               $backends[] = 'salmon';\r
+               $backends[] = 'statistics_json';\r
+               $backends[] = 'xrd';\r
+\r
+               // Check if current module is in backend or backend flag is set\r
+               return (in_array($this->module, $backends) || $this->backend);\r
+       }\r
+\r
+       /**\r
+        * @brief Checks if the maximum number of database processes is reached\r
+        *\r
+        * @return bool Is the limit reached?\r
+        */\r
+       function max_processes_reached() {\r
+\r
+               if ($this->is_backend()) {\r
+                       $process = 'backend';\r
+                       $max_processes = Config::get('system', 'max_processes_backend');\r
+                       if (intval($max_processes) == 0) {\r
+                               $max_processes = 5;\r
+                       }\r
+               } else {\r
+                       $process = 'frontend';\r
+                       $max_processes = Config::get('system', 'max_processes_frontend');\r
+                       if (intval($max_processes) == 0) {\r
+                               $max_processes = 20;\r
+                       }\r
+               }\r
+\r
+               $processlist = \dbm::processlist();\r
+               if ($processlist['list'] != '') {\r
+                       logger('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], LOGGER_DEBUG);\r
+\r
+                       if ($processlist['amount'] > $max_processes) {\r
+                               logger('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.', LOGGER_DEBUG);\r
+                               return true;\r
+                       }\r
+               }\r
+               return false;\r
+       }\r
+\r
+       /**\r
+        * @brief Checks if the minimal memory is reached\r
+        *\r
+        * @return bool Is the memory limit reached?\r
+        */\r
+       public function min_memory_reached() {\r
+               $min_memory = Config::get('system', 'min_memory', 0);\r
+               if ($min_memory == 0) {\r
+                       return false;\r
+               }\r
+\r
+               if (!is_readable('/proc/meminfo')) {\r
+                       return false;\r
+               }\r
+\r
+               $memdata = explode("\n", file_get_contents('/proc/meminfo'));\r
+\r
+               $meminfo = array();\r
+               foreach ($memdata as $line) {\r
+                       list($key, $val) = explode(':', $line);\r
+                       $meminfo[$key] = (int) trim(str_replace('kB', '', $val));\r
+                       $meminfo[$key] = (int) ($meminfo[$key] / 1024);\r
+               }\r
+\r
+               if (!isset($meminfo['MemAvailable']) OR ! isset($meminfo['MemFree'])) {\r
+                       return false;\r
+               }\r
+\r
+               $free = $meminfo['MemAvailable'] + $meminfo['MemFree'];\r
+\r
+               $reached = ($free < $min_memory);\r
+\r
+               if ($reached) {\r
+                       logger('Minimal memory reached: ' . $free . '/' . $meminfo['MemTotal'] . ' - limit ' . $min_memory, LOGGER_DEBUG);\r
+               }\r
+\r
+               return $reached;\r
+       }\r
+\r
+       /**\r
+        * @brief Checks if the maximum load is reached\r
+        *\r
+        * @return bool Is the load reached?\r
+        */\r
+       function maxload_reached() {\r
+\r
+               if ($this->is_backend()) {\r
+                       $process = 'backend';\r
+                       $maxsysload = intval(Config::get('system', 'maxloadavg'));\r
+                       if ($maxsysload < 1) {\r
+                               $maxsysload = 50;\r
+                       }\r
+               } else {\r
+                       $process = 'frontend';\r
+                       $maxsysload = intval(Config::get('system', 'maxloadavg_frontend'));\r
+                       if ($maxsysload < 1) {\r
+                               $maxsysload = 50;\r
+                       }\r
+               }\r
+\r
+               $load = current_load();\r
+               if ($load) {\r
+                       if (intval($load) > $maxsysload) {\r
+                               logger('system: load ' . $load . ' for ' . $process . ' tasks (' . $maxsysload . ') too high.');\r
+                               return true;\r
+                       }\r
+               }\r
+               return false;\r
+       }\r
+\r
+       function proc_run($args) {\r
+\r
+               if (!function_exists('proc_open')) {\r
+                       return;\r
+               }\r
+\r
+               // If the last worker fork was less than 10 seconds before then don't fork another one.\r
+               // This should prevent the forking of masses of workers.\r
+               $cachekey = 'app:proc_run:started';\r
+               $result = \Cache::get($cachekey);\r
+\r
+               if (!is_null($result) AND ( time() - $result) < 10) {\r
+                       return;\r
+               }\r
+\r
+               // Set the timestamp of the last proc_run\r
+               \Cache::set($cachekey, time(), CACHE_MINUTE);\r
+\r
+               array_unshift($args, ((x($this->config, 'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php'));\r
+\r
+               // add baseurl to args. cli scripts can't construct it\r
+               $args[] = $this->get_baseurl();\r
+\r
+               for ($x = 0; $x < count($args); $x ++) {\r
+                       $args[$x] = escapeshellarg($args[$x]);\r
+               }\r
+\r
+               $cmdline = implode($args, ' ');\r
+\r
+               if ($this->min_memory_reached()) {\r
+                       return;\r
+               }\r
+\r
+               if (Config::get('system', 'proc_windows')) {\r
+                       $resource = proc_open('cmd /c start /b ' . $cmdline, array(), $foo, $this->get_basepath());\r
+               } else {\r
+                       $resource = proc_open($cmdline . ' &', array(), $foo, $this->get_basepath());\r
+               }\r
+               if (!is_resource($resource)) {\r
+                       logger('We got no resource for command ' . $cmdline, LOGGER_DEBUG);\r
+                       return;\r
+               }\r
+               proc_close($resource);\r
+       }\r
+\r
+       /**\r
+        * @brief Returns the system user that is executing the script\r
+        *\r
+        * This mostly returns something like "www-data".\r
+        *\r
+        * @return string system username\r
+        */\r
+       static function systemuser() {\r
+               if (!function_exists('posix_getpwuid') OR ! function_exists('posix_geteuid')) {\r
+                       return '';\r
+               }\r
+\r
+               $processUser = posix_getpwuid(posix_geteuid());\r
+               return $processUser['name'];\r
+       }\r
+\r
+       /**\r
+        * @brief Checks if a given directory is usable for the system\r
+        *\r
+        * @return boolean the directory is usable\r
+        */\r
+       static function directory_usable($directory) {\r
+               if ($directory == '') {\r
+                       logger('Directory is empty. This shouldn\'t happen.', LOGGER_DEBUG);\r
+                       return false;\r
+               }\r
+\r
+               if (!file_exists($directory)) {\r
+                       logger('Path "' . $directory . '" does not exist for user ' . self::systemuser(), LOGGER_DEBUG);\r
+                       return false;\r
+               }\r
+               if (is_file($directory)) {\r
+                       logger('Path "' . $directory . '" is a file for user ' . self::systemuser(), LOGGER_DEBUG);\r
+                       return false;\r
+               }\r
+               if (!is_dir($directory)) {\r
+                       logger('Path "' . $directory . '" is not a directory for user ' . self::systemuser(), LOGGER_DEBUG);\r
+                       return false;\r
+               }\r
+               if (!is_writable($directory)) {\r
+                       logger('Path "' . $directory . '" is not writable for user ' . self::systemuser(), LOGGER_DEBUG);\r
+                       return false;\r
+               }\r
+               return true;\r
+       }\r
+}\r
index e9ac527a1ad455fe8c9c29b8ba3ee1b987637b2c..943725ffe0819df55c4e2055f3bc87c5aa8e6abb 100644 (file)
@@ -7,7 +7,7 @@
 
 namespace Friendica;
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 require_once("include/network.php");
 require_once("include/Photo.php");
index 3fb6ac3109daf150c071d7d767b4ecd72a8be5a8..5bc8e0ad3f068e0b4b8fae1d23bf31cfbee736b4 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * tests several functions which are used to prevent xss attacks
- * 
+ *
  * @package test.util
  */
 
@@ -27,31 +27,31 @@ class AntiXSSTest extends PHPUnit_Framework_TestCase {
         */
        public function testXmlify() {
                $text="<tag>I want to break\n this!11!<?hard?></tag>";
-               $xml=xmlify($text); 
+               $xml=xmlify($text);
                $retext=unxmlify($text);
 
                $this->assertEquals($text, $retext);
        }
-       
-       /**\r
-        * xmlify and put in a document\r
-        */\r
-       public function testXmlifyDocument() {\r
-               $tag="<tag>I want to break</tag>";\r
+
+       /**
+        * xmlify and put in a document
+        */
+       public function testXmlifyDocument() {
+               $tag="<tag>I want to break</tag>";
                $xml=xmlify($tag);
-               $text='<text>'.$xml.'</text>'; \r
-               
-               $xml_parser=xml_parser_create(); 
+               $text='<text>'.$xml.'</text>';
+
+               $xml_parser=xml_parser_create();
                //should be possible to parse it
-               $values=array(); $index=array(); 
-               $this->assertEquals(1, xml_parse_into_struct($xml_parser, $text, $values, $index)); 
-               
-               $this->assertEquals(array('TEXT'=>array(0)), 
-                               $index); 
-               $this->assertEquals(array(array('tag'=>'TEXT', 'type'=>'complete', 'level'=>1, 'value'=>$tag)),\r
+               $values=array(); $index=array();
+               $this->assertEquals(1, xml_parse_into_struct($xml_parser, $text, $values, $index));
+
+               $this->assertEquals(array('TEXT'=>array(0)),
+                               $index);
+               $this->assertEquals(array(array('tag'=>'TEXT', 'type'=>'complete', 'level'=>1, 'value'=>$tag)),
                                $values);
-               
-               xml_parser_free($xml_parser); \r
+
+               xml_parser_free($xml_parser);
        }
 
        /**
@@ -68,4 +68,3 @@ class AntiXSSTest extends PHPUnit_Framework_TestCase {
        //get_mentions
        //get_contact_block, bis Zeile 538
 }
-?>
index 163c94bb97a2fd91550a1b22fb38b17014cb3fde..798c81474f013062a2fef8cbde2f8d98e12867c3 100644 (file)
@@ -91,4 +91,3 @@ function add_documentation($line) {
 
        return $block;
 }
-?>
index 266ddcd754f2ac499a88618d93ee267136a98861..4accef3960a390dad4b8c79323e38be99671934b 100644 (file)
@@ -98,4 +98,3 @@ while (true) {
        // Now sleep for 5 minutes
        sleep(300);
 }
-?>
index 32b44e6d006291eba2dabe857a55f57b1b99f408..1e717e98759335166c1c2157db3c95ac4adad609 100644 (file)
@@ -1,14 +1,17 @@
 <?php
+
 /**
-* @package util
-*/
+ * @package util
+ */
+
+use Friendica\App;
 
-/* 
-* require boot.php
-*/
+/*
+ * require boot.php
+ */
 require_once("boot.php");
 
-$a = new App;
+$a = new App(dirname(__DIR__));
 @include(".htconfig.php");
 
 $lang = get_browser_language();
@@ -16,15 +19,15 @@ load_translation_table($lang);
 
 require_once("include/dba.php");
 $db = new dba($db_host, $db_user, $db_pass, $db_data, false);
-        unset($db_host, $db_user, $db_pass, $db_data);
+unset($db_host, $db_user, $db_pass, $db_data);
 
-$build = get_config('system','build');
+$build = get_config('system', 'build');
 
 echo "Old DB VERSION: " . $build . "\n";
 echo "New DB VERSION: " . DB_UPDATE_VERSION . "\n";
 
 
-if($build != DB_UPDATE_VERSION) {
+if ($build != DB_UPDATE_VERSION) {
        echo "Updating database...";
        check_db($a);
        echo "Done\n";
index 614344ab9387bbcafb99ee98c7fe2e5b6c9e23ca..40634e0d89de1d33dee9bd95f7d7d353525721a7 100644 (file)
@@ -1,10 +1,11 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\App;
+use Friendica\Core\Config;
 
 require_once("boot.php");
 
-$a = new App;
+$a = new App(dirname(__DIR__));
 @include(".htconfig.php");
 
 $lang = get_browser_language();
index 2e888008c2e6169f2835233299cf7f3e9edef397..e07f718004b54d428314bac83b02af563b276c59 100644 (file)
 <?php
-       /**
-        * Read strings.php file and create messages.po
-        *
-        * php utils/php2po.php <path/to/strings.php>
-        * 
-        * Output to <path/to/messages.po>
-        */
-        
-       DEFINE("NORM_REGEXP", "|[\\\]|");
-       
-       
-       if(! class_exists('App')) {
-               class TmpA {
-                       public $strings = Array();
-               }
-               $a = new TmpA();
-       }
+/**
+ * Read strings.php file and create messages.po
+ *
+ * php utils/php2po.php <path/to/strings.php>
+ *
+ * Output to <path/to/messages.po>
+ */
 
-       if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) {
-               print "Usage: ".$argv[0]." [-p <n>] <strings.php>\n\n";
-               print "Options:\n";
-               print "p\tNumber of plural forms. Default: 2\n";
-               print "\n";
-               return;
-       }
+use Friendica\App;
 
-       $phpfile = $argv[1];
-       $pofile = dirname($phpfile)."/messages.po";
+DEFINE("NORM_REGEXP", "|[\\\]|");
 
-       if (!file_exists($phpfile)){
-               print "Unable to find '$phpfile'\n";
-               return;
+if(! class_exists('App')) {
+       class TmpA {
+               public $strings = Array();
        }
+       $a = new TmpA();
+}
 
-       // utility functions
-       function startsWith($haystack, $needle) {
-               // search backwards starting from haystack length characters from the end
-               return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
-       }
+if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) {
+       print "Usage: ".$argv[0]." [-p <n>] <strings.php>\n\n";
+       print "Options:\n";
+       print "p\tNumber of plural forms. Default: 2\n";
+       print "\n";
+       return;
+}
+
+$phpfile = $argv[1];
+$pofile = dirname($phpfile)."/messages.po";
+
+if (!file_exists($phpfile)){
+       print "Unable to find '$phpfile'\n";
+       return;
+}
 
+// utility functions
+function startsWith($haystack, $needle) {
+       // search backwards starting from haystack length characters from the end
+       return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
+}
 
-       // start !
-       include_once($phpfile);
-
-       $out  = '';
-       $out .= "# FRIENDICA Distributed Social Network\n";
-       $out .= "# Copyright (C) 2010, 2011, 2012, 2013 the Friendica Project\n";
-       $out .= "# This file is distributed under the same license as the Friendica package.\n";
-       $out .= "# \n";
-       $out .= 'msgid ""' ."\n";
-       $out .= 'msgstr ""' ."\n";
-       $out .= '"Project-Id-Version: friendica\n"' ."\n";
-       $out .= '"Report-Msgid-Bugs-To: \n"' ."\n";
-       $out .= '"POT-Creation-Date: '. date("Y-m-d H:i:sO").'\n"' ."\n";
-       $out .= '"MIME-Version: 1.0\n"' ."\n";
-       $out .= '"Content-Type: text/plain; charset=UTF-8\n"' ."\n";
-       $out .= '"Content-Transfer-Encoding: 8bit\n"' ."\n";
-       
-       // search for plural info
-       $lang = "";
-       $lang_logic = "";
-       $lang_pnum = 2;
-       
-       $_idx = array_search('-p', $argv);
-       if ($_idx !== false) {
-               $lang_pnum = $argv[$_idx+1];
+
+// start !
+include_once($phpfile);
+
+$out  = '';
+$out .= "# FRIENDICA Distributed Social Network\n";
+$out .= "# Copyright (C) 2010, 2011, 2012, 2013 the Friendica Project\n";
+$out .= "# This file is distributed under the same license as the Friendica package.\n";
+$out .= "# \n";
+$out .= 'msgid ""' ."\n";
+$out .= 'msgstr ""' ."\n";
+$out .= '"Project-Id-Version: friendica\n"' ."\n";
+$out .= '"Report-Msgid-Bugs-To: \n"' ."\n";
+$out .= '"POT-Creation-Date: '. date("Y-m-d H:i:sO").'\n"' ."\n";
+$out .= '"MIME-Version: 1.0\n"' ."\n";
+$out .= '"Content-Type: text/plain; charset=UTF-8\n"' ."\n";
+$out .= '"Content-Transfer-Encoding: 8bit\n"' ."\n";
+
+// search for plural info
+$lang = "";
+$lang_logic = "";
+$lang_pnum = 2;
+
+$_idx = array_search('-p', $argv);
+if ($_idx !== false) {
+       $lang_pnum = $argv[$_idx+1];
+}
+
+$infile = file($phpfile);
+foreach($infile as $l) {
+       $l = trim($l);
+       if  (startsWith($l, 'function string_plural_select_')) {
+               $lang = str_replace( 'function string_plural_select_' , '', str_replace( '($n){','', $l) );
        }
-       
-       $infile = file($phpfile);
-       foreach($infile as $l) {
-               $l = trim($l);
-               if  (startsWith($l, 'function string_plural_select_')) {
-                       $lang = str_replace( 'function string_plural_select_' , '', str_replace( '($n){','', $l) );
-               }
-               if (startsWith($l, 'return')) {
-                       $lang_logic = str_replace( '$', '', trim( str_replace( 'return ' , '',  $l) , ';') );
-                       break;
-               }
+       if (startsWith($l, 'return')) {
+               $lang_logic = str_replace( '$', '', trim( str_replace( 'return ' , '',  $l) , ';') );
+               break;
        }
-       
-       echo "Language: $lang\n";
-       echo "Plural forms: $lang_pnum\n";
-       echo "Plural logic: $lang_logic;\n";
-               
-       $out .= sprintf('"Language: %s\n"', $lang) ."\n";
-       $out .= sprintf('"Plural-Forms: nplurals=%s; plural=%s;\n"', $lang_pnum, $lang_logic)  ."\n";
-       $out .= "\n";
+}
 
-       print "\nLoading base message.po...";
-       
-       // load base messages.po and extract msgids
-       $base_msgids = array();
-       $norm_base_msgids = array();
-       $base_f = file("util/messages.po") or die("No base messages.po\n");
-       $_f = 0; $_mid = ""; $_mids = array();
-       foreach( $base_f as $l) {
-               $l = trim($l);
-               //~ print $l."\n";
-               
-               if (startsWith($l, 'msgstr')) {
-                       if ($_mid != '""') {
-                               $base_msgids[$_mid] =  $_mids;
-                               $norm_base_msgids[preg_replace(NORM_REGEXP, "", $_mid)] = $_mid;
-                               //~ print "\t\t\t".$_mid. print_r($base_msgids[$_mid], true);
-                       }
-                       
-                       $_f = 0;
-                       $_mid = "";
-                       $_mids = array();
-                       
-               }
-               
-               if (startsWith($l, '"') && $_f==2) {
-                       $_mids[count($_mids)-1] .= "\n".$l;
-                       //~ print "\t\t+mids: ".print_t($_mids, true);
-               }
-               if (startsWith($l, 'msgid_plural ')) {
-                       $_f = 2;
-                       $_mids[] = str_replace('msgid_plural ', '' , $l);
-                       //~ print "\t\t mids: ".print_r($_mids, true);
-               }
-               
-               if (startsWith($l, '"') && $_f==1) {
-                       $_mid .= "\n".$l;
-                       $_mids[count($_mids)-1] .= "\n".$l;
-                       //~ print "\t+mid: $_mid \n";
-               }
-               if (startsWith($l, 'msgid ')) {
-                       $_f = 1;
-                       $_mid = str_replace('msgid ', '' , $l);
-                               $_mids = array($_mid);
-                       //~ print "\t mid: $_mid \n";
+echo "Language: $lang\n";
+echo "Plural forms: $lang_pnum\n";
+echo "Plural logic: $lang_logic;\n";
+
+$out .= sprintf('"Language: %s\n"', $lang) ."\n";
+$out .= sprintf('"Plural-Forms: nplurals=%s; plural=%s;\n"', $lang_pnum, $lang_logic)  ."\n";
+$out .= "\n";
+
+print "\nLoading base message.po...";
+
+// load base messages.po and extract msgids
+$base_msgids = array();
+$norm_base_msgids = array();
+$base_f = file("util/messages.po") or die("No base messages.po\n");
+$_f = 0; $_mid = ""; $_mids = array();
+foreach( $base_f as $l) {
+       $l = trim($l);
+       //~ print $l."\n";
+
+       if (startsWith($l, 'msgstr')) {
+               if ($_mid != '""') {
+                       $base_msgids[$_mid] =  $_mids;
+                       $norm_base_msgids[preg_replace(NORM_REGEXP, "", $_mid)] = $_mid;
+                       //~ print "\t\t\t".$_mid. print_r($base_msgids[$_mid], true);
                }
-               //~ print "\t\t\t\t$_f\n\n";
+
+               $_f = 0;
+               $_mid = "";
+               $_mids = array();
+
        }
-       
-       print " done\n";
-       print "Creating '$pofile'...";
-       // create msgid and msgstr 
-       
-       /**
-        * Get a string and retun a message.po ready text
-        * - replace " with \"
-        * - replace tab char with \t
-        * - manage multiline strings
-        */
-       function massage_string($str) {
-               $str = str_replace('\\','\\\\',$str);
-               $str = str_replace('"','\"',$str);
-               $str = str_replace("\t",'\t',$str);
-               $str = str_replace("\n",'\n"'."\n".'"',$str);
-               if (strpos($str, "\n")!==false  && $str[0]!=='"') $str = '"'."\n".$str;
-               $str = preg_replace("|\n([^\"])|", "\n\"$1", $str);
-               return sprintf('"%s"', $str);
+
+       if (startsWith($l, '"') && $_f==2) {
+               $_mids[count($_mids)-1] .= "\n".$l;
+               //~ print "\t\t+mids: ".print_t($_mids, true);
        }
-       
-       function find_original_msgid($str) {
-               global $norm_base_msgids;
-               $norm_str = preg_replace(NORM_REGEXP, "", $str);
-               if (array_key_exists($norm_str, $norm_base_msgids)) {
-                       return $norm_base_msgids[$norm_str];
-               }
-               return $str;
+       if (startsWith($l, 'msgid_plural ')) {
+               $_f = 2;
+               $_mids[] = str_replace('msgid_plural ', '' , $l);
+               //~ print "\t\t mids: ".print_r($_mids, true);
        }
-       
-       $warnings = "";
-       foreach($a->strings as $key=>$str) {
-               $msgid = massage_string($key);
-               
-               if (preg_match("|%[sd0-9](\$[sn])*|", $msgid)) {
-                       $out .= "#, php-format\n";
-               }
-               $msgid = find_original_msgid($msgid);
-               $out .= 'msgid '. $msgid . "\n";
-               
-               if (is_array($str)) {
-                       if (array_key_exists($msgid, $base_msgids) && isset($base_msgids[$msgid][1]))  {
-                               $out .= 'msgid_plural '. $base_msgids[$msgid][1] . "\n";
-                       } else {
-                               $out .= 'msgid_plural '. $msgid . "\n";
-                               $warnings .= "[W] No source plural form for msgid:\n". str_replace("\n","\n\t", $msgid) . "\n\n";
-                       }
-                       foreach ( $str as $n => $msgstr) {
-                               $out .= 'msgstr['.$n.'] '. massage_string($msgstr) . "\n";
-                       }
-               } else {
-                       $out .= 'msgstr '. massage_string($str) . "\n";
-               }
-               
-               $out .= "\n";
-       
+
+       if (startsWith($l, '"') && $_f==1) {
+               $_mid .= "\n".$l;
+               $_mids[count($_mids)-1] .= "\n".$l;
+               //~ print "\t+mid: $_mid \n";
        }
+       if (startsWith($l, 'msgid ')) {
+               $_f = 1;
+               $_mid = str_replace('msgid ', '' , $l);
+                       $_mids = array($_mid);
+               //~ print "\t mid: $_mid \n";
+       }
+       //~ print "\t\t\t\t$_f\n\n";
+}
+
+print " done\n";
+print "Creating '$pofile'...";
+// create msgid and msgstr
+
+/**
+ * Get a string and retun a message.po ready text
+ * - replace " with \"
+ * - replace tab char with \t
+ * - manage multiline strings
+ */
+function massage_string($str) {
+       $str = str_replace('\\','\\\\',$str);
+       $str = str_replace('"','\"',$str);
+       $str = str_replace("\t",'\t',$str);
+       $str = str_replace("\n",'\n"'."\n".'"',$str);
+       if (strpos($str, "\n")!==false  && $str[0]!=='"') $str = '"'."\n".$str;
+       $str = preg_replace("|\n([^\"])|", "\n\"$1", $str);
+       return sprintf('"%s"', $str);
+}
+
+function find_original_msgid($str) {
+       global $norm_base_msgids;
+       $norm_str = preg_replace(NORM_REGEXP, "", $str);
+       if (array_key_exists($norm_str, $norm_base_msgids)) {
+               return $norm_base_msgids[$norm_str];
+       }
+       return $str;
+}
+
+$warnings = "";
+foreach($a->strings as $key=>$str) {
+       $msgid = massage_string($key);
 
-       file_put_contents($pofile, $out);
-       
-       print " done\n";
-       
-       if ($warnings=="") {
-               print "No warnings.\n";
+       if (preg_match("|%[sd0-9](\$[sn])*|", $msgid)) {
+               $out .= "#, php-format\n";
+       }
+       $msgid = find_original_msgid($msgid);
+       $out .= 'msgid '. $msgid . "\n";
+
+       if (is_array($str)) {
+               if (array_key_exists($msgid, $base_msgids) && isset($base_msgids[$msgid][1]))  {
+                       $out .= 'msgid_plural '. $base_msgids[$msgid][1] . "\n";
+               } else {
+                       $out .= 'msgid_plural '. $msgid . "\n";
+                       $warnings .= "[W] No source plural form for msgid:\n". str_replace("\n","\n\t", $msgid) . "\n\n";
+               }
+               foreach ( $str as $n => $msgstr) {
+                       $out .= 'msgstr['.$n.'] '. massage_string($msgstr) . "\n";
+               }
        } else {
-               print $warnings;
+               $out .= 'msgstr '. massage_string($str) . "\n";
        }
-       
+
+       $out .= "\n";
+
+}
+
+file_put_contents($pofile, $out);
+
+print " done\n";
+
+if ($warnings=="") {
+       print "No warnings.\n";
+} else {
+       print $warnings;
+}
old mode 100644 (file)
new mode 100755 (executable)
index d68ac2a..1b84181
@@ -1,59 +1,77 @@
+#!/usr/bin/env php
 <?php
-       // Tired of chasing typos and finding them after a commit.
-       // Run this from cmdline in basedir and quickly see if we've
-       // got any parse errors in our application files.
 
+// Tired of chasing typos and finding them after a commit.
+// Run this from cmdline in basedir and quickly see if we've
+// got any parse errors in our application files.
 
-       error_reporting(E_ERROR | E_WARNING | E_PARSE );
-       ini_set('display_errors', '1');
-       ini_set('log_errors','0');
+use Friendica\App;
 
-       include 'boot.php';
+error_reporting(E_ERROR | E_WARNING | E_PARSE);
+ini_set('display_errors', '1');
+ini_set('log_errors', '0');
 
-       $a = new App();
+include 'boot.php';
 
-       if(x($a->config,'php_path'))
-               $phpath = $a->config['php_path'];
-       else
-               $phpath = 'php';
+$a = new App(dirname(__DIR__));
 
+if (x($a->config, 'php_path')) {
+       $phpath = $a->config['php_path'];
+} else {
+       $phpath = 'php';
+}
 
-       echo "Directory: mod\n";
-       $files = glob('mod/*.php');
-       foreach($files as $file) {
-        passthru("$phpath -l $file", $ret); $ret===0 or die();
-       }
+echo 'Directory: src' . PHP_EOL;
+$Iterator = new RecursiveDirectoryIterator('src');
 
-       echo "Directory: include\n";
-       $files = glob('include/*.php');
-       foreach($files as $file) {
-        passthru("$phpath -l $file", $ret); $ret===0 or die();
+foreach (new RecursiveIteratorIterator($Iterator) as $file) {
+       if (substr($file, -4) === '.php') {
+               passthru("$phpath -l $file", $ret);
+               $ret === 0 or die();
        }
+}
 
-    echo "Directory: object\n";
-       $files = glob('object/*.php');
-       foreach($files as $file) {
-        passthru("$phpath -l $file", $ret); $ret===0 or die();
-       }
+echo "Directory: mod\n";
+$files = glob('mod/*.php');
+foreach ($files as $file) {
+       passthru("$phpath -l $file", $ret);
+       $ret === 0 or die();
+}
 
-       echo "Directory: addon\n";
-       $dirs = glob('addon/*');
+echo "Directory: include\n";
+$files = glob('include/*.php');
+foreach ($files as $file) {
+       passthru("$phpath -l $file", $ret);
+       $ret === 0 or die();
+}
 
-       foreach($dirs as $dir) {
-               $addon = basename($dir);
-               $files = glob($dir . '/' . $addon . '.php');
-               foreach($files as $file) {
-            passthru("$phpath -l $file", $ret); $ret===0 or die();
-               }
-       }
+echo "Directory: object\n";
+$files = glob('object/*.php');
+foreach ($files as $file) {
+       passthru("$phpath -l $file", $ret);
+       $ret === 0 or die();
+}
 
+echo "Directory: addon\n";
+$dirs = glob('addon/*');
 
-       echo "String files\n";
+foreach ($dirs as $dir) {
+       $addon = basename($dir);
+       $files = glob($dir . '/' . $addon . '.php');
+       foreach ($files as $file) {
+               passthru("$phpath -l $file", $ret);
+               $ret === 0 or die();
+       }
+}
 
-       echo 'util/strings.php' . "\n";
-    passthru("$phpath -l util/strings.php", $ret); $ret===0 or die();
+echo "String files\n";
 
-       $files = glob('view/lang/*/strings.php');
-       foreach($files as $file) {
-        passthru("$phpath -l $file", $ret); $ret===0 or die();
-       }
+echo 'util/strings.php' . "\n";
+passthru("$phpath -l util/strings.php", $ret);
+$ret === 0 or die();
+
+$files = glob('view/lang/*/strings.php');
+foreach ($files as $file) {
+       passthru("$phpath -l $file", $ret);
+       $ret === 0 or die();
+}
index 4553da2e249a7f0d40c4027dc132f99411eabcdc..58744c098b2713cee70dbfaeded2cd19e7bd6920 100644 (file)
@@ -9,6 +9,7 @@ return array(
     'Archive_Tar' => $vendorDir . '/pear-pear.php.net/Archive_Tar/Archive/Tar.php',
     'Console_Getopt' => $vendorDir . '/pear-pear.php.net/Console_Getopt/Console/Getopt.php',
     'Detection\\MobileDetect' => $vendorDir . '/mobiledetect/mobiledetectlib/namespaced/Detection/MobileDetect.php',
+    'Friendica\\App' => $baseDir . '/src/App.php',
     'Friendica\\Core\\Config' => $baseDir . '/src/Core/Config.php',
     'Friendica\\Core\\PConfig' => $baseDir . '/src/Core/PConfig.php',
     'Friendica\\ParseUrl' => $baseDir . '/src/ParseUrl.php',
index 37d3c878b4547ab3bdf887becb969b2a2be7c793..0ea04c53739094f94dcdadecfb6cae1732cee604 100644 (file)
@@ -53,6 +53,7 @@ class ComposerStaticInitFriendica
         'Archive_Tar' => __DIR__ . '/..' . '/pear-pear.php.net/Archive_Tar/Archive/Tar.php',
         'Console_Getopt' => __DIR__ . '/..' . '/pear-pear.php.net/Console_Getopt/Console/Getopt.php',
         'Detection\\MobileDetect' => __DIR__ . '/..' . '/mobiledetect/mobiledetectlib/namespaced/Detection/MobileDetect.php',
+        'Friendica\\App' => __DIR__ . '/../..' . '/src/App.php',
         'Friendica\\Core\\Config' => __DIR__ . '/../..' . '/src/Core/Config.php',
         'Friendica\\Core\\PConfig' => __DIR__ . '/../..' . '/src/Core/PConfig.php',
         'Friendica\\ParseUrl' => __DIR__ . '/../..' . '/src/ParseUrl.php',
index e10abddcd00b41ba3e1e143fb2b59935c3e696c9..1d4a52943aeb899102e3a244c3ba0a5955f8ce87 100644 (file)
@@ -11,6 +11,6 @@ return array(
     $vendorDir . '/pear-pear.php.net/Structures_Graph',
     $vendorDir . '/pear-pear.php.net/XML_Util',
     $vendorDir . '/pear-pear.php.net/XML_Parser',
-    $vendorDir . '/pear-pear.php.net/PEAR',
     $vendorDir . '/pear-pear.php.net/Text_Highlighter',
+    $vendorDir . '/pear-pear.php.net/PEAR',
 );
index 45038987b7f513b826b94df7d0684ddf1ddbd220..d6cca604f95f93c7a2e999846279525e42a4da00 100644 (file)
         ],
         "description": "This is an XML parser based on PHPs built-in xml extension.\nIt supports two basic modes of operation: \"func\" and \"event\".  In \"func\" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in \"event\" mode it uses a set of generic callbacks.\n\nSince version 1.2.0 there's a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements.\nFurthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it."
     },
-    {
-        "name": "pear-pear.php.net/PEAR",
-        "version": "1.10.3",
-        "version_normalized": "1.10.3.0",
-        "dist": {
-            "type": "file",
-            "url": "https://pear.php.net/get/PEAR-1.10.3.tgz",
-            "reference": null,
-            "shasum": null
-        },
-        "require": {
-            "ext-pcre": "*",
-            "ext-xml": "*",
-            "pear-pear.php.net/archive_tar": ">=1.4.0.0",
-            "pear-pear.php.net/console_getopt": ">=1.4.1.0",
-            "pear-pear.php.net/structures_graph": ">=1.1.0.0",
-            "pear-pear.php.net/xml_util": ">=1.3.0.0",
-            "php": ">=5.4.0.0"
-        },
-        "conflict": {
-            "pear-pear.php.net/pear_frontend_gtk": "<0.4.0.0",
-            "pear-pear.php.net/pear_frontend_web": "<=0.4.0.0"
-        },
-        "replace": {
-            "pear-pear/pear": "== 1.10.3.0"
-        },
-        "type": "pear-library",
-        "installation-source": "dist",
-        "autoload": {
-            "classmap": [
-                ""
-            ]
-        },
-        "include-path": [
-            "/"
-        ],
-        "license": [
-            "New BSD License"
-        ],
-        "description": "The PEAR package contains:\n * the PEAR installer, for creating, distributing\n   and installing packages\n * the PEAR_Exception PHP5 error handling mechanism\n * the PEAR_ErrorStack advanced error handling mechanism\n * the PEAR_Error error handling mechanism\n * the OS_Guess class for retrieving info about the OS\n   where PHP is running on\n * the System class for quick handling of common operations\n   with files and directories\n * the PEAR base class\n  Features in a nutshell:\n  * full support for channels\n  * pre-download dependency validation\n  * new package.xml 2.0 format allows tremendous flexibility while maintaining BC\n  * support for optional dependency groups and limited support for sub-packaging\n  * robust dependency support\n  * full dependency validation on uninstall\n  * remote install for hosts with only ftp access - no more problems with\n    restricted host installation\n  * full support for mirroring\n  * support for bundling several packages into a single tarball\n  * support for static dependencies on a url-based package\n  * support for custom file roles and installation tasks"
-    },
     {
         "name": "pear-pear.php.net/Text_Highlighter",
         "version": "0.8.0",
             "html",
             "markdown"
         ]
+    },
+    {
+        "name": "pear-pear.php.net/PEAR",
+        "version": "1.10.4",
+        "version_normalized": "1.10.4.0",
+        "dist": {
+            "type": "file",
+            "url": "https://pear.php.net/get/PEAR-1.10.4.tgz",
+            "reference": null,
+            "shasum": null
+        },
+        "require": {
+            "ext-pcre": "*",
+            "ext-xml": "*",
+            "pear-pear.php.net/archive_tar": ">=1.4.0.0",
+            "pear-pear.php.net/console_getopt": ">=1.4.1.0",
+            "pear-pear.php.net/structures_graph": ">=1.1.0.0",
+            "pear-pear.php.net/xml_util": ">=1.3.0.0",
+            "php": ">=5.4.0.0"
+        },
+        "conflict": {
+            "pear-pear.php.net/pear_frontend_gtk": "<0.4.0.0",
+            "pear-pear.php.net/pear_frontend_web": "<=0.4.0.0"
+        },
+        "replace": {
+            "pear-pear/pear": "== 1.10.4.0"
+        },
+        "type": "pear-library",
+        "installation-source": "dist",
+        "autoload": {
+            "classmap": [
+                ""
+            ]
+        },
+        "include-path": [
+            "/"
+        ],
+        "license": [
+            "New BSD License"
+        ],
+        "description": "The PEAR package contains:\n * the PEAR installer, for creating, distributing\n   and installing packages\n * the PEAR_Exception PHP5 error handling mechanism\n * the PEAR_ErrorStack advanced error handling mechanism\n * the PEAR_Error error handling mechanism\n * the OS_Guess class for retrieving info about the OS\n   where PHP is running on\n * the System class for quick handling of common operations\n   with files and directories\n * the PEAR base class\n  Features in a nutshell:\n  * full support for channels\n  * pre-download dependency validation\n  * new package.xml 2.0 format allows tremendous flexibility while maintaining BC\n  * support for optional dependency groups and limited support for sub-packaging\n  * robust dependency support\n  * full dependency validation on uninstall\n  * remote install for hosts with only ftp access - no more problems with\n    restricted host installation\n  * full support for mirroring\n  * support for bundling several packages into a single tarball\n  * support for static dependencies on a url-based package\n  * support for custom file roles and installation tasks"
     }
 ]
index 7e8e8d3f8cc3c5bbd774a740c6a14d074236e692..ffa15355cf56fb04369a0f69dbb224143ced02a0 100644 (file)
@@ -86,7 +86,7 @@
  * @author     Gregory Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index 7aa3c4ce56756ce27bd9b1e9285a2e87c47c176f..5737f71b155c8432cae5c6938ee023bae65e358d 100644 (file)
@@ -75,7 +75,7 @@ $GLOBALS['_PEAR_error_handler_stack']    = array();
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2006 The PHP Group
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @see        PEAR_Error
  * @since      Class available since PHP 4.0.2
@@ -170,7 +170,7 @@ class PEAR
             $destructor = "_$classname";
             if (method_exists($this, $destructor)) {
                 global $_PEAR_destructor_object_list;
-                $_PEAR_destructor_object_list[] = &$this;
+                $_PEAR_destructor_object_list[] = $this;
                 if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
                     register_shutdown_function("_PEAR_call_destructors");
                     $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
@@ -598,11 +598,11 @@ class PEAR
     protected static function _throwError($object, $message = null, $code = null, $userinfo = null)
     {
         if ($object !== null) {
-            $a = &$object->raiseError($message, $code, null, null, $userinfo);
+            $a = $object->raiseError($message, $code, null, null, $userinfo);
             return $a;
         }
 
-        $a = &PEAR::raiseError($message, $code, null, null, $userinfo);
+        $a = PEAR::raiseError($message, $code, null, null, $userinfo);
         return $a;
     }
 
@@ -823,7 +823,7 @@ function _PEAR_call_destructors()
  * @author     Gregory Beaver <cellog@php.net>
  * @copyright  1997-2006 The PHP Group
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/manual/en/core.pear.pear-error.php
  * @see        PEAR::raiseError(), PEAR::throwError()
  * @since      Class available since PHP 4.0.2
index 9df3b9eac927612f9d044641eaaaa9dfbd9f6deb..d69bc14f1c23ea4ff16a45e06dbbca9541ada99b 100644 (file)
@@ -33,7 +33,7 @@ require_once 'System.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since PHP 4.0.2
  * @see        http://pear.php.net/manual/en/core.ppm.pear-builder.php
@@ -385,7 +385,7 @@ class PEAR_Builder extends PEAR_Common
         if (!file_exists($build_dir) || !is_dir($build_dir) || !chdir($build_dir)) {
             return $this->raiseError("could not chdir to $build_dir");
         }
-        putenv('PHP_PEAR_VERSION=1.10.3');
+        putenv('PHP_PEAR_VERSION=1.10.4');
         foreach ($to_run as $cmd) {
             $err = $this->_runCommand($cmd, $callback);
             if (PEAR::isError($err)) {
index 9e990d1348a6145050490eb9854cb08fc1278014..d81deb43a1ffa04e802966444c503612e8d5e571 100644 (file)
@@ -145,7 +145,7 @@ $GLOBALS['_PEAR_CHANNELS_MIRROR_TYPES'] =  array('server');
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 56376add6456b16c3d314ea9c9f6cf7da19b2a6c..01bb7f3fbe1495b8f33084b4a3dbd37d12b30e5a 100644 (file)
@@ -25,7 +25,7 @@ require_once 'PEAR/ChannelFile.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 39823c674b03dbc0bbcdd0eb7f7aeeec4a4608a0..411f7a49b2d2a55105657aeba190d422d610788e 100644 (file)
@@ -93,7 +93,7 @@ $GLOBALS['_PEAR_Command_objects'] = array();
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index fa2b22bf52e2eaa1f5d2ad4d0a17db71d1d967e6..fecfd875ef864cc4b9255e864e8c5b0b0b468433 100644 (file)
@@ -29,7 +29,7 @@ require_once 'PEAR/Command/Channels.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  * @deprecated since 1.8.0alpha1
index 3bb99454d79e12820f003257b7b6b3f11bf420c6..aecc90d8b26ac2317553ba6da1db651b629e0d03 100644 (file)
@@ -30,7 +30,7 @@ require_once 'PEAR/Command/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index b9286370ab390b798756f512147fd39223274457..fa190d39c28e4b397394e96c37793a9735843182 100644 (file)
@@ -31,7 +31,7 @@ define('PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS', -500);
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 41384ef0b3383dbac859c0be76aa69c68a559f39..8d972b6f1bfae8dba7ecd936d5129ad65415547c 100644 (file)
@@ -28,7 +28,7 @@ require_once 'PEAR.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index 63efb07be317c36db0dd0ab7bd3b3e49fcd26417..18dd61451a6f56c8c19dab23e3c4a1f21ab3fc81 100644 (file)
@@ -28,7 +28,7 @@ require_once 'PEAR/Command/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index a1d3a7023ff6c2a0d3b1ffa6451d2faa7884f8eb..42c1f558678d8cd47ab1c52b22e78040cbd03584 100644 (file)
@@ -29,7 +29,7 @@ require_once 'PEAR/Command/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
@@ -717,8 +717,7 @@ Run post-installation scripts in package <package>, if any exist.
                 $pkg = &$param->getPackageFile();
                 if ($info->getCode() != PEAR_INSTALLER_NOBINARY) {
                     if (!($info = $pkg->installBinary($this->installer))) {
-                        $this->ui->outputData('ERROR: ' .$oldinfo->getMessage());
-                        continue;
+                        return $this->raiseError('ERROR: ' .$oldinfo->getMessage());
                     }
 
                     // we just installed a different package than requested,
index 473c6286753547ce2293e6f6813358ce599a3840..616417cb3a84dccd14c2b04ffe10dc23f5097f30 100644 (file)
@@ -26,7 +26,7 @@ require_once 'PEAR/Command/Common.php';
  * @author     Alexander Merz <alexmerz@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.2.0
  */
index 25125fd982d80f84873b13aca6665168e36e9e96..8847112e60e0fe30a1ccdf1f809365b6b273ce86 100644 (file)
@@ -31,7 +31,7 @@ require_once 'PEAR/Command/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index 8ac3fcb6b19e9abbcee2ddef385281e45b5bd4b0..7a7bd81c0b027dc9463028b47921298bd41b6069 100644 (file)
@@ -26,7 +26,7 @@ require_once 'PEAR/Command/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  2005-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.1
  */
index 3a78b033028d4b0eb83e6d20e184a5d549494621..b5423c762ef68ce14b3115dbe2fb08af27b0987b 100644 (file)
@@ -28,7 +28,7 @@ require_once 'PEAR/Command/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index c0a8e92a8ef4fa058eff80bd851de4e29f1057d0..817b7332857233fade6ce7d82bb8c1b012ed8bec 100644 (file)
@@ -30,7 +30,7 @@ require_once 'PEAR/REST.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index 69c72c4aa31c93c2bc043f3c837f56312915516d..0f6c8dc24e0e53b2e0ff4e79955daab1d6c95782 100644 (file)
@@ -30,7 +30,7 @@ require_once 'PEAR/Command/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index 1c4f79ceb13e13c697988149957a8e0024b34898..0b00b00bc511178be2cdceb253b360841ec9c13a 100644 (file)
@@ -117,7 +117,7 @@ $GLOBALS['_PEAR_Common_script_phases'] = array('pre-install', 'post-install', 'p
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  * @deprecated This class will disappear, and its components will be spread
index d9b4d273ce295c307998c2edf83c243c7d307549..e86c5013419904b225f9a040c324de92bdb2a65b 100644 (file)
@@ -264,7 +264,7 @@ if (getenv('PHP_PEAR_SIG_KEYDIR')) {
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index 77646f1f95c24ca5a7154ddcada7380131ef907f..b142883b3214c971518962c16cccb7070bf7fbcd 100644 (file)
@@ -30,7 +30,7 @@ require_once 'PEAR/Validate.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
@@ -540,7 +540,7 @@ class PEAR_Dependency2
      */
     function getPEARVersion()
     {
-        return '1.10.3';
+        return '1.10.4';
     }
 
     function validatePearinstallerDependency($dep)
index 5421929a2b99fe5f94238945906cb194703b49d9..0d48613acdce3247564eae76d27223a48ea69db2 100644 (file)
@@ -29,7 +29,7 @@ $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'] = array();
  * @author     Tomas V.V.Cox <cox@idec.net.com>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 15f26bceff94e6406e1eba14adec4813bc2508e5..a498f134b9ebfa9a62588b2d7c94caa0e8ef7914 100644 (file)
@@ -39,7 +39,7 @@ define('PEAR_INSTALLER_ERROR_NO_PREF_STATE', 2);
  * @author     Martin Jansen <mj@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.3.0
  */
@@ -1635,7 +1635,7 @@ class PEAR_Downloader extends PEAR_Common
         }
 
         $request .= $ifmodifiedsince .
-            "User-Agent: PEAR/1.10.3/PHP/" . PHP_VERSION . "\r\n";
+            "User-Agent: PEAR/1.10.4/PHP/" . PHP_VERSION . "\r\n";
 
         if ($object !== null) { // only pass in authentication for non-static calls
             $username = $config->get('username', null, $channel);
index 925c0ecd56080829f1c4e4196d42ac532a075bda..42b35b5b6864cc9bf8d90f3fc75f95fd965c94e2 100644 (file)
@@ -49,7 +49,7 @@ define('PEAR_DOWNLOADER_PACKAGE_PHPVERSION', -1004);
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index b4412744a1de836f4ee4aa87a2921fca43f13814..53eda7c3df18efe4a611d516dc2b50445884bad0 100644 (file)
@@ -131,7 +131,7 @@ define('PEAR_ERRORSTACK_ERR_OBJTOSTRING', 2);
  * $local_stack = new PEAR_ErrorStack('MyPackage');
  * </code>
  * @author     Greg Beaver <cellog@php.net>
- * @version    1.10.3
+ * @version    1.10.4
  * @package    PEAR_ErrorStack
  * @category   Debugging
  * @copyright  2004-2008 Greg Beaver
index d83950b13af22239a060b9629c8f2a2d7ee38b11..d0e84dc1fa9627fdbe6bb03c4f2a4104acaab296 100644 (file)
@@ -88,7 +88,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.3.3
  *
index bd002c374b22089c80d376b94b089f6dafd2d8f2..a9d9b73cc32f13028b668ea6488f3247470ee221 100644 (file)
@@ -38,7 +38,7 @@ $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null;
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 4e68c065afc55943f88cfea3251b5a7a7ce36ae1..5e83216edb63cdfa6e26f41d4d6a745c66020365 100644 (file)
@@ -26,7 +26,7 @@ require_once 'PEAR/Frontend.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index acaaa7fd002a24116ada1544164f6477d2ed3610..b96b8e011a448ef3d92567f365cf9e2e0b2fc485 100644 (file)
@@ -35,7 +35,7 @@ define('PEAR_INSTALLER_NOBINARY', -240);
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index 58b661bbf4515033ea5f42f6c6ef374a8ac37716..0ca3bac637b5fa53cd28a54bd022409f15bbfbcb 100644 (file)
@@ -24,7 +24,7 @@ require_once 'PEAR/XMLParser.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 5b75c44ccd4b1abf1dfdd65c69e99b6444a848f3..eb126b62dfafb3c9e4184a710971996dd3f2ab0b 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  2007-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.7.0
  */
index 3e15d87789e58310819c4961393f30887653e46f..1bd8f78cc717fd9506b049af9b646adf6fee1e64 100644 (file)
@@ -23,7 +23,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2006 The PHP Group
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 75acfef80e510dee144430f534a8dba1163c118f..ad2957780937f3e7e4feca59e045eec9dcdcfcc4 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 9374990c4cd3e459a44077fd780d9fb75a8f636d..31c069fed6643bc2acab7a08ec70704782150ca7 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 6cd4d2b0a12c5ae8093caf5b43f7eff8fde84e27..71d07d42240f0649033da4fd722eda9e21fa7325 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 68b79366a6737e4cda8f938867a086f7e7aab1c0..91a586b3a837cfc3b60472bdba3957b5878e012c 100644 (file)
@@ -20,7 +20,7 @@
  * @author     Hannes Magnusson <bjori@php.net>
  * @copyright  2011 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.10.0
  */
index 6a7a937dec0d557fbfcae86f3710eabe9c337b2d..e07743ab8f68fcc477920810bd7da30f3c072480 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 387fdb3f5352be19d99b4aefb1f43fbee865273b..907b101145da00c69d4d0826109ff672673d05b6 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index c92f2cf0b481f557e2eaee5eaf68d599cd876805..aaa9622e51701dcfcea6224b0a805a2cc92d3af4 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 87133af46c93350a5cd8c06dbfa5986c62420cec..b21450fe53f91d1fd77b4c384fb7ebf3041dde30 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index e211c1e8f76a217f98ace93df95d989bb6fb5987..043cd360a3fae1a69e9ebf243a0f163d6716955d 100644 (file)
@@ -19,7 +19,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  2007-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.7.0
  */
index 21d26b6df4e17faa44e84f764d469afb6b336316..d73671dd50f8d8e031ece79a03a897db8c60ac56 100644 (file)
@@ -34,7 +34,7 @@ define('PEAR_PACKAGEFILE_ERROR_INVALID_PACKAGEVERSION', 2);
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 707781c30d6f2343595a589fd41c23d71a59c128..5e379f85b70ef37b8b4d96d91fd18adb643beddd 100644 (file)
@@ -28,7 +28,7 @@ require_once 'PEAR/PackageFile/v2.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
@@ -45,7 +45,7 @@ class PEAR_PackageFile_Generator_v1
 
     function getPackagerVersion()
     {
-        return '1.10.3';
+        return '1.10.4';
     }
 
     /**
@@ -196,7 +196,7 @@ class PEAR_PackageFile_Generator_v1
             );
         $ret = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
         $ret .= "<!DOCTYPE package SYSTEM \"http://pear.php.net/dtd/package-1.0\">\n";
-        $ret .= "<package version=\"1.0\" packagerversion=\"1.10.3\">\n" .
+        $ret .= "<package version=\"1.0\" packagerversion=\"1.10.4\">\n" .
 " <name>$pkginfo[package]</name>";
         if (isset($pkginfo['extends'])) {
             $ret .= "\n<extends>$pkginfo[extends]</extends>";
index 1c97296b73cfed42a482c61ef27d432e4b14549a..a44a9c5a5b84dcfab1bd040d945d1675c6e90477 100644 (file)
@@ -30,7 +30,7 @@ require_once 'XML/Util.php';
  * @author     Stephan Schmidt (original XML_Serializer code)
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
@@ -112,7 +112,7 @@ http://pear.php.net/dtd/package-2.0.xsd',
      */
     function getPackagerVersion()
     {
-        return '1.10.3';
+        return '1.10.4';
     }
 
     /**
@@ -397,7 +397,7 @@ http://pear.php.net/dtd/package-2.0.xsd',
             $this->options['beautifyFilelist'] = true;
         }
 
-        $arr['attribs']['packagerversion'] = '1.10.3';
+        $arr['attribs']['packagerversion'] = '1.10.4';
         if ($this->serialize($arr, $options)) {
             return $this->_serializedData . "\n";
         }
index 6bb3276eeb5a429d05fa36b6b0a0d4138aeae1f0..d9d19f6549c77d62ea9101fd660a289a7ae081fe 100644 (file)
@@ -274,7 +274,7 @@ define('PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME', 52);
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 248997a6ab600066c622f992509d8fb222ece0c0..ab2f539b42ced135109e90dd050cd26c908b1e09 100644 (file)
@@ -22,7 +22,7 @@ require_once 'PEAR/ErrorStack.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
@@ -1668,7 +1668,7 @@ class PEAR_PackageFile_v2
                     if ($dtype == 'pearinstaller' && $nopearinstaller) {
                         continue;
                     }
-                    if (!isset($deps[0])) {
+                    if ((is_array($deps) && !isset($deps[0])) || !is_array($deps)) {
                         $deps = array($deps);
                     }
                     foreach ($deps as $dep) {
index f7c8921e1d1c91a7228ac0d5baeda41442936b38..a6b01d57b8005bf036eb4324b4d11612d331dc47 100644 (file)
@@ -20,7 +20,7 @@
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a8
  * @access private
@@ -111,8 +111,8 @@ class PEAR_PackageFile_v2_Validator
               isset($test['dependencies']['required']) &&
               isset($test['dependencies']['required']['pearinstaller']) &&
               isset($test['dependencies']['required']['pearinstaller']['min']) &&
-              '1.10.3' != '@package' . '_version@' &&
-              version_compare('1.10.3',
+              '1.10.4' != '@package' . '_version@' &&
+              version_compare('1.10.4',
                 $test['dependencies']['required']['pearinstaller']['min'], '<')
         ) {
             $this->_pearVersionTooLow($test['dependencies']['required']['pearinstaller']['min']);
@@ -1350,7 +1350,7 @@ class PEAR_PackageFile_v2_Validator
         $this->_stack->push(__FUNCTION__, 'error',
             array('version' => $version),
             'This package.xml requires PEAR version %version% to parse properly, we are ' .
-            'version 1.10.3');
+            'version 1.10.4');
     }
 
     function _invalidTagOrder($oktags, $actual, $root)
index c52ff4f3caa7883dc66423cd930480ac984a7f39..3346639b8bc4cdefec845adb2d6f5823650dea5d 100644 (file)
@@ -22,7 +22,7 @@ require_once 'PEAR/PackageFile/v2.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a8
  */
index 713bc708ccee3f9b34ce10cda5f491611e9ef75d..f92565bd5f7ad030d36fc72232b0a588166ec7d4 100644 (file)
@@ -30,7 +30,7 @@ require_once 'System.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 0.1
  */
index aec7cf2340cef7d963f32820d53d23101acb1377..419b7fbfa92591283ace63ba6a165f7fc7bb1ec8 100644 (file)
@@ -28,7 +28,7 @@ require_once 'PEAR/Proxy.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
@@ -384,7 +384,7 @@ class PEAR_REST
         }
 
         $request .= $ifmodifiedsince .
-            "User-Agent: PEAR/1.10.3/PHP/" . PHP_VERSION . "\r\n";
+            "User-Agent: PEAR/1.10.4/PHP/" . PHP_VERSION . "\r\n";
 
         $username = $this->config->get('username', null, $channel);
         $password = $this->config->get('password', null, $channel);
index ac0aeab3abcf56ac5dbd17b391b019aaa5b171c1..040371cdba423df11456212a3d4b6e89a50f9ea9 100644 (file)
@@ -26,7 +26,7 @@ require_once 'PEAR/REST.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a12
  */
index a7e713ac4e58c0634f9a688433ccbafbc6b30387..e2d3875fd0be57c81cd1a17fd5aa0cb82278a222 100644 (file)
@@ -26,7 +26,7 @@ require_once 'PEAR/REST.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.3
  */
index 6469fd30dd96fd12674b6debc158a63541eb5e79..0509897b8db80f294aa4883b802d5903a603eb47 100644 (file)
@@ -27,7 +27,7 @@ require_once 'PEAR/REST/10.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a12
  */
index c599c61ee551a570844e9ca7d7c653fa33dd0dbd..5588f23f4d9e8b32226e08c67f1c779c49580b69 100644 (file)
@@ -36,7 +36,7 @@ define('PEAR_REGISTRY_ERROR_CHANNEL_FILE', -6);
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 271ef86bd50546c1531892713a38991b363c56eb..95797665e677001c3ec3a9efb6604011b1e39492 100644 (file)
@@ -37,7 +37,7 @@ putenv("PHP_PEAR_RUNTESTS=1");
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.3.3
  */
index e433c3e267aa2f4494820d347801bbeac913bea6..3ae59159bd35f326aa0ecdaeef8c177acc14c619 100644 (file)
@@ -47,7 +47,7 @@ define('PEAR_TASK_PACKAGEANDINSTALL', 3);
  * @author    Greg Beaver <cellog@php.net>
  * @copyright 1997-2009 The Authors
  * @license   http://opensource.org/licenses/bsd-license.php New BSD License
- * @version   Release: 1.10.3
+ * @version   Release: 1.10.4
  * @link      http://pear.php.net/package/PEAR
  * @since     Class available since Release 1.4.0a1
  * @abstract
index 457ac28f6e0d0df0fcf9e8ee5ee9979b2165e872..154952f4f0ddedee237e020eecf9e2cff534f953 100644 (file)
@@ -27,7 +27,7 @@ require_once 'PEAR/Task/Common.php';
  * @author    Greg Beaver <cellog@php.net>
  * @copyright 1997-2009 The Authors
  * @license   http://opensource.org/licenses/bsd-license.php New BSD License
- * @version   Release: 1.10.3
+ * @version   Release: 1.10.4
  * @link      http://pear.php.net/package/PEAR
  * @since     Class available since Release 1.4.0a1
  */
index 10f5e7b26e022ff4d3fb5fc8c5a75a965592dd6f..7aa699bb30df5014d124a1ee72aa4cae1f696aad 100644 (file)
@@ -23,7 +23,7 @@ require_once 'PEAR/Task/Postinstallscript.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a10
  */
index 1ea71bfe531b8e408a0655ddd95e7af27ce664b9..a5fc779ef179ef92ce82d79bf5658f0364db2874 100644 (file)
@@ -23,7 +23,7 @@ require_once 'PEAR/Task/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index a2ffc24b1dc8d110ce6a051b0fe301286bc7bc4c..6080146463e593e014bcbe92d797770f26c923ae 100644 (file)
@@ -23,7 +23,7 @@ require_once 'PEAR/Task/Replace.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a10
  */
index 3b1d84c9a37bb910616a258f54263fcecb65bfac..5bf2ac0518894972841ec5c1e24abb1e1ddf5202 100644 (file)
@@ -23,7 +23,7 @@ require_once 'PEAR/Task/Common.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 7e98f218456ebc8654bab8a48c10575c7d2aeb5e..7316ba05fb4125d24b25349e2d75c0024abe2f36 100644 (file)
@@ -23,7 +23,7 @@ require_once 'PEAR/Task/Unixeol.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a10
  */
index e0f2f26d8c50d6d5ab52bee4abe41db5359212ba..190f21381ceb7c98cf8be03d8fd8f02d82ade091 100644 (file)
@@ -24,7 +24,7 @@ require_once 'PEAR/Task/Common.php';
  * @author    Greg Beaver <cellog@php.net>
  * @copyright 1997-2009 The Authors
  * @license   http://opensource.org/licenses/bsd-license.php New BSD License
- * @version   Release: 1.10.3
+ * @version   Release: 1.10.4
  * @link      http://pear.php.net/package/PEAR
  * @since     Class available since Release 1.4.0a1
  */
index 2f10c5eb23a9305f0ff6a81a293700480758b93e..4ef537b7ca9887a9a7560e9faeff29d5896e5d32 100644 (file)
@@ -24,7 +24,7 @@ require_once 'PEAR/Task/Windowseol.php';
  * @author    Greg Beaver <cellog@php.net>
  * @copyright 1997-2009 The Authors
  * @license   http://opensource.org/licenses/bsd-license.php New BSD License
- * @version   Release: 1.10.3
+ * @version   Release: 1.10.4
  * @link      http://pear.php.net/package/PEAR
  * @since     Class available since Release 1.4.0a10
  */
index 0dc7433c1c1a564b4f1e6c1b3226abe5921dc630..4b98b3ad5284aff740e699dce8f37a07f8ee6c24 100644 (file)
@@ -31,7 +31,7 @@ require_once 'PEAR/Validator/PECL.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a1
  */
index 157cda3271aed3d23c21eff553cc0f985eff6b07..44bfb4f48bd57eab25d3646247af6cbd0cdb9b08 100644 (file)
@@ -23,7 +23,7 @@ require_once 'PEAR/Validate.php';
  * @author     Greg Beaver <cellog@php.net>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.10.3
+ * @version    Release: 1.10.4
  * @link       http://pear.php.net/package/PEAR
  * @since      Class available since Release 1.4.0a5
  */
index 85b10a72a6b089ebc2459ee3591886066ee399e5..f0fa553d3c4b2bee61a5c8e7a9eb07f37191bedf 100644 (file)
@@ -22,7 +22,7 @@
  * @author    Stephan Schmidt (original XML_Unserializer code)
  * @copyright 1997-2009 The Authors
  * @license   http://opensource.org/licenses/bsd-license New BSD License
- * @version   Release: 1.10.3
+ * @version   Release: 1.10.4
  * @link      http://pear.php.net/package/PEAR
  * @since     Class available since Release 1.4.0a1
  */
index 3184f46948abc8e5f555d0e70004c8b65eafadf2..146346b57afbf58b26009e6e966fef20632b6fd0 100644 (file)
@@ -50,7 +50,7 @@ $GLOBALS['_System_temp_files'] = array();
 * @author     Tomas V.V. Cox <cox@idecnet.com>
 * @copyright  1997-2006 The PHP Group
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
-* @version    Release: 1.10.3
+* @version    Release: 1.10.4
 * @link       http://pear.php.net/package/PEAR
 * @since      Class available since Release 0.1
 * @static
index e089c818e72c990c18a8e999ae0af1105890cea8..60cb9769bfe4f39341032b54b83ed2dc7c8f774b 100644 (file)
@@ -41,7 +41,7 @@ ob_implicit_flush(true);
 $_PEAR_PHPDIR = '#$%^&*';
 set_error_handler('error_handler');
 
-$pear_package_version = "1.10.3";
+$pear_package_version = "1.10.4";
 
 require_once 'PEAR.php';
 require_once 'PEAR/Frontend.php';
index e51b531b5ae1a7e628e6a04ca1a18be64688b3fc..17d4961fcdd560833f5f75921aacb764fa1c5408 100644 (file)
@@ -2,7 +2,7 @@
 <html itemscope itemtype="http://schema.org/Blog" lang="<?php echo $lang; ?>">\r
 <head>\r
   <title><?php if(x($page,'title')) echo $page['title'] ?></title>\r
-  <script>var baseurl="<?php echo App::get_baseurl() ?>";</script>\r
+  <script>var baseurl="<?php echo Friendica\App::get_baseurl() ?>";</script>\r
   <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>\r
 </head>\r
 <body>\r
index e93aac11258ef7665a54e551ba9b8cc67c09973c..39888630a43270e1bb2c58567cb6fa983a6c848a 100644 (file)
@@ -2,7 +2,7 @@
 <html>\r
 <head>\r
   <title><?php if(x($page,'title')) echo $page['title'] ?></title>\r
-  <script>var baseurl="<?php echo App::get_baseurl() ?>";</script>\r
+  <script>var baseurl="<?php echo Friendica\App::get_baseurl() ?>";</script>\r
   <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>\r
 </head>\r
 <body>\r
index 381b0671676fe1a5fd9e86f9bde8f33aa79bcd8b..b1ec4bae531c38d46d70daf2faa6130aa85c1696 100644 (file)
@@ -1,8 +1,11 @@
 <?php
+
 /**
  * Theme settings
  */
 
+use Friendica\App;
+
 function theme_content(App $a) {
        if (!local_user()) {
                return;
index 89f44d9c0454b3e6c7e05d6b5c86bb4c9c44f705..1095dfcc5d83ab1a57d17d9e3d32bedc048c539c 100644 (file)
@@ -6,7 +6,7 @@ $uid = get_theme_uid();
 
 $s_colorset = get_config('duepuntozero','colorset');
 $colorset = get_pconfig( $uid, 'duepuntozero', 'colorset');
-if (!x($colorset)) 
+if (!x($colorset))
     $colorset = $s_colorset;
 
 if ($colorset) {
@@ -25,5 +25,3 @@ if ($colorset) {
 }
 
 echo $setcss;
-
-?>
index c674a99d99ad848bb250c72667a8372860f80c97..dc8f29b2facfa0db1de9401a0a1e2eea25c1ea29 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Friendica\App;
+
 function duepuntozero_init(App $a) {
 
 set_template_engine($a, 'smarty3');
index 57e88265721a27a3814b541510a72827769801a8..229e863e93dc6b37ffa56982c3c3eae2bb2d3981 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Friendica\App;
+
 require_once('view/theme/frio/php/Image.php');
 
 function theme_content(App $a) {
index 91b01e950a749179e38bb5974c568aae8468746a..01cab105bc4602d610923f2f6bffeede36188b1f 100644 (file)
@@ -98,7 +98,7 @@ blockquote {
 code {
     white-space: pre-wrap;
 }
-.help-content-wrapper code {display: inline}
+.help-content-wrapper code, .help-aside-wrapper code {display: inline}
 
 /*
 * standard page elements
index c56f63d9e33fcba28ae2c4342d40616b9956472b..ef7e413ad828e1c691cab66c3eb58828d3142ac2 100644 (file)
 <head>
        <title><?php if(x($page,'title')) echo $page['title'] ?></title>
        <meta request="<?php echo htmlspecialchars($_REQUEST['pagename']) ?>">
-       <script>var baseurl="<?php echo App::get_baseurl() ?>";</script>
+       <script>var baseurl="<?php echo Friendica\App::get_baseurl() ?>";</script>
        <script>var frio="<?php echo "view/theme/frio"; ?>";</script>
-       <?php $baseurl = App::get_baseurl(); ?>
+       <?php $baseurl = Friendica\App::get_baseurl(); ?>
        <?php $frio = "view/theme/frio"; ?>
-       <?php 
+       <?php
                // Because we use minimal for modals the header and the included js stuff should be only loaded
                // if the page is an standard page (so we don't have it twice for modals)
-               // 
+               //
                /// @todo Think about to move js stuff in the footer
                if(!$minimal) {
                        if(x($page,'htmlhead')) echo $page['htmlhead'];
index 59a246bf99647cf53ad6eca0cb8086923a1b37f6..17fbb1fbac85a3433fd4e1ad9a3a1720010e4735 100644 (file)
@@ -3,10 +3,11 @@
 /**
  * @file view/theme/frio/php/frio_boot.php
  *
- * @brief This file contains functions for page contstruction
+ * @brief This file contains functions for page construction
  *
  */
 
+use Friendica\App;
 
 /**
  * @brief Load page template in dependence of the template mode
index 9e3d2ca638ab0595d1580a8f3481e3888c30d7fb..26a5859efca4bfb7b967b65685acc8d66e7cd9c5 100644 (file)
@@ -10,9 +10,9 @@
        <title><?php if(x($page,'title')) echo $page['title'] ?></title>
        <meta name="viewport" content="initial-scale=1.0">
        <meta request="<?php echo htmlspecialchars($_REQUEST['pagename']) ?>">
-       <script>var baseurl="<?php echo App::get_baseurl() ?>";</script>
+       <script>var baseurl="<?php echo Friendica\App::get_baseurl() ?>";</script>
        <script>var frio="<?php echo "view/theme/frio"; ?>";</script>
-       <?php $baseurl = App::get_baseurl(); ?>
+       <?php $baseurl = Friendica\App::get_baseurl(); ?>
        <?php $frio = "view/theme/frio"; ?>
        <?php if(x($page,'htmlhead')) echo $page['htmlhead']; ?>
 </head>
index a873e45131ca82a267dc5c4e57b1d0e9bfabed37..e0c382661a1be3b1099f626d9a9ffea4230537b8 100644 (file)
@@ -7,6 +7,8 @@
  *
  */
 
+use Friendica\App;
+
 $frio = "view/theme/frio";
 
 global $frio;
@@ -130,7 +132,7 @@ function frio_item_photo_menu(App $a, &$arr) {
  *  Additionally the profile, status and photo page links  will be changed
  *  to don't open in a new tab if the contact is a friendica contact.
  *
- * @param app $a The app data
+ * @param App $a The app data
  * @param array $args Contains contact data and the original photo_menu
  */
 function frio_contact_photo_menu(App $a, &$args){
@@ -182,7 +184,7 @@ function frio_contact_photo_menu(App $a, &$args){
  *  Some links will point to the local pages because the user would expect
  *  local page (these pages are: search, community, help, apps, directory).
  *
- * @param app $a The App class
+ * @param App $a The App class
  * @param array $nav The original nav menu
  */
 function frio_remote_nav($a,&$nav) {
@@ -271,7 +273,7 @@ function frio_remote_nav($a,&$nav) {
  * @param App $a The app data @TODO Unused
  * @param array $results The array with the originals from acl_lookup()
  */
-function frio_acl_lookup($a, &$results) {
+function frio_acl_lookup(App $a, &$results) {
        require_once("mod/contacts.php");
 
        $nets = ((x($_GET,"nets")) ? notags(trim($_GET["nets"])) : "");
index d739f56f269fb14f52dc4f8b1688367aac0ae073..062ec3b8a9c97cf520e0b99cf7ecde94d3d3e075 100644 (file)
@@ -2,7 +2,7 @@
 <html lang="<?php echo $lang; ?>">\r
 <head>\r
   <title><?php if(x($page,'title')) echo $page['title'] ?></title>\r
-  <script>var baseurl="<?php echo App::get_baseurl() ?>";</script>\r
+  <script>var baseurl="<?php echo Friendica\App::get_baseurl() ?>";</script>\r
   <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>\r
 </head>\r
 <body <?php if($a->module === 'home') echo 'onLoad="setTimeout(\'homeRedirect()\', 1500)"'?>>\r
index 7e4262cb6a46fc601c7228765405806d7b3cd752..24f41073e7cdace4aebf85385e4ba3cfce296a39 100644 (file)
@@ -9,6 +9,8 @@
  * Maintainer: Zach P <techcity@f.shmuz.in>
  */
 
+use Friendica\App;
+
 function frost_mobile_init(App $a) {
        $a->sourcename = 'Friendica mobile web';
        $a->videowidth = 250;
index 0fe3404f69c97dc7d157ce3e91ebcf54766fed31..306345d391cc8fa2662d439b1d79bbf1b0c581e6 100644 (file)
@@ -2,7 +2,7 @@
 <html lang="<?php echo $lang; ?>">\r
 <head>\r
   <title><?php if(x($page,'title')) echo $page['title'] ?></title>\r
-  <script>var baseurl="<?php echo App::get_baseurl() ?>";</script>\r
+  <script>var baseurl="<?php echo Friendica\App::get_baseurl() ?>";</script>\r
   <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>\r
 </head>\r
 <body <?php if($a->module === 'home') echo 'onLoad="setTimeout(\'homeRedirect()\', 1500)"'?>>\r
index 4c22f0a11869664db5a6b58b4b1bfdc172fa0ad3..b09153876d67c09285609c27910d02ea35e33e24 100644 (file)
@@ -9,6 +9,8 @@
  * Maintainer: Zach P <techcity@f.shmuz.in>
  */
 
+use Friendica\App;
+
 function frost_init(App $a) {
        $a->videowidth = 400;
        $a->videoheight = 330;
index 993f778f87fc4def90d12e1deacdf9a79ee3fff6..47210012caa8f7ce95ae89640781a60ce78502c1 100644 (file)
@@ -1,8 +1,11 @@
 <?php
+
 /**
  * Theme settings
  */
 
+use Friendica\App;
+
 function theme_content(App $a) {
        if (!local_user()) {
                return;
index fc908522a1862144ccdf2f971dc9b77f44367136..5647fd493a88e1cd3f20a322df9abd54bb5af8e0 100644 (file)
@@ -7,6 +7,8 @@
  * Maintainer: Tobias <https://diekershoff.homeunix.net/friendica/profile/tobias>
  */
 
+use Friendica\App;
+
 function quattro_init(App $a) {
        $a->page['htmlhead'] .= '<script src="'.App::get_baseurl().'/view/theme/quattro/tinycon.min.js"></script>';
        $a->page['htmlhead'] .= '<script src="'.App::get_baseurl().'/view/theme/quattro/js/quattro.js"></script>';;
index 1e97c6b462e70930defe99fa1e97757616482ca6..568f267c1c3e9fd7dc178ae6158f7065a00217e2 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
   <title><?php if(x($page,'title')) echo $page['title'] ?></title>
-  <script>var baseurl="<?php echo App::get_baseurl() ?>";</script>
+  <script>var baseurl="<?php echo Friendica\App::get_baseurl() ?>";</script>
   <script type="text/javascript">
        function ScrollToBottom(){
        window.scrollTo(0,document.body.scrollHeight);
index 62713e00cd9e854d9bb7e9fab8a6d7c60c9d15d7..3efcf54f413a4a96c4f691f87c6a81f4964f78e7 100644 (file)
  * Screenshot: <a href="screenshot.png">Screenshot</a>
  */
 
+use Friendica\App;
+
 function smoothly_init(App $a) {
        set_template_engine($a, 'smarty3');
 
        $cssFile = null;
        $ssl_state = null;
        $baseurl = App::get_baseurl($ssl_state);
-$a->page['htmlhead'] .= <<< EOT
+       $a->page['htmlhead'] .= <<< EOT
 
 <script>
 function insertFormatting(BBcode, id) {
@@ -99,13 +101,12 @@ $(document).ready(function() {
 </script>
 EOT;
 
-       /** custom css **/
+       /** custom css **/
        if (!is_null($cssFile)) {
         $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
        }
 
-_js_in_foot();
-
+       _js_in_foot();
 }
 
 if (! function_exists('_js_in_foot')) {
index 9fd19e8abae87c847db7a7de3415f7c6234879ec..0747770d3665052e23fa5dfd0aec419244e21d80 100644 (file)
@@ -1,9 +1,10 @@
 <?php
+
 /**
  * Theme settings
  */
 
-
+use Friendica\App;
 
 function theme_content(App $a) {
        if (!local_user()) {
index a42dfe6e13070d0b4d2cf2c58a8b0be8528ecf14..da2c08335dae02cb42c3e8579b8d7e33ac1b4cb3 100644 (file)
@@ -9,6 +9,8 @@
  * Description: "Vier" is a very compact and modern theme. It uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/
  */
 
+use Friendica\App;
+
 require_once "include/plugin.php";
 require_once "include/socgraph.php";
 require_once "mod/proxy.php";