Exemplo n.º 1
0
* @package
*/
require_once '../include/sysadmin_auth.inc';
require_once '../include/errors.inc';
require_once '../include/demo_replace.inc';
require_once '../classes/userutils.class.php';
$userID = check_var('userID', 'GET', true, false, true);
$errors = false;
$user_details = UserUtils::get_user_details($userID, $mysqli);
if ($user_details === false) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
if (isset($_POST['submit']) and $_POST['username'] != $_POST['prev_username']) {
    // Check new username is not already used. Overwriting usernames could screw up other accounts.
    if (UserUtils::username_exists($_POST['username'], $mysqli)) {
        $errors = 'Username exists';
    }
}
if (isset($_POST['submit']) and !$errors) {
    $cfg_web_root = $configObject->get('cfg_web_root');
    if (!empty($_FILES['photofile']['name'])) {
        $filename = $_FILES['photofile']['name'];
        $explode = explode('.', $filename);
        $count = count($explode) - 1;
        $file_ext = $explode[$count];
        if (!move_uploaded_file($_FILES['photofile']['tmp_name'], $cfg_web_root . 'users/photos/' . $_POST['username'] . '.' . $file_ext)) {
            log_error($userObject->get_user_ID(), 'Edit User', 'Application Error', 'Error uploading user photo - error: ' . $_FILES['photofile']['error'], $_SERVER['PHP_SELF'], 49, '', null, null, null);
        }
    }
    $initials = '';
Exemplo n.º 2
0
 $cols = explode(',', $separate_line);
 if ($line_no == 0) {
     // Read the header row
     $heading = $cols;
     $col_no = count($cols);
     echo "<tr><th></th><th>Username</th><th colspan=\"3\">Student Name</th>";
     for ($i = 1; $i < $col_no; $i++) {
         echo "<th>" . trim($heading[$i]) . "</th>";
     }
     echo "</tr>\n";
 } else {
     // 'username' can be either the real username or sid
     $username = trim($cols[0]);
     // Check see if user was found
     if (!isset($student_id_array[$username])) {
         if (UserUtils::userid_exists($username, $mysqli) or UserUtils::username_exists($username, $mysqli)) {
             echo "<tr><td><img src=\"../artwork/red_cross_16.png\" wodth=\"16\" height=\"16\" alt=\"Failed\" /></td><td class=\"failed\">{$username}</td><td colspan=\"" . (3 + $col_no) . "\" class=\"failed\" style=\"text-align:center\">&lt;user not registered on " . module_utils::get_moduleid_from_id($_GET['module'], $mysqli) . "&gt;</td>";
         } else {
             echo "<tr><td><img src=\"../artwork/red_cross_16.png\" wodth=\"16\" height=\"16\" alt=\"Failed\" /></td><td class=\"failed\">{$username}</td><td colspan=\"" . (3 + $col_no) . "\" class=\"failed\" style=\"text-align:center\">&lt;unknown user&gt;</td>";
         }
     } else {
         $student_id = $student_id_array[$username];
         echo "<tr><td><img src=\"../artwork/green_plus_16.png\" wodth=\"16\" height=\"16\" alt=\"Add\" /></td><td>{$username}</td><td>" . $student_data[$student_id]['title'] . "</td><td>" . $student_data[$student_id]['surname'] . "</td><td>" . $student_data[$student_id]['first_names'] . "</td>";
         for ($i = 1; $i < $col_no; $i++) {
             $type = trim($heading[$i]);
             $value = trim($cols[$i]);
             echo "<td>{$value}</td>";
             if ($type != '') {
                 $stmt->execute();
             }
         }
Exemplo n.º 3
0
 $new_moduleid = '';
 $result = $mysqli->prepare("SELECT MAX(id) FROM modules");
 $result->execute();
 $result->store_result();
 $result->bind_result($maxmodid);
 $result->fetch();
 $result->close();
 for ($a = 0; $a < strlen($_POST['new_grade2']); $a++) {
     $b = substr($_POST['new_grade2'], $a, 1);
     if (ctype_upper($b) or ctype_digit($b)) {
         $new_moduleid = $new_moduleid . $b;
     }
 }
 $new_moduleid = $new_moduleid . $maxmodid;
 // Check for unique username
 if (UserUtils::username_exists($_POST['new_username'], $mysqli) or UserUtils::username_exists($_POST['new_username'] . '-stu', $mysqli)) {
     $unique_username = false;
 } else {
     $unique_username = true;
 }
 $schoolID = SchoolUtils::add_school(1, 'School of Practice', $mysqli);
 // Make sure the 'School of Practice' school exists.
 CourseUtils::add_course($schoolID, 'A10DEMO', 'Demonstration BSc', $mysqli);
 // Make sure demo course exists.
 $new_modid = module_utils::add_modules($new_moduleid, $_POST['new_grade2'], 1, $schoolID, NULL, NULL, true, true, true, false, false, true, false, $mysqli, 0, 0, 1, 1, '07/01');
 if ($unique_username == true) {
     $_POST['new_grade'] = $new_moduleid;
     $session = date_utils::get_current_academic_year();
     // Add staff account
     $new_username = trim($_POST['new_username']);
     $useridstf = adduser('Staff', 'Staff', $new_username, $mysqli);
Exemplo n.º 4
0
*
* Creates a new user (staff or student).
*
* @author Simon Wilkinson
* @version 1.0
* @copyright Copyright (c) 2014 The University of Nottingham
* @package
*/
require_once '../include/admin_auth.inc';
require_once '../include/mb_string.inc.php';
require_once '../classes/userutils.class.php';
$unique_username = true;
$problem = false;
if (isset($_POST['submit'])) {
    // Check for unique username
    if (UserUtils::username_exists($_POST['new_username'], $mysqli) !== false) {
        $unique_username = false;
        $problem = true;
    }
    switch ($_POST['new_grade']) {
        case 'University Lecturer':
        case 'University Admin':
        case 'Technical Staff':
        case 'NHS Lecturer':
        case 'NHS Admin':
            $tmp_roles = 'Staff';
            break;
        case 'Invigilator':
            $tmp_roles = 'Invigilator';
            break;
        case 'Staff External Examiner':