Skip to content

Commit

Permalink
Uppercase file names
Browse files Browse the repository at this point in the history
  • Loading branch information
Tym17 committed Sep 26, 2016
1 parent 85d0a9e commit 0fe15cb
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 0 deletions.
48 changes: 48 additions & 0 deletions app/views/Index.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@


<!-- Showcase block -->
<div class="row">
<?php
// User have no serie added
if (empty($series)):
?>
<div class="col-lg-12">
<p>You don't have any serie. </p>
<a href="<?php echo APP_URL . '/serie/add' ?>" class="btn btn-primary">Add one</a>
</div>
<?php
endif;
// Loop for each serie
foreach ($series as $serie):
?>
<!-- Single card -->
<div class="col-lg-3">
<div class="card card-outline-<?php echo $serie['Color'] ?>">
<div class="card-block">
<h4 class="card-title"><?php echo $serie['Name'] ?></h4>
<p class="card-text lead">
<span class="darker-main">S</span><?php echo $serie['LastSeason'] ?>
<span class="darker-main"> E</span><?php echo $serie['LastEpisode'] ?></p>
<p class="card-text">Coming back <?php echo $serie['AirDate'] ?></p>
<a href="<?php echo APP_URL . '/serie/edit/' . $serie['id'] ?>" class="btn btn-<?php echo $serie['Color'] ?>">Edit</a>
</div>
</div>
</div>
<!-- End of a card -->
<?php endforeach; ?>


</div>
</div>
<!-- End of Showcase -->

<!-- Navbar -->
<div class="my-nav">
<div class="row">
<div class="col-sm-2">
<a href="<?php echo APP_URL . '/serie/add' ?>" class="btn btn-xs btn-primary btn-block ">Add a serie</a>
</div>
<div class="col-sm-2 offset-sm-8">
<a href="<?php echo APP_URL . '/login/out' ?>" class="btn btn-xs btn-danger btn-block">Log out</a>
</div>
</div>
16 changes: 16 additions & 0 deletions app/views/Login.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="center-signin">
<a href="<?php echo APP_URL ?>"><h1>SerieLast</h1></a>
<p>Log in</p>
<?php if (isset($error)) { echo '<div class="alert alert-danger">' . $error . '</div>'; } ?>
<form action="<?php echo APP_URL . '/login' ?>" method="post" class="sign_form">
<input type="text" name="user_name" placeholder="Name" class="form-control top"></input>
<input type="password" name="user_pass" placeholder="Password" class="form-control"></input>
<input type="submit" value="Log in" class="btn btn-lg btn-primary btn-block"></input>
</form>
<?php if (!APP_INSTALLED): ?>
<br />
<br />
<a href="<?php echo APP_URL . '/install' ?>" class="btn btn-lg btn-warning btn-block">Install menu</a>
<?php endif; ?>
</div>
<!-- -->
56 changes: 56 additions & 0 deletions library/SqliteHandle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

class SqliteHandle
{
protected $dbhandle;

function __construct($db_filename)
{
$this->dbhandle = new SQLite3($db_filename);

if (!$this->dbhandle)
die ('Could not connect to db');
}

function __destruct()
{
$this->dbhandle->close();
}

function query($query)
{
$result = $this->dbhandle->query($query);
if (!$result)
{
return false;
}
return $result;
}

function arrayify($result)
{
// Arrayification of results
$retArray = array();
$inserted = true;
// While there is items to be inserted
while ($inserted)
{
$inserted = $result->fetchArray(SQLITE3_ASSOC);
if ($inserted)
{
// An item has been fetched

$retArray[] = $inserted;
}
}
return $retArray;
}

// Escape malicious characters
function es($str)
{
$str = htmlspecialchars($str);
$str = str_replace("'", "''", $str);
return $str;
}
}
42 changes: 42 additions & 0 deletions library/controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
class Controller {

protected $_controller;
protected $_action;
protected $_template;

function __construct($controller, $action) {

$this->_controller = $controller;
$this->_action = $action;
$this->_template = new Template($controller,$action);
}

/*
** Pass variable to the Template
*/
function set($name,$value) {
$this->_template->set($name,$value);
}

function __destruct() {
// render Template uppon destruct
$this->_template->render();
}

/*
** Basic function call if no action is specified while calling for this controller
*/
function index()
{

}

/*
** Controller's own 404error page
*/
function noAction()
{
echo 'noAction';
}
}

0 comments on commit 0fe15cb

Please sign in to comment.