function CreateNav($token, $skin) { global $defined; $auth = new Authenticate(); $level = new AccessLevels(); if (empty($token)) { $data->menu = 'menu.default.tpl'; } else { if ($auth->AuthUser(NULL, NULL, $token) === -1 || $auth->AuthUser(NULL, NULL, $token) === -2) { // $data->menu = $msg; $data->menu = 'menu.default.tpl'; } else { if ($level->ChkLevel($token) === "admin") { $data->menu = 'menu.admin.tpl'; } elseif ($level->ChkLevel($token) === "user") { $data->menu = 'menu.user.tpl'; } elseif ($level->ChkLevel($token) === "view") { $data->menu = 'menu.view.tpl'; } else { $data->menu = 'menu.default.tpl'; } } } return $data->menu; }
*/ // load our config data if (file_exists("scripts/inc.config.php")) { require 'scripts/inc.config.php'; // ensure we are being called from our configured host if ($defined['hostname'] === $_SERVER['SERVER_NAME']) { // Initialize classes $db = new dbConn(); $err = new GenerateErrors(); $tpl = new Template(); $skin = new PageSkinner(); $val = new ValidateStrings(); $menu = new GenerateNavMenu(); $auth = new Authenticate(); $encrypt = new Encryption(); $level = new AccessLevels(); $misc = new MiscFunctions(); $debug = new DebugData(); // initialize a db connection handle $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']); // ensure our sessions are present if (empty($_SESSION['token'])) { $sessions = new dbSession(); } //define the template and cache directories $tpl->strTemplateDir = $defined['virpath'] . 'templates'; $tpl->strCacheDir = '/tmp'; if (!empty($_GET) || !empty($_POST)) { $flag = "TRUE"; } else { $flag = "FALSE";
</div> <?php echo $form->error($model, 'audit_trails_access_level'); ?> </div> <div class="row form-group"> <div class="col-md-3 control-label"> <?php echo $form->labelEx($model, 'grouping_access_level'); ?> </div> <div class="col-md-4"> <?php //echo $form->textField($model,'grouping_access_level'); echo $form->dropDownList($model, 'grouping_access_level', CHtml::listData(AccessLevels::model()->findAll(array('select' => 'id, access_level', 'order' => 'access_level')), 'id', 'access_level'), array('empty' => '- Select -', 'class' => 'form-control')); ?> </div> <?php echo $form->error($model, 'grouping_access_level'); ?> </div> <div class="row form-group"> <div class="col-md-3 control-label"></div> <div class="col-md-4"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', ['class' => "btn btn-primary form-control"]); ?> </div> </div>
*/ // load our config data if (file_exists("../../../scripts/inc.config.php")) { require '../../../scripts/inc.config.php'; // ensure we are being called from our configured host if ($defined['hostname'] === $_SERVER['SERVER_NAME']) { // Initialize classes $db = new dbConn(); $err = new GenerateErrors(); $tpl = new Template(); $skin = new PageSkinner(); $val = new ValidateStrings(); $menu = new GenerateNavMenu(); $auth = new Authenticate(); $encrypt = new Encryption(); $level = new AccessLevels(); $misc = new MiscFunctions(); $debug = new DebugData(); // initialize a db connection handle $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']); // ensure our sessions are present if (empty($_SESSION['token'])) { $sessions = new dbSession(); } //define the template and cache directories $tpl->strTemplateDir = '../../../../templates'; $tpl->strCacheDir = '/tmp'; if (!empty($_GET) || !empty($_POST)) { $flag = "TRUE"; } else { $flag = "FALSE";
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return AccessLevels the loaded model * @throws CHttpException */ public function loadModel($id) { $model = AccessLevels::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?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>
*/ // load our config data if (file_exists("scripts/inc.config.php")) { require 'scripts/inc.config.php'; // ensure we are being called from our configured host if ($defined['hostname'] === $_SERVER['SERVER_NAME']) { // Initialize classes $db = new dbConn(); $err = new GenerateErrors(); $tpl = new Template(); $skin = new PageSkinner(); $val = new ValidateStrings(); $menu = new GenerateNavMenu(); $auth = new Authenticate(); $encrypt = new Encryption(); $level = new AccessLevels(); $misc = new MiscFunctions(); $debug = new DebugData(); $enc = new Encryption(); // initialize a db connection handle $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']); // ensure our sessions are present if (empty($_SESSION['token'])) { $sessions = new dbSession(); } //define the template and cache directories $tpl->strTemplateDir = $defined['virpath'] . 'templates'; $tpl->strCacheDir = '/tmp'; if (!empty($_GET) || !empty($_POST)) { $flag = "TRUE"; } else {
require "../views/head.php"; $article = null; $subsectionTitle = "Uusi artikkeli"; if (isset($_GET["id"])) { $article = Article::model()->findByPk($_GET["id"]); $subsectionTitle = $article->title; } $sectionTitle = "Artikkelin muokkaus"; require "../views/header.php"; require "../views/sidebar.php"; function filterForTextarea($subject) { return str_replace(array("<", ">"), array("<", ">"), $subject); } $categories = Category::model()->findAll(); $accessLevels = AccessLevels::getLevels(); $title = $article ? htmlspecialchars($article->title) : ""; $description = $article ? filterForTextarea($article->description) : ""; $text = $article ? filterForTextarea($article->text) : ""; $id = $article ? $article->id : -1; $attachments = null; if ($article) { $attachments = $article->getAttachments(); } ?> <div class="main no-footer"> <div class="main-wrapper"> <div class="container"> <div class="editor"> <form action="admin/save" method="post" enctype="multipart/form-data">