File: //home/nepi/task.nepi.ir/index.php
<?php
require 'flight/Flight.php';
include 'ouqat.php';
Flight::register('ouqat', 'OUQAT');
Flight::set('ouqat', Flight::ouqat());
function index()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
Flight::render('app.php', array('ouqat' => Flight::get('ouqat')));
} else {
Flight::render('home.php', array('VERSION' => Flight::get('ouqat')->VERSION));
}
}
function auth()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->feedback == "You were just logged out.") {
Flight::redirect('/');
} else {
echo $ouqat->feedback;
}
}
function add()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
$ouqat->addEvent();
echo $ouqat->feedback;
} else {
echo "expire";
}
}
function del()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
$ouqat->delEvent();
echo $ouqat->feedback;
} else {
echo "expire";
}
}
function edit()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
$ouqat->editEvent();
echo $ouqat->feedback;
} else {
echo "expire";
}
}
function events($id, $year, $month, $day)
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->getEvents($id, $year, $month, $day);
} else {
echo "expire";
}
}
function uniqueDate($id)
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->getEventsUniqeDate($id);
} else {
echo "expire";
}
}
function actions()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->getActions();
} else {
echo "expire";
}
}
function setActions()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->setActions();
} else {
echo "expire";
}
}
function users()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->getUsers();
} else {
echo "expire";
}
}
function userUpdate()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->userUpdate();
} else {
echo "expire";
}
}
function userDel()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->userDel();
} else {
echo "expire";
}
}
function getBackUPDB()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->backupDB();
} else {
echo "expire";
}
}
function week()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
$ouqat->week();
echo $ouqat->feedback;
} else {
echo "expire";
}
}
function month()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
$ouqat->month();
echo $ouqat->feedback;
} else {
echo "expire";
}
}
function getWeek()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
$ouqat->getWeek();
// echo $ouqat->feedback;
} else {
echo "expire";
}
}
function getMonth()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
$ouqat->getMonth();
// echo $ouqat->feedback;
} else {
echo "expire";
}
}
function getMoodsImgsLI()
{
foreach (glob('assets/img/active/*.*') as $file) {
if ($file != "." || $file != "..")
echo '<li class="item"><img src="' . $file . '" class="icon" /></li>';
}
}
function getListEvents()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->getListEvents();
} else {
echo "expire";
}
}
function export()
{
$ouqat = Flight::get('ouqat');
if ($ouqat->getUserLoginStatus()) {
echo $ouqat->export();
} else {
echo "expire";
}
}
Flight::route('/', 'index');
Flight::route('/auth', 'auth');
Flight::route('POST /add', 'add');
Flight::route('POST /del', 'del');
Flight::route('POST /edit', 'edit');
Flight::route('POST /week', 'week');
Flight::route('POST /month', 'month');
Flight::route('/events(/@id(/@year(/@month(/@day))))', 'events');
Flight::route('/getUniqeDate(/@id:[0-9]+)', 'uniqueDate');
Flight::route('/getActions', 'actions');
Flight::route('POST /setActions', 'setActions');
Flight::route('/getUsers', 'users');
Flight::route('/userUpdate', 'userUpdate');
Flight::route('/userDel', 'userDel');
Flight::route('/getBackUPDB', 'getBackUPDB');
Flight::route('POST /getWeek', 'getWeek');
Flight::route('POST /getMonth', 'getMonth');
Flight::route('/getMoodsImgsLI', 'getMoodsImgsLI');
Flight::route('POST /getListEvents', 'getListEvents');
Flight::route('/export', 'export');
Flight::start();