Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customer order view workaround for "+" in email addresses #1199

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cronjobs/linkcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
// Check if it is a valid internal link.
foreach ( $siteURLs as $siteURL )
{
$siteURL = preg_replace("/\/$/e", "", $siteURL );
$siteURL = preg_replace("/\/$/", "", $siteURL );
$fp = @fopen( $siteURL . "/". $url, "r" );
if ( !$fp )
{
Expand Down
2 changes: 1 addition & 1 deletion design/admin/templates/setup/datatype_code.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class {$full_class_name} extends eZDataType
*/
function {$full_class_name}()
{literal}{{/literal}
$this->eZDataType( self::{$constant_name}, "{$desc_name}" );
parent::__construct( self::{$constant_name}, "{$desc_name}" );
{literal}}{/literal}

{if $class_input}
Expand Down
2 changes: 1 addition & 1 deletion design/admin/templates/shop/orderlist.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
{if is_null($Orders.item.account_name)}
<s><i>{'( removed )'|i18n( 'design/admin/shop/orderlist' )}</i></s>
{else}
<a href={concat( '/shop/customerorderview/', $Orders.item.user_id, '/', $Orders.item.account_email )|ezurl}>{$Orders.item.account_name|wash}</a>
<a href={concat( '/shop/customerorderview/', $Orders.item.user_id, '?email=', $Orders.item.account_email|urlencode )|ezurl}>{$Orders.item.account_name|wash}</a>
{/if}
</td>

Expand Down
2 changes: 1 addition & 1 deletion design/standard/templates/setup/datatype_code.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class {$full_class_name} extends eZDataType
*/
function {$full_class_name}()
{literal}{{/literal}
$this->eZDataType( self::{$constant_name}, "{$desc_name}" );
parent::__construct( self::{$constant_name}, "{$desc_name}" );
{literal}}{/literal}

{if $class_input}
Expand Down
12 changes: 6 additions & 6 deletions extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ function validateInput( $http, $base, $contentObjectAttribute )
*/

// Get section level and reset curent xml node according to input header.
function &sectionLevel( &$sectionLevel, $headerLevel, &$TagStack, &$currentNode, &$domDocument )
function sectionLevel( &$sectionLevel, $headerLevel, &$TagStack, &$currentNode, &$domDocument )
{
if ( $sectionLevel < $headerLevel )
{
Expand Down Expand Up @@ -774,7 +774,7 @@ function inputXML( )
\private
\return the user input format for the given section
*/
function &inputSectionXML( &$section, $currentSectionLevel, $tdSectionLevel = null )
function inputSectionXML( &$section, $currentSectionLevel, $tdSectionLevel = null )
{
$output = '';

Expand Down Expand Up @@ -895,7 +895,7 @@ function &inputSectionXML( &$section, $currentSectionLevel, $tdSectionLevel = nu
\private
\return the user input format for the given list item
*/
function &inputListXML( &$listNode, $currentSectionLevel, $listSectionLevel = null, $noParagraphs = true )
function inputListXML( &$listNode, $currentSectionLevel, $listSectionLevel = null, $noParagraphs = true )
{
$output = '';
$tagName = $listNode instanceof DOMNode ? $listNode->nodeName : '';
Expand Down Expand Up @@ -933,7 +933,7 @@ function &inputListXML( &$listNode, $currentSectionLevel, $listSectionLevel = nu
\private
\return the user input format for the given table cell
*/
function &inputTdXML( &$tdNode, $currentSectionLevel, $tdSectionLevel = null )
function inputTdXML( &$tdNode, $currentSectionLevel, $tdSectionLevel = null )
{
$output = '';
$tagName = $tdNode instanceof DOMNode ? $tdNode->nodeName : '';
Expand Down Expand Up @@ -962,7 +962,7 @@ function &inputTdXML( &$tdNode, $currentSectionLevel, $tdSectionLevel = null )
/*!
\return the input xml of the given paragraph
*/
function &inputParagraphXML( &$paragraph,
function inputParagraphXML( &$paragraph,
$currentSectionLevel,
$tdSectionLevel = null,
$noRender = false )
Expand Down Expand Up @@ -1046,7 +1046,7 @@ function &inputParagraphXML( &$paragraph,
\return the input xml for the given tag
\as in the xhtml used inside the editor
*/
function &inputTagXML( &$tag, $currentSectionLevel, $tdSectionLevel = null )
function inputTagXML( &$tag, $currentSectionLevel, $tdSectionLevel = null )
{
$output = '';
$tagName = $tag instanceof DOMNode ? $tag->nodeName : '';
Expand Down
4 changes: 2 additions & 2 deletions extension/ezoe/modules/ezoe/classes/GoogleSpell.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ function &_getMatches($lang, $str) {
}

function _unhtmlentities($string) {
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
$string = preg_replace_callback('~&#x([0-9a-f]+);~i', function($m) {return chr(hexdec($m[1]));}, $string);
$string = preg_replace_callback('~&#([0-9]+);~', function($m) {return chr($m[1]);}, $string);

$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
Expand Down
2 changes: 1 addition & 1 deletion extension/ezoe/modules/ezoe/classes/SpellChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SpellChecker {
*
* @param $config Configuration name/value array.
*/
function SpellChecker(&$config) {
function __construct(&$config) {
$this->_config = $config;
}

Expand Down
4 changes: 2 additions & 2 deletions extension/ezoe/modules/ezoe/classes/utils/mcejson.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Moxiecode_JSONReader
private $_lastLocations;
private $_needProp;

function Moxiecode_JSONReader($data) {
function __construct($data) {
$this->_data = $data;
$this->_len = strlen($data);
$this->_pos = -1;
Expand Down Expand Up @@ -367,7 +367,7 @@ function peek() {
* @package MCManager.utils
*/
class Moxiecode_JSON {
function Moxiecode_JSON() {
function __construct() {
}

function decode($input) {
Expand Down
4 changes: 2 additions & 2 deletions extension/ezoe/modules/ezoe/spellcheck_rpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function getRequestParam($name, $default_value = false, $sanitize = false)
// Try globals array
if (!$raw && isset($_GLOBALS["HTTP_RAW_POST_DATA"]))
$raw = $_GLOBALS["HTTP_RAW_POST_DATA"];
else if (!$raw && isset($HTTP_RAW_POST_DATA))
$raw = $HTTP_RAW_POST_DATA;
else if (!$raw)
$raw = file_get_contents("php://input");;

// Try stream
if (!$raw)
Expand Down
2 changes: 1 addition & 1 deletion kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function isValid()
\pure
\return the suffix for the attribute template, if false it is ignored.
*/
function &viewTemplateSuffix( &$contentobjectAttribute )
function viewTemplateSuffix( &$contentobjectAttribute )
{
$suffix = false;
return $suffix;
Expand Down
7 changes: 7 additions & 0 deletions kernel/shop/customerorderview.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
$tpl = eZTemplate::factory();

$Email = urldecode( $Email );

// workaround because it seems not possible to get an urlencoded "+" character accross $Params
if ( $http->hasGetVariable( "email" ) )
{
$Email = $http->getVariable( "email" );
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, if i'm not wrong, here you are remove Email Param from the url, right? i mean, this is not valid as you won't have Email as Param anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use a normal "get" parameter in orderlist.tpl, because "+" get through with them. I give this parameter a higher priority in the customerorderview.php. Does that seem wrong to you, @crevillo?

Of course fixing the bug (?) with $Params would be the better solution, but I don't know the consequences of doing that...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pbek. no, the patch is good. forget my comment. just thought that now this line
could throw a php notice or something now $Params['Email'] won't be set in this new urls.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very happy with that patch, because the real problem lies in $Params (and a missing urlencode()). ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you have in mind changing it to?

as for Params, it kind of still need to be there for bc, like is the case now in 6f5f894

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I fail to understand what you are talking about. :)
Changing what to? And what "bc"?

$productList = eZOrder::productList( $CustomerID, $Email );
$orderList = eZOrder::orderList( $CustomerID, $Email );

Expand Down
2 changes: 1 addition & 1 deletion kernel/url/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
$preFix = $protocol . "://" . $domain;
$preFix .= eZSys::wwwDir();

$link = preg_replace("/^\//e", "", $link );
$link = preg_replace("/^\//", "", $link );
$link = $preFix . "/" . $link;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ezdb/classes/ezmysqlidb.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ function escapeString( $str )
else
{
eZDebug::writeDebug( 'escapeString called before connection is made', __METHOD__ );
return mysql_escape_string( $str );
return mysqli_real_escape_string( $str );
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ezdbschema/classes/ezmysqlschema.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ function escapeSQLString( $value )
return $this->DBInstance->escapeString( $value );
}

return mysql_escape_string( $value );
return mysqli_real_escape_string( $value );
}

function schemaType()
Expand Down
4 changes: 4 additions & 0 deletions lib/ezfile/classes/ezgzipzlibcompressionhandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ function compressionLevel()
static function isAvailable()
{
$extensionName = 'zlib';

// dl() is removed in PHP 7.0, see https://secure.php.net/manual/en/function.dl.php
/*
if ( !extension_loaded( $extensionName ) )
{
$dlExtension = ( eZSys::osType() == 'win32' ) ? '.dll' : '.so';
@dl( $extensionName . $dlExtension );
}
*/
return extension_loaded( $extensionName );
}

Expand Down
4 changes: 2 additions & 2 deletions lib/ezpdf/classes/class.ezpdftable.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class eZPDFTable extends Cezpdf
* @param string $paper
* @param string $orientation
*/
function eZPDFTable($paper='a4',$orientation='portrait')
function __construct($paper='a4',$orientation='portrait')
{
parent::__construct( $paper, $orientation );
$this->TOC = array();
Expand Down Expand Up @@ -1516,7 +1516,7 @@ function callFont( $params )
return '';
}

function &fixWhitespace( &$text )
function fixWhitespace( &$text )
{
$text = str_replace( array( self::SPACE,
self::TAB,
Expand Down
24 changes: 12 additions & 12 deletions lib/ezpdf/classes/class.pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2014,10 +2014,10 @@ function selectFont( $fontName, $encoding = '', $set = 1 )
// note that pdf supports only binary format type 1 font files, though there is a
// simple utility to convert them from pfa to pfb.
$fp = fopen( $fbfile, 'rb' );
$tmp = get_magic_quotes_runtime();
set_magic_quotes_runtime( 0 );
// $tmp = get_magic_quotes_runtime();
// set_magic_quotes_runtime( 0 );
$data = fread( $fp, filesize( $fbfile ) );
set_magic_quotes_runtime( $tmp );
// set_magic_quotes_runtime( $tmp );
fclose( $fp );

// create the font descriptor
Expand Down Expand Up @@ -3564,8 +3564,8 @@ function addPngFromFile( $file, $x, $y, $w = 0, $h = 0 )
{
// read in a png file, interpret it, then add to the system
$error = 0;
$tmp = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
// $tmp = get_magic_quotes_runtime();
// set_magic_quotes_runtime(0);
$fp = @fopen( $file, 'rb' );
if ( $fp )
{
Expand All @@ -3581,7 +3581,7 @@ function addPngFromFile( $file, $x, $y, $w = 0, $h = 0 )
$error = 1;
$errormsg = 'trouble opening file: '.$file;
}
set_magic_quotes_runtime( $tmp );
// set_magic_quotes_runtime( $tmp );

if ( !$error )
{
Expand Down Expand Up @@ -3832,10 +3832,10 @@ function addJpegFromFile( $img, $x, $y, $w = 0, $h = 0 )

$fp = fopen( $img, 'rb' );

$tmp = get_magic_quotes_runtime();
set_magic_quotes_runtime( 0 );
// $tmp = get_magic_quotes_runtime();
// set_magic_quotes_runtime( 0 );
$data = fread( $fp, filesize( $img ) );
set_magic_quotes_runtime( $tmp );
// set_magic_quotes_runtime( $tmp );

fclose( $fp );

Expand Down Expand Up @@ -3888,8 +3888,8 @@ function addImage( &$img, $x, $y, $w = 0, $h = 0, $quality = 75 )
imagejpeg( $img, $tmpName, $quality );
$fp = fopen( $tmpName, 'rb' );

$tmp = get_magic_quotes_runtime();
set_magic_quotes_runtime( 0 );
// $tmp = get_magic_quotes_runtime();
// set_magic_quotes_runtime( 0 );
$fp = @fopen( $tmpName, 'rb' );
if ( $fp )
{
Expand All @@ -3906,7 +3906,7 @@ function addImage( &$img, $x, $y, $w = 0, $h = 0, $quality = 75 )
$errormsg = 'trouble opening file';
}
// $data = fread($fp,filesize($tmpName));
set_magic_quotes_runtime( $tmp );
// set_magic_quotes_runtime( $tmp );
// fclose( $fp );
unlink( $tmpName );
$this->addJpegImage_common( $data, $x, $y, $w, $h, $imageWidth, $imageHeight );
Expand Down
3 changes: 1 addition & 2 deletions lib/ezsoap/classes/ezsoapserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class eZSOAPServer
{
public function __construct()
{
global $HTTP_RAW_POST_DATA;
$this->RawPostData = $HTTP_RAW_POST_DATA;
$this->RawPostData = file_get_contents( "php://input" );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class WorkflowEventRegressionFetchTemplateRepeatType extends eZWorkflowEventType
const WORKFLOW_TYPE_STRING = 'fetchtemplaterepeat';
function __construct()
{
$this->eZWorkflowEventType( WorkflowEventRegressionFetchTemplateRepeatType::WORKFLOW_TYPE_STRING, "WorkflowEventRegressionFetchTemplateRepeatType test" );
parent::__construct( WorkflowEventRegressionFetchTemplateRepeatType::WORKFLOW_TYPE_STRING, "WorkflowEventRegressionFetchTemplateRepeatType test" );
$this->setTriggerTypes( array( 'content' => array( 'publish' => array( 'before' ) ) ) );
}

Expand Down