summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2005-07-25 20:02:56 +0000
committerMax Kremmel <xing@synapse.plus.com>2005-07-25 20:02:56 +0000
commitb5bf27ddc4ddac64a14fa82c2262acb10b5335cf (patch)
tree8b8dd3da9ca74d5af858be4e376d98974422e187
parentbe39c920051f88f5a9da87885b4b002cccc08f84 (diff)
downloadusers-b5bf27ddc4ddac64a14fa82c2262acb10b5335cf.tar.gz
users-b5bf27ddc4ddac64a14fa82c2262acb10b5335cf.tar.bz2
users-b5bf27ddc4ddac64a14fa82c2262acb10b5335cf.zip
Merge recent changes R1 1.0.2 beta --> HEAD
-rw-r--r--BitUser.php29
-rw-r--r--index.php7
-rw-r--r--lookup_user_inc.php10
-rw-r--r--modules/mod_user_tasks.php18
-rw-r--r--my.php5
-rw-r--r--templates/center_user_wiki_page.tpl1
-rw-r--r--templates/menu_users.tpl1
-rw-r--r--templates/my_images.tpl2
-rw-r--r--templates/user_tasks.tpl2
9 files changed, 52 insertions, 23 deletions
diff --git a/BitUser.php b/BitUser.php
index 4c367ae..99b7369 100644
--- a/BitUser.php
+++ b/BitUser.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.6 2005/07/17 17:36:44 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.7 2005/07/25 20:02:54 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.6 2005/07/17 17:36:44 squareing Exp $
+ * $Id: BitUser.php,v 1.7 2005/07/25 20:02:54 squareing Exp $
* @package users
*/
@@ -40,7 +40,7 @@ define("ACCOUNT_DISABLED", -6);
* Class that holds all information for a given user
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @package users
* @subpackage BitUser
*/
@@ -152,6 +152,7 @@ class BitUser extends LibertyAttachable {
$this->mUserPrefs['flag'] = $this->mUserPrefs['country'];
$this->mUserPrefs['country'] = str_replace( '_', ' ', $this->mUserPrefs['country']);
}
+ $this->mInfo['real_name'] = trim($this->mInfo['real_name']);
$this->mInfo['display_name'] = ((!empty($this->mInfo['real_name']) ? $this->mInfo['real_name'] :
(!empty($this->mUsername) ? $this->mUsername :
(!empty($this->mInfo['email']) ? substr($this->mInfo['email'],0, strpos($this->mInfo['email'],'@')) :
@@ -339,6 +340,11 @@ class BitUser extends LibertyAttachable {
} elseif( empty( $pParamHash['password'] ) ) {
$this->mErrors['password'] = tra( 'Your password should be at least '.$gBitSystem->getPreference( 'min_pass_length', 4 ).' characters long' );
}
+ } elseif( $this->isValid() ) {
+ // Prevent loosing user info on save
+ if( empty( $pParamHash['edit'] ) ) {
+ $pParamHash['edit'] = $this->mInfo['data'];
+ }
}
@@ -1014,6 +1020,20 @@ echo "userAuthPresent: $userAuthPresent<br>";
}
return $ret;
}
+
+ // specify lookup where by hash key lik 'login' or 'user_id' or 'email'
+ function getUserFromContentId( $content_id ) {
+ $ret = NULL;
+ if( !empty( $content_id ) ) {
+ $query = "SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users`
+ WHERE `content_id` = ?";
+ $tmpUser = $this->mDb->GetRow( $query, array( $content_id ) );
+ if (!empty($tmpUser['user_id'])) {
+ $ret = $tmpUser['user_id'];
+ }
+ }
+ return $ret;
+ }
/*
// all of these methods have been replaced by the single getUserInfo method
function get_user_info($user, $iCaseSensitive = TRUE) {
@@ -1058,7 +1078,7 @@ echo "userAuthPresent: $userAuthPresent<br>";
// get user_id to avoid NULL and zero confusion
$query = "SELECT `user_id`, `pass_due`
FROM `".BIT_DB_PREFIX."users_users`
- WHERE `pass_due` IS NOT NULL AND `login`=? ";
+ WHERE `pass_due` IS NOT NULL AND `user_id`=? ";
$due = $this->GetAssoc( $query, array( $this->mUserId ) );
if( !empty( $due['user_id'] ) ) {
$ret = $due['pass_due'] <= date("U");
@@ -1240,6 +1260,7 @@ echo "userAuthPresent: $userAuthPresent<br>";
}
unset( $this->mInfo[$pType.'_storage_path'] );
unset( $this->mInfo[$pType.'_attachment_id'] );
+ unset( $this->mInfo[$pType.'_url'] );
$this->mDb->CompleteTrans();
}
}
diff --git a/index.php b/index.php
index 7a42c93..966ff5a 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/index.php,v 1.4 2005/07/17 17:36:44 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/index.php,v 1.5 2005/07/25 20:02:54 squareing Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,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: index.php,v 1.4 2005/07/17 17:36:44 squareing Exp $
+ * $Id: index.php,v 1.5 2005/07/25 20:02:54 squareing Exp $
* @package users
* @subpackage functions
*/
@@ -27,11 +27,12 @@ if( !empty( $gBitSystem->mPrefs['custom_user_fields'] ) ) {
$customFields= explode( ',', $gBitSystem->mPrefs['custom_user_fields'] );
$smarty->assign('customFields', $customFields);
}
+// lookup may be via content_id which will then return user_id for search request
+require_once( USERS_PKG_PATH.'lookup_user_inc.php' );
$search_request = '';
if (!empty($_REQUEST['home'])) {
$search_request = $_REQUEST['home'];
}
-require_once( USERS_PKG_PATH.'lookup_user_inc.php' );
if( !empty( $_REQUEST['home'] ) ) {
$smarty->assign( 'home', $_REQUEST['home'] );
$gQueryUserId = $_REQUEST['home'];
diff --git a/lookup_user_inc.php b/lookup_user_inc.php
index 07eddb2..db2325f 100644
--- a/lookup_user_inc.php
+++ b/lookup_user_inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/lookup_user_inc.php,v 1.2 2005/06/28 07:46:23 spiderr Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/lookup_user_inc.php,v 1.3 2005/07/25 20:02:54 squareing Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,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: lookup_user_inc.php,v 1.2 2005/06/28 07:46:23 spiderr Exp $
+ * $Id: lookup_user_inc.php,v 1.3 2005/07/25 20:02:54 squareing Exp $
* @package users
* @subpackage functions
*/
@@ -25,6 +25,12 @@ if (isset($_REQUEST['home'])) {
$_REQUEST['fHomepage'] = $_REQUEST['home'];
}
+if (isset($_REQUEST['content_id'])) {
+ // This identifies the user_id associated with the contact_id of a record
+ // Used to allow access to user records via the generic index.php?content_id=x
+ $_REQUEST['home'] = $gBitUser->getUserFromContentId($_REQUEST['content_id']);
+}
+
if (isset($_REQUEST['home'])) {
// this allows for a numeric user_id or alpha_numeric user_id
$queryUserId = $gBitUser->lookupHomepage($_REQUEST['home'], $gBitSystem->getPreference('case_sensitive_login', 'y') == 'y');
diff --git a/modules/mod_user_tasks.php b/modules/mod_user_tasks.php
index cbdc72a..829fea9 100644
--- a/modules/mod_user_tasks.php
+++ b/modules/mod_user_tasks.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/modules/Attic/mod_user_tasks.php,v 1.2 2005/06/28 07:46:24 spiderr Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/modules/Attic/mod_user_tasks.php,v 1.3 2005/07/25 20:02:55 squareing Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,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: mod_user_tasks.php,v 1.2 2005/06/28 07:46:24 spiderr Exp $
+ * $Id: mod_user_tasks.php,v 1.3 2005/07/25 20:02:55 squareing Exp $
* @package users
* @subpackage modules
*/
@@ -17,9 +17,9 @@
* required setup
*/
require_once(USERS_PKG_PATH."task_lib.php");
-global $user, $feature_tasks, $bit_p_tasks, $tasklib;
+global $gBitUser, $gBitSystem, $tasklib;
-if ($user && isset($feature_tasks) && $feature_tasks == 'y' && isset($bit_p_tasks) && $gBitUser->hasPermission( 'bit_p_tasks' )) {
+if ($gBitUser->getUserId() > 0 && $gBitSystem->isFeatureActive('feature_tasks') && $gBitUser->hasPermission( 'bit_p_tasks' )) {
if (isset($_SESSION['thedate'])) {
$pdate = $_SESSION['thedate'];
} else {
@@ -27,21 +27,21 @@ if ($user && isset($feature_tasks) && $feature_tasks == 'y' && isset($bit_p_task
}
if (isset($_REQUEST["modTasksDel"])) {
foreach (array_keys($_REQUEST["modTasks"])as $task) {
- $tasklib->remove_task($user, $task);
+ $tasklib->remove_task($gBitUser->getUserId(), $task);
}
}
if (isset($_REQUEST["modTasksCom"])) {
foreach (array_keys($_REQUEST["modTasks"])as $task) {
- $tasklib->complete_task($user, $task);
+ $tasklib->complete_task($gBitUser->getUserId(), $task);
}
}
if (isset($_REQUEST["modTasksSave"])) {
- $tasklib->replace_task($user, 0, $_REQUEST['modTasksTitle'], $_REQUEST['modTasksTitle'], date("U"), 'o', 3, 0, 0);
+ $tasklib->replace_task($gBitUser->getUserId(), 0, $_REQUEST['modTasksTitle'], $_REQUEST['modTasksTitle'], date("U"), 'o', 3, 0, 0);
}
$ownurl =/*httpPrefix().*/ $_SERVER["REQUEST_URI"];
$smarty->assign('ownurl', $ownurl);
- $tasks_use_dates = $gBitSystem->get_user_preference($user, 'tasks_use_dates');
- $modTasks = $gBitSystem->list_tasks($user, 0, -1, 'priority_desc', '', $tasks_use_dates, $pdate);
+ $tasks_use_dates = $gBitUser->getPreference('tasks_use_dates');
+ $modTasks = $tasklib->list_tasks($gBitUser->getUserId(), 0, -1, 'priority_desc', '', $tasks_use_dates, $pdate);
$smarty->assign('modTasks', $modTasks['data']);
}
?>
diff --git a/my.php b/my.php
index 2a9f6c7..55c1a7d 100644
--- a/my.php
+++ b/my.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/my.php,v 1.5 2005/07/17 17:36:44 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/my.php,v 1.6 2005/07/25 20:02:54 squareing Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,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: my.php,v 1.5 2005/07/17 17:36:44 squareing Exp $
+ * $Id: my.php,v 1.6 2005/07/25 20:02:54 squareing Exp $
* @package users
* @subpackage functions
*/
@@ -55,6 +55,7 @@ $smarty->assign( 'numPages', $numPages );
$smarty->assign( 'contentSelect', $contentSelect );
$smarty->assign( 'contentTypes', $contentTypes );
$smarty->assign( 'contentList', $contentList['data'] );
+$smarty->assign( 'contentCount', $contentList['cant'] );
// end of content listing
$gBitSystem->display( 'bitpackage:users/my_bitweaver.tpl', 'My '.$gBitSystem->getPreference( 'siteTitle' ) );
diff --git a/templates/center_user_wiki_page.tpl b/templates/center_user_wiki_page.tpl
index 3f774a4..eefedcf 100644
--- a/templates/center_user_wiki_page.tpl
+++ b/templates/center_user_wiki_page.tpl
@@ -42,6 +42,7 @@
{/if}
{$parsed}
+ <div style="clear:both"></div>
</div><!-- end .content -->
</div><!-- end .body -->
{/jstab}
diff --git a/templates/menu_users.tpl b/templates/menu_users.tpl
index 1fa272f..deac899 100644
--- a/templates/menu_users.tpl
+++ b/templates/menu_users.tpl
@@ -6,7 +6,6 @@
{if $gBitSystem->isPackageActive( 'wiki' )}
<li><a class="item" href="{$gBitLoc.USERS_PKG_URL}edit_personal_page.php">{biticon ipackage=liberty iname=edit iforce=icon} {tr}Edit My Homepage{/tr}</a></li>
{/if}
- <li><a class="item" href="{$gBitLoc.LIBERTY_PKG_URL}list_content.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}All available Content{/tr}</a></li>
{if $gBitSystemPrefs.feature_user_layout eq 'h'}
{assign var="myLayoutConfig" value="My Homepage"}
{else if $gBitSystem->isFeatureActive( 'feature_user_layout' )}
diff --git a/templates/my_images.tpl b/templates/my_images.tpl
index 21442f3..68846ba 100644
--- a/templates/my_images.tpl
+++ b/templates/my_images.tpl
@@ -16,7 +16,7 @@
{formlabel label="Self Portrait" for="fPortraitFile"}
{if $gBitUser->mInfo.portrait_url}
{forminput}
- <img src="{$gQueryUser->minfo.portrait_url}?{php}print time();{/php}" alt="{tr}self portrait{/tr}" /><br />
+ <img src="{$gQueryUser->mInfo.portrait_url}?{php}print time();{/php}" alt="{tr}self portrait{/tr}" /><br />
<input type="submit" value="{tr}delete self portrait{/tr}" name="fSubmitDeletePortait" id="fSubmitDeletePortait"/>
{/forminput}
{/if}
diff --git a/templates/user_tasks.tpl b/templates/user_tasks.tpl
index a1d8367..24007de 100644
--- a/templates/user_tasks.tpl
+++ b/templates/user_tasks.tpl
@@ -1,6 +1,6 @@
{strip}
-<div class="floaticon">{bithelp}</div>
+<div class="floaticon">{bithelp}</div>
<div class="display usertasks">
<div class="header">
<h1>{tr}Tasks{/tr}</h1>