-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
<!-- --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} | ||
} |