added basic code to show the template
This commit is contained in:
parent
a54b2d5a6c
commit
2dfe16ef36
24
config.php
24
config.php
@ -41,6 +41,10 @@ function crypt_password ($pass, $salt) {
|
|||||||
// the
|
// the
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['logged_in'])) {
|
||||||
|
$_SESSION['logged_in'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($notemplate)) {
|
if (!isset($notemplate)) {
|
||||||
require_once 'ext/rain.tpl.class.php';
|
require_once 'ext/rain.tpl.class.php';
|
||||||
|
|
||||||
@ -48,4 +52,24 @@ if (!isset($notemplate)) {
|
|||||||
raintpl::configure("tpl_dir", "views/");
|
raintpl::configure("tpl_dir", "views/");
|
||||||
|
|
||||||
$tpl = new RainTPL;
|
$tpl = new RainTPL;
|
||||||
|
|
||||||
|
// new words counter
|
||||||
|
$new_words_count = -1;
|
||||||
|
if ($_SESSION['logged_in'] === true) {
|
||||||
|
$res = $sql->query("SELECT `id` FROM `words` WHERE `new` = 1;");
|
||||||
|
$new_words_count = $res->num_rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
// total words count
|
||||||
|
$res = $sql->query("SELECT `id` FROM `words`;");
|
||||||
|
$words_total_count = $res->num_rows * 3;
|
||||||
|
|
||||||
|
// site name
|
||||||
|
$res = $sql->query("SELECT `value` FROM `config` WHERE `key` = \"sitename\";")->fetch_assoc();
|
||||||
|
$site_name = htmlspecialchars($res['value']);
|
||||||
|
|
||||||
|
$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);
|
||||||
}
|
}
|
23
index.php
23
index.php
@ -0,0 +1,23 @@
|
|||||||
|
<?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';
|
||||||
|
|
||||||
|
$tpl->draw("index");
|
@ -1,7 +1,7 @@
|
|||||||
{include="layout"}
|
{include="layout"}
|
||||||
{include="navbar"}
|
{include="navbar"}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>{$site_title}!</h1>
|
<h1>{$site_name}!</h1>
|
||||||
<p>Want to tell them who you are? <input id="author" type="text" class="form-control" placeholder="Anonymous"></p>
|
<p>Want to tell them who you are? <input id="author" type="text" class="form-control" placeholder="Anonymous"></p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>{$site_title}</title>
|
<title>{$site_name}</title>
|
||||||
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
|
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||||
<script src="assets/js/bootstrap.min.js"></script>
|
<script src="assets/js/bootstrap.min.js"></script>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="#">{$site_title}</a>
|
<a class="navbar-brand" href="#">{$site_name}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||||
@ -18,7 +18,7 @@
|
|||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{$user_name}<b class="caret"></b></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{$user_name}<b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="ucp.php">Inbox</a></li>
|
<li><a href="ucp.php">Inbox{if="$new_words_count > 0"}{$new_words_count}{/if}</a></li>
|
||||||
<li><a href="ucp.php?page=settings">Settings</a></li>
|
<li><a href="ucp.php?page=settings">Settings</a></li>
|
||||||
{else}
|
{else}
|
||||||
<li><a href="ucp.php?page=login">Login</a></li>
|
<li><a href="ucp.php?page=login">Login</a></li>
|
||||||
|
Loading…
Reference in New Issue
Block a user