implement usage of __DIR__ to fix references on include

This commit is contained in:
2018-04-24 13:35:33 +02:00
parent 0c1141dbb9
commit d597a54353
14 changed files with 36 additions and 36 deletions

View File

@@ -14,9 +14,9 @@
* 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");
require_once(__DIR__ . "/config.php");
require_once(__DIR__ . "/mail_templates.php");
require_once(__DIR__ . "/database.php");
$sql = "SELECT id, first_name, last_name, username, email, state, note, verify_token, admin_token FROM registrations "
. "WHERE state = " . RegisterState::PendingEmailSend
@@ -46,7 +46,7 @@ foreach ($mx_db->query($sql) as $row) {
}
break;
case RegisterState::PendingAdminSend:
require_once("MatrixConnection.php");
require_once(__DIR__ . "/MatrixConnection.php");
$adminUrl = $config["webroot"] . "/verify_admin.php?t=" . $row["admin_token"];
$mxConn = new MatrixConnection($config["homeserver"], $config["access_token"]);
$mxMsg = new MatrixMessage();

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once("config.php");
require_once(__DIR__ . "/config.php");
if (!isset($config["databaseURI"])) {
throw new Exception("malformed configuration: databaseURI not defined");
}

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once("../database.php");
require_once(__DIR__ . "/../database.php");
$response = [
"limited" => false,
"result" => [],

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once("../database.php");
require_once(__DIR__ . "/../database.php");
$response = [
"lookup" => []
];

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once("../database.php");
require_once(__DIR__ . "/../database.php");
$response = new stdClass;
try {
$inputJSON = file_get_contents('php://input');

View File

@@ -44,14 +44,14 @@ try {
throw new Exception('"new_password" is not defined');
}
require_once("../helpers.php");
require_once(__DIR__ . "/../helpers.php");
$localpart = stripLocalpart($input["auth"]["user"]);
if (empty($localpart)) {
throw new Exception("localpart cannot be identified");
}
require_once("../database.php");
require_once(__DIR__ . "/../database.php");
if (!$mx_db->updatePassword(
$localpart, $input["auth"]["password"], $input["new_password"]
)) {

View File

@@ -20,7 +20,7 @@ $response = [
]
];
require_once("../database.php");
require_once(__DIR__ . "/../database.php");
abstract class LoginRequester {
@@ -56,7 +56,7 @@ try {
// prefer the localpart attribute of mxisd. But in case of matrix-synapse-rest-auth
// we have to parse it on our own
if (empty($localpart)) {
require_once("../helpers.php");
require_once(__DIR__ . "/../helpers.php");
$localpart = stripLocalpart($mxid);
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
function send_mail($receiver, $subject, $body) {
include("../config.php");
include(__DIR__ . "/../config.php");
$headers = "From: " . $config["register_email"] . "\r\n"
. "Content-Type: text/plain;charset=utf-8";
return mail($receiver, $subject, $body, $headers);

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
function send_mail($receiver, $subject, $body) {
include("../config.php");
include(__DIR__ . "/../config.php");
$headers = "From: " . $config["register_email"] . "\r\n"
. "Content-Type: text/plain;charset=utf-8";
return mail($receiver, $subject, $body, $headers);

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once("config.php");
require_once(__DIR__ . "/config.php");
$lang = $config["defaultLanguage"];
if (isset($_GET['lang'])) {
@@ -25,7 +25,7 @@ if (!file_exists($lang_file)) {
error_log("Translation for " . $lang . " not found. Fallback to 'de-de'");
$lang = "de-de";
}
$lang_file = dirname(__FILE__) . "/lang/lang." . $lang . ".php";
$lang_file = __DIR__ . "/lang/lang." . $lang . ".php";
require_once($lang_file);
unset($lang_file);
?>

View File

@@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once("config.php");
require_once(__DIR__ . "/config.php");
$lang = $config["defaultLanguage"];
if (isset($_GET['lang'])) {
$lang = filter_var($_GET['lang'], FILTER_SANITIZE_STRING);
}
$lang_file = dirname(__FILE__) . "/lang/mail." . $lang . ".php";
$lang_file = __DIR__ . "/lang/mail." . $lang . ".php";
if (!file_exists($lang_file)) {
error_log("Mail templates for '" . $lang . "' not found. Fallback to 'de-de'");
$lang = "de-de";
}
$lang_file = dirname(__FILE__) . "/lang/mail." . $lang . ".php";
$lang_file = __DIR__ . "/lang/mail." . $lang . ".php";
require_once($lang_file);
unset($lang_file);
?>

View File

@@ -19,12 +19,12 @@ if (!isset($_SERVER['HTTPS'])) {
exit();
}
require_once "../language.php";
require_once(__DIR__ . "/../language.php");
if (!file_exists("../config.php")) {
print($language["NO_CONFIGURATION"]);
exit();
}
require_once "../config.php";
require_once(__DIR__ . "/../config.php");
// this values will not be used when using the register operation type
$storeFirstLastName = false;
@@ -86,7 +86,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$note = filter_var($_POST["note"], FILTER_SANITIZE_STRING);
$email = filter_var($_POST["email"], FILTER_VALIDATE_EMAIL);
require_once("../database.php");
require_once(__DIR__ . "/../database.php");
$res = $mx_db->addRegistration($first_name, $last_name, $username, $note, $email);
if (!isset($res["verify_token"])) {
@@ -96,7 +96,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$verify_token = $res["verify_token"];
$verify_url = $config["webroot"] . "/verify.php?t=" . $verify_token;
require_once "../mail_templates.php";
require_once(__DIR__ . "/../mail_templates.php");
$success = send_mail_pending_verification(
$config["homeserver"], $storeFirstLastName ? $first_name . " " . $last_name : $username, $email, $verify_url);

View File

@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once "../language.php";
require_once(__DIR__ . "/../language.php");
if (!file_exists("../config.php")) {
print($language["NO_CONFIGURATION"]);
exit();
}
require_once "../config.php";
require_once "../mail_templates.php";
require_once(__DIR__ . "/../config.php");
require_once(__DIR__ . "/../mail_templates.php");
// enforce admin via https
if (!isset($_SERVER['HTTPS'])) {
@@ -38,7 +38,7 @@ try {
}
$token = filter_var($_GET["t"], FILTER_SANITIZE_STRING);
require_once("../database.php");
require_once(__DIR__ . "/../database.php");
$user = $mx_db->getUserForVerify($token);
if ($user == NULL) {
@@ -51,7 +51,7 @@ try {
$email = $user["email"];
$admin_token = $user["admin_token"];
require_once("../MatrixConnection.php");
require_once(__DIR__ . "/../MatrixConnection.php");
$adminUrl = $config["webroot"] . "/verify_admin.php?t=" . $admin_token;
$mxConn = new MatrixConnection($config["homeserver"], $config["access_token"]);
$mxMsg = new MatrixMessage();

View File

@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once "../language.php";
require_once(__DIR__ . "/../language.php");
if (!file_exists("../config.php")) {
print($language["NO_CONFIGURATION"]);
exit();
}
require_once "../config.php";
require_once "../mail_templates.php";
require_once(__DIR__ . "/../config.php");
require_once(__DIR__ . "/../mail_templates.php");
// enforce admin via https
if (!isset($_SERVER['HTTPS'])) {
@@ -38,7 +38,7 @@ try {
}
$token = filter_var($_GET["t"], FILTER_SANITIZE_STRING);
require_once("../database.php");
require_once(__DIR__ . "/../database.php");
$action = NULL;
if (isset($_GET["allow"])) {
@@ -67,7 +67,7 @@ try {
$mx_db->setRegistrationStateAdmin(RegisterState::PendingRegistration, $token);
// register user
require_once("../MatrixConnection.php");
require_once(__DIR__ . "/../MatrixConnection.php");
$mxConn = new MatrixConnection($config["homeserver"], $config["access_token"]);
$password = NULL;
@@ -205,5 +205,5 @@ try {
print("<a href=\"" . $config["webroot"] . "/index.php" . "\">" . $language["JUMP_TO_HOMEPAGE"] . "</a>");
}
?>
< /body>
</html>
</body>
</html>