mirror of
https://github.com/friendica/friendica
synced 2024-11-10 02:22:55 +00:00
The boot.php had been cleared of most functions
This commit is contained in:
parent
4989d1fa99
commit
63da4a75e9
37 changed files with 279 additions and 401 deletions
335
boot.php
335
boot.php
|
@ -27,14 +27,7 @@
|
||||||
* easily as email does today.
|
* easily as email does today.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Protocol;
|
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\Database\DBA;
|
|
||||||
use Friendica\DI;
|
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Notification;
|
|
||||||
use Friendica\Util\BasePath;
|
|
||||||
use Friendica\Util\DateTimeFormat;
|
|
||||||
|
|
||||||
define('FRIENDICA_PLATFORM', 'Friendica');
|
define('FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define('FRIENDICA_CODENAME', 'Siberian Iris');
|
define('FRIENDICA_CODENAME', 'Siberian Iris');
|
||||||
|
@ -51,51 +44,6 @@ define('NEW_TABLE_STRUCTURE_VERSION', 1288);
|
||||||
*/
|
*/
|
||||||
define('EOL', "<br />\r\n");
|
define('EOL', "<br />\r\n");
|
||||||
|
|
||||||
/**
|
|
||||||
* Image storage quality.
|
|
||||||
*
|
|
||||||
* Lower numbers save space at cost of image detail.
|
|
||||||
* For ease of upgrade, please do not change here. Set system.jpegquality = n in config/local.config.php,
|
|
||||||
* where n is between 1 and 100, and with very poor results below about 50
|
|
||||||
*/
|
|
||||||
define('JPEG_QUALITY', 100);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* system.png_quality = n where is between 0 (uncompressed) to 9
|
|
||||||
*/
|
|
||||||
define('PNG_QUALITY', 8);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* 'system' => [
|
|
||||||
* 'max_image_length' => 'n',
|
|
||||||
* ...
|
|
||||||
* ],
|
|
||||||
*
|
|
||||||
* in config/local.config.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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Not yet used
|
|
||||||
*/
|
|
||||||
define('DEFAULT_DB_ENGINE', 'InnoDB');
|
|
||||||
|
|
||||||
/** @deprecated since version 2019.03, please use \Friendica\Module\Register::CLOSED instead */
|
|
||||||
define('REGISTER_CLOSED', \Friendica\Module\Register::CLOSED);
|
|
||||||
/** @deprecated since version 2019.03, please use \Friendica\Module\Register::APPROVE instead */
|
|
||||||
define('REGISTER_APPROVE', \Friendica\Module\Register::APPROVE);
|
|
||||||
/** @deprecated since version 2019.03, please use \Friendica\Module\Register::OPEN instead */
|
|
||||||
define('REGISTER_OPEN', \Friendica\Module\Register::OPEN);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name CP
|
* @name CP
|
||||||
*
|
*
|
||||||
|
@ -111,72 +59,6 @@ define('CP_USERS_AND_GLOBAL', 2);
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 = [
|
|
||||||
Protocol::DFRN => (-1),
|
|
||||||
Protocol::ZOT => (-2),
|
|
||||||
Protocol::OSTATUS => (-3),
|
|
||||||
Protocol::FEED => (-4),
|
|
||||||
Protocol::DIASPORA => (-5),
|
|
||||||
Protocol::MAIL => (-6),
|
|
||||||
Protocol::FACEBOOK => (-8),
|
|
||||||
Protocol::LINKEDIN => (-9),
|
|
||||||
Protocol::XMPP => (-10),
|
|
||||||
Protocol::MYSPACE => (-11),
|
|
||||||
Protocol::GPLUS => (-12),
|
|
||||||
Protocol::PUMPIO => (-13),
|
|
||||||
Protocol::TWITTER => (-14),
|
|
||||||
Protocol::DIASPORA2 => (-15),
|
|
||||||
Protocol::STATUSNET => (-16),
|
|
||||||
Protocol::NEWS => (-18),
|
|
||||||
Protocol::ICALENDAR => (-19),
|
|
||||||
Protocol::PNUT => (-20),
|
|
||||||
|
|
||||||
Protocol::PHANTOM => (-127),
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum number of "people who like (or don't like) this" that we will list by name
|
|
||||||
*/
|
|
||||||
define('MAX_LIKERS', 75);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Notification
|
|
||||||
*
|
|
||||||
* Email notification options
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/** @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);
|
|
||||||
/* @}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Gravity
|
* @name Gravity
|
||||||
*
|
*
|
||||||
|
@ -204,18 +86,6 @@ define('PRIORITY_NEGLIGIBLE', 50);
|
||||||
define('PRIORITIES', [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE]);
|
define('PRIORITIES', [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE]);
|
||||||
/* @}*/
|
/* @}*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Social Relay settings
|
|
||||||
*
|
|
||||||
* See here: https://github.com/jaywink/social-relay
|
|
||||||
* and here: https://wiki.diasporafoundation.org/Relay_servers_for_public_posts
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
define('SR_SCOPE_NONE', '');
|
|
||||||
define('SR_SCOPE_ALL', 'all');
|
|
||||||
define('SR_SCOPE_TAGS', 'tags');
|
|
||||||
/* @}*/
|
|
||||||
|
|
||||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||||
if (!defined("SIGTERM")) {
|
if (!defined("SIGTERM")) {
|
||||||
define("SIGTERM", 15);
|
define("SIGTERM", 15);
|
||||||
|
@ -229,6 +99,14 @@ if (!defined('CURLE_OPERATION_TIMEDOUT')) {
|
||||||
define('CURLE_OPERATION_TIMEDOUT', CURLE_OPERATION_TIMEOUTED);
|
define('CURLE_OPERATION_TIMEDOUT', CURLE_OPERATION_TIMEOUTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('exif_imagetype')) {
|
||||||
|
function exif_imagetype($file)
|
||||||
|
{
|
||||||
|
$size = getimagesize($file);
|
||||||
|
return $size[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the user id of locally logged in user or false.
|
* Returns the user id of locally logged in user or false.
|
||||||
*
|
*
|
||||||
|
@ -323,200 +201,3 @@ function info($s)
|
||||||
|
|
||||||
$_SESSION['sysmsg_info'][] = $s;
|
$_SESSION['sysmsg_info'][] = $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
function feed_birthday($uid, $tz)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine the next birthday, but only if the birthday is published
|
|
||||||
* in the default profile. We _could_ also look for a private profile that the
|
|
||||||
* recipient can see, but somebody could get mad at us if they start getting
|
|
||||||
* public birthday greetings when they haven't made this info public.
|
|
||||||
*
|
|
||||||
* Assuming we are able to publish this info, we are then going to convert
|
|
||||||
* the start time from the owner's timezone to UTC.
|
|
||||||
*
|
|
||||||
* This will potentially solve the problem found with some social networks
|
|
||||||
* where birthdays are converted to the viewer's timezone and salutations from
|
|
||||||
* elsewhere in the world show up on the wrong day. We will convert it to the
|
|
||||||
* viewer's timezone also, but first we are going to convert it from the birthday
|
|
||||||
* person's timezone to GMT - so the viewer may find the birthday starting at
|
|
||||||
* 6:00PM the day before, but that will correspond to midnight to the birthday person.
|
|
||||||
*/
|
|
||||||
$birthday = '';
|
|
||||||
|
|
||||||
if (!strlen($tz)) {
|
|
||||||
$tz = 'UTC';
|
|
||||||
}
|
|
||||||
|
|
||||||
$profile = DBA::selectFirst('profile', ['dob'], ['uid' => $uid]);
|
|
||||||
if (DBA::isResult($profile)) {
|
|
||||||
$tmp_dob = substr($profile['dob'], 5);
|
|
||||||
if (intval($tmp_dob)) {
|
|
||||||
$y = DateTimeFormat::timezoneNow($tz, 'Y');
|
|
||||||
$bd = $y . '-' . $tmp_dob . ' 00:00';
|
|
||||||
$t_dob = strtotime($bd);
|
|
||||||
$now = strtotime(DateTimeFormat::timezoneNow($tz));
|
|
||||||
if ($t_dob < $now) {
|
|
||||||
$bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
|
|
||||||
}
|
|
||||||
$birthday = DateTimeFormat::convert($bd, 'UTC', $tz, DateTimeFormat::ATOM);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $birthday;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if current user has admin role.
|
|
||||||
*
|
|
||||||
* @return bool true if user is an admin
|
|
||||||
*/
|
|
||||||
function is_site_admin()
|
|
||||||
{
|
|
||||||
$a = DI::app();
|
|
||||||
|
|
||||||
$admin_email = DI::config()->get('config', 'admin_email');
|
|
||||||
|
|
||||||
$adminlist = explode(',', str_replace(' ', '', $admin_email));
|
|
||||||
|
|
||||||
return local_user() && $admin_email && DBA::exists('user', ['uid' => $a->getLoggedInUserId(), 'email' => $adminlist]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 (!empty($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) {
|
|
||||||
$pageURL .= "s";
|
|
||||||
}
|
|
||||||
|
|
||||||
$pageURL .= "://";
|
|
||||||
|
|
||||||
if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
|
|
||||||
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
|
||||||
} else {
|
|
||||||
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
|
||||||
}
|
|
||||||
return $pageURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_temppath()
|
|
||||||
{
|
|
||||||
$temppath = DI::config()->get("system", "temppath");
|
|
||||||
|
|
||||||
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
|
|
||||||
// We have a temp path and it is usable
|
|
||||||
return BasePath::getRealPath($temppath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't have a working preconfigured temp path, so we take the system path.
|
|
||||||
$temppath = sys_get_temp_dir();
|
|
||||||
|
|
||||||
// Check if it is usable
|
|
||||||
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
|
|
||||||
// Always store the real path, not the path through symlinks
|
|
||||||
$temppath = BasePath::getRealPath($temppath);
|
|
||||||
|
|
||||||
// To avoid any interferences with other systems we create our own directory
|
|
||||||
$new_temppath = $temppath . "/" . DI::baseUrl()->getHostname();
|
|
||||||
if (!is_dir($new_temppath)) {
|
|
||||||
/// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
|
|
||||||
mkdir($new_temppath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System::isDirectoryUsable($new_temppath)) {
|
|
||||||
// The new path is usable, we are happy
|
|
||||||
DI::config()->set("system", "temppath", $new_temppath);
|
|
||||||
return $new_temppath;
|
|
||||||
} else {
|
|
||||||
// We can't create a subdirectory, strange.
|
|
||||||
// But the directory seems to work, so we use it but don't store it.
|
|
||||||
return $temppath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reaching this point means that the operating system is configured badly.
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the path where spool files are stored
|
|
||||||
*
|
|
||||||
* @return string Spool path
|
|
||||||
*/
|
|
||||||
function get_spoolpath()
|
|
||||||
{
|
|
||||||
$spoolpath = DI::config()->get('system', 'spoolpath');
|
|
||||||
if (($spoolpath != "") && System::isDirectoryUsable($spoolpath)) {
|
|
||||||
// We have a spool path and it is usable
|
|
||||||
return $spoolpath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't have a working preconfigured spool path, so we take the temp path.
|
|
||||||
$temppath = get_temppath();
|
|
||||||
|
|
||||||
if ($temppath != "") {
|
|
||||||
// To avoid any interferences with other systems we create our own directory
|
|
||||||
$spoolpath = $temppath . "/spool";
|
|
||||||
if (!is_dir($spoolpath)) {
|
|
||||||
mkdir($spoolpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System::isDirectoryUsable($spoolpath)) {
|
|
||||||
// The new path is usable, we are happy
|
|
||||||
DI::config()->set("system", "spoolpath", $spoolpath);
|
|
||||||
return $spoolpath;
|
|
||||||
} else {
|
|
||||||
// We can't create a subdirectory, strange.
|
|
||||||
// But the directory seems to work, so we use it but don't store it.
|
|
||||||
return $temppath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reaching this point means that the operating system is configured badly.
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('exif_imagetype')) {
|
|
||||||
function exif_imagetype($file)
|
|
||||||
{
|
|
||||||
$size = getimagesize($file);
|
|
||||||
return $size[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validate_include(&$file)
|
|
||||||
{
|
|
||||||
$orig_file = $file;
|
|
||||||
|
|
||||||
$file = realpath($file);
|
|
||||||
|
|
||||||
if (strpos($file, getcwd()) !== 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$file = str_replace(getcwd() . "/", "", $file, $count);
|
|
||||||
if ($count != 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($orig_file !== $file) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$valid = false;
|
|
||||||
if (strpos($file, "include/") === 0) {
|
|
||||||
$valid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strpos($file, "addon/") === 0) {
|
|
||||||
$valid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simply return flag
|
|
||||||
return $valid;
|
|
||||||
}
|
|
||||||
|
|
|
@ -4604,9 +4604,6 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
|
|
||||||
// check max length of images on server
|
// check max length of images on server
|
||||||
$max_length = DI::config()->get('system', 'max_image_length');
|
$max_length = DI::config()->get('system', 'max_image_length');
|
||||||
if (!$max_length) {
|
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
|
||||||
}
|
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$Image->scaleDown($max_length);
|
$Image->scaleDown($max_length);
|
||||||
logger::info("File upload: Scaling picture to new size " . $max_length);
|
logger::info("File upload: Scaling picture to new size " . $max_length);
|
||||||
|
|
|
@ -703,9 +703,6 @@ function photos_post(App $a)
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
|
||||||
$max_length = DI::config()->get('system', 'max_image_length');
|
$max_length = DI::config()->get('system', 'max_image_length');
|
||||||
if (!$max_length) {
|
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
|
||||||
}
|
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$image->scaleDown($max_length);
|
$image->scaleDown($max_length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ function ping_init(App $a)
|
||||||
$myurl = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname();
|
$myurl = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname();
|
||||||
$mail_count = DBA::count('mail', ["`uid` = ? AND NOT `seen` AND `from-url` != ?", local_user(), $myurl]);
|
$mail_count = DBA::count('mail', ["`uid` = ? AND NOT `seen` AND `from-url` != ?", local_user(), $myurl]);
|
||||||
|
|
||||||
if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::APPROVE && is_site_admin()) {
|
if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::APPROVE && $a->isSiteAdmin()) {
|
||||||
$regs = Friendica\Model\Register::getPending();
|
$regs = Friendica\Model\Register::getPending();
|
||||||
|
|
||||||
if (DBA::isResult($regs)) {
|
if (DBA::isResult($regs)) {
|
||||||
|
|
|
@ -492,7 +492,7 @@ function settings_content(App $a)
|
||||||
$settings_connectors = '';
|
$settings_connectors = '';
|
||||||
Hook::callAll('connector_settings', $settings_connectors);
|
Hook::callAll('connector_settings', $settings_connectors);
|
||||||
|
|
||||||
if (is_site_admin()) {
|
if ($a->isSiteAdmin()) {
|
||||||
$diasp_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('Diaspora (Socialhome, Hubzilla)'), ((DI::config()->get('system', 'diaspora_enabled')) ? DI::l10n()->t('enabled') : DI::l10n()->t('disabled')));
|
$diasp_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('Diaspora (Socialhome, Hubzilla)'), ((DI::config()->get('system', 'diaspora_enabled')) ? DI::l10n()->t('enabled') : DI::l10n()->t('disabled')));
|
||||||
$ostat_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('OStatus (GNU Social)'), ((DI::config()->get('system', 'ostatus_disabled')) ? DI::l10n()->t('disabled') : DI::l10n()->t('enabled')));
|
$ostat_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('OStatus (GNU Social)'), ((DI::config()->get('system', 'ostatus_disabled')) ? DI::l10n()->t('disabled') : DI::l10n()->t('enabled')));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,7 +29,7 @@ use Friendica\DI;
|
||||||
|
|
||||||
function uimport_post(App $a)
|
function uimport_post(App $a)
|
||||||
{
|
{
|
||||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !is_site_admin()) {
|
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
notice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ function uimport_post(App $a)
|
||||||
|
|
||||||
function uimport_content(App $a)
|
function uimport_content(App $a)
|
||||||
{
|
{
|
||||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !is_site_admin()) {
|
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
|
||||||
notice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
|
notice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,9 +177,6 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
|
||||||
$max_length = DI::config()->get('system', 'max_image_length');
|
$max_length = DI::config()->get('system', 'max_image_length');
|
||||||
if (!$max_length) {
|
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
|
||||||
}
|
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$Image->scaleDown($max_length);
|
$Image->scaleDown($max_length);
|
||||||
$filesize = strlen($Image->asString());
|
$filesize = strlen($Image->asString());
|
||||||
|
|
14
src/App.php
14
src/App.php
|
@ -154,6 +154,20 @@ class App
|
||||||
return local_user() && $this->user_id && ($this->user_id == local_user());
|
return local_user() && $this->user_id && ($this->user_id == local_user());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if current user has admin role.
|
||||||
|
*
|
||||||
|
* @return bool true if user is an admin
|
||||||
|
*/
|
||||||
|
public function isSiteAdmin()
|
||||||
|
{
|
||||||
|
$admin_email = $this->config->get('config', 'admin_email');
|
||||||
|
|
||||||
|
$adminlist = explode(',', str_replace(' ', '', $admin_email));
|
||||||
|
|
||||||
|
return local_user() && $admin_email && $this->database->exists('user', ['uid' => $this->getLoggedInUserId(), 'email' => $adminlist]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the user id
|
* Fetch the user id
|
||||||
* @return int
|
* @return int
|
||||||
|
|
|
@ -257,6 +257,28 @@ class Page implements ArrayAccess
|
||||||
]) . $this->page['htmlhead'];
|
]) . $this->page['htmlhead'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
private function curPageURL()
|
||||||
|
{
|
||||||
|
$pageURL = 'http';
|
||||||
|
if (!empty($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) {
|
||||||
|
$pageURL .= "s";
|
||||||
|
}
|
||||||
|
|
||||||
|
$pageURL .= "://";
|
||||||
|
|
||||||
|
if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
|
||||||
|
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
||||||
|
} else {
|
||||||
|
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
||||||
|
}
|
||||||
|
return $pageURL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes Page->page['footer'].
|
* Initializes Page->page['footer'].
|
||||||
*
|
*
|
||||||
|
@ -290,9 +312,9 @@ class Page implements ArrayAccess
|
||||||
*/
|
*/
|
||||||
if ($mode->isMobile() || $mode->isTablet()) {
|
if ($mode->isMobile() || $mode->isTablet()) {
|
||||||
if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
|
if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
|
||||||
$link = 'toggle_mobile?address=' . urlencode(curPageURL());
|
$link = 'toggle_mobile?address=' . urlencode($this->curPageURL());
|
||||||
} else {
|
} else {
|
||||||
$link = 'toggle_mobile?off=1&address=' . urlencode(curPageURL());
|
$link = 'toggle_mobile?off=1&address=' . urlencode($this->curPageURL());
|
||||||
}
|
}
|
||||||
$this->page['footer'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate("toggle_mobile_footer.tpl"), [
|
$this->page['footer'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate("toggle_mobile_footer.tpl"), [
|
||||||
'$toggle_link' => $link,
|
'$toggle_link' => $link,
|
||||||
|
|
|
@ -223,12 +223,12 @@ class Conversation
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($total > 1) {
|
} elseif ($total > 1) {
|
||||||
if ($total < MAX_LIKERS) {
|
if ($total < $this->config->get('system', 'max_likers')) {
|
||||||
$likers = implode(', ', array_slice($links, 0, -1));
|
$likers = implode(', ', array_slice($links, 0, -1));
|
||||||
$likers .= ' ' . $this->l10n->t('and') . ' ' . $links[count($links) - 1];
|
$likers .= ' ' . $this->l10n->t('and') . ' ' . $links[count($links) - 1];
|
||||||
} else {
|
} else {
|
||||||
$likers = implode(', ', array_slice($links, 0, MAX_LIKERS - 1));
|
$likers = implode(', ', array_slice($links, 0, $this->config->get('system', 'max_likers') - 1));
|
||||||
$likers .= ' ' . $this->l10n->t('and %d other people', $total - MAX_LIKERS);
|
$likers .= ' ' . $this->l10n->t('and %d other people', $total - $this->config->get('system', 'max_likers'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$spanatts = "class=\"fakelink\" onclick=\"openClose('{$verb}list-$id');\"";
|
$spanatts = "class=\"fakelink\" onclick=\"openClose('{$verb}list-$id');\"";
|
||||||
|
|
|
@ -295,7 +295,7 @@ class Nav
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the link to the admin configuration page if user is admin
|
// Show the link to the admin configuration page if user is admin
|
||||||
if (is_site_admin()) {
|
if ($a->isSiteAdmin()) {
|
||||||
$nav['admin'] = ['admin/', DI::l10n()->t('Admin'), '', DI::l10n()->t('Site setup and configuration')];
|
$nav['admin'] = ['admin/', DI::l10n()->t('Admin'), '', DI::l10n()->t('Site setup and configuration')];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Widget
|
||||||
|
|
||||||
if (DI::config()->get('system', 'invitation_only')) {
|
if (DI::config()->get('system', 'invitation_only')) {
|
||||||
$x = intval(DI::pConfig()->get(local_user(), 'system', 'invites_remaining'));
|
$x = intval(DI::pConfig()->get(local_user(), 'system', 'invites_remaining'));
|
||||||
if ($x || is_site_admin()) {
|
if ($x || DI::app()->isSiteAdmin()) {
|
||||||
DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
|
DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
|
||||||
. DI::l10n()->tt('%d invitation available', '%d invitations available', $x)
|
. DI::l10n()->tt('%d invitation available', '%d invitations available', $x)
|
||||||
. '</div>';
|
. '</div>';
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Friendica\Core\Lock\Type;
|
||||||
use Friendica\Core\Cache\Enum\Duration;
|
use Friendica\Core\Cache\Enum\Duration;
|
||||||
use Friendica\Core\Lock\Enum\Type;
|
use Friendica\Core\Lock\Enum\Type;
|
||||||
use Friendica\Core\Lock\Exception\InvalidLockDriverException;
|
use Friendica\Core\Lock\Exception\InvalidLockDriverException;
|
||||||
use function get_temppath;
|
use Friendica\Core\System;
|
||||||
|
|
||||||
class SemaphoreLock extends AbstractLock
|
class SemaphoreLock extends AbstractLock
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ class SemaphoreLock extends AbstractLock
|
||||||
{
|
{
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
$temp = get_temppath();
|
$temp = System::getTempPath();
|
||||||
|
|
||||||
$file = $temp . '/' . $key . '.sem';
|
$file = $temp . '/' . $key . '.sem';
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Renderer
|
||||||
$output = $t->replaceMacros($template, $vars);
|
$output = $t->replaceMacros($template, $vars);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
DI::logger()->critical($e->getMessage(), ['template' => $template, 'vars' => $vars]);
|
DI::logger()->critical($e->getMessage(), ['template' => $template, 'vars' => $vars]);
|
||||||
$message = is_site_admin() ?
|
$message = DI::app()->isSiteAdmin() ?
|
||||||
$e->getMessage() :
|
$e->getMessage() :
|
||||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
throw new ServiceUnavailableException($message);
|
throw new ServiceUnavailableException($message);
|
||||||
|
@ -113,7 +113,7 @@ class Renderer
|
||||||
$template = $t->getTemplateFile($file, $subDir);
|
$template = $t->getTemplateFile($file, $subDir);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
DI::logger()->critical($e->getMessage(), ['file' => $file, 'subDir' => $subDir]);
|
DI::logger()->critical($e->getMessage(), ['file' => $file, 'subDir' => $subDir]);
|
||||||
$message = is_site_admin() ?
|
$message = DI::app()->isSiteAdmin() ?
|
||||||
$e->getMessage() :
|
$e->getMessage() :
|
||||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
throw new ServiceUnavailableException($message);
|
throw new ServiceUnavailableException($message);
|
||||||
|
@ -140,7 +140,7 @@ class Renderer
|
||||||
} else {
|
} else {
|
||||||
$admin_message = DI::l10n()->t('template engine cannot be registered without a name.');
|
$admin_message = DI::l10n()->t('template engine cannot be registered without a name.');
|
||||||
DI::logger()->critical($admin_message, ['class' => $class]);
|
DI::logger()->critical($admin_message, ['class' => $class]);
|
||||||
$message = is_site_admin() ?
|
$message = DI::app()->isSiteAdmin() ?
|
||||||
$admin_message :
|
$admin_message :
|
||||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
throw new ServiceUnavailableException($message);
|
throw new ServiceUnavailableException($message);
|
||||||
|
@ -174,7 +174,7 @@ class Renderer
|
||||||
|
|
||||||
$admin_message = DI::l10n()->t('template engine is not registered!');
|
$admin_message = DI::l10n()->t('template engine is not registered!');
|
||||||
DI::logger()->critical($admin_message, ['template_engine' => $template_engine]);
|
DI::logger()->critical($admin_message, ['template_engine' => $template_engine]);
|
||||||
$message = is_site_admin() ?
|
$message = DI::app()->isSiteAdmin() ?
|
||||||
$admin_message :
|
$admin_message :
|
||||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
throw new ServiceUnavailableException($message);
|
throw new ServiceUnavailableException($message);
|
||||||
|
|
|
@ -21,10 +21,12 @@
|
||||||
|
|
||||||
namespace Friendica\Core;
|
namespace Friendica\Core;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPException\FoundException;
|
use Friendica\Network\HTTPException\FoundException;
|
||||||
use Friendica\Network\HTTPException\MovedPermanentlyException;
|
use Friendica\Network\HTTPException\MovedPermanentlyException;
|
||||||
use Friendica\Network\HTTPException\TemporaryRedirectException;
|
use Friendica\Network\HTTPException\TemporaryRedirectException;
|
||||||
|
use Friendica\Util\BasePath;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -323,6 +325,88 @@ class System
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the temp path of the system
|
||||||
|
*
|
||||||
|
* @return string Path for temp files
|
||||||
|
*/
|
||||||
|
public static function getTempPath()
|
||||||
|
{
|
||||||
|
$temppath = DI::config()->get("system", "temppath");
|
||||||
|
|
||||||
|
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
|
||||||
|
// We have a temp path and it is usable
|
||||||
|
return BasePath::getRealPath($temppath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't have a working preconfigured temp path, so we take the system path.
|
||||||
|
$temppath = sys_get_temp_dir();
|
||||||
|
|
||||||
|
// Check if it is usable
|
||||||
|
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
|
||||||
|
// Always store the real path, not the path through symlinks
|
||||||
|
$temppath = BasePath::getRealPath($temppath);
|
||||||
|
|
||||||
|
// To avoid any interferences with other systems we create our own directory
|
||||||
|
$new_temppath = $temppath . "/" . DI::baseUrl()->getHostname();
|
||||||
|
if (!is_dir($new_temppath)) {
|
||||||
|
/// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
|
||||||
|
mkdir($new_temppath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System::isDirectoryUsable($new_temppath)) {
|
||||||
|
// The new path is usable, we are happy
|
||||||
|
DI::config()->set("system", "temppath", $new_temppath);
|
||||||
|
return $new_temppath;
|
||||||
|
} else {
|
||||||
|
// We can't create a subdirectory, strange.
|
||||||
|
// But the directory seems to work, so we use it but don't store it.
|
||||||
|
return $temppath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reaching this point means that the operating system is configured badly.
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the path where spool files are stored
|
||||||
|
*
|
||||||
|
* @return string Spool path
|
||||||
|
*/
|
||||||
|
public static function getSpoolPath()
|
||||||
|
{
|
||||||
|
$spoolpath = DI::config()->get('system', 'spoolpath');
|
||||||
|
if (($spoolpath != "") && System::isDirectoryUsable($spoolpath)) {
|
||||||
|
// We have a spool path and it is usable
|
||||||
|
return $spoolpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't have a working preconfigured spool path, so we take the temp path.
|
||||||
|
$temppath = self::getTempPath();
|
||||||
|
|
||||||
|
if ($temppath != "") {
|
||||||
|
// To avoid any interferences with other systems we create our own directory
|
||||||
|
$spoolpath = $temppath . "/spool";
|
||||||
|
if (!is_dir($spoolpath)) {
|
||||||
|
mkdir($spoolpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System::isDirectoryUsable($spoolpath)) {
|
||||||
|
// The new path is usable, we are happy
|
||||||
|
DI::config()->set("system", "spoolpath", $spoolpath);
|
||||||
|
return $spoolpath;
|
||||||
|
} else {
|
||||||
|
// We can't create a subdirectory, strange.
|
||||||
|
// But the directory seems to work, so we use it but don't store it.
|
||||||
|
return $temppath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reaching this point means that the operating system is configured badly.
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/// @todo Move the following functions from boot.php
|
/// @todo Move the following functions from boot.php
|
||||||
/*
|
/*
|
||||||
function local_user()
|
function local_user()
|
||||||
|
@ -331,7 +415,5 @@ class System
|
||||||
function notice($s)
|
function notice($s)
|
||||||
function info($s)
|
function info($s)
|
||||||
function is_site_admin()
|
function is_site_admin()
|
||||||
function get_temppath()
|
|
||||||
function get_spoolpath()
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,6 +277,44 @@ class Worker
|
||||||
return DBA::exists('workerqueue', $condition);
|
return DBA::exists('workerqueue', $condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given file is valid to be included
|
||||||
|
*
|
||||||
|
* @param mixed $file
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private static function validateInclude(&$file)
|
||||||
|
{
|
||||||
|
$orig_file = $file;
|
||||||
|
|
||||||
|
$file = realpath($file);
|
||||||
|
|
||||||
|
if (strpos($file, getcwd()) !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = str_replace(getcwd() . "/", "", $file, $count);
|
||||||
|
if ($count != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orig_file !== $file) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$valid = false;
|
||||||
|
if (strpos($file, "include/") === 0) {
|
||||||
|
$valid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($file, "addon/") === 0) {
|
||||||
|
$valid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simply return flag
|
||||||
|
return $valid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a worker entry
|
* Execute a worker entry
|
||||||
*
|
*
|
||||||
|
@ -360,7 +398,7 @@ class Worker
|
||||||
$include = "include/".$include.".php";
|
$include = "include/".$include.".php";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validate_include($include)) {
|
if (!self::validateInclude($include)) {
|
||||||
Logger::warning("Include file is not valid", ['file' => $argv[0]]);
|
Logger::warning("Include file is not valid", ['file' => $argv[0]]);
|
||||||
$stamp = (float)microtime(true);
|
$stamp = (float)microtime(true);
|
||||||
DBA::delete('workerqueue', ['id' => $queue["id"]]);
|
DBA::delete('workerqueue', ['id' => $queue["id"]]);
|
||||||
|
|
|
@ -448,7 +448,7 @@ class Item
|
||||||
// We use "microtime" to keep the arrival order and "mt_rand" to avoid duplicates
|
// We use "microtime" to keep the arrival order and "mt_rand" to avoid duplicates
|
||||||
$file = 'item-' . round(microtime(true) * 10000) . '-' . mt_rand() . '.msg';
|
$file = 'item-' . round(microtime(true) * 10000) . '-' . mt_rand() . '.msg';
|
||||||
|
|
||||||
$spoolpath = get_spoolpath();
|
$spoolpath = System::getSpoolPath();
|
||||||
if ($spoolpath != "") {
|
if ($spoolpath != "") {
|
||||||
$spool = $spoolpath . '/' . $file;
|
$spool = $spoolpath . '/' . $file;
|
||||||
|
|
||||||
|
|
|
@ -951,9 +951,6 @@ class Photo
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
|
||||||
$max_length = DI::config()->get('system', 'max_image_length');
|
$max_length = DI::config()->get('system', 'max_image_length');
|
||||||
if (!$max_length) {
|
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
|
||||||
}
|
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$Image->scaleDown($max_length);
|
$Image->scaleDown($max_length);
|
||||||
$filesize = strlen($Image->asString());
|
$filesize = strlen($Image->asString());
|
||||||
|
|
|
@ -706,7 +706,7 @@ class User
|
||||||
{
|
{
|
||||||
$cache = new CacheItemPool();
|
$cache = new CacheItemPool();
|
||||||
$cache->changeConfig([
|
$cache->changeConfig([
|
||||||
'cacheDirectory' => get_temppath() . '/password-exposed-cache/',
|
'cacheDirectory' => System::getTempPath() . '/password-exposed-cache/',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Module\ActivityPub;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Protocol\ActivityPub;
|
use Friendica\Protocol\ActivityPub;
|
||||||
|
@ -48,7 +49,7 @@ class Inbox extends BaseModule
|
||||||
} else {
|
} else {
|
||||||
$filename = 'failed-activitypub';
|
$filename = 'failed-activitypub';
|
||||||
}
|
}
|
||||||
$tempfile = tempnam(get_temppath(), $filename);
|
$tempfile = tempnam(System::getTempPath(), $filename);
|
||||||
file_put_contents($tempfile, json_encode(['parameters' => $parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
file_put_contents($tempfile, json_encode(['parameters' => $parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||||
Logger::notice('Incoming message stored', ['file' => $tempfile]);
|
Logger::notice('Incoming message stored', ['file' => $tempfile]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace Friendica\Module\Admin;
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Search;
|
use Friendica\Core\Search;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Theme;
|
use Friendica\Core\Theme;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
@ -138,8 +139,8 @@ class Site extends BaseAdmin
|
||||||
$theme = (!empty($_POST['theme']) ? Strings::escapeTags(trim($_POST['theme'])) : '');
|
$theme = (!empty($_POST['theme']) ? Strings::escapeTags(trim($_POST['theme'])) : '');
|
||||||
$theme_mobile = (!empty($_POST['theme_mobile']) ? Strings::escapeTags(trim($_POST['theme_mobile'])) : '');
|
$theme_mobile = (!empty($_POST['theme_mobile']) ? Strings::escapeTags(trim($_POST['theme_mobile'])) : '');
|
||||||
$maximagesize = (!empty($_POST['maximagesize']) ? intval(trim($_POST['maximagesize'])) : 0);
|
$maximagesize = (!empty($_POST['maximagesize']) ? intval(trim($_POST['maximagesize'])) : 0);
|
||||||
$maximagelength = (!empty($_POST['maximagelength']) ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH);
|
$maximagelength = (!empty($_POST['maximagelength']) ? intval(trim($_POST['maximagelength'])) : -1);
|
||||||
$jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY);
|
$jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality'])) : 100);
|
||||||
|
|
||||||
$register_policy = (!empty($_POST['register_policy']) ? intval(trim($_POST['register_policy'])) : 0);
|
$register_policy = (!empty($_POST['register_policy']) ? intval(trim($_POST['register_policy'])) : 0);
|
||||||
$daily_registrations = (!empty($_POST['max_daily_registrations']) ? intval(trim($_POST['max_daily_registrations'])) : 0);
|
$daily_registrations = (!empty($_POST['max_daily_registrations']) ? intval(trim($_POST['max_daily_registrations'])) : 0);
|
||||||
|
@ -463,7 +464,7 @@ class Site extends BaseAdmin
|
||||||
$additional_info = DI::config()->get('config', 'info');
|
$additional_info = DI::config()->get('config', 'info');
|
||||||
|
|
||||||
// Automatically create temporary paths
|
// Automatically create temporary paths
|
||||||
get_temppath();
|
System::getTempPath();
|
||||||
|
|
||||||
/* Register policy */
|
/* Register policy */
|
||||||
$register_choices = [
|
$register_choices = [
|
||||||
|
@ -609,7 +610,7 @@ class Site extends BaseAdmin
|
||||||
'$worker_fastlane' => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],
|
'$worker_fastlane' => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],
|
||||||
|
|
||||||
'$relay_directly' => ['relay_directly', DI::l10n()->t('Direct relay transfer'), DI::config()->get('system', 'relay_directly'), DI::l10n()->t('Enables the direct transfer to other servers without using the relay servers')],
|
'$relay_directly' => ['relay_directly', DI::l10n()->t('Direct relay transfer'), DI::config()->get('system', 'relay_directly'), DI::l10n()->t('Enables the direct transfer to other servers without using the relay servers')],
|
||||||
'$relay_scope' => ['relay_scope', DI::l10n()->t('Relay scope'), DI::config()->get('system', 'relay_scope'), DI::l10n()->t('Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts with selected tags should be received.'), [SR_SCOPE_NONE => DI::l10n()->t('Disabled'), SR_SCOPE_ALL => DI::l10n()->t('all'), SR_SCOPE_TAGS => DI::l10n()->t('tags')]],
|
'$relay_scope' => ['relay_scope', DI::l10n()->t('Relay scope'), DI::config()->get('system', 'relay_scope'), DI::l10n()->t('Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts with selected tags should be received.'), [Relay::SCOPE_NONE => DI::l10n()->t('Disabled'), Relay::SCOPE_ALL => DI::l10n()->t('all'), Relay::SCOPE_TAGS => DI::l10n()->t('tags')]],
|
||||||
'$relay_server_tags' => ['relay_server_tags', DI::l10n()->t('Server tags'), DI::config()->get('system', 'relay_server_tags'), DI::l10n()->t('Comma separated list of tags for the "tags" subscription.')],
|
'$relay_server_tags' => ['relay_server_tags', DI::l10n()->t('Server tags'), DI::config()->get('system', 'relay_server_tags'), DI::l10n()->t('Comma separated list of tags for the "tags" subscription.')],
|
||||||
'$relay_deny_tags' => ['relay_deny_tags', DI::l10n()->t('Deny Server tags'), DI::config()->get('system', 'relay_deny_tags'), DI::l10n()->t('Comma separated list of tags that are rejected.')],
|
'$relay_deny_tags' => ['relay_deny_tags', DI::l10n()->t('Deny Server tags'), DI::config()->get('system', 'relay_deny_tags'), DI::l10n()->t('Comma separated list of tags that are rejected.')],
|
||||||
'$relay_user_tags' => ['relay_user_tags', DI::l10n()->t('Allow user tags'), DI::config()->get('system', 'relay_user_tags'), DI::l10n()->t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')],
|
'$relay_user_tags' => ['relay_user_tags', DI::l10n()->t('Allow user tags'), DI::config()->get('system', 'relay_user_tags'), DI::l10n()->t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')],
|
||||||
|
|
|
@ -59,7 +59,7 @@ abstract class BaseAdmin extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_site_admin()) {
|
if (!DI::app()->isSiteAdmin()) {
|
||||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('You don\'t have access to administration pages.'));
|
throw new HTTPException\ForbiddenException(DI::l10n()->t('You don\'t have access to administration pages.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ class Invite extends BaseModule
|
||||||
if ($config->get('system', 'invitation_only')) {
|
if ($config->get('system', 'invitation_only')) {
|
||||||
$invitation_only = true;
|
$invitation_only = true;
|
||||||
$invites_remaining = DI::pConfig()->get(local_user(), 'system', 'invites_remaining');
|
$invites_remaining = DI::pConfig()->get(local_user(), 'system', 'invites_remaining');
|
||||||
if ((!$invites_remaining) && (!is_site_admin())) {
|
if ((!$invites_remaining) && (!$app->isSiteAdmin())) {
|
||||||
throw new HTTPException\ForbiddenException();
|
throw new HTTPException\ForbiddenException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,11 +82,11 @@ class Invite extends BaseModule
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($invitation_only && ($invites_remaining || is_site_admin())) {
|
if ($invitation_only && ($invites_remaining || $app->isSiteAdmin())) {
|
||||||
$code = Model\Register::createForInvitation();
|
$code = Model\Register::createForInvitation();
|
||||||
$nmessage = str_replace('$invite_code', $code, $message);
|
$nmessage = str_replace('$invite_code', $code, $message);
|
||||||
|
|
||||||
if (!is_site_admin()) {
|
if (!$app->isSiteAdmin()) {
|
||||||
$invites_remaining--;
|
$invites_remaining--;
|
||||||
if ($invites_remaining >= 0) {
|
if ($invites_remaining >= 0) {
|
||||||
DI::pConfig()->set(local_user(), 'system', 'invites_remaining', $invites_remaining);
|
DI::pConfig()->set(local_user(), 'system', 'invites_remaining', $invites_remaining);
|
||||||
|
@ -138,7 +138,7 @@ class Invite extends BaseModule
|
||||||
if ($config->get('system', 'invitation_only')) {
|
if ($config->get('system', 'invitation_only')) {
|
||||||
$inviteOnly = true;
|
$inviteOnly = true;
|
||||||
$x = DI::pConfig()->get(local_user(), 'system', 'invites_remaining');
|
$x = DI::pConfig()->get(local_user(), 'system', 'invites_remaining');
|
||||||
if ((!$x) && (!is_site_admin())) {
|
if ((!$x) && (!$app->isSiteAdmin())) {
|
||||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('You have no more invitations available'));
|
throw new HTTPException\ForbiddenException(DI::l10n()->t('You have no more invitations available'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class HTTPException
|
||||||
'$stack_trace' => DI::l10n()->t('Stack trace:'),
|
'$stack_trace' => DI::l10n()->t('Stack trace:'),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (is_site_admin()) {
|
if (DI::app()->isSiteAdmin()) {
|
||||||
$vars['$thrown'] = DI::l10n()->t('Exception thrown in %s:%d', $e->getFile(), $e->getLine());
|
$vars['$thrown'] = DI::l10n()->t('Exception thrown in %s:%d', $e->getFile(), $e->getLine());
|
||||||
$vars['$trace'] = $e->getTraceAsString();
|
$vars['$trace'] = $e->getTraceAsString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace Friendica\Module\WellKnown;
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Search;
|
use Friendica\Model\Search;
|
||||||
|
use Friendica\Protocol\Relay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Node subscription preferences for social realy systems
|
* Node subscription preferences for social realy systems
|
||||||
|
@ -40,7 +41,7 @@ class XSocialRelay extends BaseModule
|
||||||
$systemTags = [];
|
$systemTags = [];
|
||||||
$userTags = [];
|
$userTags = [];
|
||||||
|
|
||||||
if ($scope == SR_SCOPE_TAGS) {
|
if ($scope == Relay::SCOPE_TAGS) {
|
||||||
$server_tags = $config->get('system', 'relay_server_tags');
|
$server_tags = $config->get('system', 'relay_server_tags');
|
||||||
$tagitems = explode(',', $server_tags);
|
$tagitems = explode(',', $server_tags);
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ class XSocialRelay extends BaseModule
|
||||||
$tagList = array_unique(array_merge($systemTags, $userTags));
|
$tagList = array_unique(array_merge($systemTags, $userTags));
|
||||||
|
|
||||||
$relay = [
|
$relay = [
|
||||||
'subscribe' => ($scope != SR_SCOPE_NONE),
|
'subscribe' => ($scope != Relay::SCOPE_NONE),
|
||||||
'scope' => $scope,
|
'scope' => $scope,
|
||||||
'tags' => $tagList,
|
'tags' => $tagList,
|
||||||
'protocols' => [
|
'protocols' => [
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Network\HTTPClient\Factory;
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseFactory;
|
use Friendica\BaseFactory;
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Network\HTTPClient\Client;
|
use Friendica\Network\HTTPClient\Client;
|
||||||
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
|
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
|
||||||
use Friendica\Util\Profiler;
|
use Friendica\Util\Profiler;
|
||||||
|
@ -106,7 +107,7 @@ class HttpClient extends BaseFactory
|
||||||
$resolver->setMaxResponseDataSize(1000000);
|
$resolver->setMaxResponseDataSize(1000000);
|
||||||
// Designate a temporary file that will store cookies during the session.
|
// Designate a temporary file that will store cookies during the session.
|
||||||
// Some websites test the browser for cookie support, so this enhances results.
|
// Some websites test the browser for cookie support, so this enhances results.
|
||||||
$resolver->setCookieJar(get_temppath() .'/resolver-cookie-' . Strings::getRandomName(10));
|
$resolver->setCookieJar(System::getTempPath() .'/resolver-cookie-' . Strings::getRandomName(10));
|
||||||
|
|
||||||
return new Client\HttpClient($logger, $this->profiler, $guzzle, $resolver);
|
return new Client\HttpClient($logger, $this->profiler, $guzzle, $resolver);
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,9 +134,6 @@ class Image
|
||||||
switch ($this->getType()) {
|
switch ($this->getType()) {
|
||||||
case "image/png":
|
case "image/png":
|
||||||
$quality = DI::config()->get('system', 'png_quality');
|
$quality = DI::config()->get('system', 'png_quality');
|
||||||
if ((! $quality) || ($quality > 9)) {
|
|
||||||
$quality = PNG_QUALITY;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* From http://www.imagemagick.org/script/command-line-options.php#quality:
|
* From http://www.imagemagick.org/script/command-line-options.php#quality:
|
||||||
*
|
*
|
||||||
|
@ -150,9 +147,6 @@ class Image
|
||||||
break;
|
break;
|
||||||
case "image/jpeg":
|
case "image/jpeg":
|
||||||
$quality = DI::config()->get('system', 'jpeg_quality');
|
$quality = DI::config()->get('system', 'jpeg_quality');
|
||||||
if ((! $quality) || ($quality > 100)) {
|
|
||||||
$quality = JPEG_QUALITY;
|
|
||||||
}
|
|
||||||
$this->image->setCompressionQuality($quality);
|
$this->image->setCompressionQuality($quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,16 +674,10 @@ class Image
|
||||||
switch ($this->getType()) {
|
switch ($this->getType()) {
|
||||||
case "image/png":
|
case "image/png":
|
||||||
$quality = DI::config()->get('system', 'png_quality');
|
$quality = DI::config()->get('system', 'png_quality');
|
||||||
if ((!$quality) || ($quality > 9)) {
|
|
||||||
$quality = PNG_QUALITY;
|
|
||||||
}
|
|
||||||
imagepng($this->image, null, $quality);
|
imagepng($this->image, null, $quality);
|
||||||
break;
|
break;
|
||||||
case "image/jpeg":
|
case "image/jpeg":
|
||||||
$quality = DI::config()->get('system', 'jpeg_quality');
|
$quality = DI::config()->get('system', 'jpeg_quality');
|
||||||
if ((!$quality) || ($quality > 100)) {
|
|
||||||
$quality = JPEG_QUALITY;
|
|
||||||
}
|
|
||||||
imagejpeg($this->image, null, $quality);
|
imagejpeg($this->image, null, $quality);
|
||||||
}
|
}
|
||||||
$string = ob_get_contents();
|
$string = ob_get_contents();
|
||||||
|
|
|
@ -413,6 +413,48 @@ class DFRN
|
||||||
return $root;
|
return $root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the next birthday, but only if the birthday is published
|
||||||
|
* in the default profile. We _could_ also look for a private profile that the
|
||||||
|
* recipient can see, but somebody could get mad at us if they start getting
|
||||||
|
* public birthday greetings when they haven't made this info public.
|
||||||
|
*
|
||||||
|
* Assuming we are able to publish this info, we are then going to convert
|
||||||
|
* the start time from the owner's timezone to UTC.
|
||||||
|
*
|
||||||
|
* This will potentially solve the problem found with some social networks
|
||||||
|
* where birthdays are converted to the viewer's timezone and salutations from
|
||||||
|
* elsewhere in the world show up on the wrong day. We will convert it to the
|
||||||
|
* viewer's timezone also, but first we are going to convert it from the birthday
|
||||||
|
* person's timezone to GMT - so the viewer may find the birthday starting at
|
||||||
|
* 6:00PM the day before, but that will correspond to midnight to the birthday person.
|
||||||
|
*/
|
||||||
|
private static function determineNextBirthday($uid, $tz)
|
||||||
|
{
|
||||||
|
$birthday = '';
|
||||||
|
|
||||||
|
if (!strlen($tz)) {
|
||||||
|
$tz = 'UTC';
|
||||||
|
}
|
||||||
|
|
||||||
|
$profile = DBA::selectFirst('profile', ['dob'], ['uid' => $uid]);
|
||||||
|
if (DBA::isResult($profile)) {
|
||||||
|
$tmp_dob = substr($profile['dob'], 5);
|
||||||
|
if (intval($tmp_dob)) {
|
||||||
|
$y = DateTimeFormat::timezoneNow($tz, 'Y');
|
||||||
|
$bd = $y . '-' . $tmp_dob . ' 00:00';
|
||||||
|
$t_dob = strtotime($bd);
|
||||||
|
$now = strtotime(DateTimeFormat::timezoneNow($tz));
|
||||||
|
if ($t_dob < $now) {
|
||||||
|
$bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
|
||||||
|
}
|
||||||
|
$birthday = DateTimeFormat::convert($bd, 'UTC', $tz, DateTimeFormat::ATOM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $birthday;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the author element in the header for the DFRN protocol
|
* Adds the author element in the header for the DFRN protocol
|
||||||
*
|
*
|
||||||
|
@ -467,7 +509,7 @@ class DFRN
|
||||||
return $author;
|
return $author;
|
||||||
}
|
}
|
||||||
|
|
||||||
$birthday = feed_birthday($owner['uid'], $owner['timezone']);
|
$birthday = self::determineNextBirthday($owner['uid'], $owner['timezone']);
|
||||||
|
|
||||||
if ($birthday) {
|
if ($birthday) {
|
||||||
XML::addElement($doc, $author, "dfrn:birthday", $birthday);
|
XML::addElement($doc, $author, "dfrn:birthday", $birthday);
|
||||||
|
|
|
@ -37,9 +37,15 @@ use Friendica\Util\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for relay handling
|
* Base class for relay handling
|
||||||
|
* @see https://github.com/jaywink/social-relay
|
||||||
|
* @see https://wiki.diasporafoundation.org/Relay_servers_for_public_posts
|
||||||
*/
|
*/
|
||||||
class Relay
|
class Relay
|
||||||
{
|
{
|
||||||
|
const SCOPE_NONE = '';
|
||||||
|
const SCOPE_ALL = 'all';
|
||||||
|
const SCOPE_TAGS = 'tags';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a post is wanted
|
* Check if a post is wanted
|
||||||
*
|
*
|
||||||
|
@ -55,7 +61,7 @@ class Relay
|
||||||
|
|
||||||
$scope = $config->get('system', 'relay_scope');
|
$scope = $config->get('system', 'relay_scope');
|
||||||
|
|
||||||
if ($scope == SR_SCOPE_NONE) {
|
if ($scope == self::SCOPE_NONE) {
|
||||||
Logger::info('Server does not accept relay posts - rejected', ['network' => $network, 'url' => $url]);
|
Logger::info('Server does not accept relay posts - rejected', ['network' => $network, 'url' => $url]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +80,7 @@ class Relay
|
||||||
$userTags = [];
|
$userTags = [];
|
||||||
$denyTags = [];
|
$denyTags = [];
|
||||||
|
|
||||||
if ($scope == SR_SCOPE_TAGS) {
|
if ($scope == self::SCOPE_TAGS) {
|
||||||
$server_tags = $config->get('system', 'relay_server_tags');
|
$server_tags = $config->get('system', 'relay_server_tags');
|
||||||
$tagitems = explode(',', mb_strtolower($server_tags));
|
$tagitems = explode(',', mb_strtolower($server_tags));
|
||||||
foreach ($tagitems as $tag) {
|
foreach ($tagitems as $tag) {
|
||||||
|
@ -119,7 +125,7 @@ class Relay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($scope == SR_SCOPE_ALL) {
|
if ($scope == self::SCOPE_ALL) {
|
||||||
Logger::info('Server accept all posts - accepted', ['network' => $network, 'url' => $url]);
|
Logger::info('Server accept all posts - accepted', ['network' => $network, 'url' => $url]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ final class FriendicaSmartyEngine extends TemplateEngine
|
||||||
if (!is_writable(DI::basePath() . '/view/smarty3')) {
|
if (!is_writable(DI::basePath() . '/view/smarty3')) {
|
||||||
$admin_message = DI::l10n()->t('The folder view/smarty3/ must be writable by webserver.');
|
$admin_message = DI::l10n()->t('The folder view/smarty3/ must be writable by webserver.');
|
||||||
DI::logger()->critical($admin_message);
|
DI::logger()->critical($admin_message);
|
||||||
$message = is_site_admin() ?
|
$message = DI::app()->isSiteAdmin() ?
|
||||||
$admin_message :
|
$admin_message :
|
||||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
throw new ServiceUnavailableException($message);
|
throw new ServiceUnavailableException($message);
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Worker;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -152,7 +153,7 @@ class OnePoll
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
|
$cookiejar = tempnam(System::getTempPath(), 'cookiejar-onepoll-');
|
||||||
$curlResult = DI::httpClient()->get($contact['poll'], [HttpClientOptions::COOKIEJAR => $cookiejar]);
|
$curlResult = DI::httpClient()->get($contact['poll'], [HttpClientOptions::COOKIEJAR => $cookiejar]);
|
||||||
unlink($cookiejar);
|
unlink($cookiejar);
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
namespace Friendica\Worker;
|
namespace Friendica\Worker;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +30,7 @@ use Friendica\Model\Item;
|
||||||
*/
|
*/
|
||||||
class SpoolPost {
|
class SpoolPost {
|
||||||
public static function execute() {
|
public static function execute() {
|
||||||
$path = get_spoolpath();
|
$path = System::getSpoolPath();
|
||||||
|
|
||||||
if (($path != '') && is_writable($path)){
|
if (($path != '') && is_writable($path)){
|
||||||
if ($dh = opendir($path)) {
|
if ($dh = opendir($path)) {
|
||||||
|
|
|
@ -295,6 +295,12 @@ return [
|
||||||
// on detected mobile devices
|
// on detected mobile devices
|
||||||
'itemspage_network_mobile' => 20,
|
'itemspage_network_mobile' => 20,
|
||||||
|
|
||||||
|
// jpeg_quality (Integer)
|
||||||
|
//
|
||||||
|
// Lower numbers save space at cost of image detail
|
||||||
|
// where n is between 1 and 100, and with very poor results below about 50
|
||||||
|
'jpeg_quality' => 100,
|
||||||
|
|
||||||
// like_no_comment (Boolean)
|
// like_no_comment (Boolean)
|
||||||
// Don't update the "commented" value of an item when it is liked.
|
// Don't update the "commented" value of an item when it is liked.
|
||||||
'like_no_comment' => false,
|
'like_no_comment' => false,
|
||||||
|
@ -359,6 +365,10 @@ return [
|
||||||
// If you don't want to set a maximum length, set to -1.
|
// If you don't want to set a maximum length, set to -1.
|
||||||
'max_image_length' => -1,
|
'max_image_length' => -1,
|
||||||
|
|
||||||
|
// max_likers (Integer)
|
||||||
|
// Maximum number of "people who like (or don't like) this" that we will list by name
|
||||||
|
'max_likers' => 75,
|
||||||
|
|
||||||
// max_processes_backend (Integer)
|
// max_processes_backend (Integer)
|
||||||
// Maximum number of concurrent database processes for background tasks.
|
// Maximum number of concurrent database processes for background tasks.
|
||||||
'max_processes_backend' => 5,
|
'max_processes_backend' => 5,
|
||||||
|
|
|
@ -176,9 +176,9 @@ return [
|
||||||
// Directly transmit content to relay subscribers without using a relay server
|
// Directly transmit content to relay subscribers without using a relay server
|
||||||
'relay_directly' => false,
|
'relay_directly' => false,
|
||||||
|
|
||||||
// relay_scope (SR_SCOPE_NONE, SR_SCOPE_TAGS or SR_SCOPE_ALL)
|
// relay_scope (Relay::SCOPE_NONE, Relay::SCOPE_TAGS or Relay::SCOPE_ALL)
|
||||||
// Defines the scope of accepted posts from the relay servers
|
// Defines the scope of accepted posts from the relay servers
|
||||||
'relay_scope' => SR_SCOPE_NONE,
|
'relay_scope' => '',
|
||||||
|
|
||||||
// relay_server_tags (String)
|
// relay_server_tags (String)
|
||||||
// Comma separated list of tags for the "tags" subscription.
|
// Comma separated list of tags for the "tags" subscription.
|
||||||
|
|
|
@ -31,7 +31,7 @@ $a->config['sitename'] = "Friendica My Network";
|
||||||
// and/or approve/deny the request.
|
// and/or approve/deny the request.
|
||||||
// In order to perform system administration via the admin panel, admin_email
|
// In order to perform system administration via the admin panel, admin_email
|
||||||
// must precisely match the email address of the person logged in.
|
// must precisely match the email address of the person logged in.
|
||||||
$a->config['register_policy'] = REGISTER_OPEN;
|
$a->config['register_policy'] = Friendica\Module\Register::OPEN;
|
||||||
$a->config['register_text'] = 'A register text';
|
$a->config['register_text'] = 'A register text';
|
||||||
$a->config['admin_email'] = 'admin@test.it';
|
$a->config['admin_email'] = 'admin@test.it';
|
||||||
$a->config['admin_nickname'] = 'Friendly admin';
|
$a->config['admin_nickname'] = 'Friendly admin';
|
||||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
use Friendica\Core\Config\Type\JitConfig;
|
use Friendica\Core\Config\Type\JitConfig;
|
||||||
use Friendica\Core\Lock\Type\SemaphoreLock;
|
use Friendica\Core\Lock\Type\SemaphoreLock;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Mockery;
|
use Mockery;
|
||||||
use Mockery\MockInterface;
|
use Mockery\MockInterface;
|
||||||
|
@ -73,7 +74,7 @@ class SemaphoreLockTest extends LockTest
|
||||||
*/
|
*/
|
||||||
public function testMissingFileNotOverriding()
|
public function testMissingFileNotOverriding()
|
||||||
{
|
{
|
||||||
$file = get_temppath() . '/test.sem';
|
$file = System::getTempPath() . '/test.sem';
|
||||||
touch($file);
|
touch($file);
|
||||||
|
|
||||||
self::assertTrue(file_exists($file));
|
self::assertTrue(file_exists($file));
|
||||||
|
@ -91,7 +92,7 @@ class SemaphoreLockTest extends LockTest
|
||||||
*/
|
*/
|
||||||
public function testMissingFileOverriding()
|
public function testMissingFileOverriding()
|
||||||
{
|
{
|
||||||
$file = get_temppath() . '/test.sem';
|
$file = System::getTempPath() . '/test.sem';
|
||||||
touch($file);
|
touch($file);
|
||||||
|
|
||||||
self::assertTrue(file_exists($file));
|
self::assertTrue(file_exists($file));
|
||||||
|
@ -104,7 +105,7 @@ class SemaphoreLockTest extends LockTest
|
||||||
*/
|
*/
|
||||||
public function testOverrideSemFile()
|
public function testOverrideSemFile()
|
||||||
{
|
{
|
||||||
$file = get_temppath() . '/test.sem';
|
$file = System::getTempPath() . '/test.sem';
|
||||||
touch($file);
|
touch($file);
|
||||||
|
|
||||||
self::assertTrue(file_exists($file));
|
self::assertTrue(file_exists($file));
|
||||||
|
|
|
@ -57,7 +57,7 @@ function theme_post(App $a)
|
||||||
|
|
||||||
function theme_admin_post(App $a)
|
function theme_admin_post(App $a)
|
||||||
{
|
{
|
||||||
if (!is_site_admin()) {
|
if (!$a->isSiteAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue