ponepaste/api/index.php

55 lines
1.5 KiB
PHP
Raw Normal View History

2021-07-10 19:18:17 +01:00
<?php
header('Content-Type: application/json');
require_once('../includes/config.php');
2021-07-10 19:18:17 +01:00
// DB table to use
$table = 'pastes';
2021-07-10 19:18:17 +01:00
// Table's primary key
$primaryKey = 'id';
2021-07-10 19:18:17 +01:00
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array('db' => 'id', 'dt' => 0),
array('db' => 'title', 'dt' => 1),
array('db' => 'member', 'dt' => 2),
array('db' => 'tagsys', 'dt' => 3),
array('db' => 'visible', 'dt' => 4),
array('db' => 'date', 'dt' => 5),
array('db' => 'now_time', 'dt' => 6),
2021-07-10 19:18:17 +01:00
);
$columns2 = array(
array('db' => 'id', 'dt' => "ID"),
array('db' => 'title', 'dt' => "Title"),
array('db' => 'member', 'dt' => "Author"),
array('db' => 'tagsys', 'dt' => "Tags"),
array('db' => 'date', 'dt' => "Post Date"),
array('db' => 'now_time', 'dt' => "Modified Date"),
2021-07-10 19:18:17 +01:00
);
2021-07-10 19:18:17 +01:00
// SQL server connection information
$sql_details = array(
'user' => $dbuser,
'pass' => $dbpassword,
'db' => $dbname,
'host' => $dbhost
2021-07-10 19:18:17 +01:00
);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP
* server-side, there is no need to edit below this line.
*/
require('public.pastes.php');
2021-07-10 19:18:17 +01:00
echo json_encode(
2021-07-16 10:02:16 -04:00
SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $columns2),
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
);