Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/lookup-server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-11-18 15:35:38 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2016-11-18 15:35:38 +0300
commitcfbd1b9e229d4e87104ffb58c9d39b91469ccaf2 (patch)
treeb8aa5ee6091286849eef48b1b2e8c68ea19b4fc9
parent08dfa9d6347e7f14e0e3e5041285d6f19de80e61 (diff)
Moved index2.php to index.php
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--[-rwxr-xr-x]server/index.php82
-rw-r--r--server/index2.php42
2 files changed, 40 insertions, 84 deletions
diff --git a/server/index.php b/server/index.php
index 4ea884b..878944a 100755..100644
--- a/server/index.php
+++ b/server/index.php
@@ -1,44 +1,42 @@
<?php
-/**
-* Lookup Server main page.
-*
-* @author Frank Karlitschek
-* @copyright 2016 Frank Karlitschek frank@karlitschek.de
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-//makes it easier to debug
-error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
-
-//set the default timezone to use.
-date_default_timezone_set('Europe/Berlin');
-
-require('vendor/autoload.php');
-
-require('config/config.php');
-require('config/version.php');
-
-use LookupServer\BruteForce;
-use LookupServer\Server;
-
-//Do the any brute force check
-$bf = new BruteForce();
-$bf->check();
-
-//process the request.
-$s = new Server();
-$s->handlerequest();
+require 'vendor/autoload.php';
+
+$settings = [
+ 'settings' => [
+ 'displayErrorDetails' => true,
+ 'addContentLengthHeader' => true,
+ 'db' => [
+ 'host' => "172.17.0.2",
+ 'user' => "lookup",
+ 'pass' => "lookup",
+ 'dbname' => "lookup",
+ ]
+ ]
+];
+
+$container = new \Slim\Container($settings);
+
+$container['db'] = function($c) {
+ $db = $c['settings']['db'];
+ $pdo = new PDO("mysql:host=" . $db['host'] . ";dbname=" . $db['dbname'],
+ $db['user'], $db['pass']);
+ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
+ return $pdo;
+};
+$container['UserManager'] = function($c) {
+ return new \LookupServer\UserManager($c->db);
+};
+$container['BruteForceMiddleware'] = function ($c) {
+ return new \LookupServer\BruteForceMiddleware($c->db);
+};
+
+$app = new \Slim\App($container);
+$app->add($container->get('BruteForceMiddleware'));
+
+
+$app->get('/users', 'UserManager:search');
+$app->post('/users', 'UserManager:register');
+
+$app->run();
diff --git a/server/index2.php b/server/index2.php
deleted file mode 100644
index 878944a..0000000
--- a/server/index2.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-require 'vendor/autoload.php';
-
-$settings = [
- 'settings' => [
- 'displayErrorDetails' => true,
- 'addContentLengthHeader' => true,
- 'db' => [
- 'host' => "172.17.0.2",
- 'user' => "lookup",
- 'pass' => "lookup",
- 'dbname' => "lookup",
- ]
- ]
-];
-
-$container = new \Slim\Container($settings);
-
-$container['db'] = function($c) {
- $db = $c['settings']['db'];
- $pdo = new PDO("mysql:host=" . $db['host'] . ";dbname=" . $db['dbname'],
- $db['user'], $db['pass']);
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
- return $pdo;
-};
-$container['UserManager'] = function($c) {
- return new \LookupServer\UserManager($c->db);
-};
-$container['BruteForceMiddleware'] = function ($c) {
- return new \LookupServer\BruteForceMiddleware($c->db);
-};
-
-$app = new \Slim\App($container);
-$app->add($container->get('BruteForceMiddleware'));
-
-
-$app->get('/users', 'UserManager:search');
-$app->post('/users', 'UserManager:register');
-
-$app->run();