summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2008-10-18 17:12:55 +0000
committerMax Kremmel <xing@synapse.plus.com>2008-10-18 17:12:55 +0000
commit8604ee637972c1abe98bd219be1d2e5ecafb2ecd (patch)
treec83d8707e21e68c006e83beb984cea30fa39d3e2
parent5042c221b273ffd8c47b28fd02e35f7226a040ee (diff)
downloadusers-8604ee637972c1abe98bd219be1d2e5ecafb2ecd.tar.gz
users-8604ee637972c1abe98bd219be1d2e5ecafb2ecd.tar.bz2
users-8604ee637972c1abe98bd219be1d2e5ecafb2ecd.zip
deprecate all semaphore code. this has now been moved to a separate package called _bit_semaphore.
-rw-r--r--BitPermUser.php38
-rw-r--r--BitUser.php120
-rw-r--r--admin/schema_inc.php1
3 files changed, 63 insertions, 96 deletions
diff --git a/BitPermUser.php b/BitPermUser.php
index b220b5a..036fd20 100644
--- a/BitPermUser.php
+++ b/BitPermUser.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/BitPermUser.php,v 1.69 2008/10/18 11:05:41 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/BitPermUser.php,v 1.70 2008/10/18 17:12:55 squareing Exp $
*
* Lib for user administration, groups and permissions
* This lib uses pear so the constructor requieres
@@ -11,7 +11,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitPermUser.php,v 1.69 2008/10/18 11:05:41 squareing Exp $
+ * $Id: BitPermUser.php,v 1.70 2008/10/18 17:12:55 squareing Exp $
* @package users
*/
@@ -24,7 +24,7 @@ require_once( USERS_PKG_PATH.'/BitUser.php' );
* Class that holds all information for a given user
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.69 $
+ * @version $Revision: 1.70 $
* @package users
* @subpackage BitPermUser
*/
@@ -738,26 +738,6 @@ class BitPermUser extends BitUser {
}
/**
- * setPermission temporarily set the permission for the active user does NOT store the permission
- *
- * @param array $pPerm
- * @param array $pValue
- * @access public
- * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
- */
- function setPermission( $pPerm, $pValue = NULL ) {
- if( $this->isAdmin() ) {
- $this->mPerms[$pPerm] = TRUE;
- } elseif( $this->isValid() ) {
- if( $pValue == 'y' || $pValue == TRUE ) {
- $this->mPerms[$pPerm] = TRUE;
- } else {
- unset( $this->mPerms[$pPerm] );
- }
- }
- }
-
- /**
* getGroupPermissions
*
* @param array $pGroupId Group id, if unset, all groups are returned
@@ -996,6 +976,18 @@ class BitPermUser extends BitUser {
}
}
}
+ function setPermission( $pPerm, $pValue = NULL ) {
+ deprecated( "This method doesn't do what it's supposed to and it seems it's not used." );
+ if( $this->isAdmin() ) {
+ $this->mPerms[$pPerm] = TRUE;
+ } elseif( $this->isValid() ) {
+ if( $pValue == 'y' || $pValue == TRUE ) {
+ $this->mPerms[$pPerm] = TRUE;
+ } else {
+ unset( $this->mPerms[$pPerm] );
+ }
+ }
+ }
// }}}
}
diff --git a/BitUser.php b/BitUser.php
index 5424141..45ea2b3 100644
--- a/BitUser.php
+++ b/BitUser.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.201 2008/10/18 09:46:35 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.202 2008/10/18 17:12:55 squareing Exp $
*
* Lib for user administration, groups and permissions
* This lib uses pear so the constructor requieres
@@ -12,7 +12,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitUser.php,v 1.201 2008/10/18 09:46:35 squareing Exp $
+ * $Id: BitUser.php,v 1.202 2008/10/18 17:12:55 squareing Exp $
* @package users
*/
@@ -42,7 +42,7 @@ define( "ACCOUNT_DISABLED", -6 );
* Class that holds all information for a given user
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.201 $
+ * @version $Revision: 1.202 $
* @package users
* @subpackage BitUser
*/
@@ -855,7 +855,6 @@ class BitUser extends LibertyMime {
$this->purgeImage( 'logo' );
$this->invokeServices( 'users_expunge_function' );
$userTables = array(
- 'users_semaphores',
'users_cnxn',
'users_watches',
'users_favorites_map',
@@ -2210,75 +2209,6 @@ class BitUser extends LibertyMime {
return $ret;
}
- // {{{ ==================== Semaphores ====================
- /**
- * isSemaphoreSet
- *
- * @param array $pSemName
- * @param array $pLimit
- * @access public
- * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
- */
- function isSemaphoreSet( $pSemName, $pLimit ) {
- if( !empty( $pSemName ) && !empty( $pLimit )) {
- global $gBitSystem;
-
- $pLimit = $gBitSystem->getUTCTime() - $pLimit;
- $query = "DELETE FROM `".BIT_DB_PREFIX."users_semaphores` WHERE `sem_name` = ? AND `created` < ?";
- $result = $this->mDb->query( $query, array( $pSemName, ( int )$pLimit) );
-
- $query = "SELECT `sem_name` FROM `".BIT_DB_PREFIX."users_semaphores` WHERE `sem_name`=?";
- $result = $this->mDb->query( $query, array( $pSemName ));
- return $result->numRows();
- }
- }
-
- /**
- * hasSemaphoreConflict
- *
- * @param array $pSemName
- * @param array $pLimit
- * @access public
- * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
- */
- function hasSemaphoreConflict( $pSemName, $pLimit ) {
- if( !empty( $pSemName ) && !empty( $pLimit )) {
- global $gBitSystem;
- $ret = NULL;
- $pLimit = $gBitSystem->getUTCTime() - $pLimit;
- $query = "delete from `".BIT_DB_PREFIX."users_semaphores` where `sem_name`=? and `created`<?";
- $result = $this->mDb->query($query,array( $pSemName, (int)$pLimit) );
- $query = "
- SELECT uu.`login`, uu.`real_name`, uu.`email`, uu.`user_id`
- FROM `".BIT_DB_PREFIX."users_semaphores` ls INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON( uu.`user_id`=ls.`user_id`)
- WHERE `sem_name`=? AND ls.`user_id` <> ?";
- if( $ret = $this->mDb->getRow( $query, array( $pSemName, ( $this->isValid() ? $this->mUserId : ANONYMOUS_USER_ID )))) {
- $ret['nolink'] = TRUE;
- }
- return( $ret );
- }
- }
-
- /**
- * storeSemaphore
- *
- * @param array $pSemName
- * @access public
- * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
- */
- function storeSemaphore( $pSemName ) {
- if( !empty( $pSemName ) ) {
- global $gBitSystem;
- $query = "DELETE FROM `".BIT_DB_PREFIX."users_semaphores` WHERE `sem_name`=?";
- $this->mDb->query( $query, array( $pSemName ));
-
- $query = "INSERT INTO `".BIT_DB_PREFIX."users_semaphores`(`sem_name`,`created`,`user_id`) VALUES(?,?,?)";
- $result = $this->mDb->query( $query, array( $pSemName, $gBitSystem->getUTCTime(), ( $this->isValid() ? $this->mUserId : ANONYMOUS_USER_ID )));
- return $gBitSystem->getUTCTime();
- }
- }
- // }}}
-
// PURE VIRTUAL FUNCTIONS
function getGroups () {
print "CALL TO PURE VIRTUAL FUNCTIONS"; bt(); die;
@@ -2446,6 +2376,50 @@ class BitUser extends LibertyMime {
return (count($this->mErrors) == 0);
}
+ function isSemaphoreSet( $pSemName, $pLimit ) {
+ deprecated( "Semaphore methods in users have been deprecated. Please use the semaphore package instead." );
+ if( !empty( $pSemName ) && !empty( $pLimit )) {
+ global $gBitSystem;
+
+ $pLimit = $gBitSystem->getUTCTime() - $pLimit;
+ $query = "DELETE FROM `".BIT_DB_PREFIX."users_semaphores` WHERE `sem_name` = ? AND `created` < ?";
+ $result = $this->mDb->query( $query, array( $pSemName, ( int )$pLimit) );
+
+ $query = "SELECT `sem_name` FROM `".BIT_DB_PREFIX."users_semaphores` WHERE `sem_name`=?";
+ $result = $this->mDb->query( $query, array( $pSemName ));
+ return $result->numRows();
+ }
+ }
+ function hasSemaphoreConflict( $pSemName, $pLimit ) {
+ deprecated( "Semaphore methods in users have been deprecated. Please use the semaphore package instead." );
+ if( !empty( $pSemName ) && !empty( $pLimit )) {
+ global $gBitSystem;
+ $ret = NULL;
+ $pLimit = $gBitSystem->getUTCTime() - $pLimit;
+ $query = "delete from `".BIT_DB_PREFIX."users_semaphores` where `sem_name`=? and `created`<?";
+ $result = $this->mDb->query($query,array( $pSemName, (int)$pLimit) );
+ $query = "
+ SELECT uu.`login`, uu.`real_name`, uu.`email`, uu.`user_id`
+ FROM `".BIT_DB_PREFIX."users_semaphores` ls INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON( uu.`user_id`=ls.`user_id`)
+ WHERE `sem_name`=? AND ls.`user_id` <> ?";
+ if( $ret = $this->mDb->getRow( $query, array( $pSemName, ( $this->isValid() ? $this->mUserId : ANONYMOUS_USER_ID )))) {
+ $ret['nolink'] = TRUE;
+ }
+ return( $ret );
+ }
+ }
+ function storeSemaphore( $pSemName ) {
+ deprecated( "Semaphore methods in users have been deprecated. Please use the semaphore package instead." );
+ if( !empty( $pSemName ) ) {
+ global $gBitSystem;
+ $query = "DELETE FROM `".BIT_DB_PREFIX."users_semaphores` WHERE `sem_name`=?";
+ $this->mDb->query( $query, array( $pSemName ));
+
+ $query = "INSERT INTO `".BIT_DB_PREFIX."users_semaphores`(`sem_name`,`created`,`user_id`) VALUES(?,?,?)";
+ $result = $this->mDb->query( $query, array( $pSemName, $gBitSystem->getUTCTime(), ( $this->isValid() ? $this->mUserId : ANONYMOUS_USER_ID )));
+ return $gBitSystem->getUTCTime();
+ }
+ }
// }}}
}
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index 66ffb80..8aaa8ba 100644
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -84,6 +84,7 @@ $tables = array(
CONSTRAINT ', CONSTRAINT `users_cnxn_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
",
+// remove this table - semaphores have been moved to their own package.
'users_semaphores' => "
sem_name C(250) PRIMARY,
user_id I4 NOTNULL,