Compare commits
3 Commits
second_imp
...
fix_langua
| Author | SHA1 | Date | |
|---|---|---|---|
| 81c3ff5dc0 | |||
| facdad126b | |||
|
|
d5c18c2f2e |
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
class MatrixConnection
|
||||
{
|
||||
private $hs;
|
||||
|
||||
14
cron.php
14
cron.php
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once("config.php");
|
||||
require_once("mail_templates.php");
|
||||
require_once("database.php");
|
||||
|
||||
20
database.php
20
database.php
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once("config.php");
|
||||
if (!isset($config["databaseURI"])) {
|
||||
throw new Exception ("malformed configuration: databaseURI not defined");
|
||||
@@ -172,12 +186,10 @@ class mxDatabase
|
||||
*/
|
||||
function addRegistration($first_name, $last_name, $username, $note, $email) {
|
||||
if ($this->userPendingRegistrations($username)) {
|
||||
require_once("language.php");
|
||||
throw new Exception($language["USERNAME_PENDING_REGISTRATION"]." (requested)");
|
||||
throw new Exception("USERNAME_PENDING_REGISTRATION");
|
||||
}
|
||||
if ($this->userRegistered($username)) {
|
||||
require_once("language.php");
|
||||
throw new Exception($language["USERNAME_REGISTERED"] . " (registered)");
|
||||
throw new Exception("USERNAME_REGISTERED");
|
||||
}
|
||||
|
||||
$verify_token = bin2hex(random_bytes(16));
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once("../database.php");
|
||||
$response=[
|
||||
"limited" => false,
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once("../database.php");
|
||||
$response = [
|
||||
"lookup" => []
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once("../database.php");
|
||||
$response = new stdClass;
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
$response = [
|
||||
"auth" => [
|
||||
"success" => false,
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
$language = array(
|
||||
"NO_CONFIGURATION" => "Es konnte keine Konfiguration gefunden werden.",
|
||||
"UNKNOWN_SESSION" => "Sitzungstoken nicht vorhanden oder ungültig.",
|
||||
|
||||
14
language.php
14
language.php
@@ -1,4 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
$lang = "de-de";
|
||||
if(isset($_GET['lang'])){
|
||||
$lang = filter_var($_GET['lang'], FILTER_SANITIZE_STRING);
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function send_mail($receiver, $subject, $body) {
|
||||
include("config.php");
|
||||
$headers = "From: " . $config["register_email"] . "\r\n"
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<?php
|
||||
<html><head><?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once "../language.php";
|
||||
if (!file_exists("../config.php")) {
|
||||
print($language["NO_CONFIGURATION"]);
|
||||
@@ -20,32 +32,32 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
try {
|
||||
if (!isset($_SESSION["token"]) || !isset($_POST["token"]) || $_SESSION["token"] != $_POST["token"]) {
|
||||
// token not present or invalid
|
||||
throw new Exception($language["UNKNOWN_SESSION"]);
|
||||
throw new Exception("UNKNOWN_SESSION");
|
||||
}
|
||||
if (!isset($_POST["username"])) {
|
||||
throw new Exception($language["UNKNOWN_USERNAME"]);
|
||||
throw new Exception("UNKNOWN_USERNAME");
|
||||
}
|
||||
if (strlen($_POST["username"] > 20 || strlen($_POST["username"]) < 3)) {
|
||||
throw new Exception($language["USERNAME_LENGTH_INVALID"]);
|
||||
throw new Exception("USERNAME_LENGTH_INVALID");
|
||||
}
|
||||
if (ctype_alnum($_POST['username']) != true) {
|
||||
throw new Exception($language["USERNAME_NOT_ALNUM"]);
|
||||
throw new Exception("USERNAME_NOT_ALNUM");
|
||||
}
|
||||
if (isset($config["getPasswordOnRegistration"]) && $config["getPasswordOnRegistration"] &&
|
||||
$_POST["password"] != $_POST["password_confirm"]) {
|
||||
throw new Exception($language["PASSWORD_NOT_MATCH"]);
|
||||
throw new Exception("PASSWORD_NOT_MATCH");
|
||||
}
|
||||
if (isset($_POST["note"]) && strlen($_POST["note"]) > 50) {
|
||||
throw new Exception($language["NOTE_LENGTH_EXEEDED"]);
|
||||
throw new Exception("NOTE_LENGTH_EXEEDED");
|
||||
}
|
||||
if (!isset($_POST["email"]) || !filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
|
||||
throw new Exception($language["EMAIL_INVALID_FORMAT"]);
|
||||
throw new Exception("EMAIL_INVALID_FORMAT");
|
||||
}
|
||||
if (isset($_POST["first_name"]) && ! preg_match("/[A-Z][a-z]+/", $_POST["first_name"])) {
|
||||
throw new Exception($language["FIRSTNAME_INVALID_FORMAT"]);
|
||||
throw new Exception("FIRSTNAME_INVALID_FORMAT");
|
||||
}
|
||||
if (isset($_POST["last_name"]) && ! preg_match("/[A-Z][a-z]+/", $_POST["last_name"])) {
|
||||
throw new Exception($language["SIRNAME_INVALID_FORMAT"]);
|
||||
throw new Exception("SIRNAME_INVALID_FORMAT");
|
||||
}
|
||||
|
||||
$first_name = filter_var($_POST["first_name"], FILTER_SANITIZE_STRING);
|
||||
@@ -87,7 +99,11 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
print("<title>" . $language["REGISTRATION_REQUEST_FAILED"] . "</title>");
|
||||
print("</head><body>");
|
||||
print("<h1>" . $language["REGISTRATION_REQUEST_FAILED"] . "</h1>");
|
||||
if (isset($language[$e->getMessage()])) {
|
||||
print("<p>" . $language[$e->getMessage()] . "</p>");
|
||||
} else {
|
||||
print("<p>" . $e->getMessage() . "</p>");
|
||||
}
|
||||
print("<a href=\"" . $config["webroot"] . "/index.php" . "\">Zur Registrierungsseite</a>");
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<?php
|
||||
<html><head><?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once "../language.php";
|
||||
if (!file_exists("../config.php")) {
|
||||
print($language["NO_CONFIGURATION"]);
|
||||
@@ -22,7 +34,7 @@ try {
|
||||
throw new Exception("Method not allowed");
|
||||
}
|
||||
if (!isset($_GET["t"])) {
|
||||
throw new Exception($language["UNKNOWN_TOKEN"]);
|
||||
throw new Exception("UNKNOWN_TOKEN");
|
||||
}
|
||||
$token = filter_var($_GET["t"], FILTER_SANITIZE_STRING);
|
||||
|
||||
@@ -30,7 +42,7 @@ try {
|
||||
|
||||
$user = $mx_db->getUserForVerify($token);
|
||||
if ($user == NULL) {
|
||||
throw new Exception($language["UNKNOWN_TOKEN"]);
|
||||
throw new Exception("UNKNOWN_TOKEN");
|
||||
}
|
||||
$first_name = $user["first_name"];
|
||||
$last_name = $user["last_name"];
|
||||
@@ -69,7 +81,11 @@ try {
|
||||
print("<title>" . $language["VERIFICATION_FAILED"] . "</title>");
|
||||
print("</head><body>");
|
||||
print("<h1>" . $language["VERIFICATION_FAILED"] . "</h1>");
|
||||
if (isset($language[$e->getMessage()])) {
|
||||
print("<p>" . $language[$e->getMessage()] . "</p>");
|
||||
} else {
|
||||
print("<p>" . $e->getMessage() . "</p>");
|
||||
}
|
||||
print("<a href=\"" . $config["webroot"] . "/index.php" . "\">Zur Registrierungsseite</a>");
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<?php
|
||||
<html><head><?php
|
||||
/**
|
||||
* Copyright 2018 Matthias Kesler
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
require_once "../language.php";
|
||||
if (!file_exists("../config.php")) {
|
||||
print($language["NO_CONFIGURATION"]);
|
||||
@@ -22,7 +34,7 @@ try {
|
||||
throw new Exception("Method not allowed");
|
||||
}
|
||||
if (!isset($_GET["t"])) {
|
||||
throw new Exception($language["UNKNOWN_TOKEN"]);
|
||||
throw new Exception("UNKNOWN_TOKEN");
|
||||
}
|
||||
$token = filter_var($_GET["t"], FILTER_SANITIZE_STRING);
|
||||
|
||||
@@ -42,7 +54,7 @@ try {
|
||||
|
||||
$user = $mx_db->getUserForApproval($token);
|
||||
if ($user == NULL) {
|
||||
throw new Exception($language["UNKNOWN_TOKEN"]);
|
||||
throw new Exception("UNKNOWN_TOKEN");
|
||||
}
|
||||
|
||||
$first_name = $user["first_name"];
|
||||
@@ -74,7 +86,7 @@ try {
|
||||
$mxMsg->set_type("m.text");
|
||||
$mxMsg->set_body("Fehler beim Registrieren von " . $first_name . " " . $last_name . ".");
|
||||
$mxConn->send($config["register_room"], $mxMsg);
|
||||
throw new Exception($language["REGISTRATION_FAILED"]);
|
||||
throw new Exception("REGISTRATION_FAILED");
|
||||
}
|
||||
|
||||
print("<title>" . $language["ADMIN_VERIFY_SITE_TITLE"] . "</title>");
|
||||
@@ -160,7 +172,11 @@ background: rgba(255, 255, 255, 0.8);
|
||||
print("<title>" . $language["REGISTRATION_FAILED"] . "</title>");
|
||||
print("</head><body>");
|
||||
print("<h1>" . $language["REGISTRATION_FAILED"] . "</h1>");
|
||||
if (isset($language[$e->getMessage()])) {
|
||||
print("<p>" . $language[$e->getMessage()] . "</p>");
|
||||
} else {
|
||||
print("<p>" . $e->getMessage() . "</p>");
|
||||
}
|
||||
print("<a href=\"" . $config["webroot"] . "/index.php" . "\">Zur Registrierungsseite</a>");
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user