Nooku Server is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

nooku-server

Commit 3440

User picture
  • Author: gergoerdosi
  • 2012-03-16 00:09 (about 2 years ago)

Merge 203-lastvisit to development. re #203

Files Affected

 
34393440
308
WARNFS_ERR02=Warning! - Failed to move file.
308
WARNFS_ERR02=Warning! - Failed to move file.
309
WARNFS_ERR03=Upload failed. Directory not writable.
309
WARNFS_ERR03=Upload failed. Directory not writable.
310
WARNFS_ERR04=Upload failed. Directory does not exist.
310
WARNFS_ERR04=Upload failed. Directory does not exist.
311
WARNMOSUSER=Error mosUser::setLastVisit cannot call method statically with no ID
 
 
312
WARNREG_EMAIL_INUSE=This e-mail is already registered. If you forgot your password, click on the <strong>Forgot your password</strong> link and a
new password will be sent to you.
311
WARNREG_EMAIL_INUSE=This e-mail is already registered. If you forgot your password, click on the <strong>Forgot your password</strong> link and a
new password will be sent to you.
313
WARNREG_INUSE=This username/password already in use. Please try another.
312
WARNREG_INUSE=This username/password already in use. Please try another.
314
WARNREG_MAIL=Please enter a valid e-mail address.
313
WARNREG_MAIL=Please enter a valid e-mail address.
34393440
264
    }
264
    }
265
 
265
 
266
    /**
266
    /**
267
     * Updates last visit time of user
 
 
268
     *
 
 
269
     * @param int The timestamp, defaults to 'now'
 
 
270
     * @return boolean False if an error occurs
 
 
271
     */
 
 
272
    function setLastVisit( $timeStamp=null, $id=null )
 
 
273
    {
 
 
274
        // check for User ID
 
 
275
        if (is_null( $id )) {
 
 
276
            if (isset( $this )) {
 
 
277
                $id = $this->id;
 
 
278
            } else {
 
 
279
                // do not translate
 
 
280
                jexit( 'WARNMOSUSER' );
 
 
281
            }
 
 
282
        }
 
 
283
 
 
 
284
        // if no timestamp value is passed to functon, than current time is used
 
 
285
        $date =& JFactory::getDate($timeStamp);
 
 
286
 
 
 
287
        // updates user lastvistdate field with date and time
 
 
288
        $query = 'UPDATE '. $this->_tbl
 
 
289
        . ' SET lastvisitDate = '.$this->_db->Quote($date->toMySQL())
 
 
290
        . ' WHERE id = '. (int) $id
 
 
291
        ;
 
 
292
        $this->_db->setQuery( $query );
 
 
293
        if (!$this->_db->query()) {
 
 
294
            $this->setError( $this->_db->getErrorMsg() );
 
 
295
            return false;
 
 
296
        }
 
 
297
 
 
 
298
        return true;
 
 
299
    }
 
 
300
 
 
 
301
    /**
 
 
302
    * Overloaded bind function
267
    * Overloaded bind function
303
    *
268
    *
304
    * @access public
269
    * @access public
34393440
285
    }
285
    }
286
 
286
 
287
    /**
287
    /**
288
     * Pass through method to the table for setting the last visit date
 
 
289
     *
 
 
290
     * @access     public
 
 
291
     * @param    int        $timestamp    The timestamp, defaults to 'now'
 
 
292
     * @return    boolean    True on success
 
 
293
     * @since    1.5
 
 
294
     */
 
 
295
    function setLastVisit($timestamp=null)
 
 
296
    {
 
 
297
        // Create the user table object
 
 
298
        $table     =& $this->getTable();
 
 
299
        $table->load($this->id);
 
 
300
 
 
 
301
        return $table->setLastVisit($timestamp);
 
 
302
    }
 
 
303
 
 
 
304
    /**
 
 
305
     * Method to get the user parameters
288
     * Method to get the user parameters
306
     *
289
     *
307
     * This function tries to load an xml file based on the users usertype. The filename of the xml
290
     * This function tries to load an xml file based on the users usertype. The filename of the xml
34393440
125
        $table->update();
125
        $table->update();
126
 
126
 
127
        // Hit the user last visit field
127
        // Hit the user last visit field
128
        $instance->setLastVisit();
128
        $row = KService::get('com://admin/users.database.row.user')
 
 
129
            ->setData(array('id' => $instance->get('id')))
 
 
130
            ->load();
 
 
131
        
 
 
132
        $date = new KDate();
 
 
133
        $row->last_visited_on = $date->format('Y-m-d H:i:s'); 
 
 
134
        $row->save();
129
 
135
 
130
        return true;
136
        return true;
131
    }
137
    }
...
 
...
 
150
        //Check to see if we're deleting the current session
156
        //Check to see if we're deleting the current session
151
        if($my->get('id') == $user['id'])
157
        if($my->get('id') == $user['id'])
152
        {
158
        {
153
            // Hit the user last visit field
 
 
154
            $my->setLastVisit();
 
 
155
 
 
 
156
            // Destroy the php session for this user
159
            // Destroy the php session for this user
157
            $session =& JFactory::getSession();
160
            $session =& JFactory::getSession();
158
            $session->destroy();
161
            $session->destroy();