Not signed in (Sign In)
 
Aug 25th 2008 edited
 
I have replaced & for & (Framework revision 165) but is using xhtml for themes mandatory?

If not we can add a settings to check for before using xml specific syntax, like:

Index: Framework.Functions.php
===================================================================
--- Framework.Functions.php (revision 165)
+++ Framework.Functions.php (working copy)
@@ -74,9 +74,11 @@
* @param string $Parameters
* @return string
*/
-function AppendUrlParameters($Url, $Parameters) {
+function AppendUrlParameters($Url, $Parameters) {
+ global $Configuration;
+ $Amp = $Configuration['XHTML_THEME'] ? '&' : '&';
$ReturnUrl = $Url;
- $ReturnUrl .= (strpos($Url, '?') === false) ? '?' : '&';
+ $ReturnUrl .= (strpos($Url, '?') === false) ? '?' : $Amp;
$ReturnUrl .= $Parameters;
return $ReturnUrl;
}
 
Aug 25th 2008
 
Good find!

I'd say maybe check themes/head.php for an xhtml doctype, and encode if its there.
 
Aug 26th 2008
 
One thing that may be quicker than reading and scanning the head.php file every time the function is called would be to have the page head object set the configuration setting if it contains the XHTML doctype.

Would have to see if all the calls to the function come after the head renders... or better yet have the first call to the function set the configuration setting for the following calls.
 
Aug 26th 2008 edited
 
It's what I thought first, but that might not be very practical, especially with php4:

Index: src/appg/settings.php
===================================================================
--- src/appg/settings.php (revision 737)
+++ src/appg/settings.php (working copy)
@@ -116,6 +116,7 @@
$Configuration['COMMENT_TIME_THRESHOLD'] = '60';
$Configuration['COMMENT_THRESHOLD_PUNISHMENT'] = '120';
$Configuration['UPDATE_URL'] = 'http://lussumo.com/updatecheck/default.php';
+$Configuration['XHTML_THEME'] = '1';

// Vanilla Control Positions
$Configuration['CONTROL_POSITION_HEAD'] = '100';
Index: src/themes/head.php
===================================================================
--- src/themes/head.php (revision 737)
+++ src/themes/head.php (working copy)
@@ -1,6 +1,8 @@
<?php
// Note: This file is included from the library/Framework/Framework.Control.Head.php class.

+// Overwrite this setting if your theme if html based.
+// $this->Context->Configuration['XHTML_THEME'] = '1';
$HeadString = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$this->Context->GetDefinition('XMLLang').'">
<head>
 
Aug 27th 2008 edited
 
I don't think I started on the wrong way. The encoding should stay in the themes, it doesn't need to happen in AppendUrlParameters().

Index: src/themes/menu.php
===================================================================
--- src/themes/menu.php (revision 737)
+++ src/themes/menu.php (working copy)
@@ -5,12 +5,16 @@
if ($this->Context->Session->UserID > 0) {
echo str_replace('//1', $this->Context->Session->User->Name, $this->Context->GetDefinition('SignedInAsX'))
. ' (<a href="'
- . AppendUrlParameters(
+ . FormatStringForDisplay(AppendUrlParameters(
$this->Context->Configuration['SIGNOUT_URL'],
- 'FormPostBackKey=' . $this->Context->Session->GetCsrfValidationKey() )
+ 'FormPostBackKey=' . $this->Context->Session->GetCsrfValidationKey() ))
. '">'.$this->Context->GetDefinition('SignOut').'</a>)';
} else {
- echo $this->Context->GetDefinition('NotSignedIn').' (<a href="'.
... AppendUrlParameters($this->Context->Configuration['SIGNIN_URL'], 'ReturnUrl='.GetRequestUri())
... .'">'.$this->Context->GetDefinition('SignIn').'</a>)';
+ echo $this->Context->GetDefinition('NotSignedIn') . ' (<a href="'
+ . FormatStringForDisplay(AppendUrlParameters(
+ $this->Context->Configuration['SIGNIN_URL'],
+ 'ReturnUrl='.GetRequestUri()))
+ . '">'.$this->Context->GetDefinition('SignIn').'</a>)';
}
echo '</div>';
$this->CallDelegate('PreHeadRender');
 
Aug 28th 2008
 
Oops, I just notice html also require the encoding of &.

Still I don't think AppendUrlParameters() should encode it. Urls are not just use for html display.

I think the same for GetRequestUri().
 
Aug 29th 2008
 
Here is commit vanilla r740:

Index: src/themes/menu.php
===================================================================
--- src/themes/menu.php (revision 739)
+++ src/themes/menu.php (working copy)
@@ -5,12 +5,16 @@
if ($this->Context->Session->UserID > 0) {
echo str_replace('//1', $this->Context->Session->User->Name, $this->Context->GetDefinition('SignedInAsX'))
. ' (<a href="'
- . AppendUrlParameters(
+ . FormatStringForDisplay(AppendUrlParameters(
$this->Context->Configuration['SIGNOUT_URL'],
- 'FormPostBackKey=' . $this->Context->Session->GetCsrfValidationKey() )
+ 'FormPostBackKey=' . $this->Context->Session->GetCsrfValidationKey() ))
. '">'.$this->Context->GetDefinition('SignOut').'</a>)';
} else {
- echo $this->Context->GetDefinition('NotSignedIn').'
...(<a href="'.AppendUrlParameters(
...$this->Context->Configuration['SIGNIN_URL'],
...'ReturnUrl='.GetRequestUri()).'">'.$this->Context->GetDefinition('SignIn').'</a>)';
+ echo $this->Context->GetDefinition('NotSignedIn') . ' (<a href="'
+ . FormatStringForDisplay(AppendUrlParameters(
+ $this->Context->Configuration['SIGNIN_URL'],
+ 'ReturnUrl='. urlencode(GetRequestUri(0))))
+ . '">'.$this->Context->GetDefinition('SignIn').'</a>)';
}
echo '</div>';
$this->CallDelegate('PreHeadRender');

I updated GetRequestUri() (Framework r167) so that it can return an unformatted url:

/**
* Return the request URL
*
* The returned URL is tainted (based on $_SERVER['QUERY_STRING']).
* However, by default ($FormatUrlForDisplay == true), the url is safe for html used.
*
* @param boolean $FormatUrlForDisplay Set to false to return an unformatted (and tainted) URL
* @return string
*/
function GetRequestUri($FormatUrlForDisplay='1') {
global $Configuration;
$Host = ForceString($_SERVER['HTTP_HOST'], '');
if ($Host != '') $Host = PrependString($Configuration['HTTP_METHOD'].'://', $Host);
$Path = @$_SERVER['REQUEST_URI'];
// If the path wasn't provided in the REQUEST_URI variable, let's look elsewhere for it
if ($Path == '') $Path = @$_SERVER['HTTP_X_REWRITE_URL']; // Some servers use this instead
// If the path still wasn't found, let's try building it with other variables
if ($Path == '') {
$Path = @$_SERVER['SCRIPT_NAME'];
$Path .= (@$_SERVER['QUERY_STRING'] == '' ? '' : '?' . @$_SERVER['QUERY_STRING']);
}
$FullPath = ConcatenatePath($Host, $Path);
return $FormatUrlForDisplay ? FormatStringForDisplay($FullPath) : $FullPath;
}

Issue information

  • 80
  • Dinoboff

    Dinoboff

    Bug Tracker

  • Resolved
  • Low
  • Bug

Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.