Beispiel #1
0
<?php

require_once "../inc/init.php";
if (!Session::canAccess(AccessLevels::ADMINISTRATOR)) {
    CommonUtil::redirect("index");
    exit(0);
}
if (isset($_POST["user"])) {
    User::register($_POST["user"], $_POST["pass"], $_POST["firstname"], $_POST["lastname"], $_POST["accessLevel"], 1, $_POST["email"], $_POST["phone"]);
    echo "Käyttäjä lisätty.";
}
?>

<form action="/admin/users" method="post">
		<p>username <input type="text" name="user"></p>
		<p>password <input type="text" name="pass"></p>
		<p>first name <input name="firstname"></p>
		<p>last name <input name="lastname"></p>
		<p>email <input name="email"></p>
		<p>phone <input name="phone"></p>
        <p>access level <select name="accessLevel">
        <?php 
foreach (AccessLevels::getLevels() as $level => $name) {
    echo "<option value={$level}>{$name}</option>";
}
?>
        </select></p>
		<input type="submit">
</form>
Beispiel #2
0
<?php

require_once "../inc/init.php";
if (!Session::canAccess(AccessLevels::CONTENT_PROVIDER)) {
    CommonUtil::redirect("index");
    exit(0);
}
Beispiel #3
0
$sectionTitle = ":(";
if ($article) {
    $sectionTitle = "Artikkeli";
    $subsectionTitle = $article->title;
}
require "views/header.php";
require "views/sidebar.php";
?>

    <div class="main">
        <div class="main-wrapper">
            <div class="container">
                <div class="article-view">
<?php 
// check if the article exits and if the user has rights to access it
if (!$article || !Session::canAccess($article->accessLevel)) {
    // article doesn't exist or the user can't access it; display an error.
    ?>
        <div class="error">
            <div class="frown">&#61721;</div>
            <h2>Hups!</h2>
            <p>Artikkelia ei ole olemassa tai sinulla ei ole sen näkemiseen vaadittavia oikeuksia.</p>
        </div>
    <?php 
} else {
    $attachments = $article->getAttachments();
    foreach ($attachments as $attachment) {
        // output video
        if ($attachment->type == ArticleAttachment::TYPE_VIDEO) {
            ?>
<div class="video-wrapper">