![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: do_userrole_aed.php 132 2008-04-03 21:54:15Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/admin/do_userrole_aed.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 include $AppUI->getModuleClass('contacts'); 6 require_once ($AppUI->getSystemClass('libmail')); 7 8 $del = isset($_REQUEST['del']) ? w2PgetParam($_REQUEST, 'del', false) : false; 9 $notify_new_user = isset($_POST['notify_new_user']) ? $_POST['notify_new_user'] : 0; 10 11 $perms = &$AppUI->acl(); 12 if (!$perms->checkModule('admin', 'edit')) { 13 $AppUI->redirect('m=public&a=access_denied'); 14 } 15 if (!$perms->checkModule('users', 'edit')) { 16 $AppUI->redirect('m=public&a=access_denied'); 17 } 18 19 // prepare (and translate) the module name ready for the suffix 20 $AppUI->setMsg('Roles'); 21 22 if ($_REQUEST['user_id']) { 23 $user = new CUser(); 24 $user->load($_REQUEST['user_id']); 25 $contact = new CContact(); 26 $contact->load($user->user_contact); 27 } 28 29 if ($del) { 30 if ($perms->deleteUserRole(w2PgetParam($_REQUEST, 'role_id', 0), w2PgetParam($_REQUEST, 'user_id', 0))) { 31 $AppUI->setMsg('deleted', UI_MSG_ALERT, true); 32 $AppUI->redirect(); 33 } else { 34 $AppUI->setMsg('failed to delete role', UI_MSG_ERROR); 35 $AppUI->redirect(); 36 } 37 return; 38 } 39 40 if (isset($_REQUEST['user_role']) && $_REQUEST['user_role']) { 41 if ($perms->insertUserRole($_REQUEST['user_role'], $_REQUEST['user_id'])) { 42 if ($notify_new_user) { 43 notifyNewUser($contact->contact_email, $contact->contact_first_name); 44 } 45 $AppUI->setMsg('added', UI_MSG_ALERT, true); 46 $AppUI->redirect(); 47 } else { 48 $AppUI->setMsg('failed to add role', UI_MSG_ERROR); 49 $AppUI->redirect(); 50 } 51 } 52 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 7 03:00:01 2009 | Cross-referenced by PHPXref 0.7 |