Source code for file /joomla/database/table/user.php
Documentation is available at user.php
* @version $Id: user.php 9860 2008-01-04 20:46:05Z louis $
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
// Check to ensure this file is within the rest of the framework
* @package Joomla.Framework
* The users real name (or nickname)
* @var string activation hash
* @param database A database connector object
* Validation and filtering
* @return boolean True is satisfactory
// Validate user information
// check for existing username
.
' WHERE username = ' .
$this->_db->Quote($this->username)
.
' AND id != '. (int)
$this->id;
$this->_db->setQuery( $query );
if ($xid &&
$xid !=
intval( $this->id )) {
// check for existing email
.
' WHERE email = '.
$this->_db->Quote($this->email)
.
' AND id != '. (int)
$this->id
$this->_db->setQuery( $query );
if ($xid &&
$xid !=
intval( $this->id )) {
function store( $updateNulls=
false )
$section_value =
'users';
$ret =
$this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
// single group handled at the moment
// trivial to expand to multiple groups
$object_id =
$acl->get_object_id( $section_value, $this->$k, 'ARO' );
$groups =
$acl->get_object_groups( $object_id, 'ARO' );
$acl->del_group_object( $groups[0], $section_value, $this->$k, 'ARO' );
$acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' );
$acl->edit_object( $object_id, $section_value, $this->_db->getEscaped( $this->name ), $this->$k, 0, 0, 'ARO' );
$acl->add_object( $section_value, $this->name, $this->$k, null, null, 'ARO' );
$acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' );
$aro_id =
$acl->get_object_id( 'users', $this->$k, 'ARO' );
$acl->del_object( $aro_id, 'ARO', true );
$query =
'DELETE FROM '.
$this->_tbl
.
' WHERE '.
$this->_tbl_key .
' = '. (int)
$this->$k
$this->_db->setQuery( $query );
if ($this->_db->query()) {
$query =
'DELETE FROM #__messages_cfg'
.
' WHERE user_id = '. (int)
$this->$k
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
$query =
'DELETE FROM #__messages'
.
' WHERE user_id_to = '. (int)
$this->$k
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
* Updates last visit time of user
* @param int The timestamp, defaults to 'now'
* @return boolean False if an error occurs
// if no timestamp value is passed to functon, than current time is used
$date =
new JDate($timeStamp);
// updates user lastvistdate field with date and time
$query =
'UPDATE '.
$this->_tbl
.
' SET lastvisitDate = '.
$this->_db->Quote($date->toMySQL())
.
' WHERE id = '. (int)
$id
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
* Overloaded bind function
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
function bind($array, $ignore =
'')
$registry->loadArray($array['params']);
$array['params'] =
$registry->toString();
return parent::bind($array, $ignore);