Issue 8254: Length restriction for "title" and "uri"
[friendica.git/.git] / boot.php
index 0835f7f..33cdafc 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1,11 +1,21 @@
 <?php
 /**
- * @file boot.php
- * This file defines some global constants and includes the central App class.
- */
-
-/**
- * Friendica
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  *
  * Friendica is a communications platform for integrated social communications
  * utilising decentralised communications and linkage to several indie social
  * easily as email does today.
  */
 
-use Friendica\Core\Config;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
+use Friendica\Model\Notify;
 use Friendica\Model\Term;
 use Friendica\Util\BasePath;
 use Friendica\Util\DateTimeFormat;
 
 define('FRIENDICA_PLATFORM',     'Friendica');
 define('FRIENDICA_CODENAME',     'Dalmatian Bellflower');
-define('FRIENDICA_VERSION',      '2020.03-dev');
+define('FRIENDICA_VERSION',      '2020.03-rc');
 define('DFRN_PROTOCOL_VERSION',  '2.23');
 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
 
@@ -141,21 +151,31 @@ define('MAX_LIKERS',    75);
  * Email notification options
  * @{
  */
-define('NOTIFY_INTRO',        1);
-define('NOTIFY_CONFIRM',      2);
-define('NOTIFY_WALL',         4);
-define('NOTIFY_COMMENT',      8);
-define('NOTIFY_MAIL',        16);
-define('NOTIFY_SUGGEST',     32);
-define('NOTIFY_PROFILE',     64);
-define('NOTIFY_TAGSELF',    128);
-define('NOTIFY_TAGSHARE',   256);
-define('NOTIFY_POKE',       512);
-define('NOTIFY_SHARE',     1024);
-
-define('SYSTEM_EMAIL',    16384);
-
-define('NOTIFY_SYSTEM',   32768);
+/** @deprecated since 2020.03, use Notify\Type::INTRO instead */
+define('NOTIFY_INTRO',        Notify\Type::INTRO);
+/** @deprecated since 2020.03, use Notify\Type::CONFIRM instead */
+define('NOTIFY_CONFIRM',      Notify\Type::CONFIRM);
+/** @deprecated since 2020.03, use Notify\Type::WALL instead */
+define('NOTIFY_WALL',         Notify\Type::WALL);
+/** @deprecated since 2020.03, use Notify\Type::COMMENT instead */
+define('NOTIFY_COMMENT',      Notify\Type::COMMENT);
+/** @deprecated since 2020.03, use Notify\Type::MAIL instead */
+define('NOTIFY_MAIL',        Notify\Type::MAIL);
+/** @deprecated since 2020.03, use Notify\Type::SUGGEST instead */
+define('NOTIFY_SUGGEST',     Notify\Type::SUGGEST);
+/** @deprecated since 2020.03, use Notify\Type::PROFILE instead */
+define('NOTIFY_PROFILE',     Notify\Type::PROFILE);
+/** @deprecated since 2020.03, use Notify\Type::TAG_SELF instead */
+define('NOTIFY_TAGSELF',     Notify\Type::TAG_SELF);
+/** @deprecated since 2020.03, use Notify\Type::TAG_SHARE instead */
+define('NOTIFY_TAGSHARE',    Notify\Type::TAG_SHARE);
+/** @deprecated since 2020.03, use Notify\Type::POKE instead */
+define('NOTIFY_POKE',        Notify\Type::POKE);
+/** @deprecated since 2020.03, use Notify\Type::SHARE instead */
+define('NOTIFY_SHARE',       Notify\Type::SHARE);
+
+/** @deprecated since 2020.12, use Notify\Type::SYSTEM instead */
+define('NOTIFY_SYSTEM',      Notify\Type::SYSTEM);
 /* @}*/
 
 
@@ -320,10 +340,6 @@ function info($s)
 {
        $a = DI::app();
 
-       if (local_user() && DI::pConfig()->get(local_user(), 'system', 'ignore_info')) {
-               return;
-       }
-
        if (empty($_SESSION['sysmsg_info'])) {
                $_SESSION['sysmsg_info'] = [];
        }
@@ -356,7 +372,7 @@ function feed_birthday($uid, $tz)
                $tz = 'UTC';
        }
 
-       $profile = DBA::selectFirst('profile', ['dob'], ['is-default' => true, 'uid' => $uid]);
+       $profile = DBA::selectFirst('profile', ['dob'], ['uid' => $uid]);
        if (DBA::isResult($profile)) {
                $tmp_dob = substr($profile['dob'], 5);
                if (intval($tmp_dob)) {
@@ -383,7 +399,7 @@ function is_site_admin()
 {
        $a = DI::app();
 
-       $admin_email = Config::get('config', 'admin_email');
+       $admin_email = DI::config()->get('config', 'admin_email');
 
        $adminlist = explode(',', str_replace(' ', '', $admin_email));
 
@@ -446,7 +462,7 @@ function curPageURL()
 
 function get_temppath()
 {
-       $temppath = Config::get("system", "temppath");
+       $temppath = DI::config()->get("system", "temppath");
 
        if (($temppath != "") && System::isDirectoryUsable($temppath)) {
                // We have a temp path and it is usable
@@ -470,7 +486,7 @@ function get_temppath()
 
                if (System::isDirectoryUsable($new_temppath)) {
                        // The new path is usable, we are happy
-                       Config::set("system", "temppath", $new_temppath);
+                       DI::config()->set("system", "temppath", $new_temppath);
                        return $new_temppath;
                } else {
                        // We can't create a subdirectory, strange.
@@ -520,7 +536,7 @@ function clear_cache($basepath = "", $path = "")
                return;
        }
 
-       $cachetime = (int) Config::get('system', 'itemcache_duration');
+       $cachetime = (int) DI::config()->get('system', 'itemcache_duration');
        if ($cachetime == 0) {
                $cachetime = 86400;
        }
@@ -544,12 +560,12 @@ function clear_cache($basepath = "", $path = "")
 function get_itemcachepath()
 {
        // Checking, if the cache is deactivated
-       $cachetime = (int) Config::get('system', 'itemcache_duration');
+       $cachetime = (int) DI::config()->get('system', 'itemcache_duration');
        if ($cachetime < 0) {
                return "";
        }
 
-       $itemcache = Config::get('system', 'itemcache');
+       $itemcache = DI::config()->get('system', 'itemcache');
        if (($itemcache != "") && System::isDirectoryUsable($itemcache)) {
                return BasePath::getRealPath($itemcache);
        }
@@ -563,7 +579,7 @@ function get_itemcachepath()
                }
 
                if (System::isDirectoryUsable($itemcache)) {
-                       Config::set("system", "itemcache", $itemcache);
+                       DI::config()->set("system", "itemcache", $itemcache);
                        return $itemcache;
                }
        }
@@ -577,7 +593,7 @@ function get_itemcachepath()
  */
 function get_spoolpath()
 {
-       $spoolpath = Config::get('system', 'spoolpath');
+       $spoolpath = DI::config()->get('system', 'spoolpath');
        if (($spoolpath != "") && System::isDirectoryUsable($spoolpath)) {
                // We have a spool path and it is usable
                return $spoolpath;
@@ -595,7 +611,7 @@ function get_spoolpath()
 
                if (System::isDirectoryUsable($spoolpath)) {
                        // The new path is usable, we are happy
-                       Config::set("system", "spoolpath", $spoolpath);
+                       DI::config()->set("system", "spoolpath", $spoolpath);
                        return $spoolpath;
                } else {
                        // We can't create a subdirectory, strange.