2010-07-02 01:48:07 +02:00
|
|
|
<?php
|
2015-12-24 01:31:17 +01:00
|
|
|
/** @file boot.php
|
|
|
|
*
|
|
|
|
* This file defines some global constants and includes the central App class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Friendica
|
2016-04-03 13:48:31 +02:00
|
|
|
*
|
2015-12-24 01:31:17 +01:00
|
|
|
* Friendica is a communications platform for integrated social communications
|
|
|
|
* utilising decentralised communications and linkage to several indie social
|
|
|
|
* projects - as well as popular mainstream providers.
|
2016-04-03 13:48:31 +02:00
|
|
|
*
|
2015-12-24 01:31:17 +01:00
|
|
|
* Our mission is to free our friends and families from the clutches of
|
|
|
|
* data-harvesting corporations, and pave the way to a future where social
|
|
|
|
* communications are free and open and flow between alternate providers as
|
|
|
|
* easily as email does today.
|
|
|
|
*/
|
2010-07-02 01:48:07 +02:00
|
|
|
|
2016-02-09 11:07:37 +01:00
|
|
|
require_once('include/autoloader.php');
|
2016-04-03 13:48:31 +02:00
|
|
|
|
2011-08-02 01:51:01 +02:00
|
|
|
require_once('include/config.php');
|
|
|
|
require_once('include/network.php');
|
|
|
|
require_once('include/plugin.php');
|
|
|
|
require_once('include/text.php');
|
2012-06-12 04:52:46 +02:00
|
|
|
require_once('include/datetime.php');
|
2012-01-04 05:26:20 +01:00
|
|
|
require_once('include/pgettext.php');
|
2011-08-17 18:36:24 +02:00
|
|
|
require_once('include/nav.php');
|
2011-10-24 13:02:38 +02:00
|
|
|
require_once('include/cache.php');
|
2012-07-24 04:37:00 +02:00
|
|
|
require_once('library/Mobile_Detect/Mobile_Detect.php');
|
2012-11-22 17:14:22 +01:00
|
|
|
require_once('include/features.php');
|
2015-06-26 18:57:20 +02:00
|
|
|
require_once('include/identity.php');
|
2016-03-08 20:28:09 +01:00
|
|
|
require_once('include/pidfile.php');
|
2014-09-07 17:28:38 +02:00
|
|
|
require_once('update.php');
|
|
|
|
require_once('include/dbstructure.php');
|
|
|
|
|
2011-11-24 08:17:26 +01:00
|
|
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
2015-12-22 16:43:07 +01:00
|
|
|
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
2016-09-13 18:52:29 +02:00
|
|
|
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
|
2012-03-15 05:40:36 +01:00
|
|
|
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
2016-11-19 18:22:49 +01:00
|
|
|
define ( 'DB_UPDATE_VERSION', 1209 );
|
2015-12-25 18:36:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Constant with a HTML line break.
|
|
|
|
*
|
|
|
|
* Contains a HTML line break (br) element and a real carriage return with line
|
|
|
|
* feed for the source.
|
|
|
|
* This can be used in HTML and JavaScript where needed a line break.
|
|
|
|
*/
|
2010-10-13 11:47:32 +02:00
|
|
|
define ( 'EOL', "<br />\r\n" );
|
|
|
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
2011-08-17 05:05:02 +02:00
|
|
|
|
2011-05-04 11:20:44 +02:00
|
|
|
|
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @brief Image storage quality.
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* Lower numbers save space at cost of image detail.
|
2012-04-09 14:04:49 +02:00
|
|
|
* For ease of upgrade, please do not change here. Change jpeg quality with
|
|
|
|
* $a->config['system']['jpeg_quality'] = n;
|
|
|
|
* in .htconfig.php, where n is netween 1 and 100, and with very poor results
|
|
|
|
* below about 50
|
2011-05-04 11:20:44 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-04-09 14:04:49 +02:00
|
|
|
define ( 'JPEG_QUALITY', 100 );
|
2012-06-07 17:42:13 +02:00
|
|
|
/**
|
|
|
|
* $a->config['system']['png_quality'] from 0 (uncompressed) to 9
|
|
|
|
*/
|
|
|
|
define ( 'PNG_QUALITY', 8 );
|
|
|
|
|
2012-06-28 18:33:21 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* An alternate way of limiting picture upload sizes. Specify the maximum pixel
|
|
|
|
* length that pictures are allowed to be (for non-square pictures, it will apply
|
|
|
|
* to the longest side). Pictures longer than this length will be resized to be
|
|
|
|
* this length (on the longest side, the other side will be scaled appropriately).
|
|
|
|
* Modify this value using
|
|
|
|
*
|
|
|
|
* $a->config['system']['max_image_length'] = n;
|
|
|
|
*
|
|
|
|
* in .htconfig.php
|
|
|
|
*
|
|
|
|
* If you don't want to set a maximum length, set to -1. The default value is
|
|
|
|
* defined by 'MAX_IMAGE_LENGTH' below.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
define ( 'MAX_IMAGE_LENGTH', -1 );
|
|
|
|
|
2011-01-30 07:35:11 +01:00
|
|
|
|
2012-05-09 07:46:40 +02:00
|
|
|
/**
|
|
|
|
* Not yet used
|
|
|
|
*/
|
|
|
|
|
|
|
|
define ( 'DEFAULT_DB_ENGINE', 'MyISAM' );
|
|
|
|
|
2011-01-30 07:35:11 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name SSL Policy
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2011-01-30 07:35:11 +01:00
|
|
|
* SSL redirection policies
|
2015-12-25 20:58:26 +01:00
|
|
|
* @{
|
2011-01-30 07:35:11 +01:00
|
|
|
*/
|
|
|
|
define ( 'SSL_POLICY_NONE', 0 );
|
|
|
|
define ( 'SSL_POLICY_FULL', 1 );
|
2011-01-30 07:41:01 +01:00
|
|
|
define ( 'SSL_POLICY_SELFSIGN', 2 );
|
2015-12-25 20:58:26 +01:00
|
|
|
/* @}*/
|
2011-01-30 07:35:11 +01:00
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Logger
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2010-12-10 13:04:35 +01:00
|
|
|
* log levels
|
2015-12-25 20:58:26 +01:00
|
|
|
* @{
|
2010-12-10 13:04:35 +01:00
|
|
|
*/
|
2010-11-02 01:56:36 +01:00
|
|
|
define ( 'LOGGER_NORMAL', 0 );
|
|
|
|
define ( 'LOGGER_TRACE', 1 );
|
|
|
|
define ( 'LOGGER_DEBUG', 2 );
|
|
|
|
define ( 'LOGGER_DATA', 3 );
|
|
|
|
define ( 'LOGGER_ALL', 4 );
|
2015-12-25 20:58:26 +01:00
|
|
|
/* @}*/
|
2010-11-02 01:56:36 +01:00
|
|
|
|
2015-08-24 17:24:14 +02:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Cache
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* Cache levels
|
|
|
|
* @{
|
2015-08-24 17:24:14 +02:00
|
|
|
*/
|
|
|
|
define ( 'CACHE_MONTH', 0 );
|
|
|
|
define ( 'CACHE_WEEK', 1 );
|
|
|
|
define ( 'CACHE_DAY', 2 );
|
|
|
|
define ( 'CACHE_HOUR', 3 );
|
2016-10-23 23:59:40 +02:00
|
|
|
define ( 'CACHE_HALF_HOUR', 4 );
|
|
|
|
define ( 'CACHE_QUARTER_HOUR', 5 );
|
|
|
|
define ( 'CACHE_FIVE_MINUTES', 6 );
|
|
|
|
define ( 'CACHE_MINUTE', 7 );
|
2015-12-25 20:58:26 +01:00
|
|
|
/* @}*/
|
2015-08-24 17:24:14 +02:00
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Register
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* Registration policies
|
|
|
|
* @{
|
2010-12-10 13:04:35 +01:00
|
|
|
*/
|
2010-10-13 11:47:32 +02:00
|
|
|
define ( 'REGISTER_CLOSED', 0 );
|
|
|
|
define ( 'REGISTER_APPROVE', 1 );
|
|
|
|
define ( 'REGISTER_OPEN', 2 );
|
2015-12-25 20:58:26 +01:00
|
|
|
/** @}*/
|
2010-07-02 01:48:07 +02:00
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Contact_is
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* Relationship types
|
|
|
|
* @{
|
2010-12-10 13:04:35 +01:00
|
|
|
*/
|
2011-08-08 01:15:54 +02:00
|
|
|
define ( 'CONTACT_IS_FOLLOWER', 1);
|
|
|
|
define ( 'CONTACT_IS_SHARING', 2);
|
|
|
|
define ( 'CONTACT_IS_FRIEND', 3);
|
2015-12-25 20:58:26 +01:00
|
|
|
/** @}*/
|
2010-09-10 01:48:33 +02:00
|
|
|
|
2012-04-29 02:53:19 +02:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Update
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2012-04-29 02:53:19 +02:00
|
|
|
* DB update return values
|
2015-12-25 20:58:26 +01:00
|
|
|
* @{
|
2012-04-29 02:53:19 +02:00
|
|
|
*/
|
|
|
|
define ( 'UPDATE_SUCCESS', 0);
|
|
|
|
define ( 'UPDATE_FAILED', 1);
|
2015-12-25 20:58:26 +01:00
|
|
|
/** @}*/
|
2012-04-29 02:53:19 +02:00
|
|
|
|
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name page/profile types
|
2010-12-10 13:04:35 +01:00
|
|
|
*
|
|
|
|
* PAGE_NORMAL is a typical personal profile account
|
2011-08-08 01:15:54 +02:00
|
|
|
* PAGE_SOAPBOX automatically approves all friend requests as CONTACT_IS_SHARING, (readonly)
|
2012-04-09 14:04:49 +02:00
|
|
|
* PAGE_COMMUNITY automatically approves all friend requests as CONTACT_IS_SHARING, but with
|
2010-12-10 13:04:35 +01:00
|
|
|
* write access to wall and comments (no email and not included in page owner's ACL lists)
|
2012-04-09 14:04:49 +02:00
|
|
|
* PAGE_FREELOVE automatically approves all friend requests as full friends (CONTACT_IS_FRIEND).
|
2010-12-10 13:04:35 +01:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* @{
|
2010-12-10 13:04:35 +01:00
|
|
|
*/
|
2010-10-17 07:11:21 +02:00
|
|
|
define ( 'PAGE_NORMAL', 0 );
|
2010-10-18 05:04:17 +02:00
|
|
|
define ( 'PAGE_SOAPBOX', 1 );
|
|
|
|
define ( 'PAGE_COMMUNITY', 2 );
|
|
|
|
define ( 'PAGE_FREELOVE', 3 );
|
2012-01-25 01:23:30 +01:00
|
|
|
define ( 'PAGE_BLOG', 4 );
|
2012-04-04 23:13:34 +02:00
|
|
|
define ( 'PAGE_PRVGROUP', 5 );
|
2015-12-25 20:58:26 +01:00
|
|
|
/** @}*/
|
2010-10-17 07:11:21 +02:00
|
|
|
|
2016-09-25 17:28:00 +02:00
|
|
|
/**
|
2016-09-25 22:37:27 +02:00
|
|
|
* @name account types
|
2016-09-25 17:28:00 +02:00
|
|
|
*
|
2016-09-27 20:29:50 +02:00
|
|
|
* ACCOUNT_TYPE_PERSON - the account belongs to a person
|
|
|
|
* Associated page types: PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE
|
|
|
|
*
|
|
|
|
* ACCOUNT_TYPE_ORGANISATION - the account belongs to an organisation
|
|
|
|
* Associated page type: PAGE_SOAPBOX
|
|
|
|
*
|
|
|
|
* ACCOUNT_TYPE_NEWS - the account is a news reflector
|
|
|
|
* Associated page type: PAGE_SOAPBOX
|
|
|
|
*
|
|
|
|
* ACCOUNT_TYPE_COMMUNITY - the account is community forum
|
|
|
|
* Associated page types: PAGE_COMMUNITY, PAGE_PRVGROUP
|
2016-09-25 17:28:00 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-09-25 22:37:27 +02:00
|
|
|
define ( 'ACCOUNT_TYPE_PERSON', 0 );
|
2016-09-26 21:35:01 +02:00
|
|
|
define ( 'ACCOUNT_TYPE_ORGANISATION',1 );
|
2016-09-25 22:37:27 +02:00
|
|
|
define ( 'ACCOUNT_TYPE_NEWS', 2 );
|
|
|
|
define ( 'ACCOUNT_TYPE_COMMUNITY', 3 );
|
2016-09-25 17:28:00 +02:00
|
|
|
/** @}*/
|
|
|
|
|
2015-12-25 18:36:13 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name CP
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 18:36:13 +01:00
|
|
|
* Type of the community page
|
2015-12-25 20:58:26 +01:00
|
|
|
* @{
|
2015-12-25 18:36:13 +01:00
|
|
|
*/
|
2015-02-08 20:35:40 +01:00
|
|
|
define ( 'CP_NO_COMMUNITY_PAGE', -1 );
|
|
|
|
define ( 'CP_USERS_ON_SERVER', 0 );
|
|
|
|
define ( 'CP_GLOBAL_COMMUNITY', 1 );
|
2015-12-25 20:58:26 +01:00
|
|
|
/** @}*/
|
2015-02-08 20:35:40 +01:00
|
|
|
|
2011-04-11 12:22:09 +02:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Network
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2012-04-09 14:04:49 +02:00
|
|
|
* Network and protocol family types
|
2015-12-25 20:58:26 +01:00
|
|
|
* @{
|
2011-04-11 12:22:09 +02:00
|
|
|
*/
|
2011-11-01 04:39:04 +01:00
|
|
|
define ( 'NETWORK_DFRN', 'dfrn'); // Friendica, Mistpark, other DFRN implementations
|
2012-03-29 04:56:14 +02:00
|
|
|
define ( 'NETWORK_ZOT', 'zot!'); // Zot!
|
2011-04-11 12:22:09 +02:00
|
|
|
define ( 'NETWORK_OSTATUS', 'stat'); // status.net, identi.ca, GNU-social, other OStatus implementations
|
|
|
|
define ( 'NETWORK_FEED', 'feed'); // RSS/Atom feeds with no known "post/notify" protocol
|
|
|
|
define ( 'NETWORK_DIASPORA', 'dspr'); // Diaspora
|
|
|
|
define ( 'NETWORK_MAIL', 'mail'); // IMAP/POP
|
2012-02-01 05:03:46 +01:00
|
|
|
define ( 'NETWORK_MAIL2', 'mai2'); // extended IMAP/POP
|
2012-04-09 14:04:49 +02:00
|
|
|
define ( 'NETWORK_FACEBOOK', 'face'); // Facebook API
|
2011-11-24 08:17:26 +01:00
|
|
|
define ( 'NETWORK_LINKEDIN', 'lnkd'); // LinkedIn
|
2012-04-09 14:04:49 +02:00
|
|
|
define ( 'NETWORK_XMPP', 'xmpp'); // XMPP
|
2012-01-04 05:26:20 +01:00
|
|
|
define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace
|
2012-02-01 05:03:46 +01:00
|
|
|
define ( 'NETWORK_GPLUS', 'goog'); // Google+
|
2013-08-28 08:56:48 +02:00
|
|
|
define ( 'NETWORK_PUMPIO', 'pump'); // pump.io
|
2013-09-05 08:34:54 +02:00
|
|
|
define ( 'NETWORK_TWITTER', 'twit'); // Twitter
|
2014-01-13 19:57:15 +01:00
|
|
|
define ( 'NETWORK_DIASPORA2', 'dspc'); // Diaspora connector
|
2014-04-04 10:40:46 +02:00
|
|
|
define ( 'NETWORK_STATUSNET', 'stac'); // Statusnet connector
|
2014-06-04 21:25:31 +02:00
|
|
|
define ( 'NETWORK_APPNET', 'apdn'); // app.net
|
2015-10-27 07:49:02 +01:00
|
|
|
define ( 'NETWORK_NEWS', 'nntp'); // Network News Transfer Protocol
|
|
|
|
define ( 'NETWORK_ICALENDAR', 'ical'); // iCalendar
|
2012-05-11 12:41:29 +02:00
|
|
|
define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder
|
2015-12-25 20:58:26 +01:00
|
|
|
/** @}*/
|
2012-05-11 12:41:29 +02:00
|
|
|
|
2012-04-09 16:56:01 +02:00
|
|
|
/**
|
2012-03-29 04:56:14 +02:00
|
|
|
* These numbers are used in stored permissions
|
|
|
|
* and existing allocations MUST NEVER BE CHANGED
|
|
|
|
* OR RE-ASSIGNED! You may only add to them.
|
|
|
|
*/
|
|
|
|
|
|
|
|
$netgroup_ids = array(
|
|
|
|
NETWORK_DFRN => (-1),
|
|
|
|
NETWORK_ZOT => (-2),
|
|
|
|
NETWORK_OSTATUS => (-3),
|
|
|
|
NETWORK_FEED => (-4),
|
|
|
|
NETWORK_DIASPORA => (-5),
|
|
|
|
NETWORK_MAIL => (-6),
|
|
|
|
NETWORK_MAIL2 => (-7),
|
|
|
|
NETWORK_FACEBOOK => (-8),
|
|
|
|
NETWORK_LINKEDIN => (-9),
|
|
|
|
NETWORK_XMPP => (-10),
|
|
|
|
NETWORK_MYSPACE => (-11),
|
|
|
|
NETWORK_GPLUS => (-12),
|
2013-08-28 08:56:48 +02:00
|
|
|
NETWORK_PUMPIO => (-13),
|
2013-09-05 08:34:54 +02:00
|
|
|
NETWORK_TWITTER => (-14),
|
2014-01-13 19:57:15 +01:00
|
|
|
NETWORK_DIASPORA2 => (-15),
|
2014-04-04 10:40:46 +02:00
|
|
|
NETWORK_STATUSNET => (-16),
|
2015-10-27 07:49:02 +01:00
|
|
|
NETWORK_APPNET => (-17),
|
|
|
|
NETWORK_NEWS => (-18),
|
|
|
|
NETWORK_ICALENDAR => (-19),
|
2012-05-11 12:41:29 +02:00
|
|
|
|
|
|
|
NETWORK_PHANTOM => (-127),
|
2012-03-29 04:56:14 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
|
|
|
* Maximum number of "people who like (or don't like) this" that we will list by name
|
|
|
|
*/
|
2010-10-13 02:11:06 +02:00
|
|
|
|
|
|
|
define ( 'MAX_LIKERS', 75);
|
|
|
|
|
2011-07-15 12:08:43 +02:00
|
|
|
/**
|
|
|
|
* Communication timeout
|
|
|
|
*/
|
|
|
|
|
|
|
|
define ( 'ZCURL_TIMEOUT' , (-1));
|
|
|
|
|
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Notify
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* Email notification options
|
|
|
|
* @{
|
2010-12-10 13:04:35 +01:00
|
|
|
*/
|
2012-02-09 23:06:17 +01:00
|
|
|
define ( 'NOTIFY_INTRO', 0x0001 );
|
|
|
|
define ( 'NOTIFY_CONFIRM', 0x0002 );
|
|
|
|
define ( 'NOTIFY_WALL', 0x0004 );
|
|
|
|
define ( 'NOTIFY_COMMENT', 0x0008 );
|
|
|
|
define ( 'NOTIFY_MAIL', 0x0010 );
|
|
|
|
define ( 'NOTIFY_SUGGEST', 0x0020 );
|
|
|
|
define ( 'NOTIFY_PROFILE', 0x0040 );
|
|
|
|
define ( 'NOTIFY_TAGSELF', 0x0080 );
|
|
|
|
define ( 'NOTIFY_TAGSHARE', 0x0100 );
|
2012-07-20 05:13:40 +02:00
|
|
|
define ( 'NOTIFY_POKE', 0x0200 );
|
2014-01-05 16:10:02 +01:00
|
|
|
define ( 'NOTIFY_SHARE', 0x0400 );
|
2010-07-22 11:13:39 +02:00
|
|
|
|
2012-03-25 13:37:09 +02:00
|
|
|
define ( 'NOTIFY_SYSTEM', 0x8000 );
|
2015-12-25 20:58:26 +01:00
|
|
|
/* @}*/
|
2012-03-25 13:37:09 +02:00
|
|
|
|
|
|
|
|
2012-07-06 02:59:56 +02:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Term
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2012-07-06 02:59:56 +02:00
|
|
|
* Tag/term types
|
2015-12-25 20:58:26 +01:00
|
|
|
* @{
|
2012-07-06 02:59:56 +02:00
|
|
|
*/
|
|
|
|
define ( 'TERM_UNKNOWN', 0 );
|
|
|
|
define ( 'TERM_HASHTAG', 1 );
|
2013-01-13 14:50:55 +01:00
|
|
|
define ( 'TERM_MENTION', 2 );
|
2012-07-06 02:59:56 +02:00
|
|
|
define ( 'TERM_CATEGORY', 3 );
|
|
|
|
define ( 'TERM_PCATEGORY', 4 );
|
|
|
|
define ( 'TERM_FILE', 5 );
|
2013-01-13 14:50:55 +01:00
|
|
|
define ( 'TERM_SAVEDSEARCH', 6 );
|
2013-01-27 23:25:04 +01:00
|
|
|
define ( 'TERM_CONVERSATION', 7 );
|
2012-07-06 02:59:56 +02:00
|
|
|
|
|
|
|
define ( 'TERM_OBJ_POST', 1 );
|
|
|
|
define ( 'TERM_OBJ_PHOTO', 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Namespaces
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* Various namespaces we may need to parse
|
|
|
|
* @{
|
2010-12-10 13:04:35 +01:00
|
|
|
*/
|
2012-07-20 03:17:16 +02:00
|
|
|
define ( 'NAMESPACE_ZOT', 'http://purl.org/zot' );
|
2012-04-09 14:04:49 +02:00
|
|
|
define ( 'NAMESPACE_DFRN' , 'http://purl.org/macgirvin/dfrn/1.0' );
|
2010-09-10 02:55:59 +02:00
|
|
|
define ( 'NAMESPACE_THREAD' , 'http://purl.org/syndication/thread/1.0' );
|
|
|
|
define ( 'NAMESPACE_TOMB' , 'http://purl.org/atompub/tombstones/1.0' );
|
|
|
|
define ( 'NAMESPACE_ACTIVITY', 'http://activitystrea.ms/spec/1.0/' );
|
2010-10-25 05:39:24 +02:00
|
|
|
define ( 'NAMESPACE_ACTIVITY_SCHEMA', 'http://activitystrea.ms/schema/1.0/' );
|
2010-11-04 00:48:21 +01:00
|
|
|
define ( 'NAMESPACE_MEDIA', 'http://purl.org/syndication/atommedia' );
|
2010-10-25 05:39:24 +02:00
|
|
|
define ( 'NAMESPACE_SALMON_ME', 'http://salmon-protocol.org/ns/magic-env' );
|
|
|
|
define ( 'NAMESPACE_OSTATUSSUB', 'http://ostatus.org/schema/1.0/subscribe' );
|
|
|
|
define ( 'NAMESPACE_GEORSS', 'http://www.georss.org/georss' );
|
|
|
|
define ( 'NAMESPACE_POCO', 'http://portablecontacts.net/spec/1.0' );
|
|
|
|
define ( 'NAMESPACE_FEED', 'http://schemas.google.com/g/2010#updates-from' );
|
2011-06-21 04:08:40 +02:00
|
|
|
define ( 'NAMESPACE_OSTATUS', 'http://ostatus.org/schema/1.0' );
|
|
|
|
define ( 'NAMESPACE_STATUSNET', 'http://status.net/schema/api/1/' );
|
2011-07-21 08:14:43 +02:00
|
|
|
define ( 'NAMESPACE_ATOM1', 'http://www.w3.org/2005/Atom' );
|
2015-12-25 20:58:26 +01:00
|
|
|
/* @}*/
|
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Activity
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* Activity stream defines
|
|
|
|
* @{
|
2010-12-10 13:04:35 +01:00
|
|
|
*/
|
2010-09-09 05:14:17 +02:00
|
|
|
define ( 'ACTIVITY_LIKE', NAMESPACE_ACTIVITY_SCHEMA . 'like' );
|
2010-09-10 03:49:19 +02:00
|
|
|
define ( 'ACTIVITY_DISLIKE', NAMESPACE_DFRN . '/dislike' );
|
2015-06-01 13:57:45 +02:00
|
|
|
define ( 'ACTIVITY_ATTEND', NAMESPACE_ZOT . '/activity/attendyes' );
|
|
|
|
define ( 'ACTIVITY_ATTENDNO', NAMESPACE_ZOT . '/activity/attendno' );
|
|
|
|
define ( 'ACTIVITY_ATTENDMAYBE', NAMESPACE_ZOT . '/activity/attendmaybe' );
|
2015-06-01 01:23:04 +02:00
|
|
|
|
2010-09-10 02:55:59 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_HEART', NAMESPACE_DFRN . '/heart' );
|
|
|
|
|
2010-09-09 05:14:17 +02:00
|
|
|
define ( 'ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend' );
|
2011-10-03 01:18:01 +02:00
|
|
|
define ( 'ACTIVITY_REQ_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'request-friend' );
|
|
|
|
define ( 'ACTIVITY_UNFRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'remove-friend' );
|
2010-10-22 06:48:22 +02:00
|
|
|
define ( 'ACTIVITY_FOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'follow' );
|
2011-01-03 14:58:27 +01:00
|
|
|
define ( 'ACTIVITY_UNFOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'stop-following' );
|
2012-04-30 08:15:12 +02:00
|
|
|
define ( 'ACTIVITY_JOIN', NAMESPACE_ACTIVITY_SCHEMA . 'join' );
|
|
|
|
|
2010-09-09 05:14:17 +02:00
|
|
|
define ( 'ACTIVITY_POST', NAMESPACE_ACTIVITY_SCHEMA . 'post' );
|
|
|
|
define ( 'ACTIVITY_UPDATE', NAMESPACE_ACTIVITY_SCHEMA . 'update' );
|
2010-11-05 04:47:44 +01:00
|
|
|
define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
|
2012-01-25 01:23:30 +01:00
|
|
|
define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' );
|
2015-07-15 18:27:44 +02:00
|
|
|
define ( 'ACTIVITY_SHARE', NAMESPACE_ACTIVITY_SCHEMA . 'share' );
|
2010-09-09 05:14:17 +02:00
|
|
|
|
2012-07-20 03:17:16 +02:00
|
|
|
define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' );
|
2012-08-23 06:36:55 +02:00
|
|
|
define ( 'ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood' );
|
2012-07-20 03:17:16 +02:00
|
|
|
|
2014-07-22 00:36:20 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_BOOKMARK', NAMESPACE_ACTIVITY_SCHEMA . 'bookmark' );
|
2010-09-09 05:14:17 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' );
|
|
|
|
define ( 'ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note' );
|
|
|
|
define ( 'ACTIVITY_OBJ_PERSON', NAMESPACE_ACTIVITY_SCHEMA . 'person' );
|
2014-07-22 00:36:20 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_IMAGE', NAMESPACE_ACTIVITY_SCHEMA . 'image' );
|
2010-09-09 05:14:17 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'photo' );
|
2014-07-22 00:36:20 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_VIDEO', NAMESPACE_ACTIVITY_SCHEMA . 'video' );
|
2010-09-09 05:14:17 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo' );
|
|
|
|
define ( 'ACTIVITY_OBJ_ALBUM', NAMESPACE_ACTIVITY_SCHEMA . 'photo-album' );
|
2011-06-10 01:24:29 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event' );
|
2012-04-30 08:15:12 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_GROUP', NAMESPACE_ACTIVITY_SCHEMA . 'group' );
|
2011-09-19 05:17:44 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_TAGTERM', NAMESPACE_DFRN . '/tagterm' );
|
2012-04-13 06:10:32 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_PROFILE', NAMESPACE_DFRN . '/profile' );
|
2015-06-21 22:36:24 +02:00
|
|
|
define ( 'ACTIVITY_OBJ_QUESTION', 'http://activityschema.org/object/question' );
|
2015-12-25 20:58:26 +01:00
|
|
|
/* @}*/
|
2010-09-09 05:14:17 +02:00
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @name Gravity
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-25 20:58:26 +01:00
|
|
|
* Item weight for query ordering
|
|
|
|
* @{
|
2010-12-10 13:04:35 +01:00
|
|
|
*/
|
2010-09-17 12:10:19 +02:00
|
|
|
define ( 'GRAVITY_PARENT', 0);
|
|
|
|
define ( 'GRAVITY_LIKE', 3);
|
|
|
|
define ( 'GRAVITY_COMMENT', 6);
|
2015-12-25 20:58:26 +01:00
|
|
|
/* @}*/
|
|
|
|
|
2016-08-01 07:48:43 +02:00
|
|
|
/**
|
|
|
|
* @name Priority
|
|
|
|
*
|
|
|
|
* Process priority for the worker
|
|
|
|
* @{
|
|
|
|
*/
|
2016-08-18 12:33:17 +02:00
|
|
|
define('PRIORITY_UNDEFINED', 0);
|
|
|
|
define('PRIORITY_CRITICAL', 10);
|
|
|
|
define('PRIORITY_HIGH', 20);
|
|
|
|
define('PRIORITY_MEDIUM', 30);
|
|
|
|
define('PRIORITY_LOW', 40);
|
|
|
|
define('PRIORITY_NEGLIGIBLE',50);
|
2016-08-01 07:48:43 +02:00
|
|
|
/* @}*/
|
|
|
|
|
2010-09-09 05:14:17 +02:00
|
|
|
|
2016-05-22 12:31:32 +02:00
|
|
|
// Normally this constant is defined - but not if "pcntl" isn't installed
|
|
|
|
if (!defined("SIGTERM"))
|
|
|
|
define("SIGTERM", 15);
|
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Reverse the effect of magic_quotes_gpc if it is enabled.
|
|
|
|
* Please disable magic_quotes_gpc so we don't have to do this.
|
|
|
|
* See http://php.net/manual/en/security.magicquotes.disabling.php
|
|
|
|
*
|
|
|
|
*/
|
2010-11-24 08:42:45 +01:00
|
|
|
|
2011-07-18 06:34:02 +02:00
|
|
|
function startup() {
|
2013-09-15 10:40:58 +02:00
|
|
|
|
2011-07-18 06:34:02 +02:00
|
|
|
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
2012-10-16 01:28:43 +02:00
|
|
|
|
2011-07-18 06:34:02 +02:00
|
|
|
set_time_limit(0);
|
2011-09-23 02:35:49 +02:00
|
|
|
|
|
|
|
// This has to be quite large to deal with embedded private photos
|
2011-11-02 09:50:15 +01:00
|
|
|
ini_set('pcre.backtrack_limit', 500000);
|
2011-07-18 06:34:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
if (get_magic_quotes_gpc()) {
|
2012-04-09 14:04:49 +02:00
|
|
|
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
|
|
|
|
while (list($key, $val) = each($process)) {
|
|
|
|
foreach ($val as $k => $v) {
|
|
|
|
unset($process[$key][$k]);
|
|
|
|
if (is_array($v)) {
|
|
|
|
$process[$key][stripslashes($k)] = $v;
|
|
|
|
$process[] = &$process[$key][stripslashes($k)];
|
|
|
|
} else {
|
|
|
|
$process[$key][stripslashes($k)] = stripslashes($v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unset($process);
|
2011-07-18 06:34:02 +02:00
|
|
|
}
|
|
|
|
|
2010-11-24 08:42:45 +01:00
|
|
|
}
|
|
|
|
|
2010-12-10 13:04:35 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* class: App
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2015-12-24 01:31:17 +01:00
|
|
|
* @brief Our main application structure for the life of this page.
|
2016-10-02 05:29:30 +02:00
|
|
|
*
|
2010-12-10 13:04:35 +01:00
|
|
|
* Primarily deals with the URL that got us here
|
2012-04-09 14:04:49 +02:00
|
|
|
* and tries to make some sense of it, and
|
2010-12-10 13:04:35 +01:00
|
|
|
* stores our page contents and config storage
|
2012-04-09 14:04:49 +02:00
|
|
|
* and anything else that might need to be passed around
|
|
|
|
* before we spit the page out.
|
2010-12-10 13:04:35 +01:00
|
|
|
*
|
|
|
|
*/
|
2015-12-24 01:31:17 +01:00
|
|
|
class App {
|
|
|
|
|
|
|
|
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;
|
2016-03-01 14:27:38 +01:00
|
|
|
public $is_mobile = false;
|
|
|
|
public $is_tablet = false;
|
2015-12-24 01:31:17 +01:00
|
|
|
public $is_friendica_app;
|
|
|
|
public $performance = array();
|
2016-01-14 21:56:37 +01:00
|
|
|
public $callstack = array();
|
2016-03-01 14:27:38 +01:00
|
|
|
public $theme_info = array();
|
2016-07-02 08:54:57 +02:00
|
|
|
public $backend = true;
|
2015-12-24 01:31:17 +01:00
|
|
|
|
|
|
|
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;
|
2016-11-29 21:04:31 +01:00
|
|
|
public $theme_richtext_editor = true;
|
2015-12-24 01:31:17 +01:00
|
|
|
public $theme_events_in_profile = true;
|
2010-09-28 02:16:52 +02:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
/**
|
|
|
|
* @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',
|
|
|
|
);
|
2012-12-22 20:57:29 +01:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
/**
|
|
|
|
* @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();
|
2010-07-02 01:48:07 +02:00
|
|
|
|
2016-07-07 20:32:13 +02:00
|
|
|
public $process_id;
|
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
private $ldelim = array(
|
|
|
|
'internal' => '',
|
|
|
|
'smarty3' => '{{'
|
|
|
|
);
|
|
|
|
private $rdelim = array(
|
|
|
|
'internal' => '',
|
|
|
|
'smarty3' => '}}'
|
|
|
|
);
|
2010-10-14 07:01:23 +02:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
private $scheme;
|
|
|
|
private $hostname;
|
|
|
|
private $baseurl;
|
|
|
|
private $db;
|
2013-01-26 16:46:43 +01:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
private $curl_code;
|
|
|
|
private $curl_content_type;
|
|
|
|
private $curl_headers;
|
2010-07-02 01:48:07 +02:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
private $cached_profile_image;
|
|
|
|
private $cached_profile_picdate;
|
2012-06-12 04:52:46 +02:00
|
|
|
|
2016-01-25 15:20:58 +01:00
|
|
|
private static $a;
|
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
/**
|
2015-12-25 20:58:26 +01:00
|
|
|
* @brief App constructor.
|
2015-12-24 01:31:17 +01:00
|
|
|
*/
|
|
|
|
function __construct() {
|
2014-05-29 11:40:54 +02:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
global $default_timezone;
|
2013-09-15 10:40:58 +02:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
$hostname = "";
|
2013-09-15 10:40:58 +02:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
if (file_exists(".htpreconfig.php"))
|
|
|
|
@include(".htpreconfig.php");
|
2013-09-15 10:40:58 +02:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
$this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
|
2010-12-11 05:21:34 +01:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
date_default_timezone_set($this->timezone);
|
2014-11-08 00:07:21 +01:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
$this->performance["start"] = microtime(true);
|
|
|
|
$this->performance["database"] = 0;
|
2016-08-08 07:14:40 +02:00
|
|
|
$this->performance["database_write"] = 0;
|
2015-12-24 01:31:17 +01:00
|
|
|
$this->performance["network"] = 0;
|
|
|
|
$this->performance["file"] = 0;
|
|
|
|
$this->performance["rendering"] = 0;
|
|
|
|
$this->performance["parser"] = 0;
|
|
|
|
$this->performance["marktime"] = 0;
|
2016-01-16 09:16:51 +01:00
|
|
|
$this->performance["markstart"] = microtime(true);
|
2016-01-14 21:56:37 +01:00
|
|
|
|
|
|
|
$this->callstack["database"] = array();
|
2016-11-20 00:41:53 +01:00
|
|
|
$this->callstack["database_write"] = array();
|
2016-01-14 21:56:37 +01:00
|
|
|
$this->callstack["network"] = array();
|
|
|
|
$this->callstack["file"] = array();
|
|
|
|
$this->callstack["rendering"] = array();
|
|
|
|
$this->callstack["parser"] = array();
|
2014-11-08 00:07:21 +01:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
$this->config = array();
|
|
|
|
$this->page = array();
|
|
|
|
$this->pager= array();
|
2014-11-08 00:07:21 +01:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
$this->query_string = '';
|
2014-11-08 00:07:21 +01:00
|
|
|
|
2016-07-07 20:32:13 +02:00
|
|
|
$this->process_id = uniqid("log", true);
|
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
startup();
|
2014-11-08 00:07:21 +01:00
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
set_include_path(
|
|
|
|
'include' . PATH_SEPARATOR
|
|
|
|
. 'library' . PATH_SEPARATOR
|
|
|
|
. 'library/phpsec' . PATH_SEPARATOR
|
|
|
|
. 'library/langdet' . PATH_SEPARATOR
|
|
|
|
. '.' );
|
2014-11-08 00:07:21 +01:00
|
|
|
|
|
|
|
|
2015-12-24 01:31:17 +01:00
|
|
|
$this->scheme = 'http';
|
2016-02-09 11:04:48 +01:00
|
|
|
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?
|
|
|
|
|