From cb0aeb81d77d7170196f1b667978f56c6018100b Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 25 Nov 2006 20:51:43 +0000 Subject: merge from 3.0 branch till 1508. --- .gitattributes | 3 +++ HISTORY | 4 ++- UPGRADE | 3 ++- demos/blog/protected/Common/BlogErrorHandler.php | 2 +- demos/blog/protected/Common/BlogPage.php | 4 +-- demos/blog/protected/Portlets/SearchPortlet.php | 2 +- demos/personal/protected/Pages/Layout.php | 2 +- demos/quickstart/protected/controls/SearchBox.php | 12 ++++----- .../protected/pages/Controls/Repeater.page | 2 +- .../pages/GettingStarted/Introduction.page | 5 ++-- framework/I18N/core/DateFormat.php | 8 ++++-- framework/TApplication.php | 5 +--- framework/Util/TDateTimeStamp.php | 2 ++ framework/Web/THttpRequest.php | 2 +- framework/Web/THttpResponse.php | 2 +- framework/Web/UI/WebControls/THead.php | 30 ++++++++++++++++++++++ requirements/index.php | 2 +- .../tickets/protected/pages/Ticket283.page | 18 +++++++++++++ .../tickets/protected/pages/Ticket283.php | 11 ++++++++ .../tickets/protected/pages/Ticket453.page | 3 +++ 20 files changed, 97 insertions(+), 25 deletions(-) create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket283.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket283.php create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket453.page diff --git a/.gitattributes b/.gitattributes index 3eed4a0d..89e7752e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2203,6 +2203,8 @@ tests/FunctionalTests/tickets/protected/pages/Ticket278.page -text tests/FunctionalTests/tickets/protected/pages/Ticket278.php -text tests/FunctionalTests/tickets/protected/pages/Ticket28.page -text tests/FunctionalTests/tickets/protected/pages/Ticket28.php -text +tests/FunctionalTests/tickets/protected/pages/Ticket283.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket283.php -text tests/FunctionalTests/tickets/protected/pages/Ticket284.page -text tests/FunctionalTests/tickets/protected/pages/Ticket284.php -text tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php -text @@ -2212,6 +2214,7 @@ tests/FunctionalTests/tickets/protected/pages/Ticket306.page -text tests/FunctionalTests/tickets/protected/pages/Ticket311.page -text tests/FunctionalTests/tickets/protected/pages/Ticket312.page -text tests/FunctionalTests/tickets/protected/pages/Ticket351.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket453.page -text tests/FunctionalTests/tickets/protected/pages/Ticket54.page -text tests/FunctionalTests/tickets/protected/pages/Ticket54Master.php -text tests/FunctionalTests/tickets/protected/pages/Ticket54Master.tpl -text diff --git a/HISTORY b/HISTORY index f2e5ab18..0f07bb13 100644 --- a/HISTORY +++ b/HISTORY @@ -19,9 +19,11 @@ Version 3.0.6 December 4, 2006 ============================== BUG: Ticket#442 - TPageService getBasePath in namespace form (Qiang) BUG: TTableCell should render   only when Text is not set and there's no child (Qiang) +ENH: Ticket#446 - Added TMetaTagCollection.getMetaTagByID method (Qiang) CHG: Ticket#437 - __autoload is replaced by spl_autoload_register (Qiang) -CHG: constructUrl() now encodes & into & by default (Qiang) +CHG: Ticket#454 - Redundant PHP Version Check CHG: TRepeater does not render anymore for empty item template (Qiang) +CHG: THttpRequest.constructUrl() now encodes ampersand by default (Qiang) Version 3.0.5 October 23, 2006 ============================== diff --git a/UPGRADE b/UPGRADE index 17386019..97972ad9 100644 --- a/UPGRADE +++ b/UPGRADE @@ -23,8 +23,9 @@ Upgrading from v3.0.x Upgrading from v3.0.5 --------------------- -- constructUrl() now encodes & into & by default. - TRepeater does not render anymore for empty item template. +- constructUrl() now encodes ampersand by default. This should have minimal + impact on any existing PRADO applications, though. Upgrading from v3.0.4 --------------------- diff --git a/demos/blog/protected/Common/BlogErrorHandler.php b/demos/blog/protected/Common/BlogErrorHandler.php index 012f2e4c..06042be1 100644 --- a/demos/blog/protected/Common/BlogErrorHandler.php +++ b/demos/blog/protected/Common/BlogErrorHandler.php @@ -36,7 +36,7 @@ class BlogErrorHandler extends TErrorHandler $message=$exception->getMessage(); Prado::log($message,TLogger::ERROR,'BlogApplication'); $message=urldecode($this->getApplication()->getSecurityManager()->hashData($message)); - $this->Response->redirect($this->Service->constructUrl('ErrorReport',array('msg'=>$message))); + $this->Response->redirect($this->Service->constructUrl('ErrorReport',array('msg'=>$message),false)); } else parent::handleExternalError($statusCode,$exception); diff --git a/demos/blog/protected/Common/BlogPage.php b/demos/blog/protected/Common/BlogPage.php index dc59ba7b..aaf0c7e1 100644 --- a/demos/blog/protected/Common/BlogPage.php +++ b/demos/blog/protected/Common/BlogPage.php @@ -32,12 +32,12 @@ class BlogPage extends TPage public function gotoDefaultPage() { - $this->Response->redirect($this->Service->constructUrl($this->Service->DefaultPage)); + $this->gotoPage($this->Service->DefaultPage); } public function gotoPage($pagePath,$getParameters=null) { - $this->Response->redirect($this->Service->constructUrl($pagePath,$getParameters)); + $this->Response->redirect($this->Service->constructUrl($pagePath,$getParameters,false)); } public function reportError($errorCode) diff --git a/demos/blog/protected/Portlets/SearchPortlet.php b/demos/blog/protected/Portlets/SearchPortlet.php index c218a739..10ef0499 100644 --- a/demos/blog/protected/Portlets/SearchPortlet.php +++ b/demos/blog/protected/Portlets/SearchPortlet.php @@ -31,7 +31,7 @@ class SearchPortlet extends Portlet public function search($sender,$param) { $keyword=$this->Keyword->Text; - $url=$this->Service->constructUrl('SearchPost',array('keyword'=>$keyword)); + $url=$this->Service->constructUrl('SearchPost',array('keyword'=>$keyword),false); $this->Response->redirect($url); } } diff --git a/demos/personal/protected/Pages/Layout.php b/demos/personal/protected/Pages/Layout.php index 37ed95d4..f5009542 100644 --- a/demos/personal/protected/Pages/Layout.php +++ b/demos/personal/protected/Pages/Layout.php @@ -5,7 +5,7 @@ class Layout extends TTemplateControl public function logout($sender,$param) { $this->Application->getModule('auth')->logout(); - $this->Response->redirect($this->Service->constructUrl('Home')); + $this->Response->redirect($this->Service->constructUrl('Home',null,false)); } } diff --git a/demos/quickstart/protected/controls/SearchBox.php b/demos/quickstart/protected/controls/SearchBox.php index b579cd91..6fb8e376 100644 --- a/demos/quickstart/protected/controls/SearchBox.php +++ b/demos/quickstart/protected/controls/SearchBox.php @@ -1,25 +1,25 @@ ensureChildControls(); return $this->getRegisteredObject('search')->getText(); } - + public function getTextBox() { $this->ensureChildControls(); return $this->getRegisteredObject('search'); } - + public function getButton() { $this->ensureChildControls(); return $this->getRegisteredObject('find'); } - + public function onInit($param) { parent::onInit($param); @@ -32,7 +32,7 @@ class SearchBox extends TTemplateControl if(strlen($query = $this->search->getText()) >0) { $ps = $this->getApplication()->getPageService(); - $page = $ps->constructUrl('Search', array('q' => $query)); + $page = $ps->constructUrl('Search', array('q' => $query), false); $this->getApplication()->getResponse()->redirect($page); } } diff --git a/demos/quickstart/protected/pages/Controls/Repeater.page b/demos/quickstart/protected/pages/Controls/Repeater.page index d8f3fd0a..3534c603 100644 --- a/demos/quickstart/protected/pages/Controls/Repeater.page +++ b/demos/quickstart/protected/pages/Controls/Repeater.page @@ -19,7 +19,7 @@ To populate data into the repeater items, set DataSource to a valid dat

