122 Commits

Author SHA1 Message Date
surrim
9a60f9a494
Php8 fixes for #766 (#769)
* init empty vars to avoid PHP8 warnings

* removed debug output for serendipity_session_destroy()

* init smarty fixed for PHP8

* removed optional parameters for PHP 8

* 2k11 template fixes, maybe updating smarty will solve everything

* init or test undefined variables for PHP 8

* remove only existing files

* make sure string is not empty before comparing the first letter

* check if SMARTY_DIR was already defined

* use mb_language('uni') for unicode

* fixed image filter bug

* Smarty debug fixed in external lib

* fixed archive bug

* fixed entries bug

* updated plugin versions

Co-authored-by: surrim <surrim@happyhydro.org>
2021-07-18 22:14:23 +02:00
onli
01aa046fc4 PHP 8 compat fixes for bartleby 2021-07-04 15:34:44 +02:00
onli
28c199c7aa php8 compat fixes for groups section 2021-05-13 17:57:07 +02:00
onli
4c246ad426 php8 compat fixes for entry preview 2021-05-09 16:54:27 +02:00
onli
395d018908 php8 compat for login 2021-05-06 20:45:19 +02:00
onli
90dd334327 PHP 8 compatibility fixes for the installer 2021-05-02 09:50:58 +02:00
onli
1fcb77427e php8 compat fix: $lang and $cond['joins'] unset before access 2021-04-19 17:19:44 +02:00
onli
df6d80f328 php 8 compat: Fix unused key and empty path, for css 2021-04-19 17:19:44 +02:00
onli
0a4911566c php8 compat: Prevent unused key error 2021-04-19 17:19:44 +02:00
onli
b36ad0f14f php8 compat: fix undefined key 2021-04-19 17:19:44 +02:00
onli
bfc7d135a4 php8 compat: fix undefined keys 2021-04-19 17:19:44 +02:00
onli
75352e8565 php8 compat: Pass undefined user and password error 2021-04-19 17:19:44 +02:00
Hanno Böck
931e621549 Replace token generation with hash and uniqid with secure random numbers from random_bytes 2021-02-03 17:44:12 +01:00
Stephan Brunker
3d975cd562 syntax fixes, if without brackets 2020-06-06 01:51:25 +02:00
Eike Rathke
906239faa1 Set hashtype = 2 when converting from MD5
Otherwise we'd end up with an attempt to authenticate with SHA1 against
BCRYPT that never succeeds, see
https://board.s9y.org/viewtopic.php?t=24720
2020-04-26 22:01:25 +02: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
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
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
Jari Turkia
260efcc5a6 Make sure there is a $serendipity['lang'] defined by serendipity_getSessionLanguage() 2019-03-10 11:31:25 +01:00
onli
f948279583 Fix autologin token, form tokens failed cause session was not set 2019-02-20 23:06:13 +01:00
onli
c737565c13 Improve autologin token security by setting httpOnly and secure flag 2019-02-20 22:24:05 +01:00
onli
c7c133ef1d Set the bcrypt hashtype as the default for user creation 2018-06-12 22:43:19 +02:00
onli
eafc4dd625 Move from SHA1 to bcrypt
SHA1 is not an ideal password hash, even when salted, because it is cheap to compute. Since version 5.5 PHP offers bcrypt built in, which is a more expensive and secure hash function specifically suited for passwords
2018-03-23 18:02:02 +01:00
onli
52a41b37d5 Rework autologin to use a token approach
The prior code stored encrypted user data in the cookie that was then checked. This new approach is cleaner, as it only stores a token, and it does not use problematic crypto functions deprecated in PHP 7.2
2018-03-23 18:01:32 +01:00
onli
19b023529d Merge pull request #448 from gnuheidix/admin_username
HTTP500: crashing when username is an array
2017-04-11 15:02:50 +02:00
klemens
5a95db314a spelling fixes 2017-04-06 22:26:07 +02:00
Thomas Heidrich
3a7e04c69c improved check quality
!empty verifies that $username has been set with a significant value of any kind; is_string makes sure the type is really what is being expected in the following code.
2017-02-09 23:39:06 +01:00
Thomas Heidrich
e28bbf04d2 avoid HTTP500 crashing when username is an array 2017-02-08 20:19:43 +01:00
Matthias Mees
7410465496 Improve accessibility of iconfont icons
Iconfont icons are of no value to screenreader users; in our case,
they get alternative text. By adding 'aria-hidden="true"' to the
<span> holding the iconfont icon, we avoid the screenreader trying
to announce the iconfont icon.
2016-10-26 11:29:25 +02:00
onli
6419df26e0 Improve getTemplateFile performance by avoiding double lookups 2016-07-24 20:22:14 +02:00
onli
8affa1126a Massively simplify fallback chain logic
Should've been tested in the alpha, but given the problems with the preview logic (see http://board.s9y.org/viewtopic.php?f=3&t=20791) I'm convinced we need this now. This mainly reworks serendipity_getTemplateFile to follow a simple scheme on where to look for templates – either in the backend or frontend, based on where we are but overridable, then in the engine, then in the defaultTemplate as fallback.
2016-07-24 20:13:36 +02:00
onli
73ea0c4b1e Restore session id change on logout (#399) 2016-04-27 18:12:48 +00:00
onli
a8ac90c466 Init php 7 compatibility (#399)
A first approach at fixing s9y for php 7, which makes it possible to
write an entry without any error message. The specific changes are: 1.
__construct for the plugin classes 2. Update Cache Lite to a modern
version to fix its similar constructor problem 3. Remove the
session_regenerate_id call from the session destructor (should get
re-added to session creation where necessary) 4. Remove error handler to
prevent silenced warnings from becoming fatal exceptions
2016-04-26 22:39:11 +00:00
Ian
d93674485d cleaups 2016-03-19 17:18:11 +01:00
Ian
d7b1e7d23d minor whitespace and code cleanup
and a small github docnote fix
and added a todo for transforming a filename into a valid  upload path
2015-09-30 11:22:37 +02:00
Ian
d5eae21a9c suggested fix for the Serendipity fallback chaining
This fixes the plugin tpl fallback for all plugins, already using the parseTemplate() method. All others, which may still follow the themes fallback (like contactform etc), would need to always be part of the user template $serendipity['template'], or be fixed later on.

This also fixes the backend chaining, which now simply follows the force with a possible engine and then uses $serendipity['template_backend'] (2k11), $serendipity['defaultTemplate'] (2k11), 'default'.

As a third, this now uses the correct preview_iframe.tpl file on save and checks for a correct set jquery_backend.js in the user theme $serendipity['template'].

Please double check this approach for cases I did not find yet. Thanks! :)


References #343
2015-08-16 18:05:59 +02:00
Ian
8b8dcfd968 minors 2015-08-15 16:44:45 +02:00
Garvin Hicking
e7d822be11 Things I noticed for s9y.github.io 2015-03-19 16:17:30 +01:00
Garvin Hicking
98cd0e0541 fix 2015-03-16 14:07:24 +01:00
Garvin Hicking
5f59a811e8 Allow to set custom cookie validity.
Will be needed for blog.s9y.org templatechooser, which is why I need it in 2.0.1
2015-03-16 13:58:52 +01:00
Garvin Hicking
88a4776891 Fix not initializing smarty framework in the preview iframe, which lead to templates
config.inc.php files not being loaded (to hook into a config.inc.php)
2015-03-13 15:37:10 +01:00
Ian
aca77bd482 cleanup cosmetics 2014-12-10 14:34:54 +01:00
Garvin Hicking
4d17c0ae02 Added SQLite3 OO layer, old one did not work for PHP 5.4+
PDO SQlite3 is preferrable though
2014-11-24 11:48:16 +01:00
Garvin Hicking
26535ec09c Patch remaining usages of html_entity_decode
Document
2014-11-24 09:57:47 +01:00
onli
92afc37753 Introduce serendipity_specialchars-wrapper for encoding bug (#236)
PHP 5.4 sets UTF-8 as the default for htmlspecialchars, htmlentities and html_entity_decode. The first two will echo an empty string when given a string with umlauts. This commits introduces serendipity_specialchar-wrapper that are meant to be a temporary solution for the s9y-core until PHP 5.6 fixed the bug, so the native charset option of s9y continues to work.
2014-11-23 23:41:08 +01:00
Ian
d15c4c81b8 force_frontend_fallback chaining
References #148
2014-11-19 15:23:10 +01:00
Ian
530dff515b fix whitespaces and change a msg error string to 2.0 style 2014-11-17 19:37:17 +01:00
Garvin Hicking
83d19d183d stricter array check, thanks to wesley 2014-07-11 11:58:07 +02:00
Garvin Hicking
20cf96e969 move "smarty preview" to actual case, should fix the "entry saved" missing message 2014-06-03 11:09:00 +02:00
onli
3f18352bdc let preview use frontend-theme templates (#172) 2014-05-30 00:14:11 +02:00