[pLog-svn] r2407 - in plog/branches/plog-1.0.2/class: gallery/dao
net view view/admin
pwestbro at devel.plogworld.net
pwestbro at devel.plogworld.net
Wed Aug 10 16:40:49 GMT 2005
Author: pwestbro
Date: 2005-08-10 16:40:49 +0000 (Wed, 10 Aug 2005)
New Revision: 2407
Modified:
plog/branches/plog-1.0.2/class/gallery/dao/galleryalbums.class.php
plog/branches/plog-1.0.2/class/gallery/dao/galleryresources.class.php
plog/branches/plog-1.0.2/class/net/customrequestgenerator.class.php
plog/branches/plog-1.0.2/class/view/admin/adminpostslistview.class.php
plog/branches/plog-1.0.2/class/view/view.class.php
Log:
Fixed some more problems where variables and indexes were being used when
not defined.
Modified: plog/branches/plog-1.0.2/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/gallery/dao/galleryalbums.class.php 2005-08-10 11:46:18 UTC (rev 2406)
+++ plog/branches/plog-1.0.2/class/gallery/dao/galleryalbums.class.php 2005-08-10 16:40:49 UTC (rev 2407)
@@ -397,7 +397,7 @@
$row["show_album"],
$row["id"] );
$key = $album->getParentId();
- if( $albums["$key"] == "" )
+ if( !array_key_exists( $key, $albums ) || $albums["$key"] == "" )
$albums["$key"] = Array();
$albums["$key"][] = $album;
@@ -429,7 +429,7 @@
function _getNestedAlbumList( $albums, $start = 0, $level = -1 )
{
$level++;
- if( $albums["$start"] == "" )
+ if( !array_key_exists( $start, $albums ) || $albums["$start"] == "" )
return Array();
foreach( $albums["$start"] as $album ) {
Modified: plog/branches/plog-1.0.2/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/gallery/dao/galleryresources.class.php 2005-08-10 11:46:18 UTC (rev 2406)
+++ plog/branches/plog-1.0.2/class/gallery/dao/galleryresources.class.php 2005-08-10 16:40:49 UTC (rev 2407)
@@ -195,7 +195,7 @@
* the resources that match the given conditions, or empty
* if none could be found.
*/
- function getUserResources( $ownerId, $albumId = GALLERY_NO_ALBUM, $resourceType = GALLEY_RESOURCE_ANY, $page = DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
+ function getUserResources( $ownerId, $albumId = GALLERY_NO_ALBUM, $resourceType = GALLERY_RESOURCE_ANY, $page = DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
{
$query = "SELECT id, owner_id, album_id, description,
date, flags, resource_type, file_path, file_name,
@@ -204,7 +204,7 @@
WHERE owner_id = '".Db::qstr($ownerId)."'";
if( $albumId > GALLERY_NO_ALBUM )
$query .= " AND album_id = '".Db::qstr($albumId)."'";
- if( $resourceType > GALLEY_RESOURCE_ANY )
+ if( $resourceType > GALLERY_RESOURCE_ANY )
$query .= " AND resource_type = '".Db::qstr($resourceType)."'";
@@ -268,7 +268,7 @@
$table = "{$prefix}gallery_resources";
if( $albumId > GALLERY_NO_ALBUM )
$cond .= "album_id = '".Db::qstr($albumId)."'";
- if( $resourceType > GALLEY_RESOURCE_ANY )
+ if( $resourceType > GALLERY_RESOURCE_ANY )
$cond .= " AND resource_type = '".Db::qstr($resourceType)."'";
// return the number of items
Modified: plog/branches/plog-1.0.2/class/net/customrequestgenerator.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/net/customrequestgenerator.class.php 2005-08-10 11:46:18 UTC (rev 2406)
+++ plog/branches/plog-1.0.2/class/net/customrequestgenerator.class.php 2005-08-10 16:40:49 UTC (rev 2407)
@@ -94,6 +94,7 @@
$ownerInfo = $this->_blogInfo->getOwnerInfo();
// this is quite a dirty one but it works...
+ $newDate = $date;
if( strlen($date) == 6 ) $newDate = $date."00000000";
if( strlen($date) == 8 ) $newDate = $date."000000";
$t = new Timestamp( $newDate );
Modified: plog/branches/plog-1.0.2/class/view/admin/adminpostslistview.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/view/admin/adminpostslistview.class.php 2005-08-10 11:46:18 UTC (rev 2406)
+++ plog/branches/plog-1.0.2/class/view/admin/adminpostslistview.class.php 2005-08-10 16:40:49 UTC (rev 2407)
@@ -104,14 +104,18 @@
* gets the value of a parameter
* @private
*/
- function _getParameter( $params, $paramId, $defaultValue )
- {
- $value = $params["$paramId"];
- if( $value == "" )
- $value = $this->getSessionValue( $paramId, $defaultValue );
-
- return $value;
- }
+ function _getParameter( $params, $paramId, $defaultValue )
+ {
+ $value = "";
+ if( array_key_exists( $paramId, $params ) )
+ {
+ $value = $params["$paramId"];
+ }
+ if( $value == "" )
+ $value = $this->getSessionValue( $paramId, $defaultValue );
+
+ return $value;
+ }
function _setViewParameters( $params )
{
@@ -121,7 +125,7 @@
$this->_showStatus = $this->_getParameter( $params, "showStatus", 0 );
$this->_showUser = $this->_getParameter( $params, "showUser", 0 );
$this->_showMonth = $this->_getParameter( $params, "showMonth", $this->_locale->formatDate( new Timestamp(), "%Y%m" ));
- $this->_searchTerms = $params["searchTerms"];
+ $this->_searchTerms = $this->_getParameter( $params, "searchTerms", "");
}
/**
Modified: plog/branches/plog-1.0.2/class/view/view.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/view/view.class.php 2005-08-10 11:46:18 UTC (rev 2406)
+++ plog/branches/plog-1.0.2/class/view/view.class.php 2005-08-10 16:40:49 UTC (rev 2407)
@@ -264,18 +264,22 @@
* @return The value associated to the parameter or empty if not
* found
*/
- function getSessionValue( $param, $defaultValue = "" )
- {
- $session = HttpVars::getSession();
- $viewName = $this->className();
- $keyName = "{$viewName}_{$param}";
-
- $value = $session["$keyName"];
- if( $value == "" && $defaultValue != "" )
- $value = $defaultValue;
-
- return $value;
- }
+ function getSessionValue( $param, $defaultValue = "" )
+ {
+ $session = HttpVars::getSession();
+ $viewName = $this->className();
+ $keyName = "{$viewName}_{$param}";
+
+ $value = "";
+ if ( array_key_exists( $keyName, $session ) )
+ {
+ $value = $session["$keyName"];
+ }
+ if( $value == "" && $defaultValue != "" )
+ $value = $defaultValue;
+
+ return $value;
+ }
/**
More information about the pLog-svn
mailing list