-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
Change language string names Add extra large class to field Don't check for empty new url if in advanced mode Remove not null constraint in db Remove not null constraint in db (2/2) Add extra check for a 3xx code Port to all databases Add missing update files
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE `#__redirect_links` ADD header smallint(3) NOT NULL DEFAULT 301; | ||
ALTER TABLE `#__redirect_links` MODIFY new_url varchar(255); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE "#__redirect_links" ADD COLUMN "header"INTEGER DEFAULT 301 NOT NULL; | ||
ALTER TABLE "#__redirect_links" ALTER COLUMN "new_url" DROP NOT NULL; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE [#__redirect_links] ADD [header] [smallint] NOT NULL DEFAULT 301; | ||
ALTER TABLE [#__redirect_links] ALTER COLUMN [new_url] [nvarchar](255) NULL; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><title></title> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_redirect | ||
* | ||
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('JPATH_BASE') or die; | ||
|
||
JFormHelper::loadFieldClass('list'); | ||
|
||
/** | ||
* A drop down containing all valid HTTP 1.1 response codes. | ||
* | ||
* @package Joomla.Administrator | ||
* @subpackage com_redirect | ||
* @since 3.4 | ||
*/ | ||
class JFormFieldRedirect extends JFormFieldList | ||
{ | ||
/** | ||
* The form field type. | ||
* | ||
* @var string | ||
* @since 3.4 | ||
*/ | ||
protected $type = 'Redirect'; | ||
|
||
/** | ||
* A map of integer HTTP 1.1 response codes to the full HTTP Status for the headers. | ||
* | ||
* @var object | ||
* @since 3.4 | ||
* @see http://www.iana.org/assignments/http-status-codes/ | ||
*/ | ||
protected $responseMap = array( | ||
100 => 'HTTP/1.1 100 Continue', | ||
101 => 'HTTP/1.1 101 Switching Protocols', | ||
102 => 'HTTP/1.1 102 Processing', | ||
200 => 'HTTP/1.1 200 OK', | ||
201 => 'HTTP/1.1 201 Created', | ||
202 => 'HTTP/1.1 202 Accepted', | ||
203 => 'HTTP/1.1 203 Non-Authoritative Information', | ||
204 => 'HTTP/1.1 204 No Content', | ||
205 => 'HTTP/1.1 205 Reset Content', | ||
206 => 'HTTP/1.1 206 Partial Content', | ||
207 => 'HTTP/1.1 207 Multi-Status', | ||
208 => 'HTTP/1.1 208 Already Reported', | ||
226 => 'HTTP/1.1 226 IM Used', | ||
300 => 'HTTP/1.1 300 Multiple Choices', | ||
301 => 'HTTP/1.1 301 Moved Permanently', | ||
302 => 'HTTP/1.1 302 Found', | ||
303 => 'HTTP/1.1 303 See other', | ||
304 => 'HTTP/1.1 304 Not Modified', | ||
305 => 'HTTP/1.1 305 Use Proxy', | ||
306 => 'HTTP/1.1 306 (Unused)', | ||
307 => 'HTTP/1.1 307 Temporary Redirect', | ||
308 => 'HTTP/1.1 308 Permanent Redirect', | ||
400 => 'HTTP/1.1 400 Bad Request', | ||
401 => 'HTTP/1.1 401 Unauthorized', | ||
402 => 'HTTP/1.1 402 Payment Required', | ||
403 => 'HTTP/1.1 403 Forbidden', | ||
404 => 'HTTP/1.1 404 Not Found', | ||
405 => 'HTTP/1.1 405 Method Not Allowed', | ||
406 => 'HTTP/1.1 406 Not Acceptable', | ||
407 => 'HTTP/1.1 407 Proxy Authentication Required', | ||
408 => 'HTTP/1.1 408 Request Timeout', | ||
409 => 'HTTP/1.1 409 Conflict', | ||
410 => 'HTTP/1.1 410 Gone', | ||
411 => 'HTTP/1.1 411 Length Required', | ||
412 => 'HTTP/1.1 412 Precondition Failed', | ||
413 => 'HTTP/1.1 413 Payload Too Large', | ||
414 => 'HTTP/1.1 414 URI Too Long', | ||
415 => 'HTTP/1.1 415 Unsupported Media Type', | ||
416 => 'HTTP/1.1 416 Requested Range Not Satisfiable', | ||
417 => 'HTTP/1.1 417 Expectation Failed', | ||
418 => 'HTTP/1.1 418 I\'m a teapot', | ||
422 => 'HTTP/1.1 422 Unprocessable Entity', | ||
423 => 'HTTP/1.1 423 Locked', | ||
424 => 'HTTP/1.1 424 Failed Dependency', | ||
425 => 'HTTP/1.1 425 Reserved for WebDAV advanced collections expired proposal', | ||
426 => 'HTTP/1.1 426 Upgrade Required', | ||
428 => 'HTTP/1.1 428 Precondition Required', | ||
429 => 'HTTP/1.1 429 Too Many Requests', | ||
431 => 'HTTP/1.1 431 Request Header Fields Too Large', | ||
500 => 'HTTP/1.1 500 Internal Server Error', | ||
501 => 'HTTP/1.1 501 Not Implemented', | ||
502 => 'HTTP/1.1 502 Bad Gateway', | ||
503 => 'HTTP/1.1 503 Service Unavailable', | ||
504 => 'HTTP/1.1 504 Gateway Timeout', | ||
505 => 'HTTP/1.1 505 HTTP Version Not Supported', | ||
506 => 'HTTP/1.1 506 Variant Also Negotiates (Experimental)', | ||
507 => 'HTTP/1.1 507 Insufficient Storage', | ||
508 => 'HTTP/1.1 508 Loop Detected', | ||
510 => 'HTTP/1.1 510 Not Extended', | ||
511 => 'HTTP/1.1 511 Network Authentication Required', | ||
); | ||
|
||
/** | ||
* Method to get the field input markup. | ||
* | ||
* @return string The field input markup. | ||
* @since 3.4 | ||
*/ | ||
protected function getOptions() | ||
{ | ||
$options = array(); | ||
|
||
foreach ($this->responseMap as $key => $value) | ||
{ | ||
$options[] = JHtml::_('select.option', $key, $value); | ||
} | ||
|
||
// Merge any additional options in the XML definition. | ||
$options = array_merge(parent::getOptions(), $options); | ||
|
||
return $options; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -949,14 +949,14 @@ public function logout($userid = null, $options = array()) | |
* or "303 See Other" code in the header pointing to the new location. If the headers have already been | ||
* sent this will be accomplished using a JavaScript statement. | ||
* | ||
* @param string $url The URL to redirect to. Can only be http/https URL | ||
* @param boolean $moved True if the page is 301 Permanently Moved, otherwise 303 See Other is assumed. | ||
* @param string $url The URL to redirect to. Can only be http/https URL | ||
* @param integer $status The HTTP 1.1 status code to be provided. 303 is assumed by default. | ||
* | ||
* @return void | ||
* | ||
* @since 3.2 | ||
*/ | ||
public function redirect($url, $moved = false) | ||
public function redirect($url, $status = 303) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
wilsonge
Author
Contributor
|
||
{ | ||
// Handle B/C by checking if a message was passed to the method, will be removed at 4.0 | ||
if (func_num_args() > 1) | ||
|
@@ -969,9 +969,9 @@ public function redirect($url, $moved = false) | |
* $args[0] = $url | ||
* $args[1] = Message to enqueue | ||
* $args[2] = Message type | ||
* $args[3] = $moved | ||
* $args[3] = $status (previously moved) | ||
*/ | ||
if (isset($args[1]) && !empty($args[1]) && !is_bool($args[1])) | ||
if (isset($args[1]) && !empty($args[1]) && (!is_bool($args[1]) && !is_int($args[1]))) | ||
{ | ||
// Log that passing the message to the function is deprecated | ||
JLog::add( | ||
|
@@ -997,7 +997,7 @@ public function redirect($url, $moved = false) | |
$this->enqueueMessage($message, $type); | ||
|
||
// Reset the $moved variable | ||
$moved = isset($args[3]) ? (boolean) $args[3] : false; | ||
$status = isset($args[3]) ? (boolean) $args[3] : false; | ||
} | ||
} | ||
|
||
|
@@ -1009,7 +1009,7 @@ public function redirect($url, $moved = false) | |
} | ||
|
||
// Hand over processing to the parent now | ||
parent::redirect($url, $moved); | ||
parent::redirect($url, $status); | ||
} | ||
|
||
/** | ||
|
This change here introduces a fatal backwards-compatibility failure of the Joomla API outside a major release and should be reverted before next minor release imho (EDIT: ADDED: lastest 3.3.6 does not include this).
EDIT: ADDED:
It affects all extensions using this public function that is part of Joomla API which then get following fatal error:
You have not supplied a valid HTTP 1.1 status code#0 /home/beat/www/j/libraries/cms/application/cms.php(1014): JApplicationWeb->redirect('http://localhos...', '')