aboutsummaryrefslogtreecommitdiff
path: root/test/components
diff options
context:
space:
mode:
Diffstat (limited to 'test/components')
-rw-r--r--test/components/communication.php17
-rw-r--r--test/components/engine.php66
-rw-r--r--test/components/footer.php9
-rw-r--r--test/components/navbar.php36
-rw-r--r--test/components/results.php20
-rw-r--r--test/components/settings.php24
6 files changed, 0 insertions, 172 deletions
diff --git a/test/components/communication.php b/test/components/communication.php
deleted file mode 100644
index 3f00204..0000000
--- a/test/components/communication.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<!-- Home side panel -->
-<form class="form-horizontal" method="post">
- <div class="row">
- <!-- Text field -->
- <div class="col-md-8">
- <textarea class="form-control" rows="3" name="textarea"></textarea>
- </div>
- <!-- Control buttons -->
- <div class="col-md-4">
- <button type="submit" class="btn btn-default">Submit</button>
- <button type="button" class="btn btn-success" data-toggle="modal" data-target="#SettingsModal">Settings</button>
- <button type="button" class="btn btn-danger">Reset</button>
- </div>
- </div><!-- row -->
-</form>
-<br/>
-<!-- End side panel -->
diff --git a/test/components/engine.php b/test/components/engine.php
deleted file mode 100644
index bc89d8e..0000000
--- a/test/components/engine.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-function ShowRecord($id) {
- for ($i=0; $i < $id; $i++) {
- $cookie = json_decode($_COOKIE['TALK'.$i], true);
- echo("<tr>");
- echo("<td>".$cookie['type']."</td>");
- echo("<td>".$cookie['textarea']."</td>");
- echo("<td>".date("H:i:s", $cookie['time'])."</td>");
- echo("</tr>");
- }
- return 0;
-}
-
- if (isset($_COOKIE['BOT_TOKEN'])) {
- $BOT_TOKEN = $_COOKIE['BOT_TOKEN'];
- }
-
- if (isset($_POST['BOT_TOKEN'])) {
- unset($_COOKIE); // Clear the session
- SetCookie("BOT_TOKEN", htmlspecialchars($_POST['BOT_TOKEN']));
- $BOT_TOKEN = htmlspecialchars($_POST['BOT_TOKEN']);
- }
-
- if (isset($BOT_TOKEN)) {
- define('BOT_TOKEN', $BOT_TOKEN);
- $bot = new Bot(BOT_TOKEN);
- if (isset($_COOKIE['BOT_SESSION'])) {
- $session = $bot->session($_COOKIE['BOT_SESSION']);
- } else {
- $session = $bot->session();
- SetCookie("BOT_SESSION", $session);
- }
- if (!isset($session)) { ?>
- <div class="container">
- <div class="alert alert-danger" role="alert">Session is not initialized, check the settings!</div>
- </div>
- <?php }
- }
-
- if (isset($_POST['textarea'])) {
- $textarea = htmlspecialchars($_POST['textarea']);
- if (isset($_COOKIE['CURRENT_ID'])) {
- $current_id = (int)$_COOKIE['CURRENT_ID'];
- SetCookie('CURRENT_ID', $current_id+1);
- } else {
- $current_id = 0;
- SetCookie('CURRENT_ID', $current_id);
- }
-
- $cookie = array(
- 'type' => 'user',
- 'textarea' => $textarea,
- 'time' => time()
- );
- SetCookie("TALK".$current_id, json_encode($cookie));
-
- $current_id = $current_id+1;
- SetCookie('CURRENT_ID', $current_id+1);
- $cookie = array(
- 'type' => 'bot',
- 'textarea' => $bot->say($textarea),
- 'time' => time()
- );
- SetCookie("TALK".$current_id, json_encode($cookie));
- }
-?>
diff --git a/test/components/footer.php b/test/components/footer.php
deleted file mode 100644
index fa5a161..0000000
--- a/test/components/footer.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<!-- Beginning footer -->
-<footer class="footer">
- <div class="container">
- <p class="text-muted">
- <a href="mailto:valentineus@gmail.com">valentineus@gmail.com</a>
- </p>
- </div>
-</footer>
-<!-- End footer -->
diff --git a/test/components/navbar.php b/test/components/navbar.php
deleted file mode 100644
index ed858b5..0000000
--- a/test/components/navbar.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<!-- Start navigation bar -->
-<nav class="navbar navbar-default navbar-fixed-top">
- <div class="container">
- <div class="collapse navbar-collapse">
- <ul class="nav navbar-nav">
- <li>
- <!-- Home project -->
- <a href="https://github.com/valentineus/Module-III-API"><span class="github" aria-hidden="true"></span> GitHub.com</a>
- </li>
- </ul>
- <!-- The right side of the navigation bar -->
- <ul class="nav navbar-nav navbar-right">
- <li>
- <p class="navbar-text" data-toggle="popover" data-placement="auto" data-trigger="hover" data-content="Cookies must be enabled in your browser!"><?php
- // Check the ability to use Cookie
- if (SetCookie("TestCookie", "Success")) { ?>
- <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
- <?php } else { ?>
- <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
- <?php }
- ?> Cookie</p>
-
- <p class="navbar-text" data-toggle="popover" data-placement="auto" data-trigger="hover" data-content="Before the work necessary to configure!"><?php
- // Checking the portal settings
- if (isset($_COOKIE['BOT_TOKEN']) OR isset($_POST['BOT_TOKEN'])) { ?>
- <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
- <?php } else { ?>
- <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
- <?php }
- ?> Settings</p>
- </li>
- </ul><!-- navbar-right -->
- </div>
- </div><!-- container -->
-</nav>
-<!-- End navigation bar -->
diff --git a/test/components/results.php b/test/components/results.php
deleted file mode 100644
index def09b1..0000000
--- a/test/components/results.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<div class="row">
- <div class="col-md-12">
- <table class="table table-striped">
- <tr>
- <th>#</th>
- <th>Text</th>
- <th>Date</th>
- </tr>
- <?php
- if (isset($current_id)) {
- ShowRecord($current_id);
- } elseif (isset($_COOKIE['CURRENT_ID'])) {
- ShowRecord((int)$_COOKIE['CURRENT_ID']);
- } else {
- echo("Error!");
- }
- ?>
- </table>
- </div>
-</div>
diff --git a/test/components/settings.php b/test/components/settings.php
deleted file mode 100644
index fe8e5ff..0000000
--- a/test/components/settings.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<!-- Start pop-up window for the settings -->
-<div class="modal fade" id="SettingsModal" tabindex="-1" role="dialog" aria-labelledby="SettingsModal">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <form class="form-horizontal" method="post">
- <div class="modal-body">
- <!-- Elements of a modal window -->
- <div class="form-group">
- <label for="inputPassword" class="col-sm-2 control-label">ID:</label>
- <div class="col-sm-10">
- <input type="text" class="form-control" id="inputPassword" name="BOT_TOKEN" placeholder="109cd867-0ef3-4473-af71-7543a9b2fccd">
- </div>
- </div>
- </div>
- <!-- The window control buttons -->
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
- <button type="submit" class="btn btn-success">Save changes</button>
- </div>
- </form>
- </div><!-- modal-content -->
- </div><!-- modal-dialog -->
-</div>
-<!-- End pop-up window for the settings -->