summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2006-11-25 20:51:43 +0000
committerxue <>2006-11-25 20:51:43 +0000
commitcb0aeb81d77d7170196f1b667978f56c6018100b (patch)
tree53deb6628356454d7e4348641135c84c1a909292 /framework
parentaf340f68ef716b9a3c021a8cabc40068068bf3bf (diff)
merge from 3.0 branch till 1508.
Diffstat (limited to 'framework')
-rw-r--r--framework/I18N/core/DateFormat.php8
-rw-r--r--framework/TApplication.php5
-rw-r--r--framework/Util/TDateTimeStamp.php2
-rw-r--r--framework/Web/THttpRequest.php2
-rw-r--r--framework/Web/THttpResponse.php2
-rw-r--r--framework/Web/UI/WebControls/THead.php30
6 files changed, 41 insertions, 8 deletions
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('&amp;','&',$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