<?php

Routes::add_web("GET", "/", ["Homecontroller", "index"]);

Routes::add_web("GET", "/cover/{id}/{size}/{filename}", ["CoverController", "get_cover"]);
Routes::add_web("GET", "/cover/{id}/{filename}", ["CoverController", "get_cover"]);


Routes::add_web("GET", "/documents/{pid}", ["DocumentController", "browse"]);
Routes::add_web("GET", "/documents", ["DocumentController", "browse"]);
Routes::add_web("GET", "/document/{id}", ["DocumentController", "show"]);
Routes::add_web("GET", "/overview/create/{id}", ["DocumentController", "create_overview"], ["Auth", "can_moderate"]);

Routes::add_web("GET", "/revision/{id}", ["RevisionController", "show"]);

Routes::add_web("GET", "/pdf/{id}/{type}/{filename}", ["PDFController", "download"]);

Routes::add_web("GET", "/page/{id}/{page}/page.jpg", ["PDFController", "get_page"]);

Auth::routes();

Routes::add_web("POST", "/search", ["SearchController", "search"]);
Routes::add_web("GET", "/search", ["SearchController", "search"]);
Routes::add_web("POST", "/search/{page}", ["SearchController", "search"]);
Routes::add_web("GET", "/search/{page}", ["SearchController", "search"]);

Routes::add_web("GET", "/spider_pdfs", ["SpiderController", "spider_pdfs"], ["Auth", "can_moderate"]);
Routes::add_web("GET", "/spider_pages", ["SpiderController", "spider_pages"], ["Auth", "can_moderate"]);

Routes::add_web("GET", "/status", ["SystemController", "status"], ["Auth", "can_moderate"]);

Routes::add_web("GET", "/downloads", ["ImportController", "downloads"], ["Auth", "can_upload"]);

Routes::add_web("GET", "/del_docproduct/{doc}/{prod}", ["DocumentController", "del_docproduct"], ["Auth", "can_moderate"]);

Routes::add_web("GET", "/imports", ["ImportController", "imports"], ["Auth", "can_upload"]);

Routes::add_web("GET", "/idmatch", function() { return blade("idmatch"); }, ["Auth", "can_moderate"]);

Routes::add_web("GET", "/merge/{id}", ["DocumentController", "merge"], ["Auth", "can_moderate"]);
Routes::add_web("GET", "/explode/{id}", ["DocumentController", "separate"], ["Auth", "can_moderate"]);


Routes::add_web("GET", "/test", function($_request) {
	print("<pre>");
	print_r($_request);
	exit(0);
});


Routes::add_web("GET", "/privacy", function() { return blade("privacy"); });


Routes::add_web("GET", "/wordpress/wp-admin/setup-config.php", ["AntiSpam", "tarpit"]);
Routes::add_web("GET", "/wp-admin/setup-config.php", ["AntiSpam", "tarpit"]);

Routes::add_web("HEAD", "/", function() { return "OK"; });


Routes::add_web("GET", "/document/{id}/metadata/{metadata}/delete", ["DocumentController", "delete_metadata"], ["Auth", "can_moderate"]);

Routes::add_web("GET", "/delete/revision/{id}", ["RevisionController", "delete"], ["Auth", "can_moderate"]);

Routes::add_web("GET", "/redownload/revision/{id}", ["RevisionController", "redownload"], ["Auth", "can_moderate"]);


Routes::add_web("GET", "/purge/revision/{id}", ["RevisionController", "purge"], ["Auth", "can_moderate"]);

Routes::add_web("GET", "/attachment/{id}/{filename}", ["DocumentController", "download_attachment"]);

Routes::add_web("GET", "/upload/attachment/{id}", ["DocumentController", "upload_attachment"], ["Auth", "can_moderate"]);
Routes::add_web("POST", "/upload/attachment/{id}", ["DocumentController", "do_upload_attachment"], ["Auth", "can_moderate"]);

