Ejemplo n.º 1
0
function getClasses($uid)
{
    global $mysqli, $suid;
    $u = cleanInput('/[^0-9]/', strtolower($uid));
    $result = [];
    if (hasACL("teacher_panel", "R", "E")) {
        $M_result = $mysqli->query("SELECT name,id FROM class;");
        while ($M_row = $M_result->fetch_assoc()) {
            $result[] = ["id" => $M_row['id'], "name" => $M_row['name']];
        }
    } else {
        $M_result = $mysqli->query("SELECT class_id FROM class_acls WHERE user_id={$uid};");
        while ($M_row = $M_result->fetch_assoc()) {
            $M_result2 = $mysqli->query("SELECT name FROM class WHERE id=" . $M_row['class_id'] . ";");
            $n = "Unknown";
            if ($M_result2 != false) {
                $M_row2 = $M_result2->fetch_assoc();
                $n = $M_row2['name'];
            }
            $result[] = ["id" => $M_row['class_id'], "name" => $n];
        }
    }
    return $result;
}
Ejemplo n.º 2
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
if (!hasACL('admin_panel', 'W', 'S')) {
    sro('/Pages/restricted/admin.php');
    die("");
}
global $suid, $mysqli;
$uid = cleanInput('/[^0-9]/', $_POST['keyfield']);
if ("{$uid}" == "{$suid}") {
    logEvent("audelete", "current-user", encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'} : {$uid} == {$suid}"));
    die("Cannot delete current user.");
} else {
    if ($uid == '1') {
        logEvent("audelete", "admin-user", encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'} : {$uid}, {$suid}"));
        die("Cannot delete user.");
    } else {
        $M_query = "SELECT * FROM users WHERE id='{$uid}';";
        $M_result = $mysqli->query($M_query) or die("error");
        $M_count = $M_result->num_rows;
        if ($M_count == 1) {
            $M_row = $M_result->fetch_assoc();
            $toAdd = encodeHex("users: ['" . implode("','", array_keys($M_row)) . "'], {'" . implode("', '", $M_row) . "'}");
            $M_query1 = "DELETE FROM users WHERE id='{$uid}'";
            $M_result1 = $mysqli->query($M_query1);
            $M_query2 = "INSERT INTO deleted (fid, data) VALUES ('{$uid}', '{$toAdd}')";
            $M_result2 = $mysqli->query($M_query2);
            logEvent("audelete", "success", encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'} : {$uid},  {$suid}, M_query: `{$M_query}`, M_count: `{$M_count}`, M_row: ['" . implode("','", array_keys($M_row)) . "'], {'" . implode("', '", $M_row) . "'}, toAdd: {$toAdd}, M_query1: {$M_query1}, M_query2: {$M_query2}"));
Ejemplo n.º 3
0
<?php

require_once '/var/www/config.php';
sro('/Includes/session.php');
global $sudata;
?>
		<script>var pantheum = {
			_private:{},
			user:{administrator:<?php 
print hasACL('admin_panel', 'R', 'S') ? 'true' : 'false';
?>
},
			api_path: '/PHP5/dictionary/',
			view: {},
			model: {},
			udata:<?php 
echo $sudata ? $sudata : 'null';
?>
,
		};</script>
		<script type="text/javascript" src="/JS/pantheum.js"></script>
<?php 
if (!array_key_exists("devel", $_GET) or $_GET["devel"] != "false") {
    ?>
		<script>
			(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
			(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
			m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
			})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

			ga('create', 'UA-69525223-1', 'auto');
Ejemplo n.º 4
0
require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
global $mysqli;
if (isLoggedIn()) {
    logEvent('pswd-change', 'logged-out', encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'}"));
    die('{"result": "Not logged in."}');
}
global $suid;
$level = 'S';
if (isset($_GET['uid']) && $suid != $_GET['uid']) {
    $level = 'E';
}
if (!hasACL('user_password', 'R', $level)) {
    sro('/Pages/restricted/admin.php');
    die("{$level}");
}
$username = cleanInput('/[^a-zA-Z0-9]/', $_POST['u']);
$password = cleanInput('/[^a-zA-Z0-9]/', $_POST['p']);
$newpassw = cleanInput('/[^a-zA-Z0-9]/', $_POST['n1']);
$newpass2 = cleanInput('/[^a-zA-Z0-9]/', $_POST['n2']);
if ($username != $_POST['u'] || $username == '' || $password == '' || $newpassw == '' || $newpass2 == '') {
    logEvent('pswd-change', 'blank-input', encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'}"));
    die('{"result": "Missing form data."}');
}
if ($newpassw != $newpass2) {
    logEvent('pswd-change', 'mismatched-passwords', encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'}"));
    die('{"result": "New passwords do not match."}');
}
Ejemplo n.º 5
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
global $sli;
if (isset($sli)) {
    if (!hasACL('teacher_panel', 'R', 'S')) {
        sro('/Pages/restricted/teacher.php');
        die("");
    }
} else {
    sro('/Pages/restricted/logged-out.php');
    die("");
}
?>
<header>
	<h1>Class Settings</h1>
</header>
<div id="tpage">
    <nav id="tnav">
    </nav>
    <section id="tcontent" class="scrollable">
    </section>
</div>
<div class="clear"></div>
<script type="text/javascript">
    $(function() {
        cpage = new jPage();
        cpage.init('tcontent');
Ejemplo n.º 6
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
global $sli;
if (isset($sli)) {
    if (!hasACL('class', 'R', 'S')) {
        sro('/Pages/restricted/teacher.php');
        die("");
    }
} else {
    sro('/Pages/restricted/logged-out.php');
    die("");
}
?>
<header>
	<h1>Class Dashboard</h1>
</header>
<div id="cpage">
    <nav id="cnav">
    </nav>
    <section id="ccontent" class="scrollable">
    </section>
</div>
<div class="clear"></div>
<script type="text/javascript">
    $(function() {
        cpage = new jPage();
        cpage.init('ccontent');
Ejemplo n.º 7
0
<article class="width-half column-left mobile-width-full">
    <p>
        <span data-i18n="msg.welcome">Welcome to the Pantheum, quizzes and a dictionary for Latin, created by Nick Scheel with website design by Alex Scheel.</span> <a data-i18n="link.need_help" href="/help.php">Need help?</a><br><br>
        <button data-i18n="link.latin_websites" class="large" onclick="window.location.href='/links.php';">Latin websites</button><br>
        <button data-i18n="link.sentence_viewer" class="large" onclick="window.location.href='/sentence.php';">Sentence Viewer</button><br>
        <button data-i18n="link.dictionary" class="large" onclick="window.location.href='/dictionary.php';">Dictionary</button><br>
        <?php 
if (hasACL('add_words', 'R', 'S')) {
    ?>
        		<button data-i18n="link.add_words" class="large" onclick="window.location.href='/add_word.php';">Add words</button><br>
        <?php 
}
?>
        <button data-i18n="link.settings" class="large" onclick="window.location.href='/user.php';">Account Settings</button><br>
        <?php 
if (hasACL('admin_panel', 'R', 'S')) {
    ?>
        		<button data-i18n="link.admin" class="large" onclick="window.location.href='/admin.php';">Admin Settings</button><br>
        <?php 
}
?>
        <br>
        <span data-i18n="msg.loggedin">Thanks for logging in, your answers will be saved.</span>
    </p>
</article>
<article class="secondary width-half column-right mobile-width-full">
    <h1>
        <span data-i18n="quick_quiz">Quick quiz</span>
        <?php 
sro('/PHP5/dictionary/select-lang.php');
?>
Ejemplo n.º 8
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/db.php');
sro('/PHP5/lib/PHPLang/display.php');
if (!hasACL('admin_panel', 'R', 'S')) {
    sro('/Pages/restricted/admin.php');
    die("");
}
if (!hasACL('add_words', 'R', 'S')) {
    sro('/Pages/restricted/adder.php');
    die("");
}
$uid = cleanInput('/[^0-9]/', $_GET['id']);
$word = WORD(defaultDB(), intval($uid));
?>
<h2><?php 
echo $word->name();
?>
</h2>
<div id="aswDetails">
    <p>
        Name: <?php 
echo $word->name();
?>
<br>
        Part of speech: <?php 
echo display_spart($word->spart());
Ejemplo n.º 9
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
if (!isLoggedIn()) {
    sro('/Pages/restricted/logged-out.php');
    die("");
}
global $suid;
$level = 'S';
if (isset($_GET['uid']) && $suid != $_GET['uid']) {
    $level = 'E';
}
if (!hasACL('user_settings', 'R', $level) && !hasACL('user_password', 'R', $level)) {
    sro('/Pages/restricted/admin.php');
    die("");
}
?>
<h2 data-i18n="overview">Overview</h2>

<span data-i18n>Username</span>: <?php 
echo $suname;
?>
<br>
<span data-i18n>Rank</span>: <?php 
echo getNamedRank($srank);
Ejemplo n.º 10
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
global $sli;
if (isset($sli)) {
    if (hasACL('teacher_panel', 'W', 'S')) {
        sro('/Pages/create_class/index.php');
    } else {
        sro('/Pages/restricted/teacher.php');
    }
} else {
    sro('/Pages/restricted/logged-out.php');
}
Ejemplo n.º 11
0
require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/db.php');
if (!isLoggedIn()) {
    sro('/Pages/restricted/logged-out.php');
    die("");
}
global $suid;
$level = 'S';
if (isset($_GET['uid']) && $suid != $_GET['uid']) {
    $level = 'E';
}
if (!hasACL('user_settings', 'R', $level)) {
    sro('/Pages/restricted/admin.php');
    die("");
}
?>
<h2 data-i18n="preferences">Preferences</h2>

<span data-i18n="ui.change_language">Language</span>:
<select id="lang" style="width: 200px">
    <option value="en">English</option>
    <option value="la">Latin</option>
</select>
<br>
<br>

<span data-i18n="word_formatting">Word formatting</span>:
Ejemplo n.º 12
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/common.php');
sro('/PHP5/lib/PHPLang/db.php');
sro('/PHP5/lib/PHPLang/display.php');
global $sql_stmts;
$db = defaultDB();
$editor = hasACL('add_words', 'R', 'S');
if (count($_GET)) {
    if (!array_key_exists("id", $_GET) or !($ids = vec_norm(explode(",", $_GET["id"]), "intval"))) {
        $ids = [];
    }
    if ($ids) {
        $langs = array_unique(array_map(function ($w) {
            $word = WORD($w);
            return $word->lang();
        }, $ids));
    } else {
        if (!array_key_exists("lang", $_GET) or !($langs = vec_norm(explode(",", $_GET["lang"]), "trim"))) {
            $langs = ['la'];
        }
    }
    if ($ids or !array_key_exists("name", $_GET) or !($names = vec_norm(explode(",", $_GET["name"]), "trim"))) {
        $names = NULL;
    }
    if ($ids or !array_key_exists("spart", $_GET) or !($sparts = vec_norm(explode(",", $_GET["spart"]), "trim"))) {
        $sparts = NULL;