もっともっともっともっとPHP 8.2対応
このコミットが含まれているのは:
コミット
ccfa0c90ae
@ -39,9 +39,7 @@ class DeletenoticeAction extends FormAction
|
||||
{
|
||||
$this->notice = Notice::getByID($this->trimmed('notice'));
|
||||
|
||||
if ($this->notice->isVerb([ActivityVerb::DELETE]) ||
|
||||
(!$this->scoped->sameAs($this->notice->getProfile()) &&
|
||||
!$this->scoped->hasRight(Right::DELETEOTHERSNOTICE))) {
|
||||
if ($this->isAuthorizedToDelete($this->notice)) {
|
||||
// TRANS: Error message displayed when trying to delete a notice that was not made by the current user.
|
||||
$this->clientError(_('Cannot delete this notice.'));
|
||||
}
|
||||
@ -49,14 +47,21 @@ class DeletenoticeAction extends FormAction
|
||||
$this->formOpts['notice'] = $this->notice;
|
||||
}
|
||||
|
||||
function getInstructions()
|
||||
protected function isAuthorizedToDelete(Notice $notice): bool
|
||||
{
|
||||
return $notice->isVerb([ActivityVerb::DELETE]) ||
|
||||
(!$this->scoped->sameAs($notice->getProfile()) &&
|
||||
!$this->scoped->hasRight(Right::DELETEOTHERSNOTICE));
|
||||
}
|
||||
|
||||
function getInstructions(): string
|
||||
{
|
||||
// TRANS: Instructions for deleting a notice.
|
||||
return _('You are about to permanently delete a notice. ' .
|
||||
'Once this is done, it cannot be undone.');
|
||||
}
|
||||
|
||||
function title()
|
||||
function title(): string
|
||||
{
|
||||
// TRANS: Page title when deleting a notice.
|
||||
return _('Delete notice');
|
||||
@ -65,9 +70,9 @@ class DeletenoticeAction extends FormAction
|
||||
protected function doPost()
|
||||
{
|
||||
if ($this->arg('yes')) {
|
||||
if (Event::handle('StartDeleteOwnNotice', array($this->scoped->getUser(), $this->notice))) {
|
||||
if (Event::handle('StartDeleteOwnNotice', [$this->scoped->getUser(), $this->notice])) {
|
||||
$this->notice->deleteAs($this->scoped);
|
||||
Event::handle('EndDeleteOwnNotice', array($this->scoped->getUser(), $this->notice));
|
||||
Event::handle('EndDeleteOwnNotice', [$this->scoped->getUser(), $this->notice]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,9 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
*/
|
||||
class DeleteuserAction extends ProfileFormAction
|
||||
{
|
||||
var $user = null;
|
||||
protected $user = null;
|
||||
|
||||
function prepare(array $args=array())
|
||||
public function prepare(array $args = []): bool
|
||||
{
|
||||
if (!parent::prepare($args)) {
|
||||
return false;
|
||||
@ -85,27 +85,32 @@ class DeleteuserAction extends ProfileFormAction
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if ($this->arg('no')) {
|
||||
$this->returnToPrevious();
|
||||
} elseif ($this->arg('yes')) {
|
||||
return;
|
||||
}
|
||||
if ($this->arg('yes')) {
|
||||
$this->handlePost();
|
||||
$this->returnToPrevious();
|
||||
} else {
|
||||
$this->showPage();
|
||||
return;
|
||||
}
|
||||
$this->showPage();
|
||||
}
|
||||
}
|
||||
|
||||
function showContent() {
|
||||
public function showContent(): void
|
||||
{
|
||||
$this->areYouSureForm();
|
||||
$block = new AccountProfileBlock($this, $this->profile);
|
||||
$block->show();
|
||||
}
|
||||
|
||||
function title() {
|
||||
public function title(): string
|
||||
{
|
||||
// TRANS: Title of delete user page.
|
||||
return _m('TITLE','Delete user');
|
||||
}
|
||||
|
||||
function showNoticeForm() {
|
||||
function showNoticeForm(): void
|
||||
{
|
||||
// nop
|
||||
}
|
||||
|
||||
@ -116,7 +121,7 @@ class DeleteuserAction extends ProfileFormAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function areYouSureForm()
|
||||
function areYouSureForm(): void
|
||||
{
|
||||
$id = $this->profile->id;
|
||||
$this->elementStart('form', array('id' => 'deleteuser-' . $id,
|
||||
@ -167,7 +172,7 @@ class DeleteuserAction extends ProfileFormAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handlePost()
|
||||
function handlePost(): void
|
||||
{
|
||||
if (Event::handle('StartDeleteUser', array($this, $this->user))) {
|
||||
// Mark the account as deleted and shove low-level deletion tasks
|
||||
|
@ -163,13 +163,12 @@ class RegisterAction extends Action
|
||||
$token = $this->trimmed('token');
|
||||
if (!$token || $token != common_session_token()) {
|
||||
// TRANS: Client error displayed when the session token does not match or is not given.
|
||||
$this->showForm(_('There was a problem with your session token. '.
|
||||
'Try again, please.'));
|
||||
$this->showForm(_('There was a problem with your session token. Try again, please.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$nickname = $this->trimmed('nickname');
|
||||
$email = $this->trimmed('email');
|
||||
$email = common_canonical_email($this->trimmed('email'));
|
||||
$fullname = $this->trimmed('fullname');
|
||||
$homepage = $this->trimmed('homepage');
|
||||
$bio = $this->trimmed('bio');
|
||||
@ -198,52 +197,54 @@ class RegisterAction extends Action
|
||||
$this->showForm($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$email = common_canonical_email($email);
|
||||
|
||||
if (!$this->boolean('license')) {
|
||||
// TRANS: Form validation error displayed when trying to register without agreeing to the site license.
|
||||
$this->showForm(_('You cannot register if you do not '.
|
||||
'agree to the license.'));
|
||||
$this->showForm(_('You cannot register if you do not agree to the license.'));
|
||||
} else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
|
||||
// TRANS: Form validation error displayed when trying to register without a valid e-mail address.
|
||||
$this->showForm(_('Not a valid email address.'));
|
||||
} else if ($this->emailExists($email)) {
|
||||
// TRANS: Form validation error displayed when trying to register with an already registered e-mail address.
|
||||
$this->showForm(_('Email address already exists.'));
|
||||
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
|
||||
!common_valid_http_url($homepage)) {
|
||||
} else if (!is_null($homepage) && (strlen($homepage) > 0) && !common_valid_http_url($homepage)) {
|
||||
// TRANS: Form validation error displayed when trying to register with an invalid homepage URL.
|
||||
$this->showForm(_('Homepage is not a valid URL.'));
|
||||
} else if (Profile::bioTooLong($bio)) {
|
||||
// TRANS: Form validation error on registration page when providing too long a bio text.
|
||||
// TRANS: %d is the maximum number of characters for bio; used for plural.
|
||||
$this->showForm(sprintf(_m('Bio is too long (maximum %d character).',
|
||||
'Bio is too long (maximum %d characters).',
|
||||
Profile::maxBio()),
|
||||
Profile::maxBio()));
|
||||
} else if (strlen($password) < 6) {
|
||||
// TRANS: Form validation error displayed when trying to register with too short a password.
|
||||
$this->showForm(_('Password must be 6 or more characters.'));
|
||||
} else if ($password != $confirm) {
|
||||
// TRANS: Form validation error displayed when trying to register with non-matching passwords.
|
||||
$this->showForm(_('Passwords do not match.'));
|
||||
'Bio is too long (maximum %d characters).',
|
||||
Profile::maxBio()),
|
||||
Profile::maxBio()));
|
||||
} else if (strlen($password) < 6) {
|
||||
// TRANS: Form validation error displayed when trying to register with too short a password.
|
||||
$this->showForm(_('Password must be 6 or more characters.'));
|
||||
} else if ($password != $confirm) {
|
||||
// TRANS: Form validation error displayed when trying to register with non-matching passwords.
|
||||
$this->showForm(_('Passwords do not match.'));
|
||||
} else {
|
||||
try {
|
||||
$user = User::register(array('nickname' => $nickname,
|
||||
'password' => $password,
|
||||
'email' => $email,
|
||||
'fullname' => $fullname,
|
||||
'homepage' => $homepage,
|
||||
'bio' => $bio,
|
||||
'location' => $location,
|
||||
'code' => $code));
|
||||
$user = User::register([
|
||||
'nickname' => $nickname,
|
||||
'password' => $password,
|
||||
'email' => $email,
|
||||
'fullname' => $this->trimmed('fullname'),
|
||||
'homepage' => $this->trimmed('homepage'),
|
||||
'bio' => $this->trimmed('bio'),
|
||||
'location' => $this->trimmed('location'),
|
||||
'code' => $code
|
||||
]);
|
||||
|
||||
// success!
|
||||
if (!common_set_user($user)) {
|
||||
// TRANS: Server error displayed when saving fails during user registration.
|
||||
$this->serverError(_('Error setting user.'));
|
||||
}
|
||||
|
||||
// this is a real login
|
||||
common_real_login(true);
|
||||
|
||||
if ($this->boolean('rememberme')) {
|
||||
common_debug('Adding rememberme cookie for ' . $nickname);
|
||||
common_rememberme($user);
|
||||
@ -251,9 +252,7 @@ class RegisterAction extends Action
|
||||
|
||||
// Re-init language env in case it changed (not yet, but soon)
|
||||
common_init_language();
|
||||
|
||||
Event::handle('EndRegistrationTry', array($this));
|
||||
|
||||
Event::handle('EndRegistrationTry', [$this]);
|
||||
$this->showSuccess();
|
||||
} catch (Exception $e) {
|
||||
// TRANS: Form validation error displayed when trying to register with an invalid username or password.
|
||||
|
@ -31,6 +31,7 @@ defined('GNUSOCIAL') || die();
|
||||
class File extends Managed_DataObject
|
||||
{
|
||||
public $is_mariadb;
|
||||
public $total;
|
||||
|
||||
public $__table = 'file'; // table name
|
||||
public $id; // int(4) primary_key not_null
|
||||
@ -426,7 +427,7 @@ class File extends Managed_DataObject
|
||||
*/
|
||||
public static function validFilename($filename)
|
||||
{
|
||||
return preg_match('/^[A-Za-z0-9._-]+$/', $filename);
|
||||
return preg_match('/^[A-Za-z0-9._-]+$/', $filename ?? "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,7 +100,7 @@ class File_thumbnail extends Managed_DataObject
|
||||
$file = File::getById($file->getID());
|
||||
}
|
||||
|
||||
if (file_exists($imgPath)) {
|
||||
if (file_exists($imgPath ?? "")) {
|
||||
$image = new ImageFile($imgPath, $file->getID(), null, $file->getUrl(false));
|
||||
} else {
|
||||
try {
|
||||
|
@ -802,7 +802,7 @@ class Notice extends Managed_DataObject
|
||||
|
||||
// Get ActivityObject properties
|
||||
$actobj = null;
|
||||
if ($act->objects[0]->id !== null) {
|
||||
if ($act->id !== null) {
|
||||
// implied object
|
||||
$options['uri'] = $act->id ?? "";
|
||||
$options['url'] = $act->link ?? "";
|
||||
@ -810,7 +810,7 @@ class Notice extends Managed_DataObject
|
||||
$options['self'] = $act->selfLink;
|
||||
}
|
||||
} else {
|
||||
$actobj = count($act->objects)===1 ? $act->objects[0] : null;
|
||||
$actobj = count($act->objects) === 1 ? $act->objects[0] : null;
|
||||
if ($actobj !== null && !empty($actobj->id)) {
|
||||
$options['uri'] = $actobj->id ?? "";
|
||||
if ($actobj->link !== null) {
|
||||
@ -889,7 +889,7 @@ class Notice extends Managed_DataObject
|
||||
|
||||
// we use mb_strlen because it _might_ be that the content is just the string "0"...
|
||||
$content = $act->content ?? $act->summary;
|
||||
if (mb_strlen($content) === 0 && !is_null($actobj)) {
|
||||
if (mb_strlen($content ?? "") === 0 && $actobj !== null) {
|
||||
$content = $actobj->content ?? $actobj->summary;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ class Profile extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
if (mb_strlen($this->getFullname()) > 0) {
|
||||
if (mb_strlen($this->getFullname() ?? "") > 0) {
|
||||
// TRANS: The "fancy name": Full name of a profile or group (%1$s) followed by some URI (%2$s) in parentheses.
|
||||
return sprintf(_m('FANCYNAME', '%1$s (%2$s)'), $this->getFullname(), $uri);
|
||||
} else {
|
||||
|
122
classes/User.php
122
classes/User.php
@ -62,63 +62,63 @@ class User extends Managed_DataObject
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'description' => 'local users',
|
||||
'fields' => array(
|
||||
'id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'),
|
||||
'nickname' => array('type' => 'varchar', 'length' => 64, 'description' => 'nickname or username, duped in profile'),
|
||||
'password' => array('type' => 'text', 'description' => 'salted password, can be null for OpenID users'),
|
||||
'email' => array('type' => 'varchar', 'length' => 191, 'description' => 'email address for password recovery etc.'),
|
||||
'incomingemail' => array('type' => 'varchar', 'length' => 191, 'description' => 'email address for post-by-email'),
|
||||
'emailnotifysub' => array('type' => 'bool', 'default' => true, 'description' => 'Notify by email of subscriptions'),
|
||||
'emailnotifyfav' => array('type' => 'int', 'size' => 'tiny', 'default' => null, 'description' => 'Notify by email of favorites'),
|
||||
'emailnotifynudge' => array('type' => 'bool', 'default' => true, 'description' => 'Notify by email of nudges'),
|
||||
'emailnotifymsg' => array('type' => 'bool', 'default' => true, 'description' => 'Notify by email of direct messages'),
|
||||
'emailnotifyattn' => array('type' => 'bool', 'default' => true, 'description' => 'Notify by email of @-replies'),
|
||||
'language' => array('type' => 'varchar', 'length' => 50, 'description' => 'preferred language'),
|
||||
'timezone' => array('type' => 'varchar', 'length' => 50, 'description' => 'timezone'),
|
||||
'emailpost' => array('type' => 'bool', 'default' => true, 'description' => 'Post by email'),
|
||||
'sms' => array('type' => 'varchar', 'length' => 64, 'description' => 'sms phone number'),
|
||||
'carrier' => array('type' => 'int', 'description' => 'foreign key to sms_carrier'),
|
||||
'smsnotify' => array('type' => 'bool', 'default' => false, 'description' => 'whether to send notices to SMS'),
|
||||
'smsreplies' => array('type' => 'bool', 'default' => false, 'description' => 'whether to send notices to SMS on replies'),
|
||||
'smsemail' => array('type' => 'varchar', 'length' => 191, 'description' => 'built from sms and carrier'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'),
|
||||
'autosubscribe' => array('type' => 'bool', 'default' => false, 'description' => 'automatically subscribe to users who subscribe to us'),
|
||||
'subscribe_policy' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'),
|
||||
'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
|
||||
'private_stream' => array('type' => 'bool', 'default' => false, 'description' => 'whether to limit all notices to followers only'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
'user_nickname_key' => array('nickname'),
|
||||
'user_email_key' => array('email'),
|
||||
'user_incomingemail_key' => array('incomingemail'),
|
||||
'user_sms_key' => array('sms'),
|
||||
'user_uri_key' => array('uri'),
|
||||
),
|
||||
'foreign keys' => array(
|
||||
'user_id_fkey' => array('profile', array('id' => 'id')),
|
||||
'user_carrier_fkey' => array('sms_carrier', array('carrier' => 'id')),
|
||||
),
|
||||
'indexes' => array(
|
||||
'user_carrier_idx' => array('carrier'),
|
||||
'user_created_id_idx' => array('created', 'id'),
|
||||
'user_smsemail_idx' => array('smsemail'),
|
||||
),
|
||||
);
|
||||
'fields' => [
|
||||
'id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
|
||||
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname or username, duped in profile'],
|
||||
'password' => ['type' => 'text', 'description' => 'salted password, can be null for OpenID users'],
|
||||
'email' => ['type' => 'varchar', 'length' => 191, 'description' => 'email address for password recovery etc.'],
|
||||
'incomingemail' => ['type' => 'varchar', 'length' => 191, 'description' => 'email address for post-by-email'],
|
||||
'emailnotifysub' => ['type' => 'bool', 'default' => true, 'description' => 'Notify by email of subscriptions'],
|
||||
'emailnotifyfav' => ['type' => 'int', 'size' => 'tiny', 'default' => null, 'description' => 'Notify by email of favorites'],
|
||||
'emailnotifynudge' => ['type' => 'bool', 'default' => true, 'description' => 'Notify by email of nudges'],
|
||||
'emailnotifymsg' => ['type' => 'bool', 'default' => true, 'description' => 'Notify by email of direct messages'],
|
||||
'emailnotifyattn' => ['type' => 'bool', 'default' => true, 'description' => 'Notify by email of @-replies'],
|
||||
'language' => ['type' => 'varchar', 'length' => 50, 'description' => 'preferred language'],
|
||||
'timezone' => ['type' => 'varchar', 'length' => 50, 'description' => 'timezone'],
|
||||
'emailpost' => ['type' => 'bool', 'default' => true, 'description' => 'Post by email'],
|
||||
'sms' => ['type' => 'varchar', 'length' => 64, 'description' => 'sms phone number'],
|
||||
'carrier' => ['type' => 'int', 'description' => 'foreign key to sms_carrier'],
|
||||
'smsnotify' => ['type' => 'bool', 'default' => false, 'description' => 'whether to send notices to SMS'],
|
||||
'smsreplies' => ['type' => 'bool', 'default' => false, 'description' => 'whether to send notices to SMS on replies'],
|
||||
'smsemail' => ['type' => 'varchar', 'length' => 191, 'description' => 'built from sms and carrier'],
|
||||
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'],
|
||||
'autosubscribe' => ['type' => 'bool', 'default' => false, 'description' => 'automatically subscribe to users who subscribe to us'],
|
||||
'subscribe_policy' => ['type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'],
|
||||
'urlshorteningservice' => ['type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'],
|
||||
'private_stream' => ['type' => 'bool', 'default' => false, 'description' => 'whether to limit all notices to followers only'],
|
||||
'created' => ['type' => 'datetime', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'unique keys' => [
|
||||
'user_nickname_key' => ['nickname'],
|
||||
'user_email_key' => ['email'],
|
||||
'user_incomingemail_key' => ['incomingemail'],
|
||||
'user_sms_key' => ['sms'],
|
||||
'user_uri_key' => ['uri'],
|
||||
],
|
||||
'foreign keys' => [
|
||||
'user_id_fkey' => ['profile', ['id' => 'id']],
|
||||
'user_carrier_fkey' => ['sms_carrier', ['carrier' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'user_carrier_idx' => ['carrier'],
|
||||
'user_created_id_idx' => ['created', 'id'],
|
||||
'user_smsemail_idx' => ['smsemail'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
protected $_profile = array();
|
||||
protected $_profile = [];
|
||||
|
||||
/**
|
||||
* @return Profile
|
||||
*
|
||||
* @throws UserNoProfileException if user has no profile
|
||||
*/
|
||||
public function getProfile()
|
||||
public function getProfile(): object
|
||||
{
|
||||
if (!isset($this->_profile[$this->id])) {
|
||||
$profile = Profile::getKV('id', $this->id);
|
||||
@ -135,12 +135,12 @@ class User extends Managed_DataObject
|
||||
return $this->getProfile()->sameAs($other);
|
||||
}
|
||||
|
||||
public function getUri()
|
||||
public function getUri(): string
|
||||
{
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
public function getNickname()
|
||||
public function getNickname(): string
|
||||
{
|
||||
return $this->getProfile()->getNickname();
|
||||
}
|
||||
@ -149,7 +149,7 @@ class User extends Managed_DataObject
|
||||
{
|
||||
$user = User::getKV('nickname', $nickname);
|
||||
if (!$user instanceof User) {
|
||||
throw new NoSuchUserException(array('nickname' => $nickname));
|
||||
throw new NoSuchUserException(['nickname' => $nickname]);
|
||||
}
|
||||
|
||||
return $user;
|
||||
@ -277,7 +277,7 @@ class User extends Managed_DataObject
|
||||
|
||||
$user->created = common_sql_now();
|
||||
|
||||
if (Event::handle('StartUserRegister', array($profile))) {
|
||||
if (Event::handle('StartUserRegister', [$profile])) {
|
||||
$profile->query('START TRANSACTION');
|
||||
|
||||
$id = $profile->insert();
|
||||
@ -416,7 +416,7 @@ class User extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
Event::handle('EndUserRegister', array($profile));
|
||||
Event::handle('EndUserRegister', [$profile]);
|
||||
}
|
||||
|
||||
if (!$user instanceof User || empty($user->id)) {
|
||||
@ -630,14 +630,14 @@ class User extends Managed_DataObject
|
||||
common_log(LOG_INFO, "User {$this->nickname} has no profile; continuing deletion.");
|
||||
}
|
||||
|
||||
$related = array(
|
||||
'Confirm_address',
|
||||
'Remember_me',
|
||||
'Foreign_link',
|
||||
'Invitation',
|
||||
);
|
||||
$related = [
|
||||
'Confirm_address',
|
||||
'Remember_me',
|
||||
'Foreign_link',
|
||||
'Invitation',
|
||||
];
|
||||
|
||||
Event::handle('UserDeleteRelated', array($this, &$related));
|
||||
Event::handle('UserDeleteRelated', [$this, &$related]);
|
||||
|
||||
foreach ($related as $cls) {
|
||||
$inst = new $cls();
|
||||
@ -875,7 +875,7 @@ class User extends Managed_DataObject
|
||||
public function __sleep()
|
||||
{
|
||||
$vars = parent::__sleep();
|
||||
$skip = array('_profile');
|
||||
$skip = ['_profile'];
|
||||
return array_diff($vars, $skip);
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ class HTTP_Request2_Adapter_Socket extends HTTP_Request2_Adapter
|
||||
return true;
|
||||
}
|
||||
|
||||
$lengthKnown = 'chunked' == strtolower($response->getHeader('transfer-encoding'))
|
||||
$lengthKnown = 'chunked' == strtolower($response->getHeader('transfer-encoding') ?? "")
|
||||
|| null !== $response->getHeader('content-length')
|
||||
// no body possible for such responses, see also request #17031
|
||||
|| HTTP_Request2::METHOD_HEAD == $this->request->getMethod()
|
||||
@ -1135,4 +1135,4 @@ class HTTP_Request2_Adapter_Socket extends HTTP_Request2_Adapter
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -53,6 +53,8 @@ require_once 'HTTP/Request2/Exception.php';
|
||||
*/
|
||||
class HTTP_Request2_Response
|
||||
{
|
||||
public $redirUrls;
|
||||
|
||||
/**
|
||||
* HTTP protocol version (e.g. 1.0, 1.1)
|
||||
* @var string
|
||||
@ -677,4 +679,4 @@ class HTTP_Request2_Response
|
||||
return (0 == $header[1] % 31)? gzuncompress($data): gzinflate($data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -195,11 +195,13 @@ class HTTP_Request2_SocketWrapper
|
||||
$info = stream_get_meta_data($this->socket);
|
||||
$old_blocking = (bool)$info['blocked'];
|
||||
stream_set_blocking($this->socket, false);
|
||||
$r = array($this->socket);
|
||||
$w = array();
|
||||
$e = array();
|
||||
$r = [$this->socket];
|
||||
$w = [];
|
||||
$e = [];
|
||||
if (stream_select($r, $w, $e, $timeout)) {
|
||||
$line .= @fgets($this->socket, $bufferSize);
|
||||
} else {
|
||||
echo "stream_select失敗: " . error_get_last()['message'];
|
||||
}
|
||||
stream_set_blocking($this->socket, $old_blocking);
|
||||
|
||||
|
@ -14,7 +14,7 @@ class IDNATest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public static function unichr($chr)
|
||||
{
|
||||
return mb_convert_encoding('&#' . intval($chr) . ';', 'UTF-8', 'HTML-ENTITIES');
|
||||
return htmlspecialchars('&#' . intval($chr) . ';', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||
}
|
||||
|
||||
private function hexarray2string($arr)
|
||||
|
@ -175,10 +175,8 @@ function _get_codeset($domain=null) {
|
||||
*/
|
||||
function _encode($text) {
|
||||
$target_encoding = _get_codeset();
|
||||
if (function_exists("mb_detect_encoding")) {
|
||||
$source_encoding = mb_detect_encoding($text);
|
||||
if ($source_encoding != $target_encoding)
|
||||
$text = mb_convert_encoding($text, $target_encoding, $source_encoding);
|
||||
if ($source_encoding != $target_encoding) {
|
||||
$text = htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
@ -51,6 +51,10 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
*/
|
||||
class GNUsocial_HTTPResponse extends HTTP_Request2_Response
|
||||
{
|
||||
public $redirUrls;
|
||||
public $url;
|
||||
public $redirectCount;
|
||||
|
||||
function __construct(HTTP_Request2_Response $response, $url, $redirects=0)
|
||||
{
|
||||
foreach (get_object_vars($response) as $key => $val) {
|
||||
|
@ -2080,7 +2080,7 @@ function common_get_mime_media($type)
|
||||
// Get only the mimetype and not additional info (separated from bare mime with semi-colon)
|
||||
function common_bare_mime($mimetype)
|
||||
{
|
||||
$mimetype = mb_strtolower($mimetype);
|
||||
$mimetype = mb_strtolower($mimetype ?? "");
|
||||
if (($semicolon = mb_strpos($mimetype, ';')) !== false) {
|
||||
$mimetype = mb_substr($mimetype, 0, $semicolon);
|
||||
}
|
||||
|
@ -25,9 +25,9 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("classes/Activitypub_profile.php");
|
||||
include("classes/Activitypub_rsa.php");
|
||||
include("classes/Activitypub_pending_follow_requests.php");
|
||||
include("../plugins/ActivityPub/classes/Activitypub_profile.php");
|
||||
include("../plugins/ActivityPub/classes/Activitypub_rsa.php");
|
||||
include("../plugins/ActivityPub/classes/Activitypub_pending_follow_requests.php");
|
||||
|
||||
// Import plugin libs
|
||||
foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . '*.php') as $filename) {
|
||||
|
@ -55,7 +55,7 @@ class Activitypub_attachment
|
||||
];
|
||||
|
||||
// Image
|
||||
if (substr($res["mediaType"], 0, 5) == "image") {
|
||||
if (substr($res["mediaType"], "", 5) == "image") {
|
||||
$res["meta"]= [
|
||||
'width' => $attachment->width,
|
||||
'height' => $attachment->height
|
||||
|
@ -85,7 +85,7 @@ class Activitypub_notice
|
||||
'id' => self::getUri($notice),
|
||||
'type' => 'Delete',
|
||||
// XXX: A bit of ugly code here
|
||||
'object' => array_merge(Activitypub_tombstone::tombstone_to_array((int)substr(explode(':', $notice->getUri())[2], 9)), ['deleted' => str_replace(' ', 'T', $notice->getCreated()) . 'Z']),
|
||||
'object' => array_merge(Activitypub_tombstone::tombstone_to_array((int)substr(explode(':', $notice->getUri())[2] ?? "", 9)), ['deleted' => str_replace(' ', 'T', $notice->getCreated()) . 'Z']),
|
||||
'url' => $notice->getUrl(),
|
||||
'actor' => $profile->getUri(),
|
||||
'to' => $to,
|
||||
|
@ -33,7 +33,7 @@ if (!defined('STATUSNET')) {
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
include("classes/Spam_score.php");
|
||||
include("../plugins/ActivitySpam/classes/Spam_score.php");
|
||||
|
||||
/**
|
||||
* Check new notices with activity spam service.
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("classes/Fave_tally.php");
|
||||
include("../plugins/AnonymousFave/classes/Fave_tally.php");
|
||||
|
||||
define('ANONYMOUS_FAVE_PLUGIN_VERSION', '0.1.0');
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
include("classes/Nickname_blacklist.php");
|
||||
include("classes/Homepage_blacklist.php");
|
||||
include("../plugins/Blacklist/classes/Nickname_blacklist.php");
|
||||
include("../plugins/Blacklist/classes/Homepage_blacklist.php");
|
||||
|
||||
/**
|
||||
* Plugin to prevent use of nicknames or URLs on a blacklist
|
||||
|
@ -29,10 +29,10 @@
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
include("classes/Bookmark.php");
|
||||
include("lib/bookmarksnoticestream.php");
|
||||
include("lib/deliciousbackupimporter.php");
|
||||
include("lib/deliciousbookmarkimporter.php");
|
||||
include("../plugins/Bookmark/classes/Bookmark.php");
|
||||
include("../plugins/Bookmark/lib/bookmarksnoticestream.php");
|
||||
include("../plugins/Bookmark/lib/deliciousbackupimporter.php");
|
||||
include("../plugins/Bookmark/lib/deliciousbookmarkimporter.php");
|
||||
|
||||
/**
|
||||
* Bookmark plugin main class
|
||||
|
@ -355,7 +355,6 @@ class Bookmark extends Managed_DataObject
|
||||
foreach ($tags as $term) {
|
||||
$catEl = new AtomCategory();
|
||||
$catEl->term = $term;
|
||||
$activity->categories[] = $catEl;
|
||||
}
|
||||
|
||||
$options = array_merge([
|
||||
|
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("lib/conversationtree.php");
|
||||
include("../plugins/ConversationTree/lib/conversationtree.php");
|
||||
|
||||
class ConversationTreePlugin extends Plugin
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
include("lib/cronish.php");
|
||||
include("../plugins/Cronish/lib/cronish.php");
|
||||
|
||||
class CronishPlugin extends Plugin {
|
||||
const PLUGIN_VERSION = '2.0.0';
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("classes/DBQueueManager.php");
|
||||
include("../plugins/DBQueue/classes/DBQueueManager.php");
|
||||
|
||||
class DBQueuePlugin extends Plugin
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("classes/Message.php");
|
||||
include("../plugins/DirectMessage/classes/Message.php");
|
||||
|
||||
// require needed abstractions first
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'messagelist.php';
|
||||
|
@ -31,9 +31,8 @@
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
include("lib/alphanav.php");
|
||||
include("lib/sortablegrouplist.php");
|
||||
//include("lib/sortablesubscriptionlist.php");
|
||||
include("../plugins/Directory/lib/alphanav.php");
|
||||
include("../plugins/Directory/lib/sortablegrouplist.php");
|
||||
|
||||
/**
|
||||
* Directory plugin main class
|
||||
|
@ -33,8 +33,8 @@ if (!defined('STATUSNET')) {
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
include("lib/domainstatusnetworkinstaller.php");
|
||||
include("lib/freeemail.php");
|
||||
include("../plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php");
|
||||
include("../plugins/DomainStatusNetwork/lib/freeemail.php");
|
||||
|
||||
$_dir = dirname(__FILE__);
|
||||
|
||||
|
@ -33,9 +33,9 @@ if (!defined('STATUSNET')) {
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
include("lib/siteconfirmreminderhandler.php");
|
||||
include("lib/userconfirmregreminderhandler.php");
|
||||
include("lib/userinvitereminderhandler.php");
|
||||
include("../plugins/EmailReminder/lib/siteconfirmreminderhandler.php");
|
||||
include("../plugins/EmailReminder/lib/userconfirmregreminderhandler.php");
|
||||
include("../plugins/EmailReminder/lib/userinvitereminderhandler.php");
|
||||
|
||||
/**
|
||||
* Email reminder plugin
|
||||
|
@ -30,7 +30,8 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("classes/File_embed.php");
|
||||
include("../plugins/Embed/classes/File_embed.php");
|
||||
include("../plugins/Embed/lib/embedhelper.php");
|
||||
|
||||
use Embed\Embed;
|
||||
|
||||
|
@ -29,10 +29,10 @@
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
include("classes/Happening.php");
|
||||
include("classes/RSVP.php");
|
||||
include("lib/eventsnoticestream.php");
|
||||
include("lib/eventtimelist.php");
|
||||
include("../plugins/Event/classes/Happening.php");
|
||||
include("../plugins/Event/classes/RSVP.php");
|
||||
include("../plugins/Event/lib/eventsnoticestream.php");
|
||||
include("../plugins/Event/lib/eventtimelist.php");
|
||||
|
||||
/**
|
||||
* Event plugin
|
||||
|
@ -133,31 +133,31 @@ class NeweventAction extends FormAction
|
||||
$actobj->type = Happening::OBJECT_TYPE;
|
||||
$actobj->title = $title;
|
||||
$actobj->summary = $description;
|
||||
$actobj->extra[] = array('dtstart',
|
||||
array('xmlns' => 'urn:ietf:params:xml:ns:xcal'),
|
||||
common_date_iso8601($start_str));
|
||||
$actobj->extra[] = array('dtend',
|
||||
array('xmlns' => 'urn:ietf:params:xml:ns:xcal'),
|
||||
common_date_iso8601($end_str));
|
||||
$actobj->extra[] = array('location',
|
||||
array('xmlns' => 'urn:ietf:params:xml:ns:xcal'),
|
||||
$location);
|
||||
$actobj->extra[] = array('url',
|
||||
array('xmlns' => 'urn:ietf:params:xml:ns:xcal'),
|
||||
$url);
|
||||
$actobj->extra[] = ['dtstart',
|
||||
['xmlns' => 'urn:ietf:params:xml:ns:xcal'],
|
||||
common_date_iso8601($start_str)];
|
||||
$actobj->extra[] = ['dtend',
|
||||
['xmlns' => 'urn:ietf:params:xml:ns:xcal'],
|
||||
common_date_iso8601($end_str)];
|
||||
$actobj->extra[] = ['location',
|
||||
['xmlns' => 'urn:ietf:params:xml:ns:xcal'],
|
||||
$location];
|
||||
$actobj->extra[] = ['url',
|
||||
['xmlns' => 'urn:ietf:params:xml:ns:xcal'],
|
||||
$url];
|
||||
|
||||
/* We don't use these ourselves, but we add them to be nice RSS/XML citizens */
|
||||
$actobj->extra[] = array('startdate',
|
||||
array('xmlns' => 'http://purl.org/rss/1.0/plugins/event/'),
|
||||
common_date_iso8601($start_str));
|
||||
$actobj->extra[] = array('enddate',
|
||||
array('xmlns' => 'http://purl.org/rss/1.0/plugins/event/'),
|
||||
common_date_iso8601($end_str));
|
||||
$actobj->extra[] = array('location',
|
||||
array('xmlns' => 'http://purl.org/rss/1.0/plugins/event/'),
|
||||
$location);
|
||||
$actobj->extra[] = ['startdate',
|
||||
['xmlns' => 'http://purl.org/rss/1.0/plugins/event/'],
|
||||
common_date_iso8601($start_str)];
|
||||
$actobj->extra[] = ['enddate',
|
||||
['xmlns' => 'http://purl.org/rss/1.0/plugins/event/'],
|
||||
common_date_iso8601($end_str)];
|
||||
$actobj->extra[] = ['location',
|
||||
['xmlns' => 'http://purl.org/rss/1.0/plugins/event/'],
|
||||
$location];
|
||||
|
||||
$act->objects = array($actobj);
|
||||
$act->objects = [$actobj];
|
||||
|
||||
$stored = Notice::saveActivity($act, $this->scoped, $options);
|
||||
|
||||
|
@ -44,7 +44,9 @@ class RsvpAction extends FormAction
|
||||
{
|
||||
protected $form = 'RSVP';
|
||||
|
||||
public $rsvp = "";
|
||||
protected $event = null;
|
||||
public $args;
|
||||
|
||||
function title()
|
||||
{
|
||||
@ -54,11 +56,21 @@ class RsvpAction extends FormAction
|
||||
|
||||
protected function doPreparation()
|
||||
{
|
||||
if (isset($this->args["yes"])) {
|
||||
$this->rsvp = "yes;
|
||||
} else if (isset($this->args["maybe"])) {
|
||||
$this->rsvp = "maybe";
|
||||
} else if (isset($this->args["cancel"])) {
|
||||
$this->rsvp = "cancel";
|
||||
} else {
|
||||
$this->rsvp = "no";
|
||||
}
|
||||
|
||||
if ($this->trimmed('notice')) {
|
||||
$stored = Notice::getByID($this->trimmed('notice'));
|
||||
$this->event = Happening::fromStored($stored);
|
||||
} else {
|
||||
$this->event = Happening::getByKeys(['uri'=>$this->trimmed('event')]);
|
||||
$this->event = Happening::getByKeys(['uri' => $this->trimmed('event')]);
|
||||
}
|
||||
|
||||
$this->formOpts['event'] = $this->event;
|
||||
@ -66,7 +78,7 @@ class RsvpAction extends FormAction
|
||||
|
||||
protected function doPost()
|
||||
{
|
||||
if ($this->trimmed('rsvp') === 'cancel') {
|
||||
if ($this->rsvp === 'cancel') {
|
||||
$rsvp = RSVP::byEventAndActor($this->event, $this->scoped);
|
||||
try {
|
||||
$notice = $rsvp->getStored();
|
||||
@ -81,7 +93,7 @@ class RsvpAction extends FormAction
|
||||
return _m('Cancelled RSVP');
|
||||
}
|
||||
|
||||
$verb = RSVP::verbFor(strtolower($this->trimmed('rsvp')));
|
||||
$verb = RSVP::verbFor(strtolower($this->rsvp));
|
||||
$options = array('source' => 'web');
|
||||
|
||||
$act = new Activity();
|
||||
|
@ -61,6 +61,7 @@ class TimelistAction extends Action {
|
||||
parent::handle();
|
||||
|
||||
if (!common_logged_in()) {
|
||||
error_log("penis1");
|
||||
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
|
||||
$this->clientError(_m('Not logged in.'));
|
||||
}
|
||||
@ -68,6 +69,7 @@ class TimelistAction extends Action {
|
||||
if (!empty($this->start)) {
|
||||
$times = EventTimeList::getTimes($this->start, $this->duration);
|
||||
} else {
|
||||
error_log("penis2");
|
||||
// TRANS: Client error when submitting a form with unexpected information.
|
||||
$this->clientError(_m('Unexpected form submission.'));
|
||||
}
|
||||
@ -76,6 +78,7 @@ class TimelistAction extends Action {
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
print json_encode($times);
|
||||
} else {
|
||||
error_log("penis3");
|
||||
// TRANS: Client error displayed when using an action in a non-AJAX way.
|
||||
$this->clientError(_m('This action is AJAX only.'));
|
||||
}
|
||||
@ -88,7 +91,9 @@ class TimelistAction extends Action {
|
||||
* @param string $msg error message
|
||||
* @param int $code error code
|
||||
*/
|
||||
function clientError($msg, $code = 400) {
|
||||
function clientError($msg, $code = 400, ?string $format = null): void
|
||||
{
|
||||
error_log("penis");
|
||||
if ($this->boolean('ajax')) {
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
print json_encode(
|
||||
|
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
include("lib/discovery.php");
|
||||
include("../plugins/LRDD/lib/discovery.php");
|
||||
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/extlib/');
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("classes/Usage_stats.php");
|
||||
include("../plugins/Nodeinfo/classes/Usage_stats.php");
|
||||
|
||||
/**
|
||||
* Controls cache and routes
|
||||
|
@ -26,10 +26,10 @@
|
||||
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("classes/Ostatus_profile.php");
|
||||
include("classes/FeedSub.php");
|
||||
include("classes/HubSub.php");
|
||||
include("classes/Magicsig.php");
|
||||
include("../plugins/OStatus/classes/Ostatus_profile.php");
|
||||
include("../plugins/OStatus/classes/FeedSub.php");
|
||||
include("../plugins/OStatus/classes/HubSub.php");
|
||||
include("../plugins/OStatus/classes/Magicsig.php");
|
||||
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'util.php';
|
||||
|
||||
|
@ -27,6 +27,9 @@ defined('GNUSOCIAL') || die();
|
||||
*/
|
||||
class OStatusQueueHandler extends QueueHandler
|
||||
{
|
||||
public $notice;
|
||||
public $user;
|
||||
|
||||
// If we have more than this many subscribing sites on a single feed,
|
||||
// break up the WebSub distribution into smaller batches which will be
|
||||
// rolled into the queue progressively. This reduces disruption to
|
||||
|
@ -30,9 +30,9 @@
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
include("classes/User_openid.php");
|
||||
include("classes/User_openid_trustroot.php");
|
||||
include("classes/User_openid_prefs.php");
|
||||
include("../plugins/OpenID/classes/User_openid.php");
|
||||
include("../plugins/OpenID/classes/User_openid_trustroot.php");
|
||||
include("../plugins/OpenID/classes/User_openid_prefs.php");
|
||||
|
||||
/**
|
||||
* Plugin for OpenID authentication and identity
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
include("lib/opportunisticqueuemanager.php");
|
||||
include("../plugins/OpportunisticQM/lib/opportunisticqueuemanager.php");
|
||||
|
||||
class OpportunisticQMPlugin extends Plugin {
|
||||
const PLUGIN_VERSION = '3.0.0';
|
||||
|
@ -31,9 +31,9 @@
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
include("classes/Poll.php");
|
||||
include("classes/Poll_response.php");
|
||||
include("classes/User_poll_prefs.php");
|
||||
include("../plugins/Poll/classes/Poll.php");
|
||||
include("../plugins/Poll/classes/Poll_response.php");
|
||||
include("../plugins/Poll/classes/User_poll_prefs.php");
|
||||
|
||||
/**
|
||||
* Poll plugin main class
|
||||
|
@ -36,6 +36,8 @@ defined('GNUSOCIAL') || die();
|
||||
*/
|
||||
class Poll_response extends Managed_DataObject
|
||||
{
|
||||
public $votes;
|
||||
|
||||
public $__table = 'poll_response'; // table name
|
||||
public $id; // char(36) primary key not null -> UUID
|
||||
public $uri; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("classes/Registration_ip.php");
|
||||
include("../plugins/RegisterThrottle/classes/Registration_ip.php");
|
||||
|
||||
/**
|
||||
* Throttle registration by IP address
|
||||
|
@ -31,7 +31,7 @@
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
include("classes/TagSub.php");
|
||||
include("../plugins/TagSub/classes/TagSub.php");
|
||||
|
||||
/**
|
||||
* TagSub plugin main class
|
||||
|
@ -28,9 +28,9 @@
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
include("lib/webfingerresource.php");
|
||||
include("lib/webfingerresource/notice.php");
|
||||
include("lib/webfingerresource/profile.php");
|
||||
include("../plugins/WebFinger/lib/webfingerresource.php");
|
||||
include("../plugins/WebFinger/lib/webfingerresource/notice.php");
|
||||
include("../plugins/WebFinger/lib/webfingerresource/profile.php");
|
||||
|
||||
class WebFingerPlugin extends Plugin
|
||||
{
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("lib/queuedxmpp.php");
|
||||
include("lib/xmppmanager.php");
|
||||
include("../plugins/Xmpp/lib/queuedxmpp.php");
|
||||
include("../plugins/Xmpp/lib/xmppmanager.php");
|
||||
|
||||
/**
|
||||
* Plugin for XMPP
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
include("../plugins/Xmpp/lib/sharingxmpp.php");
|
||||
|
||||
use XMPPHP\Log;
|
||||
|
||||
|
@ -62,6 +62,7 @@ define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
|
||||
define('GNUSOCIAL', true);
|
||||
define('STATUSNET', true); // compatibility
|
||||
|
||||
include ("../debug.php");
|
||||
include("../lib/util/util.php");
|
||||
|
||||
$user = null;
|
||||
|
14
vendor/embed/embed/src/Adapters/Webpage.php
vendored
14
vendor/embed/embed/src/Adapters/Webpage.php
vendored
@ -9,6 +9,20 @@ use Embed\Providers;
|
||||
*/
|
||||
class Webpage extends Adapter
|
||||
{
|
||||
public $url;
|
||||
public $authorName;
|
||||
public $title;
|
||||
public $description;
|
||||
public $width;
|
||||
public $height;
|
||||
public $code;
|
||||
public $type;
|
||||
public $imageWidth;
|
||||
public $imageHeight;
|
||||
public $imagesUrls;
|
||||
public $images;
|
||||
public $image;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
5
vendor/embed/embed/src/Http/Url.php
vendored
5
vendor/embed/embed/src/Http/Url.php
vendored
@ -313,7 +313,8 @@ class Url
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
$path = !empty($this->info['path']) ? '/'.implode('/', array_map('self::urlEncode', $this->info['path'])).'/' : '/';
|
||||
$path = !empty($this->info['path']) ? '/' . implode('/', array_map('Url::urlEncode', $this->info['path'])) . '/' : '/';
|
||||
|
||||
|
||||
if (isset($this->info['file'])) {
|
||||
$path .= self::urlEncode($this->info['file']);
|
||||
@ -641,7 +642,7 @@ class Url
|
||||
function ($matches) {
|
||||
return rawurlencode($matches[0]);
|
||||
},
|
||||
$url
|
||||
$url ?? ""
|
||||
);
|
||||
|
||||
$parts = parse_url($enc_url);
|
||||
|
2
vendor/embed/embed/src/Providers/OEmbed.php
vendored
2
vendor/embed/embed/src/Providers/OEmbed.php
vendored
@ -48,7 +48,7 @@ class OEmbed extends Provider
|
||||
{
|
||||
$type = $this->bag->get('type');
|
||||
|
||||
if (strpos($type, ':') !== false) {
|
||||
if (strpos($type ?? "", ':') !== false) {
|
||||
$type = substr(strrchr($type, ':'), 1);
|
||||
}
|
||||
|
||||
|
4
vendor/embed/embed/src/Utils.php
vendored
4
vendor/embed/embed/src/Utils.php
vendored
@ -235,7 +235,7 @@ class Utils
|
||||
$encodings = array_map('strtoupper', mb_list_encodings());
|
||||
|
||||
if (in_array($charset, $encodings, true)) {
|
||||
return mb_convert_encoding($content, 'UTF-8', $charset);
|
||||
return htmlspecialchars($content, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||
}
|
||||
|
||||
if (function_exists('iconv')) {
|
||||
@ -306,7 +306,7 @@ class Utils
|
||||
$detected = mb_detect_encoding($string, implode(',', array_keys(self::$encodings)), true);
|
||||
|
||||
if ($detected && isset(self::$encodings[$detected])) {
|
||||
$string = mb_convert_encoding($string, 'HTML-ENTITIES', $detected);
|
||||
$string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $detected);
|
||||
$string = preg_replace(
|
||||
'/<head[^>]*>/',
|
||||
'<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset='.self::$encodings[$detected].'">',
|
||||
|
@ -90,36 +90,14 @@ class UTF8Utils
|
||||
* converted to U+FFFD REPLACEMENT CHARACTER code points.
|
||||
*/
|
||||
|
||||
// mb_convert_encoding is chosen over iconv because of a bug. The best
|
||||
// htmlspecialchars is chosen over iconv because of a bug. The best
|
||||
// details for the bug are on http://us1.php.net/manual/en/function.iconv.php#108643
|
||||
// which contains links to the actual but reports as well as work around
|
||||
// details.
|
||||
if (function_exists('mb_convert_encoding')) {
|
||||
// mb library has the following behaviors:
|
||||
// - UTF-16 surrogates result in false.
|
||||
// - Overlongs and outside Plane 16 result in empty strings.
|
||||
|
||||
// Before we run mb_convert_encoding we need to tell it what to do with
|
||||
// characters it does not know. This could be different than the parent
|
||||
// application executing this library so we store the value, change it
|
||||
// to our needs, and then change it back when we are done. This feels
|
||||
// a little excessive and it would be great if there was a better way.
|
||||
$save = mb_substitute_character();
|
||||
mb_substitute_character('none');
|
||||
$data = mb_convert_encoding($data, 'UTF-8', $encoding);
|
||||
mb_substitute_character($save);
|
||||
}
|
||||
// @todo Get iconv running in at least some environments if that is possible.
|
||||
elseif (function_exists('iconv') && 'auto' !== $encoding) {
|
||||
// fprintf(STDOUT, "iconv found\n");
|
||||
// iconv has the following behaviors:
|
||||
// - Overlong representations are ignored.
|
||||
// - Beyond Plane 16 is replaced with a lower char.
|
||||
// - Incomplete sequences generate a warning.
|
||||
$data = @iconv($encoding, 'UTF-8//IGNORE', $data);
|
||||
} else {
|
||||
throw new Exception('Not implemented, please install mbstring or iconv');
|
||||
}
|
||||
$save = mb_substitute_character();
|
||||
mb_substitute_character('none');
|
||||
$data = htmlspecialchars($data, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||
mb_substitute_character($save);
|
||||
|
||||
/*
|
||||
* One leading U+FEFF BYTE ORDER MARK character must be ignored if any are present.
|
||||
|
4
vendor/mf2/mf2/Mf2/Parser.php
vendored
4
vendor/mf2/mf2/Mf2/Parser.php
vendored
@ -93,7 +93,7 @@ function fetch($url, $convertClassic = true, &$curlInfo=null) {
|
||||
* @return string
|
||||
*/
|
||||
function unicodeToHtmlEntities($input) {
|
||||
return mb_convert_encoding($input, 'HTML-ENTITIES', mb_detect_encoding($input));
|
||||
return htmlspecialchars($input, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,7 +112,7 @@ function collapseWhitespace($str) {
|
||||
|
||||
function unicodeTrim($str) {
|
||||
// this is cheating. TODO: find a better way if this causes any problems
|
||||
$str = str_replace(mb_convert_encoding(' ', 'UTF-8', 'HTML-ENTITIES'), ' ', $str);
|
||||
$str = str_replace(htmlspecialchars(' ', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), ' ', $str);
|
||||
$str = preg_replace('/^\s+/', '', $str);
|
||||
return preg_replace('/\s+$/', '', $str);
|
||||
}
|
||||
|
2
vendor/mf2/mf2/tests/Mf2/ParserTest.php
vendored
2
vendor/mf2/mf2/tests/Mf2/ParserTest.php
vendored
@ -23,7 +23,7 @@ class ParserTest extends PHPUnit_Framework_TestCase {
|
||||
public function testUnicodeTrim() {
|
||||
$this->assertEquals('thing', Mf2\unicodeTrim(' thing '));
|
||||
$this->assertEquals('thing', Mf2\unicodeTrim(' thing '));
|
||||
$this->assertEquals('thing', Mf2\unicodeTrim(mb_convert_encoding(' thing ', 'UTF-8', 'HTML-ENTITIES') ));
|
||||
$this->assertEquals('thing', Mf2\unicodeTrim(htmlspecialchars(' thing ', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ));
|
||||
}
|
||||
|
||||
public function testMicroformatNameFromClassReturnsFullRootName() {
|
||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする