Esempio n. 1
0
function get_content_submenu($value)
{
    $query = "select * from pages where information_id={$value} ORDER BY position ASC";
    global $connection;
    $result2 = mysql_query($query, $connection);
    checkset($result2);
    return $result2;
}
    }
    ?>
            <?php 
}
?>
            <?php 
if ($foundation_loop > 0) {
    $foundation_table = array();
    ?>
            
            <tr ><td colspan="5"> <h1> Foundation Details </h1> </td> </tr>
            <?php 
    for ($i = 0; $i < $foundation_loop; $i++) {
        ?>
            <tr <?php 
        checkset($required['foundation'][$i]['course_set']);
        ?>
>
              <td><label for="courseid"><?php 
        echo $required['foundation'][$i]['course_code'];
        $foundation_table[$i]['course_code'] = $required['foundation'][$i]['course_code'];
        ?>
</label></td>
              <td><label for="credit"><?php 
        echo $required['foundation'][$i]['credit'];
        $foundation_table[$i]['credit'] = $required['foundation'][$i]['credit'];
        ?>
</label></td>
              <td><label for="sem1">
                  <?php 
        if ($required['foundation'][$i]['course_ava'] == 1) {
    } else {
        // if all is well, we return TRUE
        return TRUE;
    }
}
// check ALL the REQUEST variables
function checkSet()
{
    return isset($_REQUEST['userName']) || isset($_REQUEST['userRepeatPass']) || isset($_REQUEST['userEmail']) || isset($_REQUEST['userCell']) || isset($_REQUEST['userCarrier']) || isset($_REQUEST['userFeeds']) || isset($_REQUEST['receive_email']) || isset($_REQUEST['receive_sms_text']) || isset($_REQUEST['receive_sms_link']);
}
function checkEmail($email)
{
    return preg_match('/^\\S+@[\\w\\d.-]{2,}\\.[\\w]{2,6}$/iU', $email) ? TRUE : FALSE;
}
$prompt = TRUE;
if (checkset()) {
    if (empty($_REQUEST['userNewPass']) == FALSE && sanityCheck($_REQUEST['userNewPass'], 'string', 10) != FALSE) {
        if (strlen($_REQUEST['userNewPass']) < 6) {
            echo '<p style="color:red">Please choose a password of at least 6 characters</p>';
            $_REQUEST['userNewPass'] = '';
            exit;
        }
        // Make sure that the two password entries are identical
        if (empty($_REQUEST['userRepeatNewPass']) == FALSE && sanityCheck($_REQUEST['userRepeatNewPass'], 'string', 10) != FALSE) {
            $userRepeatNewPass = $_REQUEST['userRepeatNewPass'];
            if ($userRepeatNewPass != $_REQUEST['userNewPass']) {
                echo '<p style="color:red">Password mismatch.  Please re-enter your password.</p>';
                exit;
            }
        } else {
            echo '<p style="color:red">Please enter your password again in the Repeat Password field.</p>';
Esempio n. 4
0
function import_basisrooster($file_id, $tmp_name)
{
    global $grp2ppl, $stamz;
    lock_renew_helper(1);
    $udmz = read_udmz_file($tmp_name);
    // a previous update may have gone wrong, cleanup just in case
    mdb2_exec("DELETE FROM files2lessen WHERE file_id = {$file_id}");
    mdb2_exec("DELETE FROM grp2ppl WHERE file_id_basis = {$file_id}");
    mdb2_exec("DELETE FROM grp2grp WHERE file_id_basis = {$file_id}");
    // eerst lopen we alle leerlingen langs
    // dan alle docenten
    // dan alle groepen
    // en als laatste: alle lessen
    if (!checkset($udmz, 'udmz file', array('Groep', 'Leerling', 'Docent', 'Les'))) {
        return;
    }
    $leerlingen = 0;
    $categorieen_leerling = 0;
    foreach ($udmz['Leerling'] as $category => $value) {
        if (in_array($category, config('ZERMELO_CATEGORY_IGNORE'))) {
            continue;
        }
        $categorieen_leerling++;
        $leerlingen += count($value);
    }
    $docenten = count($udmz['Docent']);
    $groepen = 0;
    $categorieen_groep = 0;
    foreach ($udmz['Groep'] as $category => $value) {
        if (in_array($category, config('ZERMELO_CATEGORY_IGNORE'))) {
            continue;
        }
        $categorieen_groep++;
        foreach ($value as $id => $row) {
            if (in_array($id, config('ZERMELO_GROUP_IGNORE'))) {
                continue;
            }
            $groepen++;
        }
    }
    $lessen = count($udmz['Les']);
    /*
    logit('Categorieen leerling: '.$categorieen_leerling);
    logit('Leerlingen: '.$leerlingen);
    logit('Docenten: '.$docenten);
    logit('Categorieen groep: '.$categorieen_groep);
    logit('Groepen: '.$groepen);
    logit('Lessen: '.$lessen);
    */
    $total = $categorieen_leerling + $leerlingen + $categorieen_groep + $groepen + $docenten + $lessen;
    $done = 0;
    lock_renew_helper(2, $done / $total);
    foreach ($udmz['Leerling'] as $category => $list) {
        if (in_array($category, config('ZERMELO_CATEGORY_IGNORE'))) {
            continue;
        }
        incdone($done, $total, 2);
        if (!($category_id = add_entity($category, CATEGORIE))) {
            return;
        }
        foreach ($list as $id => $row) {
            incdone($done, $total, 2);
            if (!checkset($row, "Leerling.{$category}", array('LASTNAME', 'FIRSTNAME', 'BETWEENNAME', 'BASICCLASS'))) {
                return;
            }
            if (!($leerling_id = add_entity($id, LEERLING))) {
                return;
            }
            insert_name($leerling_id, $row['FIRSTNAME'], $row['BETWEENNAME'], $row['LASTNAME']);
            if (!($lesgroep_id = add_entity($row['BASICCLASS'], STAMKLAS))) {
                return;
            }
            $stamz[$row['BASICCLASS']] = $category;
            add_basis_grp2ppl($lesgroep_id, $leerling_id, $file_id);
            add_basis_grp2ppl($category_id, $leerling_id, $file_id);
        }
    }
    lock_renew_helper(2, $done / $total);
    foreach ($udmz['Docent'] as $id => $row) {
        incdone($done, $total, 2);
        if (!checkset($row, 'Docent', array('Voornaam', 'Tussenvoegsel', 'Achternaam', 'e-mail'))) {
            continue;
        }
        if (!($docent_id = add_entity($id, DOCENT))) {
            return;
        }
        if ($row['Achternaam'] != '' && $row['Voornaam'] != '') {
            insert_name($docent_id, substr($row['Voornaam'], 0, 1) . '.', $row['Tussenvoegsel'], $row['Achternaam'], $row['e-mail']);
        }
    }
    lock_renew_helper(2, $done / $total);
    foreach ($udmz['Groep'] as $category => $list) {
        if (in_array($category, config('ZERMELO_CATEGORY_IGNORE'))) {
            continue;
        }
        incdone($done, $total, 2);
        if (!($category_id = add_entity($category, CATEGORIE))) {
            return;
        }
        foreach ($list as $id => $row) {
            if (in_array($id, config('ZERMELO_GROUP_IGNORE'))) {
                continue;
            }
            incdone($done, $total, 2);
            if (isset($stamz[$id])) {
                if ($stamz[$id] != $category) {
                    logit('stamklas in andere categorie?!?!?');
                } else {
                    continue;
                }
                // doe niks, want stamklassen hebben we al
            }
            if (!checkset($row, "Groep.{$category}", array('SET'))) {
                return;
            }
            if (!($lesgroep_id = add_entity(config('IGNORE_BEFORE_DOT') ? $id : $category . '.' . $id, LESGROEP))) {
                return;
            }
            if ($row['SET'] == '') {
                continue;
            }
            // geen leerlingen in deze groep
            foreach (explode(',', $row['SET']) as $leerlingnummer) {
                if (!($leerling_id = add_entity($leerlingnummer, LEERLING))) {
                    return;
                }
                add_basis_grp2ppl($lesgroep_id, $leerling_id, $file_id);
            }
        }
    }
    lock_renew_helper(2, $done / $total);
    mdb2_exec(<<<EOT
INSERT INTO grp2grp ( lesgroep_id, lesgroep2_id, file_id_basis )
SELECT DISTINCT grp2ppl.lesgroep_id, grp2ppl2.lesgroep_id, grp2ppl.file_id_basis
FROM grp2ppl
JOIN grp2ppl AS grp2ppl2 ON grp2ppl.ppl_id = grp2ppl2.ppl_id AND grp2ppl.file_id_basis = grp2ppl2.file_id_basis
WHERE grp2ppl.file_id_basis = {$file_id}
EOT
);
    lock_renew_helper(2, $done / $total);
    foreach ($udmz['Les'] as $id => $row) {
        incdone($done, $total, 2);
        if (!checkset($row, 'Les', array('#WijzigComment', 'Dag', 'Uur', 'Vak', 'Grp', 'Doc', 'Lok'))) {
            return;
        }
        if (!($zermelo_id = add_zermelo_id($id))) {
            return;
        }
        insert_les(',', $zermelo_id, $row['Dag'], $row['Uur'], $row['Vak'], $row['Grp'], $row['Doc'], $row['Lok'], $file_id, $row['#WijzigComment']);
    }
    // als we hier zijn, dan is alles goed gegaan
    mdb2_exec("UPDATE files SET file_status = 1 WHERE file_id = {$file_id}");
    lock_renew_helper(3, $done / $total);
}