<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
-use Friendica\Model\Notify;
+use Friendica\Model\Notification;
use Friendica\Util\BasePath;
use Friendica\Util\DateTimeFormat;
define('FRIENDICA_PLATFORM', 'Friendica');
-define('FRIENDICA_CODENAME', 'Red Hot Poker');
-define('FRIENDICA_VERSION', '2020.09-1');
+define('FRIENDICA_CODENAME', 'Siberian Iris');
+define('FRIENDICA_VERSION', '2021.09-dev');
define('DFRN_PROTOCOL_VERSION', '2.23');
-define('NEW_UPDATE_ROUTINE_VERSION', 1170);
+define('NEW_TABLE_STRUCTURE_VERSION', 1288);
/**
* Constant with a HTML line break.
define('MAX_LIKERS', 75);
/**
- * @name Notify
+ * @name Notification
*
* Email notification options
* @{
*/
-/** @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);
+/** @deprecated since 2020.03, use Notification\Type::INTRO instead */
+define('NOTIFY_INTRO', Notification\Type::INTRO);
+/** @deprecated since 2020.03, use Notification\Type::CONFIRM instead */
+define('NOTIFY_CONFIRM', Notification\Type::CONFIRM);
+/** @deprecated since 2020.03, use Notification\Type::WALL instead */
+define('NOTIFY_WALL', Notification\Type::WALL);
+/** @deprecated since 2020.03, use Notification\Type::COMMENT instead */
+define('NOTIFY_COMMENT', Notification\Type::COMMENT);
+/** @deprecated since 2020.03, use Notification\Type::MAIL instead */
+define('NOTIFY_MAIL', Notification\Type::MAIL);
+/** @deprecated since 2020.03, use Notification\Type::SUGGEST instead */
+define('NOTIFY_SUGGEST', Notification\Type::SUGGEST);
+/** @deprecated since 2020.03, use Notification\Type::PROFILE instead */
+define('NOTIFY_PROFILE', Notification\Type::PROFILE);
+/** @deprecated since 2020.03, use Notification\Type::TAG_SELF instead */
+define('NOTIFY_TAGSELF', Notification\Type::TAG_SELF);
+/** @deprecated since 2020.03, use Notification\Type::TAG_SHARE instead */
+define('NOTIFY_TAGSHARE', Notification\Type::TAG_SHARE);
+/** @deprecated since 2020.03, use Notification\Type::POKE instead */
+define('NOTIFY_POKE', Notification\Type::POKE);
+/** @deprecated since 2020.03, use Notification\Type::SHARE instead */
+define('NOTIFY_SHARE', Notification\Type::SHARE);
+
+/** @deprecated since 2020.12, use Notification\Type::SYSTEM instead */
+define('NOTIFY_SYSTEM', Notification\Type::SYSTEM);
/* @}*/
/**
define('PRIORITY_MEDIUM', 30);
define('PRIORITY_LOW', 40);
define('PRIORITY_NEGLIGIBLE', 50);
+define('PRIORITIES', [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE]);
/* @}*/
/**
return;
}
- $a = DI::app();
if (empty($_SESSION['sysmsg'])) {
$_SESSION['sysmsg'] = [];
}
- if ($a->interactive) {
- $_SESSION['sysmsg'][] = $s;
- }
+
+ $_SESSION['sysmsg'][] = $s;
}
/**
*/
function info($s)
{
- $a = DI::app();
+ if (empty($_SESSION)) {
+ return;
+ }
if (empty($_SESSION['sysmsg_info'])) {
$_SESSION['sysmsg_info'] = [];
}
- if ($a->interactive) {
- $_SESSION['sysmsg_info'][] = $s;
- }
+
+ $_SESSION['sysmsg_info'][] = $s;
}
function feed_birthday($uid, $tz)
$adminlist = explode(',', str_replace(' ', '', $admin_email));
- return local_user() && $admin_email && in_array($a->user['email'] ?? '', $adminlist);
+ return local_user() && $admin_email && DBA::exists('user', ['uid' => $a->getLoggedInUserId(), 'email' => $adminlist]);
}
/**
return '';
}
-function get_cachefile($file, $writemode = true)
-{
- $cache = get_itemcachepath();
-
- if ((!$cache) || (!is_dir($cache))) {
- return "";
- }
-
- $subfolder = $cache . "/" . substr($file, 0, 2);
-
- $cachepath = $subfolder . "/" . $file;
-
- if ($writemode) {
- if (!is_dir($subfolder)) {
- mkdir($subfolder);
- chmod($subfolder, 0777);
- }
- }
-
- return $cachepath;
-}
-
-function clear_cache($basepath = "", $path = "")
-{
- if ($path == "") {
- $basepath = get_itemcachepath();
- $path = $basepath;
- }
-
- if (($path == "") || (!is_dir($path))) {
- return;
- }
-
- if (substr(realpath($path), 0, strlen($basepath)) != $basepath) {
- return;
- }
-
- $cachetime = (int) DI::config()->get('system', 'itemcache_duration');
- if ($cachetime == 0) {
- $cachetime = 86400;
- }
-
- if (is_writable($path)) {
- if ($dh = opendir($path)) {
- while (($file = readdir($dh)) !== false) {
- $fullpath = $path . "/" . $file;
- if ((filetype($fullpath) == "dir") && ($file != ".") && ($file != "..")) {
- clear_cache($basepath, $fullpath);
- }
- if ((filetype($fullpath) == "file") && (filectime($fullpath) < (time() - $cachetime))) {
- unlink($fullpath);
- }
- }
- closedir($dh);
- }
- }
-}
-
-function get_itemcachepath()
-{
- // Checking, if the cache is deactivated
- $cachetime = (int) DI::config()->get('system', 'itemcache_duration');
- if ($cachetime < 0) {
- return "";
- }
-
- $itemcache = DI::config()->get('system', 'itemcache');
- if (($itemcache != "") && System::isDirectoryUsable($itemcache)) {
- return BasePath::getRealPath($itemcache);
- }
-
- $temppath = get_temppath();
-
- if ($temppath != "") {
- $itemcache = $temppath . "/itemcache";
- if (!file_exists($itemcache) && !is_dir($itemcache)) {
- mkdir($itemcache);
- }
-
- if (System::isDirectoryUsable($itemcache)) {
- DI::config()->set("system", "itemcache", $itemcache);
- return $itemcache;
- }
- }
- return "";
-}
-
/**
* Returns the path where spool files are stored
*