admin/user_data/user_data.php

Go to the documentation of this file.
00001 <?php
00002   /*
00003    This file is part of DocBookWiki.  DocBookWiki is a web application
00004    that displays and edits DocBook documents.
00005 
00006    Copyright (C) 2004, 2005, 2006, 2007
00007    Dashamir Hoxha, dashohoxha@users.sourceforge.net
00008 
00009    DocBookWiki is free software; you can redistribute it and/or modify
00010    it under the  terms of the GNU General  Public License as published
00011    by the Free  Software Foundation; either version 2  of the License,
00012    or (at your option) any later version.
00013 
00014    DocBookWiki is distributed in the  hope that it will be useful, but
00015    WITHOUT  ANY  WARRANTY;  without   even  the  implied  warranty  of
00016    MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU
00017    General Public License for more details.
00018 
00019    You should have  received a copy of the  GNU General Public License
00020    along  with  DocBookWiki;  if  not,  write  to  the  Free  Software
00021    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022    USA
00023   */
00024 
00025 include_once SCRIPTS.'user_data.php';
00026 
00035 class user_data extends WebObject
00036 {
00037   function on_save($event_args)
00038   {
00039     $user_data = get_user_data(USER);
00040     $user_data['name'] = $event_args['name'];
00041     $user_data['email'] = $event_args['email'];
00042     save_user_data($user_data);
00043   }
00044 
00045   function on_change_passwd($event_args)
00046   {
00047     $new_password = $event_args['new_password'];
00048     $user_data = get_user_data(USER);
00049 
00050     //encrypt the new password and save it
00051     srand(time());
00052     $user_data['password'] = crypt($new_password, rand());
00053     save_user_data($user_data);
00054     WebApp::message(T_("Password changed successfully."));
00055   }
00056 
00057   function onParse()
00058   {
00059     WebApp::setSVar('edit_rights->user', USER);
00060   }
00061 
00062   function onRender()
00063   {
00064     $user_data = get_user_data(USER);
00065     WebApp::addVar('name', $user_data['name']);
00066     WebApp::addVar('email', $user_data['email']);
00067 
00068     $this->add_rs_books_admin();
00069   }
00070 
00074   function add_rs_books_admin()
00075   {
00076     $rs = new EditableRS('books_admin');
00077 
00078     $user_data = get_user_data(USER);
00079     $arr_books = explode(',', $user_data['books']);
00080 
00081     for ($i=0; $i < sizeof($arr_books); $i++)
00082       {
00083         $book_id = trim($arr_books[$i]);
00084         if ($book_id=='')  continue;
00085         $rs->addRec(compact('book_id'));
00086       }
00087 
00088     global $webPage;
00089     $webPage->addRecordset($rs);
00090   }
00091 }
00092 ?>

Generated on Wed Jan 9 08:27:32 2008 for DokBookWiki by  doxygen 1.5.2