From b9628f189b0ca2f7c411bd79566da37c73cc8e8f Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 21 Sep 2016 06:40:03 +0400 Subject: Demo in beta mode. --- demo/components/class-application.php | 106 ++++++++++++++++++++++++++++++++++ demo/components/communication.php | 16 +++++ demo/components/footer.php | 9 +++ demo/components/navbar.php | 24 ++++++++ demo/components/results.php | 12 ++++ demo/components/settings.php | 24 ++++++++ 6 files changed, 191 insertions(+) create mode 100644 demo/components/class-application.php create mode 100644 demo/components/communication.php create mode 100644 demo/components/footer.php create mode 100644 demo/components/navbar.php create mode 100644 demo/components/results.php create mode 100644 demo/components/settings.php (limited to 'demo/components') diff --git a/demo/components/class-application.php b/demo/components/class-application.php new file mode 100644 index 0000000..bdd6419 --- /dev/null +++ b/demo/components/class-application.php @@ -0,0 +1,106 @@ +session($_COOKIE['BOT_SESSION']); + } else { // Open a new one + $session = $bot->session(); + SetCookie("BOT_SESSION", $session); + } + + // We issue results + if (isset($session)) { + return $session; + } else { + return 0; + } +} + +/** +* The function returns the current ID. +* Returns zero if no ID is stored. +*/ +function GetID() { + // Search current ID... + if (isset($_COOKIE['CURRENT_ID'])) { + $id = (int)$_COOKIE['CURRENT_ID'] + 1; + // ...or returns zero + } else { + $id = 0; + } + // We issue results + return $id; +} + +/** +* The function overrides the current ID to +* the specified or the next. If any missing ID +* returns the one. +* @param $id - Current ID. +*/ +function SetID($id) { + // Process the specified ID... + if (isset($id)) { + $id = $id + 1; + // ...Or are saved... + } elseif (isset($_COOKIE['CURRENT_ID'])) { + $id = (int)$_COOKIE['CURRENT_ID'] + 1; + // ...Or return one + } else { + $id = 1; + } + SetCookie('CURRENT_ID', $id, time()+300); // Save the result + // We issue results + return $id; +} + +/** +* The function maintains a history of conversations, +* using a database of cookie files. +* @param $currentid - Message ID. +* @param $textarea - Message text. +* @param $type - Who said (Man / Bot). +*/ +function SavingStories($currentid, $textarea, $type) { + // We form an array with values + $cookie = array( + 'type' => $type, + 'textarea' => $textarea, + 'time' => time()); + // Save by encoding in JSON-string + SetCookie("TALK".$currentid, json_encode($cookie), time()+60); +} + +/** +* Function line formation. +* @param $id - Variable Message ID. +*/ +function ShowRecord($id) { + for ($i=0; $i < $id; $i++) { + if (isset($_COOKIE['TALK'.$i])) { + $cookie = json_decode($_COOKIE['TALK'.$i], true); + echo(""); + echo("".$cookie['type'].""); + echo("".$cookie['textarea'].""); + echo("".date("H:i:s", $cookie['time']).""); + echo(""); + } + } +} ?> diff --git a/demo/components/communication.php b/demo/components/communication.php new file mode 100644 index 0000000..e73be75 --- /dev/null +++ b/demo/components/communication.php @@ -0,0 +1,16 @@ + +
+
+ +
+ +
+ +
+ + +
+
+
+
+ diff --git a/demo/components/footer.php b/demo/components/footer.php new file mode 100644 index 0000000..b1df881 --- /dev/null +++ b/demo/components/footer.php @@ -0,0 +1,9 @@ + + + diff --git a/demo/components/navbar.php b/demo/components/navbar.php new file mode 100644 index 0000000..9fcb9ee --- /dev/null +++ b/demo/components/navbar.php @@ -0,0 +1,24 @@ + + + diff --git a/demo/components/results.php b/demo/components/results.php new file mode 100644 index 0000000..4ae9332 --- /dev/null +++ b/demo/components/results.php @@ -0,0 +1,12 @@ +
+
+ + + + + + + +
#TextDate
+
+
diff --git a/demo/components/settings.php b/demo/components/settings.php new file mode 100644 index 0000000..fe8e5ff --- /dev/null +++ b/demo/components/settings.php @@ -0,0 +1,24 @@ + + + -- cgit v1.2.3