class MyPage extends TPage { - protected function onLoad($param) { + public function onLoad($param) { parent::onLoad($param); if(!$this->IsPostBack) { $this->Repeater->DataSource=$data; diff --git a/demos/quickstart/protected/pages/GettingStarted/Introduction.page b/demos/quickstart/protected/pages/GettingStarted/Introduction.page index e52f4acf..52b7d9af 100644 --- a/demos/quickstart/protected/pages/GettingStarted/Introduction.page +++ b/demos/quickstart/protected/pages/GettingStarted/Introduction.page @@ -1,16 +1,17 @@

Welcome to the PRADO Quickstart Tutorial

-This Quickstart tutorial is provided to help you quickly start building your own Web applications based on PRADO version 3.0. +This Quickstart tutorial is provided to help you quickly start building your own Web applications based on PRADO version 3.x.

You may refer to the following resources if you find this tutorial does not fulfill all your needs.

\ No newline at end of file diff --git a/framework/I18N/core/DateFormat.php b/framework/I18N/core/DateFormat.php index 142926f4..8dd3fdca 100644 --- a/framework/I18N/core/DateFormat.php +++ b/framework/I18N/core/DateFormat.php @@ -110,13 +110,17 @@ class DateFormat */ public function format($time, $pattern='F', $charset='UTF-8') { - if(is_string($time)) + if (is_numeric($time)) //assumes unix epoch + $time = floatval($time); + else if(is_string($time)) $time = @strtotime($time); if(is_null($pattern)) $pattern = 'F'; - $date = @getdate($time); + $s = Prado::createComponent('System.Util.TDateTimeStamp'); + + $date = $s->getDate($time); $pattern = $this->getPattern($pattern); diff --git a/framework/TApplication.php b/framework/TApplication.php index 9e1026bf..974f0ec4 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -1318,10 +1318,7 @@ class TApplicationStatePersister extends TModule implements IStatePersister if($saveFile) { $fileName=$this->getStateFilePath(); - if(version_compare(phpversion(),'5.1.0','>=')) - file_put_contents($fileName,$content,LOCK_EX); - else - file_put_contents($fileName,$content); + file_put_contents($fileName,$content,LOCK_EX); } } diff --git a/framework/Util/TDateTimeStamp.php b/framework/Util/TDateTimeStamp.php index 659b98aa..1c813fbb 100644 --- a/framework/Util/TDateTimeStamp.php +++ b/framework/Util/TDateTimeStamp.php @@ -194,6 +194,8 @@ class TDateTimeStamp return $this->_getDateInternal($d); } + + /** * Low-level function that returns the getdate() array. We have a special * $fast flag, which if set to true, will return fewer array values, diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index 44efb14b..bb7b4281 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -483,7 +483,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar * @param string service parameter * @param array GET parameters, null if not needed * @param boolean whether to encode the ampersand in URL, defaults to true. - * @param boolean whether to encode the GET parameters (their names and values), defaults to true. + * @param boolean whether to encode the GET parameters (their names and values), defaults to false. * @return string URL * @see parseUrl */ diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index ad935103..3a6d0aa3 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -318,7 +318,7 @@ class THttpResponse extends TModule implements ITextWriter $this->getApplication()->onEndRequest(); if($url[0]==='/') $url=$this->getRequest()->getBaseUrl().$url; - header('Location: '.$url); + header('Location: '.str_replace('&','&',$url)); exit(); } diff --git a/framework/Web/UI/WebControls/THead.php b/framework/Web/UI/WebControls/THead.php index 93858da0..746d33ac 100644 --- a/framework/Web/UI/WebControls/THead.php +++ b/framework/Web/UI/WebControls/THead.php @@ -342,6 +342,36 @@ class TMetaTagCollection extends TList else throw new TInvalidDataTypeException('metatagcollection_metatag_invalid'); } + + /** + * Finds the lowest cardinal index of the meta tag whose id is the one being looked for. + * @param string the ID of the meta tag to be looked for + * @return integer the index of the meta tag found, -1 if not found. + */ + public function findIndexByID($id) + { + $index=0; + foreach($this as $item) + { + if($item->getID()===$id) + return $index; + $index++; + } + return -1; + } + + /** + * Finds the item whose value is the one being looked for. + * @param string the id of the meta tag to be looked for + * @return TMetaTag the meta tag found, null if not found. + */ + public function findMetaTagByID($id) + { + if(($index=$this->findIndexByID($id))>=0) + return $this->itemAt($index); + else + return null; + } } ?> \ No newline at end of file diff --git a/requirements/index.php b/requirements/index.php index 76b6356e..36ffac29 100644 --- a/requirements/index.php +++ b/requirements/index.php @@ -235,7 +235,7 @@ function getPreferredLanguage() { $langs=getUserLanguages(); $lang=explode('-',$langs[0]); - if(empty($lang[0]) || !ctype_alpha($lang[0])) + if(empty($lang[0]) || !function_exists('ctype_alpha') || !ctype_alpha($lang[0])) $language='en'; else $language=$lang[0]; diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket283.page b/tests/FunctionalTests/tickets/protected/pages/Ticket283.page new file mode 100644 index 00000000..b5e1f95b --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket283.page @@ -0,0 +1,18 @@ + + + +Panel 1 + + + + + +Panel 2 + + + + + + + + diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket283.php b/tests/FunctionalTests/tickets/protected/pages/Ticket283.php new file mode 100644 index 00000000..8426eae4 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket283.php @@ -0,0 +1,11 @@ +label1->Text = $sender->Text.' Clicked!'; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket453.page b/tests/FunctionalTests/tickets/protected/pages/Ticket453.page new file mode 100644 index 00000000..23905aea --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket453.page @@ -0,0 +1,3 @@ + + + \ No newline at end of file -- cgit v1.2.3