diff --git a/www/api/v1/.htaccess b/www/api/v1/.htaccess new file mode 100644 index 0000000..6e5e71e --- /dev/null +++ b/www/api/v1/.htaccess @@ -0,0 +1,16 @@ +#RewriteBase / + +RewriteEngine On + +#RewriteRule ^/v1/?([*a-zA-Z0-9_-]+)$ /api/index.php?slug1=$1 [L] +RewriteRule ^([*a-zA-Z0-9_-]+)(?:\/|)$ index.php?fi=$1 [L] +#RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?slug=$1 [L] + +#RewriteRule ^project/$ projects/index.php [L] +#RewriteRule ^projects/$ projects/index.php [L] +#RewriteRule ^v1/?([a-zA-Z0-9_-]+)$ index.php?project=$1 [L] +#RewriteRule ^project/?([a-zA-Z0-9_-]+)/$ projects/index.php?project=$1 [L] +#RewriteRule ^project/?([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ projects/index.php?project=$1&item=$2 [L] +#RewriteRule ^project/?([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ projects/index.php?project=$1&item=$2 [L] +#RewriteRule ^project/?([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ projects/index.php?project=$1&item=$2&ID=$3 [L] +#RewriteRule ^project/?([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ projects/index.php?project=$1&item=$2&ID=$3 [L] diff --git a/www/api/v1/api-init.php b/www/api/v1/api-init.php new file mode 100644 index 0000000..e188fa4 --- /dev/null +++ b/www/api/v1/api-init.php @@ -0,0 +1,41 @@ + $value){ + if(($data[$key] = filter($value)) === false){ + print_r($value); + echo "Failed to sanitize: `".$key."`: ".$value." \t-\t type: ".gettype($value)."\n"; + } + } + } + } + + return $data; +} diff --git a/www/api/v1/docs.php b/www/api/v1/docs.php new file mode 100644 index 0000000..678400d --- /dev/null +++ b/www/api/v1/docs.php @@ -0,0 +1,123 @@ +'GET', "href"=>"/", "name"=>"Nothing", "body"=>"{}"); +$docs['recipe'][] = array("method"=>'GET', "href"=>"/recipe", "name"=>"Get all available recipes", "body"=>"{}"); +$docs['recipe'][] = array("method"=>'POST', "href"=>"/recipe", "name"=>"Create recipe", "body"=>"{\n \"name\": \"string\",\n \"portions\": \"integer\",\n \"public\": \"boolean\" \n}"); + + + +function capitalizeFirst($input){ + $input[0] = strtoupper($input[0]); + return $input; +} +?> + +
+ + + + + + + + + + + + + +