mirror of
				https://github.com/Alamantus/Lexiconga.git
				synced 2025-11-04 10:17:01 +01:00 
			
		
		
		
	Make sure php files can be used anywhere
This commit is contained in:
		
							parent
							
								
									c44d4eee3e
								
							
						
					
					
						commit
						ffdd008344
					
				
					 5 changed files with 35 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('./config.php');
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/./config.php'));
 | 
			
		||||
 | 
			
		||||
class Db {
 | 
			
		||||
  private $dbh;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('./Db.php');
 | 
			
		||||
require_once('./Token.php');
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/./Db.php'));
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/./Token.php'));
 | 
			
		||||
 | 
			
		||||
class Dictionary {
 | 
			
		||||
  private $db;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('../vendor/autoload.php');
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/../vendor/autoload.php'));
 | 
			
		||||
 | 
			
		||||
use \Firebase\JWT\JWT;
 | 
			
		||||
use \Hashids\Hashids;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('./Db.php');
 | 
			
		||||
require_once('./Token.php');
 | 
			
		||||
require_once('./Dictionary.php');
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/./Db.php'));
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/./Token.php'));
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/./Dictionary.php'));
 | 
			
		||||
 | 
			
		||||
class User {
 | 
			
		||||
  private $db;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('./Response.php');
 | 
			
		||||
require_once('./User.php');
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/./Response.php'));
 | 
			
		||||
require_once(realpath(dirname(__FILE__) . '/./User.php'));
 | 
			
		||||
 | 
			
		||||
$inputJSON = file_get_contents('php://input');
 | 
			
		||||
$inputJSON = strip_tags($inputJSON);
 | 
			
		||||
| 
						 | 
				
			
			@ -444,6 +444,32 @@ switch ($action) {
 | 
			
		|||
      'error' => true,
 | 
			
		||||
    ), 400);
 | 
			
		||||
  }
 | 
			
		||||
  case 'password-reset': {
 | 
			
		||||
    if (isset($request['code']) && isset($request['password'])) {
 | 
			
		||||
      $user = new User();
 | 
			
		||||
      $password_reset = $user->setPasswordReset($request['email']);
 | 
			
		||||
      if ($password_reset === true) {
 | 
			
		||||
        return Response::json(array(
 | 
			
		||||
          'data' => $password_reset,
 | 
			
		||||
          'error' => false,
 | 
			
		||||
        ), 200);
 | 
			
		||||
      }
 | 
			
		||||
      if (isset($password_reset['error'])) {
 | 
			
		||||
        return Response::json(array(
 | 
			
		||||
          'data' => $password_reset['error'],
 | 
			
		||||
          'error' => true,
 | 
			
		||||
        ), 500);
 | 
			
		||||
      }
 | 
			
		||||
      return Response::json(array(
 | 
			
		||||
        'data' => 'Could not send password reset key: email not found',
 | 
			
		||||
        'error' => true,
 | 
			
		||||
      ), 401);
 | 
			
		||||
    }
 | 
			
		||||
    return Response::json(array(
 | 
			
		||||
      'data' => 'Could not send password reset key: required data missing',
 | 
			
		||||
      'error' => true,
 | 
			
		||||
    ), 400);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  default: {
 | 
			
		||||
    return Response::html('Hi!');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue