summaryrefslogtreecommitdiff
path: root/Pigeonholes.php
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2006-02-08 21:51:14 +0000
committerMax Kremmel <xing@synapse.plus.com>2006-02-08 21:51:14 +0000
commitbd3da2b27d914f8e8bdf3b58b662dee3b62217c8 (patch)
treeb129d3eeafc2d087072c28710964c13cd14ef09b /Pigeonholes.php
parent24e783063112b3bf3a1bc11a14ae87fae74111e2 (diff)
downloadpigeonholes-bd3da2b27d914f8e8bdf3b58b662dee3b62217c8.tar.gz
pigeonholes-bd3da2b27d914f8e8bdf3b58b662dee3b62217c8.tar.bz2
pigeonholes-bd3da2b27d914f8e8bdf3b58b662dee3b62217c8.zip
php: introduce new method: getPref( $package, $pref, $defaut ) (order is open for discussion
tpl: $gBitPref.package.pref applied package name to all saves - should make database more organised and should allow more reliable uninstalls in the future
Diffstat (limited to 'Pigeonholes.php')
-rw-r--r--Pigeonholes.php26
1 files changed, 14 insertions, 12 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php
index 02914ab..5a2abf9 100644
--- a/Pigeonholes.php
+++ b/Pigeonholes.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.40 2006/02/08 12:31:13 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.41 2006/02/08 21:51:14 squareing Exp $
*
* +----------------------------------------------------------------------+
* | Copyright ( c ) 2004, bitweaver.org
@@ -17,7 +17,7 @@
* Pigeonholes class
*
* @author xing <xing@synapse.plus.com>
- * @version $Revision: 1.40 $
+ * @version $Revision: 1.41 $
* @package pigeonholes
*/
@@ -402,17 +402,19 @@ class Pigeonholes extends LibertyAttachable {
* @return a nicely grouped set of pigeonhole members in a set of columns and starting letters.
* @access public
**/
- function checkPathPermissions( &$pPath ) {
+ function checkPathPermissions( $pPath ) {
global $gBitUser;
- foreach( $pPath as $key => $path ) {
- // load preferences for this node, if it's not loaded yet
- if( empty( $path['preferences'] ) ) {
- $pPath[$key]['preferences'] = $this->loadPreferences( $path['content_id'] );
- }
- $group_id = !empty( $pPath[$key]['preferences']['group_id'] ) ? $pPath[$key]['preferences']['group_id'] : NULL;
- $permission = !empty( $pPath[$key]['preferences']['permission'] ) ? $pPath[$key]['preferences']['permission'] : NULL;
- if( ( !empty( $group_id ) && !$gBitUser->isInGroup( $group_id ) ) || ( !empty( $permission ) && !$gBitUser->hasPermission( $permission ) ) ) {
- return FALSE;
+ foreach( $pPath as $path ) {
+ $contentIds[] = $path['content_id'];
+ }
+ if( !empty( $contentIds ) ) {
+ $query = "SELECT `name`, `value` FROM `".BIT_DB_PREFIX."liberty_content_prefs` WHERE `content_id` IN( ".preg_replace( "/,$/", "", str_repeat( "?,", count( $contentIds ) ) )." ) ";
+ $result = $this->mDb->query( $query, $contentIds );
+ while( $aux = $result->fetchRow() ) {
+ ${$aux['name']} = $aux['value'];
+ if( ( !empty( $group_id ) && !$gBitUser->isInGroup( $group_id ) ) || ( !empty( $permission ) && !$gBitUser->hasPermission( $permission ) ) ) {
+ return FALSE;
+ }
}
}
return TRUE;