1670 Commits

Author SHA1 Message Date
Thomas Hochstein
7ca42f379f Fix typo (ML renaming code).
Fixes 2ccb43a271a41eba90fba1bacc46965f8323437f

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 16:23:21 +01:00
Thomas Hochstein
e792a8d913 Fix RCE vulnerability on Windows.
Steps to reproduce:

1) Upload a PHP script to the Media Libray,
   naming it "test" (or any other name
   without extension).
2) Rename it to "exploit.php." (trailing dot!)

On Linux, the file will be renamed to
"exploit.php..", which is safe and
cannot be exploited.

On Windows though, the file will be
renemad to "exploit.php" and is then
remotely executable by calling it
from "/uploads/exploit.php".

Thanks to Junyu Zhang <rgdz.eye@gmail.com>
for spotting this!

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 15:04:31 +01:00
Thomas Hochstein
21c3b0d83f Add missing active content check for renaming.
After fixing the other ML file renaming bugs,
it was now possible to rename a file without
extension into a file that *does* have an
extension - so we need to check against
active content.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 15:04:25 +01:00
Thomas Hochstein
0b2d6bf931 Really set source of plugins.
Fixes d179f1b1540768eb13e75795457822e6477541cc

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 15:03:31 +01:00
Thomas Hochstein
2ccb43a271 Fix for "disappearing" media files after renaming.
The renaming code added a dot '.' to the
filename on disk even if the file hat no
extension. Therefore, the file name on disk was
different from the name in the database,
triggering the database purging code on the
next ML display.

(serendipity_displayImageList() will delete
files from the database that don't exist
any longer on disk.)

This code won't add spurious dots for
empty extensions, keeping disk and
database in sync.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 13:10:46 +01:00
Thomas Hochstein
fd49846aa1 Add different error messages for ML rename.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 13:06:33 +01:00
Thomas Hochstein
18ab57b76b ML: Really add error message when renaming fails.
Fixes 1c95c173a22e15fa22b21d3466b8e5cc9e626645
2020-03-25 11:03:34 +01:00
Thomas Hochstein
1c95c173a2 ML: Add error message when renaming fails.
Completing 1ed4b9e7eca2a0c371582a454c232c

As we already have an (unused) language
constant for this error, we seem to have
had this kind of check before ...

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-25 00:54:48 +01:00
Thomas Hochstein
b12c098bd0 Add author to details of installed plugins.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-24 16:12:31 +01:00
Thomas Hochstein
d179f1b154 Add plugin source to list of plugins.
* plugin_api.inc.php:
  - Add static list of bundled plugins.
  - Add function to check if plugin is
    bundled.
* plugins.inc.php:
  - Set source of plugin
    (Spartacus, bundled or local).
* plugins.inc.tpl:
  - Display plugin source.
* Add language constants.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-24 15:57:48 +01:00
Thomas Hochstein
f576501737 Revert "Save remote plugin source when merging remote / local data."
This reverts commit 8c702769e428f49671f20b6d1e57c210e52222a7.

We can do this better.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-24 15:36:49 +01:00
Thomas Hochstein
8c702769e4 Save remote plugin source when merging remote / local data.
When installing / updating plugins, plugin data
is fetched from Spartacus first; those plugins
will habe "Spartacus" as "pluginlocation".

Later on, information about installed plugins
is fetched from cache / database, overwriting
the previously fetched data for all installed
plugins. After that, "pluginlocation" is
"local" even for plugins that live on
Spartacus if they have been installed.

So we save "pluginlocation" data to a new
"pluginsource" field before merging /
overwriting so we can detect plugins that
are available on Spartacus.

