summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY2
-rw-r--r--demos/quickstart/protected/pages/Advanced/Collections.page12
-rw-r--r--framework/Web/THttpRequest.php18
-rw-r--r--framework/Web/THttpResponse.php5
4 files changed, 29 insertions, 8 deletions
diff --git a/HISTORY b/HISTORY
index 7e0ee535..784ce572 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3,6 +3,8 @@ Version 3.0.2 July 2, 2006
BUG: Ticket#182 - List and validator controls cause problem in child classes (Qiang)
BUG: Ticket#191 - Duplicated postbacks occur when using TButton with validators (Qiang)
BUG: Ticket#213 - PRADO Requirements Checker charset error (Qiang)
+BUG: Ticket#244 - redirect() needs absolute URL (Qiang)
+BUG: Ticket#245 - getIsSecureConnection() is not working correctly (Qiang)
CHG: ensureChildControls() is now invoked in TControl::initRecursive (Qiang)
CHG: Postback enabled control will always disable default client-side browser action. (Qiang)
CHG: CSS and JS files in a theme are now included in page in alphabetic order (Qiang)
diff --git a/demos/quickstart/protected/pages/Advanced/Collections.page b/demos/quickstart/protected/pages/Advanced/Collections.page
index 181dc556..7fc3443d 100644
--- a/demos/quickstart/protected/pages/Advanced/Collections.page
+++ b/demos/quickstart/protected/pages/Advanced/Collections.page
@@ -1,6 +1,6 @@
<com:TContent ID="body" >
-<h1>Collections</h1>
+<h1 id="5501">Collections</h1>
<p>
Collection is a basic data structure in programming. In traditional PHP programming, array is used widely to represent collection data structure. A PHP array is a mix of cardinal-indxed array and hash table.
</p>
@@ -8,7 +8,7 @@ Collection is a basic data structure in programming. In traditional PHP programm
To enable object-oriented manipulation of collections, PRADO provides a set of powerful collection classes. Among them, the <tt>TList</tt> and <tt>TMap</tt> are the most fundamental and usually serve as the base classes for other collection classes. Since many PRADO components have properties that are of collection type, it is very important for developers to master the usage of PRADO collection classes.
</p>
-<h2>Using <tt>TList</tt></h2>
+<h2 id="5502">Using <tt>TList</tt></h2>
<p>
A <tt>TList</tt> object represents a cardinal-indexed array, i.e., an array (object) with the index 0, 1, 2, ...
</p>
@@ -42,7 +42,7 @@ In addition, <tt>TList</tt> implements a few commonly used convenient methods fo
<li><tt>mergeWith()</tt>: appends the list with data from an array or traversable object (including <tt>TList</tt>).</li>
</ul>
-<h3>Using <tt>TList</tt>-based component properties</h3>
+<h3 id="5504">Using <tt>TList</tt>-based component properties</h3>
<p>
As aforementioned, many PRADO component properties are based on <tt>TList</tt> or <tt>TList</tt>-derived collection classes. These properties all share the above usages.
</p>
@@ -62,7 +62,7 @@ foreach($control->Controls as $childControl) ...
Another example is the <tt>Items</tt> property, available in list controls, <tt>TRepeater</tt>, <tt>TDataList</tt> and <tt>TDataGrid</tt>. In these controls, the ancestor class of <tt>Items</tt> is <tt>TList</tt>.
</p>
-<h3>Extending <tt>TList</tt></h3>
+<h3 id="5505">Extending <tt>TList</tt></h3>
<p>
Often, we want to extend <tt>TList</tt> to perform additional operations for each addition or removal of an item. The only methods that the child class needs to override are <tt>insertAt()</tt> and <tt>removeAt()</tt>. For example, to ensure the list only contains items that are of <tt>TControl</tt> type, we can override <tt>insertAt()</tt> as follows,
</p>
@@ -77,7 +77,7 @@ public function insertAt($index,$item)
</com:TTextHighlighter>
-<h2>Using <tt>TMap</tt></h2>
+<h2 id="5503">Using <tt>TMap</tt></h2>
<p>
A <tt>TMap</tt> object represents a hash table (or we say string-indexed array).
</p>
@@ -107,7 +107,7 @@ The following methods are provided by <tt>TMap</tt> for convenience,
<li><tt>mergeWith()</tt>: appends the map with data from an array or traversable object (including <tt>TMap</tt>).</li>
</ul>
-<h3>Using of <tt>TAttributeCollection</tt></h3>
+<h3 id="5506">Using of <tt>TAttributeCollection</tt></h3>
<p>
<tt>TAttributeCollection</tt> is a special class extending from <tt>TMap</tt>. It is mainly used by the <tt>Attributes</tt> property of <tt>TControl</tt>.
</p>
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 4e04ecca..b908db53 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -259,7 +259,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getIsSecureConnection()
{
- return !empty($_SERVER['HTTPS']);
+ return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'],'off');
}
/**
@@ -287,6 +287,14 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
}
/**
+ * @return string schema and hostname of the requested URL
+ */
+ public function getBaseUrl()
+ {
+ return ($this->getIsSecureConnection() ? "https://" : "http://") . $_SERVER ['HTTP_HOST'];
+ }
+
+ /**
* @return string entry script URL (w/o host part)
*/
public function getApplicationUrl()
@@ -295,6 +303,14 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
}
/**
+ * @return string entry script URL (w/ host part)
+ */
+ public function getAbsoluteApplicationUrl()
+ {
+ return $this->getBaseUrl() . $this->getApplicationUrl();
+ }
+
+ /**
* @return string application entry script file path (processed w/ realpath())
*/
public function getApplicationFilePath()
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php
index 5a3ff99d..f455f48d 100644
--- a/framework/Web/THttpResponse.php
+++ b/framework/Web/THttpResponse.php
@@ -274,12 +274,15 @@ class THttpResponse extends TModule implements ITextWriter
/**
* Redirects the browser to the specified URL.
* The current application will be terminated after this method is invoked.
- * @param string URL to be redirected to
+ * @param string URL to be redirected to. If the URL is a relative one, the base URL of
+ * the current request will be inserted at the beginning.
*/
public function redirect($url)
{
if(!$this->getApplication()->getRequestCompleted())
$this->getApplication()->onEndRequest();
+ if($url[0]==='/')
+ $url=$this->getRequest()->getBaseUrl().$url;
header('Location:'.$url);
exit();
}