<?php
//routes/admin.php
$kw->route('GET /admin', function($kw){
if(isset($_SESSION['email'])){
require_once('controllers/admin/index.php');
index($kw);
}else{
$kw->reroute('./login');
}
});
$kw->route('GET /admin/logout', function($kw){
session_destroy();
$kw->reroute('./');
});
$kw->route('GET /admin_post', function($kw){
if(isset($_SESSION['email'])){
require_once('controllers/admin/posts/reads.php');
reads($kw);
}else{
$kw->reroute('./login');
}
});
$kw->route('GET /admin_user', function($kw){
if(isset($_SESSION['email'])){
require_once('controllers/admin/users/read.php');
read($kw);
}else{
$kw->reroute('./login');
}
});
<?php
//controllers/admin/posts/reads.php
function reads($kw){
require_once('setting.php');
$kw->mset([
'appName'=>$setting['siteTitle'],
'title'=>'ទំព័រការផ្សាយ',
'date'=>$setting['date']
]);
$view = new View;
echo $view->render('views/admin/post.php');
}
<?php require('views/admin/partials/header.php') ?>
<link href='public/styles/admin/post.css' rel='stylesheet' />
<script src="public/scripts/ckeditor/ckeditor.js"></script>
<script src="public/scripts/admin/post.js"></script>
<section class='Main'>
<div class='Sidebar'>
<?php require('views/admin/partials/sidebar.php') ?>
</div>
<div class='Content'>
<form action='./admin_post' method='post'>
<input type='text' name='title' placeholder='ចំណងជើង' required />
<textarea name='text' id='editor'></textarea>
<div class='wrapper'>
<input type='text' name='thumb' required placeholder='តំណរភ្ឌាប់រូប' />
<select name='category' required>
<option>ជាតិ</option>
<option>អន្តរជាតិ</option>
</select>
<input type='datetime-local' value='<?php echo $datetime ?>' name='datetime' required />
<input type='submit' value='បញ្ជូន' />
</div>
<input type='hidden' name='entries' required />
</form>
<div class='form'>
<select name='type'>
<option>YouTube</option>
<option>YouTubePlaylist</option>
<option>Facebook</option>
<option>OK</option>
<option>Dailymotion</option>
<option>Vimeo</option>
</select>
<input name='id' type='text' placeholder="អត្តសញ្ញាណវីដេអូ" required />
<select name='ending'>
<option>ចប់ហើយ</option>
<option>មិនទាន់ចប់</option>
</select>
<input onclick='genJson()' type="button" value="បញ្ចូលវីដេអូ" />
</div>
<table class='viddata'></table>
</div>
</section>
<script src="public/scripts/ckeditor/config.js"></script>
<?php require('views/partials/footer.php') ?>
.Content .ck-editor__editable{
min-height: 320px;
color: black;
}
.Content form input[name=title]{
width: 100%;
font: 18px/1.5 Anton, Koulen;
padding: 2px 10px;
}
.Content form .wrapper{
display: grid;
grid-template-columns: 40% 20% auto 10%;
}
.Content form .wrapper input,
.Content form .wrapper select{
font: var(--font-body);
padding: 2px 10px;
}
.Content .form{
display: grid;
grid-template-columns: 40% 20% auto 10% ;
}
.Content .form input, .Content .form select{
font: var(--font-body);
padding: 2px 10px;
}
.Content table {
margin-top: 5px;
width: 100%;
border-collapse: collapse;
}
.Content table, td, th {
border: 1px solid black;
background: white;
color: black;
text-align: center;
padding: 5px;
}
.Content table, th {
background: #ddd;
}
.Content table .episode:hover{
cursor: pointer;
color: red;
}
Epizy: http://khmerweb.epizy.com