mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 20:41:20 -05:00
58 lines
1.0 KiB
PHP
Executable File
58 lines
1.0 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Class and Function List:
|
|
* Function list:
|
|
* - __construct()
|
|
* - index()
|
|
* - create()
|
|
* Classes list:
|
|
* - Api extends Main
|
|
*/
|
|
include_once ('application/controllers/main.php');
|
|
|
|
class Api extends Main
|
|
{
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
function index()
|
|
{
|
|
$languages = $this->languages->get_languages();
|
|
$languages = array_keys($languages);
|
|
$languages = implode(', ', $languages);
|
|
$data['languages'] = $languages;
|
|
$this->load->view('api_help', $data);
|
|
}
|
|
|
|
function create()
|
|
{
|
|
$this->load->model('pastes');
|
|
|
|
if (!$this->input->post('text'))
|
|
{
|
|
$data['msg'] = 'Error: Missing paste text';
|
|
$this->load->view('view/api', $data);
|
|
}
|
|
else
|
|
{
|
|
|
|
if (!$this->input->post('lang'))
|
|
{
|
|
$_POST['lang'] = 'text';
|
|
}
|
|
$_POST['code'] = $this->input->post('text');
|
|
|
|
if ($this->config->item('private_only'))
|
|
{
|
|
$_POST['private'] = 1;
|
|
}
|
|
$paste_url = $this->pastes->createPaste();
|
|
$data['msg'] = base_url() . $paste_url;
|
|
$this->load->view('view/api', $data);
|
|
}
|
|
}
|
|
}
|