Commit 1e5b4784 authored by thiaramus's avatar thiaramus
Browse files

Added .htaccess to build "pretty url" requests.

Added index.php to be used as a simple bootstrap.
parent 054346d1
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
\ No newline at end of file
* webJAM - A modern JAM MessageBase Editor
* Copyright (C) 2017 Philipp Giebel (
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program.
* If not, see (
* * filename: index.php
* * description: A simple API bootstrap.
* * author: Roman Litvinenko (
require_once 'include/';
// Grab request URI and parse it into the array
$parsedUri = parse_url($uri);
// Generate apiClass name from the first URI keyword.
// Prefix 'api' is being added to prevent instantiating classes other
// than api endpoints.
$apiCallPath = explode('/', trim($parsedUri['path'], '/'));
$apiClassName = 'api' . ucfirst($apiCallPath[0]);
// Autoload a matching class or return an error message if there is no such class
if (class_exists($apiClassName)) {
$apiClass = new $apiClassName($parsedUri);
if (is_a($apiClass, 'mainApiParent')) {
} else {
echo "Invalid API method";
} else {
echo "Invalid API call";
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment