1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

54 Commits

Author SHA1 Message Date
Maurício Meneghini Fauth
cdf59074d3 Replace languages.inc globals with I18n\Languages consts (#1121)
The include/languages.inc file was not removed as it's used in other
repositories. It should be removed after migration.

Tests were added to ensure that the global variables and the constants
are in sync with each other.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2024-11-14 11:37:00 +03:00
Maurício Meneghini Fauth
817a3e7fd9 Move myphpnet_* functions to the UserPreferences class (#1075) 2024-11-11 11:50:15 +03:00
Takuya Aramaki
38ef33f923 Move language_choose_code() into new LangChooser class (#1081) 2024-10-14 18:48:22 +05:00
Takuya Aramaki
c7425ed96a Remove LAST_LANG cookie as it is not used anymore. (#1072)
See 7691b44067
2024-09-17 10:35:59 +03:00
Andreas Möller
00342c402f Fix: Remove vim instruction (#880) 2023-12-07 15:01:52 +01:00
Andreas Möller
45d49c7e95 Fix: Remove emacs instruction (#876) 2023-12-07 11:44:39 +00:00
Andreas Möller
c093fb5382 Enhancement: Enable trailing_comma_in_multiline fixer (#647)
* Enhancement: Enable and configure trailing_comma_in_multiline fixer

* Fix: Run 'make coding-standards'
2023-12-06 23:16:28 +00:00
Andreas Möller
1ebc2c4996 Enhancement: Enable binary_operator_spaces fixer
Closes GH-667.
2022-08-22 19:17:38 +02:00
Andreas Möller
d9bcfed482 Enhancement: Enable array_syntax fixer
Co-authored-by: MathiasReker <mathias@reker.dk>

Closes GH-659.
2022-08-22 18:59:14 +02:00
Andreas Möller
cdb83249d3 Enhancement: Enable switch_case_space fixer
Closes GH-669.
2022-08-22 16:59:10 +02:00
Andreas Möller
f127de5db9 Enhancement: Enable strict_param fixer
We set strict param to false to ensure current behavior,
except for two cases where it is safe to go with true.

Closes GH-658.
2022-07-15 14:48:44 +02:00
Andreas Möller
b575ebd409 Enhancement: Include *.inc files (with exceptions)
Closes GH-662.
2022-07-15 13:57:08 +02:00
Ayesh Karunaratne
1b83fd7ab7 Multiple micro-optimizations
* Replace `ob_get_contents();ob_clean()` with `ob_get_clean()`

`ob_get_clean()` is equivalent to `ob_get_contents()` followed by `ob_clean()`.

* Replace `intval()` calls with `(int)` type cast

This is a micro-optimization because `intval()` is a function call, and the type cast is about 6 times fast.

* Replace `preg_replace` call that could be done with an `rtrim()` call

In `./error.php`, there is a `preg_replace('!/+$!', '', $URI);` call that essentially is equivalent to `rtrim()`, that both calls removing trailing slash characters in `$URI`.
The `rtim()` call is more legible and faster.

* Combine consecutive `str_replace` calls to a single `str_replace` call

* Use short ternary operator where possible

Improves code readability.

* Cascade various `else` statements where possible

Cleans up the code by removing unnecessary `else` blocks and moving the code to the parent context if the previous `if` block exits the function by either terminating the script, or with a `return` statement.

* Combine multiple `isset()` calls to a single `isset()`

`isset()` accepts multiple parameters and returns `true` only if all of the parameters are `isset`. It makes sense to combine multiple individual `isset` calls to a single call for better readability.

* Replace `for` loop with a `foreach` loop

* Remove unnecessary character escapes in regular expressions

Regular expression special characters are context-sensitive. For example, special characters such as `.` are not considered special within square braces (`[]`).
This removes several of such instances that certain characters are escaped, but it is not strictly necessary within the context. This improves the readability of the expression.

See more information at [PHP.Watch: Writing better Regular Expressions in PHP](https://php.watch/articles/php-regex-readability#reduce-escape)

* Remove unnecessary break statement

* Remove unnecessary PHP close tags

* Remove redundant JSON_ERROR_NONE check

Remove unnecessary `json_last_error() == JSON_ERROR_NONE` where the decoded object is inspected already.

Closes GH-603.
2022-07-03 12:24:14 +02:00
Sherif Ramadan
7691b44067 Fix Bug #79524
Ignore LAST_LANG cookie from now on, because it's stupid. Honor Accept-Language
headers instead.
2020-05-04 00:59:21 +00:00
Sara Golemon
cfc6b38ec8 Goodbye Magic Quotes 2019-07-10 13:45:01 -04:00
Peter Kokot
e235f79473 Trim trailing whitespace
This patch cleans all redundant trailing whitespace across the
repository except for the icalendar files.
2018-10-17 10:51:08 +02:00
Peter Kokot
0f95b8c709 Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-10-17 07:29:46 +02:00
Peter Cowburn
ee6c0e89af make sure params are strings for manual-lookup.php (bug #61756) 2012-04-17 22:36:09 +01:00
Rasmus Lerdorf
5a93445f9b Fix xss problems 2011-01-21 15:28:33 +00:00
Hannes Magnusson
21efa66aab Add support for PHP 5.3 and 6 *sigh* 2008-02-24 22:16:44 +00:00
Hannes Magnusson
6c3b9a713d Fixed bug#41376 (a xss bug on php.net website)
# Found by André moulu
2007-05-12 15:43:49 +00:00
Gabor Hojtsy
9cc1cf7138 Wups, this needs to be global... 2003-08-08 14:07:33 +00:00
Gabor Hojtsy
e09380cbb4 Do not allow non-online languages as user preferred ones 2003-08-08 14:04:13 +00:00
Gabor Hojtsy
18df8ff1ef Fix a bug, which made language specifying shortcuts
(eg. /it/books) not work.
2003-07-25 16:54:07 +00:00
Gabor Hojtsy
98679b4e1f Only use a non-empty requested language 2003-06-04 08:38:31 +00:00
Gabor Hojtsy
7eca1945e0 Also set the explicit lang if it was specified in a shortcut
(eg. /hu/echo) as we include the page now, and don't
redirect
2003-06-04 08:18:37 +00:00
Gabor Hojtsy
bc78f8032c Remove PHP < 4.1.0 BC code
- the creation of $_.. vars
 - global-ing them before usage

These are not needed anymore, we have all mirrors with
PHP > 4.1.0, and those having old versions are disabled
2003-05-27 16:40:05 +00:00
Gabor Hojtsy
eab7a75a1b Comment the BC code for pre 4.1.0 mirrors as we have
them disabled now, so autoglobal vars should work on
all mirrors without special preparation

Use $_SERVER['DOCUMENT_ROOT'] for includes
instead of a user defined constant, as the docroot
value is always available [even before prepend.inc]
This ensures consistency and causes no stat() calls

Add myphpnet_...() functions to load, get/set and save
the user preferences, and use them everywhere. This
enables us to easily add new preferences to the same
cookie. Every preference will last for a year this way,
and the cookie will only be set again, if someone
modifies his data on my.php

If this works nicely, then we can easily add a preferred
mirror site setting (and more)

[These changes seem to work on my local mirror]
2003-05-24 19:50:37 +00:00
Gabor Hojtsy
e3da085740 Tab => spaces 2003-05-17 12:46:44 +00:00
Gabor Hojtsy
661cd64838 Add new mirror_setcookie() function to set
a cookie for all mirror sites, and use it for
country and last language cookies set by our
code

Also add code to remember the last search term
and selected search option in a cookie (JS code
will come to handle this on the client side)
2003-05-17 12:45:51 +00:00
Gabor Hojtsy
c9265def2c Use spaces not tabs 2003-05-17 09:14:42 +00:00
Gabor Hojtsy
48ff88618d Fix the inconsistencies introduced by the last two
fixes. We use $languages and not $lang here...
2003-05-17 09:13:03 +00:00
Jacques Marneweck
37a267d343 * More of the E_NOTICE fixes. Also make the spacer.gif pull from the
seperate images server if www.php.net

--jm
2003-05-15 21:16:21 +00:00
Wez Furlong
c00483cbec Less stat() calls. 2003-05-15 17:05:17 +00:00
Jacques Marneweck
4fe45890c8 * Busy fixing all the errors that appears when E_NOTICE is set on php.net
as reported by James Cox in his e-mail with message id
   <MMEPJPGPACDMPGEEKFMKIECLLCAA.james@imajes.info>

--jm
2003-05-14 00:50:53 +00:00
Gabor Hojtsy
4da75f0885 Really remember last used language :) And do not override the user setting
with it. What if I would like to see the Hungarian version of a page on time,
and I still want to use English as my default language ;)
2003-03-15 12:56:28 +00:00
Derick Rethans
b48781f249 s/\t/\ \ \ \ /g 2003-03-14 09:40:32 +00:00
Derick Rethans
c58d7e533b - Remember the last selected language from the langchooser on every
manual page.
2003-03-14 09:39:15 +00:00
Gabor Hojtsy
197589449a Typo, thanks to Mitja for pointing it out... 2003-03-13 17:43:14 +00:00
Gabor Hojtsy
08b7de85a3 Really honor the user's language settings... 2003-03-13 17:14:02 +00:00
Gabor Hojtsy
1f24235737 Adding new array creation to langchooser, so we can inform users
about how we have parsed their accept-language

Add the first version of my.php (which will enable users to set their
own languages). Please don't spread the word, this needs testing, before
it can go live for all users...
2003-03-13 17:06:25 +00:00
Gabor Hojtsy
03b69e9837 Fix the explicit spec. bug I have introduced the past weekend... 2003-03-11 21:28:57 +00:00
Gabor Hojtsy
0067b7530d Update code to handle qualities (really only used by Safari as far as I know).
Refactor the code to be under a function, so temp variables are lost, and there
is no global namespace solution. Also remove ?> from the end, so there won't be
any whitespace outoput in any case...
2003-03-08 20:43:16 +00:00
Gabor Hojtsy
ea39292d73 Adding translation table for pt_br and Chinese language variations and
strip out any other language flavor specified in the accept language, as
we have no support for flavors of other languages (eg. en-us or en-gb will
become en).
2003-03-02 19:33:43 +00:00
Gabor Hojtsy
d661afe206 Better explicit language handling, including REQUEST vars now... 2003-03-02 16:16:04 +00:00
Gabor Hojtsy
f62e1d8900 Also count with explicit language specifications for search forms... 2003-03-02 15:47:42 +00:00
Gabor Hojtsy
96c0018daa Provide a default for the stipped URI, so it works if the
language is not specified...
2003-03-01 20:50:46 +00:00
Gabor Hojtsy
64906f9b38 Provide an URL version with language code stripped off for cleaner
shortcut handling
2003-03-01 16:03:44 +00:00
Gabor Hojtsy
4a5b9f90f0 Ups, $idx is not needed. Keep the code simple and clean too ;)) 2003-03-01 13:53:56 +00:00
Gabor Hojtsy
ae05da2ba1 Applying KISS, taking account the user's Accept Language browser setting
(without bothering with the priority values provided by the UA, as those
are not applicable for us).
2003-03-01 13:52:46 +00:00