This data is present in plugins.inc.tpl
and can be used there.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-23 22:28:43 +01:00
onli
8a1ab31a66 Remove utf8mb4_ready requirement from native -> utf8 upgrade 2020-03-23 17:25:04 +01:00
onli
be422b5e83 Add maintenance tasK: native -> utf8, utf8 -> utf8mb4
Note: Native to utf8 will not work if the data in the database table is actually utf8! These are helper functions for during the alpha, to make testing easier, not tasks for the beta/stable
2020-03-23 17:15:56 +01:00
onli
af036ca58d Add warning to upgrade task for utf8mb4 upgrade 2020-03-23 09:57:59 +01:00
onli
a6f9ec1638 fix: don't ugprade only entries, but all our databases 2020-03-23 00:03:20 +01:00
onli
945b73dc34 Use utf8mb4_unicode_ci instead of utf8mb4_general_ci in upgrade 2020-03-22 23:52:01 +01:00
onli
c6800d5fc3 minor: explain serendipity_utf8mb4_ready in doccomment 2020-03-22 23:20:08 +01:00
onli
3ac81b91ca Reworked version and function requirement for utf8mb4 (#394) 2020-03-22 23:13:15 +01:00
onli
fa17e0709c Upgrade task to move utf8 mysql databases to utf8mb4 (#394) 2020-03-22 22:15:23 +01:00
onli
8b27a56209 Raise mysql requirements for utf8mb4 to 5.7/10.0.2
utf8mb4 did not work on a test server with large prefix (=not 3000 byte index limit, only 1000) on Depian 9/mariadb 10.1.44, because the row format was not barracuda (by default?)
2020-03-22 20:44:11 +01:00
onli
b15a453165 Use InnoDB and utf8mb4 on current mysql databases
For new installations only so far
2020-03-22 13:15:32 +01:00
Thomas Hochstein
b718637794 Set empty limit to "" in serendipity_fetchEntries.
If $limit is empty(), no limit is set, so we can
set the LIMIT statement to "" to achieve the same.

But an empty() $limit can be "0", so the
generated SQL statement could end with "0"
instead of the LIMIT statement. We catch this
with forcing an empty() $limit to "".

Fixes #636.
(No matter that this shouldn't even happen.)

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-21 17:59:13 +01:00
Thomas Hochstein
1ed4b9e7ec Prevent renaming ML object into existing file.
When renaming objects in the Media Library,
s9y didn't check if a file with the same
name already exists, resulting in a file
name collision deleting both files from
the database _and_ from disk.

Add a check to avoid that.

An error message would be nice, too, but
that may be added later on.

Tested on s9y-stable test instance.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2020-03-20 17:54:29 +01:00
surrim
ed778d7199 changed parameters order for implode() 2020-03-17 15:48:36 +01:00
surrim
bd70590359 init 2020-03-16 23:51:17 +01:00
Lothar Serra Mari
137330fd5b Don't allow requesting an archive page that doesn't exist 2019-12-15 13:17:29 +01:00
Stephan Brunker
756f520d71 functions_routing.php: set action to empty when serving JS
genpage is called but no action given - the default page was generated at every call.
2019-12-15 13:16:28 +01:00
Garvin Hicking
4d770c9cc6 [TASK] Adds ability to make plugins change the multi-media insertion gallery HTML 2019-12-03 15:50:51 +01:00
Stephan Brunker
aa1f3b533d Fix category page title - strip_langs - 2019-11-02 14:20:18 +01:00
Stephan Brunker
d75e311077 added event_hook multilingual_strip_langs to permalinks 2019-11-02 14:20:18 +01:00
Stephan Brunker
5c4c11f0b4 fixing multilingual issues: display languages in native names and fix initialition point of plugins 2019-11-02 14:20:18 +01:00
Garvin Hicking
b4f0b35a5d
Merge pull request #650 from stephanbrunker/master
Fix a lot of single issues and overhaul the language settings
2019-10-17 13:46:06 +02:00
Stephan Brunker
ea371f6a4e fixed requested changes, array processing of multilingual_stip_langs 2019-10-15 22:45:02 +02:00
Garvin Hicking
5b35569e73 [BUGFIX] Fixes missing referenced variable when $_GET['serendipity'] is not an array
refs #642
refs #653
2019-10-15 14:03:34 +02:00
Stephan Brunker
502b837dd6 Fix a lot of single issues and overhaul the language settings
see docs/NEWS and the plugin/changelog files for details
2019-10-13 22:49:03 +02:00
Hanno
5765d1a779
Avoid undefined index notices, see https://github.com/s9y/Serendipity/issues/642 2019-10-13 18:21:18 +02:00
Thomas Hochstein
f4d07960bb Assume uninitialized constant PLUGIN_LINK_SPARTACUS.
Fixes #638.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-13 17:35:58 +02:00
Thomas Hochstein
722a4ef4c4 Fix a typo in a comment.
Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-13 17:20:45 +02:00
Thomas Hochstein
9867d70fac Fix mangling of auto-generated mails.
s9y will encode the body of its auto-generated
mails as quoted-printable when imap_8bit() is
available. imap_8bit() will use "\r\n" as
linebreaks as mandated for SMTP transfer.
The result will be transmitted via PHP's
mail() function, using direct SMTP on
Windows and piping it to a MTA on Unix.

Most MTAs will cope just fine with those
linebreaks, while qmail will not; it will
replace all "\n" linebreaks with "\r\n",
so we get "\r\r\n" in our case. We can't
"fix" qmail (as its maintainer, if there
even is one, does not consider this
behaviour wrong), but we can replace the
line endings we get from imap_8bit().

The fix does work with qmail and Exim and
should work with sendmail and Postfix and
other MTAs, too. It may break sending
mail on Windows (i.e. lose all linebreaks),
but I think that's acceptable, as we'll
have more qmail installation than Windows
servers out there.

A workaround could be to set
serendipity['forceBase64']=true in
serendipity_config_local.inc.php, but I'd
prefer this fix.

Fixes #644.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-10-13 13:15:27 +02:00
onli
27fd525706 fix: rotate image did not rotate all thumbnails 2019-10-10 23:41:52 +02:00
Garvin Hicking
e8b8be0342 [TASK] Prevents PHP warnings with type differences on $_REQUEST['serendipity']
refs #642
2019-10-07 17:03:33 +02:00
Eike Rathke
07a241798d With MySQL use cast(okey as unsigned) instead of cast(okey as integer)
The autologin ("Save information") functionality in 2.3.1 is broken since

    commit 52a41b37d554da11acc932eeec44c5fb1414a492
    CommitDate: Fri Mar 23 18:01:32 2018 +0100

	Rework autologin to use a token approach

Although a cookie serendipity[author_autologintoken] with correct
expiration (one month) which random data content is present as value
in the serendipity_options table with name autologin_Username and
correct timestamp as okey and that is found with manually executing
the SQL statement

  SELECT name, value, okey FROM serendipity_options WHERE name = 'autologin_Username' AND okey > 1565801743 LIMIT 1

like done in include/functions_config.inc.php
serendipity_checkAutologin(), the login is forgotten after 30 minutes
or so. That was not the case with 2.1.5 where the login was valid for
weeks.

Of

    if (stristr($serendipity['dbType'], 'sqlite')) {
        $cast = "okey";
    } else {
        // Adds explicits casting for mysql, postgresql and others.
        $cast = "cast(okey as integer)";
    }

from which $cast then is used in the SQL statement instead of a plain
okey; when doing that manually with

  SELECT name, value, okey FROM serendipity_options WHERE name = 'autologin_Username' AND cast(okey as integer) > 1565801743 LIMIT 1

it produces the MySQL error

  #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'integer) > 1565801743 LIMIT 1' at line 1

This also with $serendipity['dbType'] = 'mysqli' for the above code.

Indeed, cast(okey as integer) is invalid in MySQL and should be
cast(okey as unsigned) instead which then also works manually, see
https://stackoverflow.com/a/12127022 and
https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_cast

Same in serendipity_issueAutologin().

Changing those two places accordingly resolves the autologin not
persistent problem.

Additionally, inspecting the serendipity_options table revealed loads
of old serendipity[author_authorinformation] cookie information that
was never deleted in serendipity_issueAutologin() with the

  OR (okey LIKE 'l_%' AND $cast < " . (time() - 1814400) . ")")

expression producing a MySQL error. This has to be done manually
once as also 2.3.1 will not delete it anymore.
2019-09-06 10:48:36 +02:00
Thomas Hochstein
12bb9c0cc0 Fix media library (mass) delete.
Fixes #619.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 01:36:51 +02:00
Thomas Hochstein
ebb852d400 Fix prev/next page links for stable archives.
We shouldn't swap prev/next links for archive
pages. With stable archives, the title page is
the last page of the archive, not the first, so
all other pages are "previos", and we should
display it like that.

That may seem counterintuitive at first, but
otherwise archive page directions and pagination
directions don't match (see bulletproof), and we
shouldn't count archive pages differently from
the URL. With the current code, page 100 of 100
archive pages would be shown in footer_info as
page 1, page 99 as page 2, and that doesn't make
sense either.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-17 00:52:19 +02:00
Thomas Hochstein
f4d47812a5 Fix core pagination for "stable archives".
The current page will always be the current page,
regardless of archive sorting order. Page 76 of
86 pages will remain page 76, even if the archive
sorting is changed; it won't become page 10.

Fixes #625 in core.

Themes will have to cope with the sorting order
in their pagination code if they want to display
a descending order for stable archive sorting.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-16 21:37:45 +02:00
Thomas Hochstein
221bd4a4c7
Merge pull request #620 from th-h/thh-plugin-notifier
Add plugin update notifications.
2019-08-13 22:21:28 +02:00
Thomas Hochstein
4e88c875d8 Add Spartacus links to plugin lists.
Quite some information is missing from
the list of installed plugins; and the
list of installable plugins has some
more information, but not everything
that is present on Spartacus, i.e.
the last modification date.

So let's add a link to the plugin entry
on Spartacus (in the chosen language
version).

Fixes #471.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 13:44:46 +02:00
Thomas Hochstein
53f63342c6 Fix typo / unify PHP and smarty variable names.
"requirement_failures" from PHP is saved in
"requirements_failues" - "requirements" as
in plural, and with a typo. That doesn't make
sense. Let's use "requirement_failures"
everywhere.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 02:18:09 +02:00
Thomas Hochstein
35cd41d4ef Wording change for plugin version display.
"Version" should be at the start of a
sentence or line.

Signed-off-by: Thomas Hochstein <thh@inter.net>
2019-08-11 01:50:28 +02:00