summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LibertyAttachable.php17
-rw-r--r--LibertyComment.php17
-rw-r--r--LibertyContent.php60
-rwxr-xr-xLibertyStructure.php15
-rwxr-xr-xLibertySystem.php18
-rw-r--r--plugins/format.tikiwiki.php43
6 files changed, 80 insertions, 90 deletions
diff --git a/LibertyAttachable.php b/LibertyAttachable.php
index 6583c60..d14f797 100644
--- a/LibertyAttachable.php
+++ b/LibertyAttachable.php
@@ -3,7 +3,7 @@
* Management of Liberty Content
*
* @package liberty
- * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.12 2006/01/24 21:49:32 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.13 2006/01/25 15:40:25 spiderr Exp $
* @author spider <spider@steelsun.com>
*/
// +----------------------------------------------------------------------+
@@ -284,7 +284,7 @@ Disable for now - instead fend off new uploads once quota is exceeded. Need a ni
$sql = "SELECT * FROM `".BIT_DB_PREFIX."tiki_attachments` WHERE `attachment_id` = ?";
$rs = $this->mDb->query($sql, array( $pAttachmentId ));
- $tmpAttachment = $rs->fields;
+ $tmpAttachment = $rs->fetchRow();
if ( @$this->verifyId($tmpAttachment['attachment_id']) ) {
$newAttachmentId = $this->mDb->GenID( 'tiki_attachments_id_seq' );
@@ -310,9 +310,9 @@ Disable for now - instead fend off new uploads once quota is exceeded. Need a ni
if( @$this->verifyId( $pAttachmentId ) ) {
$sql = "SELECT `attachment_plugin_guid`, `user_id` FROM `".BIT_DB_PREFIX."tiki_attachments` WHERE `attachment_id`=?";
- $rs = $this->mDb->query( $sql, array( $pAttachmentId ) );
- $guid = $rs->fields['attachment_plugin_guid'];
- $user_id = $rs->fields['user_id'];
+ $row = $this->mDb->getRow( $sql, array( $pAttachmentId ) );
+ $guid = $row['attachment_plugin_guid'];
+ $user_id = $row['user_id'];
if( $guid && ($user_id == $gBitUser->mUserId || $gBitUser->isAdmin()) ) {
if ( function_exists( $gLibertySystem->mPlugins[$guid]['expunge_function'])) {
@@ -370,14 +370,12 @@ Disable for now - instead fend off new uploads once quota is exceeded. Need a ni
WHERE ta.`content_id`=?";
if( $result = $this->mDb->query($query,array((int) $conId)) ) {
$this->mStorage = array();
- while( !$result->EOF ) {
- $row = &$result->fields;
+ while( $row = $result->fetchRow() ) {
if( $func = $gLibertySystem->getPluginFunction( $row['attachment_plugin_guid'], 'load_function' ) ) {
$this->mStorage[$row['attachment_id']] = $func( $row );
} else {
print "NO load_function for ".$row['attachment_plugin_guid']." ".$gLibertySystem->mPlugins[$row['attachment_plugin_guid']];
}
- $result->MoveNext();
}
}
}
@@ -395,8 +393,7 @@ Disable for now - instead fend off new uploads once quota is exceeded. Need a ni
WHERE ta.`attachment_id`=?";
if( $result = $this->mDb->query($query,array((int) $pAttachmentId)) ) {
$ret = array();
- if( !$result->EOF ) {
- $row = &$result->fields;
+ if( $row = $result->fetchRow() ) {
if( $func = $gLibertySystem->getPluginFunction( $row['attachment_plugin_guid'], 'load_function' ) ) {
$ret = $func( $row );
}
diff --git a/LibertyComment.php b/LibertyComment.php
index 71eb08a..e72f70c 100644
--- a/LibertyComment.php
+++ b/LibertyComment.php
@@ -3,7 +3,7 @@
* Management of Liberty Content
*
* @package liberty
- * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyComment.php,v 1.7 2005/12/26 12:25:03 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyComment.php,v 1.8 2006/01/25 15:40:25 spiderr Exp $
* @author spider <spider@steelsun.com>
*/
@@ -60,12 +60,10 @@ class LibertyComment extends LibertyContent {
FROM `".BIT_DB_PREFIX."tiki_comments` tc LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_content` tcn ON (tc.`content_id` = tcn.`content_id`)
LEFT OUTER JOIN `".BIT_DB_PREFIX."users_users` uu ON (tcn.`user_id` = uu.`user_id`)
$mid";
- $rs = $this->mDb->query($sql, $bindVars);
-
- if ($rs && $rs->numRows()) {
- $this->mInfo = $rs->fields;
- $this->mContentId = $rs->fields['content_id'];
- $this->mCommentId = $rs->fields['comment_id'];
+ if( $row = $this->mDb->getRow($sql, $bindVars) ) {
+ $this->mInfo = $row;
+ $this->mContentId = $row['content_id'];
+ $this->mCommentId = $row['comment_id'];
}
return count($this->mInfo);
}
@@ -268,10 +266,9 @@ class LibertyComment extends LibertyContent {
if ($contentId) {
$sql = "SELECT tcm.`comment_id` FROM `".BIT_DB_PREFIX."tiki_comments` tcm, `".BIT_DB_PREFIX."tiki_content` tc
WHERE tcm.`parent_id` = ? AND tcm.`content_id` = tc.`content_id` ORDER BY tc.`created` $sort_order";
- if( $rs = $this->mDb->query( $sql, array($contentId), $pMaxComments, $pOffset ) ) {
- $rows = $rs->getRows();
+ if( $rows = $this->mDb->getAll( $sql, array($contentId), $pMaxComments, $pOffset ) ) {
foreach ($rows as $row) {
- $comment = new LibertyComment($row['comment_id']);
+ $comment = new LibertyComment( $row['comment_id'] );
$comment->mInfo['level'] = $curLevel;
$curLevel++;
$comment->mInfo['children'] = $this->getComments_threaded($comment->mInfo['content_id']);
diff --git a/LibertyContent.php b/LibertyContent.php
index a38c838..f2361c4 100644
--- a/LibertyContent.php
+++ b/LibertyContent.php
@@ -3,7 +3,7 @@
* Management of Liberty content
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.21 2006/01/23 21:26:38 lsces Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.22 2006/01/25 15:40:25 spiderr Exp $
* @author spider <spider@steelsun.com>
*/
@@ -589,18 +589,19 @@ class LibertyContent extends LibertyBase {
* @param pCaseSensitive look for case sensitive names
*/
function pageExists( $pPageName, $pCaseSensitive=FALSE ) {
+ global $gBitSystem;
$ret = NULL;
- $pageWhere = $pCaseSensitive ? 'tc.`title`' : 'LOWER( tc.`title` )';
- $bindVars = array( ($pCaseSensitive ? $pPageName : strtolower( $pPageName ) ) );
- $query = "SELECT `page_id`, tp.`content_id`, `description`, tc.`last_modified`, tc.`title`
- FROM `".BIT_DB_PREFIX."tiki_pages` tp, `".BIT_DB_PREFIX."tiki_content` tc
- WHERE tc.`content_id`=tp.`content_id` AND $pageWhere = ?";
- $result = $this->mDb->query($query, array( $bindVars ));
-
- if( $result->numRows() ) {
- $ret = $result->getArray();
+ if( $gBitSystem->isPackageActive( 'wiki' ) ) {
+ $pageWhere = $pCaseSensitive ? 'tc.`title`' : 'LOWER( tc.`title` )';
+ $bindVars = array( ($pCaseSensitive ? $pPageName : strtolower( $pPageName ) ) );
+ $query = "SELECT `page_id`, tp.`content_id`, `description`, tc.`last_modified`, tc.`title`
+ FROM `".BIT_DB_PREFIX."tiki_pages` tp, `".BIT_DB_PREFIX."tiki_content` tc
+ WHERE tc.`content_id`=tp.`content_id` AND $pageWhere = ?";
+ $ret = $this->mDb->getAll($query, $bindVars );
+ if( empty( $ret ) ) {
+ $ret = NULL; // we don't want an empty array
+ }
}
-
return $ret;
}
@@ -820,9 +821,7 @@ class LibertyContent extends LibertyBase {
WHERE uu.`user_id` != ".ANONYMOUS_USER_ID." AND tc.`hits` > 0 $mid
GROUP BY uu.`user_id`, uu.`login`, uu.`real_name`
ORDER BY `ag_hits` DESC";
- if( $result = $this->mDb->query( $query, $bindVars, $pListHash['max_records'], $pListHash['offset'] ) ) {
- $ret = $result->GetRows();
- }
+ $ret = $this->mDb->getRow( $query, $bindVars, $pListHash['max_records'], $pListHash['offset'] );
return $ret;
}
@@ -949,29 +948,29 @@ class LibertyContent extends LibertyBase {
$cant = $this->mDb->getOne($query_cant,$bindVars);
$ret = array();
$contentTypes = $gLibertySystem->mContentTypes;
- while ($res = $result->fetchRow()) {
- $aux = array();
- $aux = $res;
- if( !empty( $contentTypes[$res['content_type_guid']] ) ) {
+ while ($aux = $result->fetchRow()) {
+ if( !empty( $contentTypes[$aux['content_type_guid']] ) ) {
// quick alias for code readability
- $type = &$contentTypes[$res['content_type_guid']];
+ $type = &$contentTypes[$aux['content_type_guid']];
+ $aux['creator'] = (isset( $aux['creator_real_name'] ) ? $aux['creator_real_name'] : $aux['creator_user'] );
+ $aux['real_name'] = (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['content_description'] = $type['content_description'];
+ $aux['user'] = $aux['creator_user'];
+ $aux['real_name'] = (isset( $aux['creator_real_name'] ) ? $aux['creator_real_name'] : $aux['creator_user'] );
+ $aux['user_id'] = $aux['creator_user_id'];
if( empty( $type['content_object'] ) ) {
// create *one* object for each object *type* to call virtual methods.
- include_once( $gBitSystem->mPackages[$type['handler_package']]['path'].$type['handler_file'] );
- $type['content_object'] = new $type['handler_class']();
+ if( !empty( $gBitSystem->mPackages[$type['handler_package']] ) ) {
+ include_once( $gBitSystem->mPackages[$type['handler_package']]['path'].$type['handler_file'] );
+ $type['content_object'] = new $type['handler_class']();
+ $aux['display_link'] = $type['content_object']->getDisplayLink( $aux['title'], $aux );
+ $aux['title'] = $type['content_object']->getTitle( $aux );
+ }
}
- $aux['creator'] = (isset( $res['creator_real_name'] ) ? $res['creator_real_name'] : $res['creator_user'] );
- $aux['real_name'] = (isset( $res['creator_real_name'] ) ? $res['creator_real_name'] : $res['creator_user'] );
- $aux['editor'] = (isset( $res['modifier_real_name'] ) ? $res['modifier_real_name'] : $res['modifier_user'] );
- $aux['content_description'] = $type['content_description'];
- $aux['user'] = $res['creator_user'];
- $aux['real_name'] = (isset( $res['creator_real_name'] ) ? $res['creator_real_name'] : $res['creator_user'] );
- $aux['user_id'] = $res['creator_user_id'];
require_once $gBitSmarty->_get_plugin_filepath( 'modifier', 'bit_long_date' );
- $aux['display_link'] = $type['content_object']->getDisplayLink( $aux['title'], $aux );
// getDisplayUrl is currently a pure virtual method in LibertyContent, so this cannot be called currently
// $aux['display_url'] = $type['content_object']->getDisplayUrl( $aux['title'], $aux );
- $aux['title'] = $type['content_object']->getTitle( $aux );
$ret[] = $aux;
}
}
@@ -1035,7 +1034,6 @@ class LibertyContent extends LibertyBase {
if( $result = $this->mDb->query( $query,array( $this->mContentId ) ) ) {
while ($res = $result->fetchRow()) {
$ret[] = $res;
- $result->MoveNext();
}
}
}
diff --git a/LibertyStructure.php b/LibertyStructure.php
index 36b13a1..bfc3ac1 100755
--- a/LibertyStructure.php
+++ b/LibertyStructure.php
@@ -3,7 +3,7 @@
* Management of Liberty Content
*
* @package liberty
- * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyStructure.php,v 1.16 2006/01/17 00:23:24 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyStructure.php,v 1.17 2006/01/25 15:40:25 spiderr Exp $
* @author spider <spider@steelsun.com>
*/
@@ -57,7 +57,7 @@ class LibertyStructure extends LibertyBase {
}
if( $result = $this->mDb->query( $query, $bindVars ) ) {
- $ret = $result->fields;
+ $ret = $result->fetchRow();
}
if( !empty( $contentTypes[$ret['content_type_guid']] ) ) {
@@ -700,18 +700,17 @@ class LibertyStructure extends LibertyBase {
$query = "SELECT * from `".BIT_DB_PREFIX."tiki_structures` where `parent_id`=? ORDER BY pos, page_alias, content_id";
$result = $this->mDb->query( $query, array( (int)$pStructureId ) );
- while ( !$result->EOF ) {
- array_push( $pToc, $result->fields['content_id'] );
- $this->getContentIds( $result->fields['structure_id'], $pToc, ++$pLevel );
- $result->MoveNext();
+ while ( $row = $result->fetchRow() ) {
+ array_push( $pToc, $row['content_id'] );
+ $this->getContentIds( $row['structure_id'], $pToc, ++$pLevel );
}
}
function getContentArray( $pStructureId, &$pToc, $pLevel=0 ) {
$query = "SELECT * from `".BIT_DB_PREFIX."tiki_structures` where `structure_id`=?";
$result = $this->mDb->query( $query, array( (int)$pStructureId ) );
- if( !$result->EOF ) {
- array_push( $pToc, $result->fields['content_id'] );
+ while ( $row = $result->fetchRow() ) {
+ array_push( $pToc, $row['content_id'] );
$this->getContentIds( $pStructureId, $pToc, $pLevel );
}
}
diff --git a/LibertySystem.php b/LibertySystem.php
index 0b02a1f..45a4899 100755
--- a/LibertySystem.php
+++ b/LibertySystem.php
@@ -3,7 +3,7 @@
* System class for handling the liberty package
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.11 2006/01/20 11:08:50 squareing Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.12 2006/01/25 15:40:25 spiderr Exp $
* @author spider <spider@steelsun.com>
*/
@@ -61,10 +61,10 @@ class LibertySystem extends LibertyBase {
}
function loadPlugins() {
- $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."tiki_plugins`", NULL, BIT_QUERY_DEFAULT, BIT_QUERY_DEFAULT );
- while( $rs && !$rs->EOF ) {
- $this->mPlugins[$rs->fields['plugin_guid']] = $rs->fields;
- $rs->MoveNext();
+ if( $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."tiki_plugins`", NULL, BIT_QUERY_DEFAULT, BIT_QUERY_DEFAULT ) ) {
+ while( $row = $rs->fetchRow() ) {
+ $this->mPlugins[$row['plugin_guid']] = $row;
+ }
}
}
@@ -102,10 +102,10 @@ class LibertySystem extends LibertyBase {
}
function loadContentTypes( $pCacheTime=BIT_QUERY_CACHE_TIME ) {
- $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."tiki_content_types`", NULL, BIT_QUERY_DEFAULT, BIT_QUERY_DEFAULT );
- while( $rs && !$rs->EOF ) {
- $this->mContentTypes[$rs->fields['content_type_guid']] = $rs->fields;
- $rs->MoveNext();
+ if( $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."tiki_content_types`", NULL, BIT_QUERY_DEFAULT, BIT_QUERY_DEFAULT ) ) {
+ while( $row = $rs->fetchRow() ) {
+ $this->mContentTypes[$row['content_type_guid']] = $row;
+ }
}
}
diff --git a/plugins/format.tikiwiki.php b/plugins/format.tikiwiki.php
index 3583e63..7d4522f 100644
--- a/plugins/format.tikiwiki.php
+++ b/plugins/format.tikiwiki.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.17 $
+ * @version $Revision: 1.18 $
* @package liberty
*/
global $gLibertySystem;
@@ -61,13 +61,12 @@ function tikiwiki_rename( $pContentId, $pOldName, $pNewName, &$pCommonObject ) {
INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON( tl.`from_content_id`=tc.`content_id` )
WHERE `to_content_id` = ?";
if( $result = $pCommonObject->mDb->query($query, array( $pContentId ) ) ) {
- while( !$result->EOF ) {
- $data = preg_replace( '/(\W|\(\()('.$pOldName.')(\W|\)\))/', '\\1'.$pNewName.'\\3', $result->fields['data'] );
- if( md5( $data ) != md5( $result->fields['data'] ) ) {
+ while( $row = $result->fetchRow() ) {
+ $data = preg_replace( '/(\W|\(\()('.$pOldName.')(\W|\)\))/', '\\1'.$pNewName.'\\3', $row['data'] );
+ if( md5( $data ) != md5( $row['data'] ) ) {
$query = "UPDATE `".BIT_DB_PREFIX."tiki_content` SET `data`=? WHERE `content_id`=?";
- $pCommonObject->mDb->query($query, array( $data, $result->fields['from_content_id'] ) );
+ $pCommonObject->mDb->query($query, array( $data, $row['from_content_id'] ) );
}
- $result->MoveNext();
}
}
}
@@ -195,13 +194,12 @@ class TikiWikiParser extends BitBase {
WHERE tl.`from_content_id`=? ORDER BY tc.`title`";
if( $result = $this->mDb->query( $query, array( $pContentId ) ) ) {
$lastTitle = '';
- while( !$result->EOF ) {
- if( $result->fields['title'] == $lastTitle ) {
+ while( $row = $result->fetchRow() ) {
+ if( $row['title'] == $lastTitle ) {
// TODO - need to check ensure that tiki_links duplicate are properly inserted - spiderr
}
- $this->mPageLookup[$result->fields['hash_key']][] = $result->fields;
- $lastTitle = $result->fields['title'];
- $result->MoveNext();
+ $this->mPageLookup[$row['hash_key']][] = $row;
+ $lastTitle = $row['title'];
}
}
}
@@ -217,8 +215,9 @@ class TikiWikiParser extends BitBase {
*/
function getAllPages( $pContentId, $pCommonObject ) {
+ global $gBitSystem;
$ret = array();
- if( @BitBase::verifyId( $pContentId ) ) {
+ if( $gBitSystem->isFeatureActive( 'wiki' ) && @BitBase::verifyId( $pContentId ) ) {
$query = "SELECT `page_id`, tc.`content_id`, `description`, tc.`last_modified`, tc.`title`
FROM `".BIT_DB_PREFIX."tiki_links` tl
INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON( tl.`to_content_id`=tc.`content_id` )
@@ -226,12 +225,11 @@ class TikiWikiParser extends BitBase {
WHERE tl.`from_content_id`=? ORDER BY tc.`title`";
if( $result = $this->mDb->query( $query, array( $pContentId ) ) ) {
$lastTitle = '';
- while( !$result->EOF ) {
- if( array_key_exists( strtolower( $result->fields['title'] ), $ret ) ) {
- $result->fields['description'] = tra( 'Multiple pages with this name' );
+ while( $row = $result->fetchRow() ) {
+ if( array_key_exists( strtolower( $row['title'] ), $ret ) ) {
+ $row['description'] = tra( 'Multiple pages with this name' );
}
- $ret[strtolower( $result->fields['title'] )] = $result->fields;
- $result->MoveNext();
+ $ret[strtolower( $row['title'] )] = $row;
}
}
}
@@ -247,11 +245,12 @@ class TikiWikiParser extends BitBase {
}
// final attempt to get page details
if( empty( $ret ) && empty( $pPageList ) ) {
- $ret = $pCommonObject->pageExists( $pTitle );
- if( count( $ret ) > 1 ) {
- $ret[0]['description'] = tra( 'Multiple pages with this name' );
+ if( $ret = $pCommonObject->pageExists( $pTitle ) ) {
+ if( count( $ret ) > 1 ) {
+ $ret[0]['description'] = tra( 'Multiple pages with this name' );
+ }
+ $ret = $ret[0];
}
- $ret = $ret[0];
}
return $ret;
}
@@ -1266,7 +1265,7 @@ class TikiWikiParser extends BitBase {
}
// Replace Hotwords before begin
- if ($gBitSystem->getPreference('package_hotwords') == 'y') {
+ if ($gBitSystem->isPackageActive( 'hotwords' ) ) {
$line = $hotwordlib->replace_hotwords($line, $words);
}