added a flash and also some basic UCP code

This commit is contained in:
nilsding 2014-08-18 15:07:41 +02:00
parent 4558a51f90
commit 3d09077fe2
6 changed files with 63 additions and 0 deletions

View File

@ -68,8 +68,16 @@ if (!isset($notemplate)) {
$res = $sql->query("SELECT `value` FROM `config` WHERE `key` = \"sitename\";")->fetch_assoc();
$site_name = htmlspecialchars($res['value']);
// the flash
$message = null;
if (isset($_SESSION['flash'])) {
$message = $_SESSION['flash'];
unset($_SESSION['flash']);
}
$tpl->assign("logged_in", $_SESSION['logged_in']);
$tpl->assign("site_name", $site_name);
$tpl->assign("words_total", $words_total_count);
$tpl->assign("inbox_count", $new_words_count);
$tpl->assign("message", $message);
}

43
ucp.php
View File

@ -0,0 +1,43 @@
<?php
/* This file is part of 3words
*
* (c) 2014 Leafcat Coding -- http://leafc.at
*
* License: AGPLv3, see LICENSE for full license text
*
* This file was touched by:
* - nilsding <nilsding@nilsding.org>
*
* Oh, and before I forget...
* ________ __________ __ ____ __ ______
* / ____/ / / / ____/ //_/ / __ \/ / / / __ \
* / /_ / / / / / / ,< / /_/ / /_/ / /_/ / with
* / __/ / /_/ / /___/ /| | / ____/ __ / ____/ a
* /_/ \____/\____/_/ |_| /_/ /_/ /_/_/ cactus!
*
* Thanks for listening.
*/
include_once 'config.php';
switch ($_GET['page']) {
case "login": {
$tpl->draw("login");
break;
}
case "logout": {
session_destroy();
session_start();
$_SESSION['flash'] = "Sucessfully logged out";
header('Location: index.php');
break;
}
case "settings": {
$tpl->draw("settings");
break;
}
case "inbox":
default: {
$tpl->draw("inbox");
}
}

View File

@ -1,6 +1,9 @@
{include="layout"}
{include="navbar"}
<div class="container">
{if="$message"}
<div class="alert alert-info">{$message}</div>
{/if}
<div class="row">
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked nav-justified">

View File

@ -1,6 +1,9 @@
{include="layout"}
{include="navbar"}
<div class="container">
{if="$message"}
<div class="alert alert-info">{$message}</div>
{/if}
<h1>{$site_name}!</h1>
<p>Want to tell them who you are? <input id="author" type="text" class="form-control" placeholder="Anonymous"></p>
<div class="row">

View File

@ -1,6 +1,9 @@
{include="layout"}
{include="navbar"}
<div class="container">
{if="$message"}
<div class="alert alert-info">{$message}</div>
{/if}
<form role="form" method="POST">
<div class="form-group">
<label for="InputUsername">Username</label>

View File

@ -1,6 +1,9 @@
{include="layout"}
{include="navbar"}
<div class="container">
{if="$message"}
<div class="alert alert-info">{$message}</div>
{/if}
<div class="row">
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked nav-justified">