summaryrefslogtreecommitdiff
path: root/www/index.php
diff options
context:
space:
mode:
authorAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-05-27 14:55:52 +0300
committerAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-05-27 14:55:52 +0300
commit7746e8bcfe3a57501fb44ab1f9a664fee2a1326f (patch)
treedfb0d981754a63048d72c067e15dd89c73ab3ee8 /www/index.php
parentd51264c55ba73330cf129b43f635c9489fe663f9 (diff)
initial
Diffstat (limited to 'www/index.php')
-rw-r--r--www/index.php126
1 files changed, 43 insertions, 83 deletions
diff --git a/www/index.php b/www/index.php
index 74b121d..7278d8d 100644
--- a/www/index.php
+++ b/www/index.php
@@ -1,83 +1,43 @@
-<!doctype html>
-<html>
-<head>
- <meta charset="utf-8" />
- <title>Welcome to OpenShift</title>
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet" type="text/css" />
- <style type="text/css">
- html, body {
- margin: 0;
- padding: 0;
- }
-
- body {
- font-family: 'Open Sans', sans-serif;
- padding-top: 100px;
- }
-
- h1 {
- font-size: 52px;
- margin-bottom: 0;
- }
-
- h1, h2, p {
- margin-top: 0;
- font-weight: normal;
- }
-
- a {
- color: #DB242F;
- }
-
- a:not(:hover) {
- text-decoration: none;
- }
-
- .container {
- display: flex;
- flex-direction: row;
- margin: 0 auto;
- width: 960px;
- }
-
- .section {
- padding: 15px;
- }
-
- .section + .section {
- margin-left: 15px;
- }
-
- .welcome {
- background: #eee;
- border-radius: 5px;
- text-align: center;
- flex: 0 0 300px;
- }
- </style>
-</head>
-<body>
- <div class="container">
- <div class="section welcome">
- <div>
- <img src="/static/openshift-logo.png" alt="OpenShift Logo" />
- </div>
- <h1>Welcome!</h1>
- <p>You are running PHP <?php echo phpversion(); ?></p>
- </div>
- <div class="section">
- <h2>What's next?</h2>
- <p>Make changes to this website by editing the files inside <code>www/</code> of your repository.</p>
- <p>Commit your changes after, then push to the remote repository.</p>
- <pre><code>$ git commit -a -m "Some commit message"
-$ git push origin master</code></pre>
- <h2>More</h2>
- <ul>
- <li>Visit <a href="http://www.openshift.com">http://www.openshift.com</a>.</li>
- <li>Get help in the <a href="http://www.openshift.com/forums/openshift">OpenShift forums</a>.</li>
- <li>More on the cartridge at <a href="https://github.com/pinodex/openshift-cartridge-nginx-php7">pinodex/openshift-cartridge-nginx-php7</a>.</li>
- </ul>
- </div>
- </div>
-</body>
-</html> \ No newline at end of file
+<?php
+
+use \NeonXP\TelegramApi\Telegram;
+use \Doctrine\Common\Annotations\AnnotationRegistry;
+use \NeonXP\TelegramApi\Types\Message;
+use \NeonXP\TelegramApi\Types\InputFile;
+use \NeonXP\TelegramApi\Script;
+use \NeonXP\TelegramApi\Script\State;
+use \NeonXP\TelegramApi\Script\Conditions\isText;
+use \NeonXP\TelegramApi\Script\Conditions\isMatch;
+use \NeonXP\TelegramApi\Script\Conditions\isAnyText;
+use \NeonXP\TelegramApi\Script\Conditions\isContact;
+use \NeonXP\TelegramApi\Script\Conditions\isPhoto;
+use \NeonXP\TelegramApi\Script\Conditions\isSticker;
+use \NeonXP\TelegramApi\Script\Conditions\isLocation;
+use \NeonXP\TelegramApi\Script\Conditions\isDocument;
+use \NeonXP\TelegramApi\Script\Conditions\isReply;
+use \NeonXP\TelegramApi\Script\Conditions\isForward;
+use \NeonXP\TelegramApi\Script\Conditions\isVideo;
+use \NeonXP\TelegramApi\Script\Conditions\isVoice;
+use \NeonXP\TelegramApi\Script\Conditions\isAudio;
+use \NeonXP\TelegramApi\Helpers\StatusActions;
+
+require './../vendor/autoload.php';
+
+AnnotationRegistry::registerAutoloadNamespace(
+ 'JMS\Serializer\Annotation',
+ __DIR__.'/../vendor/jms/serializer/src'
+);
+$script = require_once __DIR__ . '/script.php';
+
+$pgsqlConnection = 'postgresql://' . getenv('OPENSHIFT_POSTGRESQL_DB_HOST') . ':' . getenv('OPENSHIFT_POSTGRESQL_DB_PORT');
+
+$cache = new \Doctrine\Common\Cache\ApcuCache();
+
+$dozorApi = new \NeonXP\DozorApi($cache);
+
+$telegram = new Telegram([
+ 'token' => getenv('TELEGRAM_BOT_TOKEN')
+]);
+$telegram->setCache($cache);
+$telegram->setScript(\NeonXP\BotScript::getScript($telegram, $dozorApi));
+$telegram->handleWebhook();