summaryrefslogtreecommitdiff
path: root/Pigeonholes.php
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2006-01-25 15:40:26 +0000
committerChristian Fowler <spider@viovio.com>2006-01-25 15:40:26 +0000
commite154b57af04aaaca301dacac5453c1fd663a213c (patch)
tree216ca0709fb54cc5f1161915c3482342aac57b3e /Pigeonholes.php
parent2d0c4a72fd26352ab25c3aa550643cc489489e7c (diff)
downloadpigeonholes-e154b57af04aaaca301dacac5453c1fd663a213c.tar.gz
pigeonholes-e154b57af04aaaca301dacac5453c1fd663a213c.tar.bz2
pigeonholes-e154b57af04aaaca301dacac5453c1fd663a213c.zip
Added uspport for multiple database backend support. This necessitates removal of all use of ->EOF and ->fields on the result sets. Also, queries that snag a single row and then use $rs->fields should
revert to the simpler getRow() funciton in the BitDb classes. BitDb.php was broken into kernel/BitDbBase.php and kernel/BitDbAdodb.php. kernel/BitDbPear.php was added wiht functionality for Pear::DB Also, the bitweavercore cvs module now works. So you can install a total barebones bitweaver - even without the wiki package. The main fix was to insure pageExists was only executing if wiki package was active so it would not select from non-existant tables
Diffstat (limited to 'Pigeonholes.php')
-rw-r--r--Pigeonholes.php48
1 files changed, 19 insertions, 29 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php
index c6ccf97..7472a5e 100644
--- a/Pigeonholes.php
+++ b/Pigeonholes.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.26 2006/01/24 22:41:47 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.27 2006/01/25 15:40:26 spiderr Exp $
*
* +----------------------------------------------------------------------+
* | Copyright ( c ) 2004, bitweaver.org
@@ -17,7 +17,7 @@
* Pigeonholes class
*
* @author xing <xing@synapse.plus.com>
- * @version $Revision: 1.26 $
+ * @version $Revision: 1.27 $
* @package pigeonholes
*/
@@ -79,12 +79,12 @@ class Pigeonholes extends LibertyAttachable {
WHERE $lookupColumn=?";
$result = $this->mDb->query( $query, array( $lookupId ) );
- if( $result && $result->numRows() ) {
- $this->mInfo = $result->fields;
- $this->mContentId = $result->fields['content_id'];
- $this->mStructureId = $result->fields['structure_id'];
- $this->mInfo['creator'] = ( isset( $result->fields['creator_real_name'] ) ? $result->fields['creator_real_name'] : $result->fields['creator_user'] );
- $this->mInfo['editor'] = ( isset( $result->fields['modifier_real_name'] ) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'] );
+ if( $result && $row = $result->fetchRow() ) {
+ $this->mInfo = $row;
+ $this->mContentId = $this->mInfo['content_id'];
+ $this->mStructureId = $this->mInfo['structure_id'];
+ $this->mInfo['creator'] = ( isset( $this->mInfo['creator_real_name'] ) ? $this->mInfo['creator_real_name'] : $this->mInfo['creator_user'] );
+ $this->mInfo['editor'] = ( isset( $this->mInfo['modifier_real_name'] ) ? $this->mInfo['modifier_real_name'] : $this->mInfo['modifier_user'] );
$this->mInfo['display_link'] = $this->getDisplayLink();
}
@@ -142,8 +142,7 @@ class Pigeonholes extends LibertyAttachable {
$join $where $order";
$result = $this->mDb->query( $query, $bindVars, @BitBase::verifyId( $pListHash['max_records'] ) ? $pListHash['max_records'] : NULL );
$contentTypes = $gLibertySystem->mContentTypes;
- while( !$result->EOF ) {
- $aux = $result->fields;
+ while( $aux = $result->fetchRow() ) {
if( !empty( $contentTypes[$aux['content_type_guid']] ) ) {
$type = &$contentTypes[$aux['content_type_guid']];
if( empty( $type['content_object'] ) ) {
@@ -155,7 +154,6 @@ class Pigeonholes extends LibertyAttachable {
$aux['title'] = $type['content_object']->getTitle( $aux );
$ret[] = $aux;
}
- $result->MoveNext();
}
return( !empty( $this->mErrors ) ? $this->mErrors : $ret );
}
@@ -200,9 +198,9 @@ class Pigeonholes extends LibertyAttachable {
$result = $this->mDb->query( $query, $bindVars, @BitBase::verifyId( $pListHash['max_records'] ) ? $pListHash['max_records'] : NULL );
$contentTypes = $gLibertySystem->mContentTypes;
- while( !$result->EOF ) {
- $i = $result->fields['content_id'];
- $ret[$i] = $result->fields;
+ while( $row = $result->fetchRow() ) {
+ $i = $row['content_id'];
+ $ret[$i] = $row;
if( !empty( $contentTypes[$ret[$i]['content_type_guid']] ) ) {
$type = &$contentTypes[$ret[$i]['content_type_guid']];
if( empty( $type['content_object'] ) ) {
@@ -216,7 +214,7 @@ class Pigeonholes extends LibertyAttachable {
// generate a map of what items are assigned to what pigeonholes
if( !empty( $pListHash['include_members'] ) && @BitBase::verifyId( $result->fields['parent_id'] ) ) {
- $map[$i][] = $result->fields['parent_id'];
+ $map[$i][] = $row['parent_id'];
}
$result->MoveNext();
@@ -270,8 +268,7 @@ class Pigeonholes extends LibertyAttachable {
FROM `".BIT_DB_PREFIX."bit_pigeonhole_members` bpm
INNER JOIN `".BIT_DB_PREFIX."bit_pigeonholes` bp ON ( bp.`content_id` = bpm.`parent_id` )
WHERE bpm.`content_id`=?";
- $result = $this->mDb->query( $query, array( $pContentId ) );
- $ret = $result->getRows();
+ $ret = $this->mDb->getAll( $query, array( $pContentId ) );
}
return( !empty( $ret ) ? $ret : FALSE );
}
@@ -367,10 +364,9 @@ class Pigeonholes extends LibertyAttachable {
$result = $this->mDb->query( $query, $bindVars, $pListHash['max_records'], $pListHash['offset'] );
- while( !$result->EOF ) {
- $aux = $result->fields;
- $aux['creator'] = ( isset( $result->fields['creator_real_name'] ) ? $result->fields['creator_real_name'] : $result->fields['creator_user'] );
- $aux['editor'] = ( isset( $result->fields['modifier_real_name'] ) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'] );
+ while( $aux = $result->fetchRow() ) {
+ $aux['creator'] = ( isset( $aux['creator_real_name'] ) ? $aux['creator_real_name'] : $aux['creator_user'] );
+ $aux['editor'] = ( isset( $aux['modifier_real_name'] ) ? $aux['modifier_real_name'] : $aux['modifier_user'] );
$aux['display_link'] = Pigeonholes::getDisplayLink( $aux['title'], $aux );
if( !empty( $pListHash['force_extras'] ) ||
@@ -387,7 +383,6 @@ class Pigeonholes extends LibertyAttachable {
}
$ret[] = $aux;
- $result->MoveNext();
}
$query = "SELECT COUNT( tc.`title` )
@@ -587,17 +582,12 @@ class Pigeonholes extends LibertyAttachable {
$where = "WHERE bps.`content_id`=?";
$bindVars[] = @BitBase::verifyId( $pContentId ) ? $pContentId : $this->mContentId;
}
- $query = "SELECT bps.*
+ $query = "SELECT bps.`name`, bps.`value`
FROM `".BIT_DB_PREFIX."bit_pigeonhole_settings` bps
INNER JOIN `".BIT_DB_PREFIX."bit_pigeonhole_members` bpm ON ( bps.`content_id` = bpm.`parent_id` )
$where";
- $ret = array();
- $result = $this->mDb->query( $query, $bindVars );
- while( !$result->EOF ) {
- $ret[$result->fields['name']] = $result->fields['value'];
- $result->MoveNext();
- }
+ $ret = $this->mDb->getAssoc( $query, $bindVars );
} else {
$this->mErrors['get_members'] = tra( 'No valid content / member id was given.' );
}