allow displaying of the api page

This commit is contained in:
Claude 2015-09-02 10:18:15 +02:00
parent 8ff8b48625
commit 7540f11074

View File

@ -26,11 +26,6 @@ class Api extends Main
{ {
die("The API has been disabled\n"); die("The API has been disabled\n");
} }
if (config_item('apikey') != $this->input->get('apikey'))
{
die("Invalid API key\n");
}
} }
function index() function index()
@ -44,6 +39,11 @@ class Api extends Main
function create() function create()
{ {
if (config_item('apikey') != $this->input->get('apikey'))
{
die("Invalid API key\n");
}
$this->load->model('pastes'); $this->load->model('pastes');
$this->load->library('form_validation'); //needed by parent class $this->load->library('form_validation'); //needed by parent class
@ -89,6 +89,11 @@ class Api extends Main
function paste() function paste()
{ {
if (config_item('apikey') != $this->input->get('apikey'))
{
die("Invalid API key\n");
}
if (config_item('private_only')) if (config_item('private_only'))
{ {
show_404(); show_404();
@ -112,6 +117,11 @@ class Api extends Main
function random() function random()
{ {
if (config_item('apikey') != $this->input->get('apikey'))
{
die("Invalid API key\n");
}
if (config_item('private_only')) if (config_item('private_only'))
{ {
show_404(); show_404();
@ -124,6 +134,11 @@ class Api extends Main
function recent() function recent()
{ {
if (config_item('apikey') != $this->input->get('apikey'))
{
die("Invalid API key\n");
}
if (config_item('private_only')) if (config_item('private_only'))
{ {
show_404(); show_404();
@ -148,6 +163,11 @@ class Api extends Main
function trending() function trending()
{ {
if (config_item('apikey') != $this->input->get('apikey'))
{
die("Invalid API key\n");
}
if (config_item('private_only')) if (config_item('private_only'))
{ {
show_404(); show_404();