1
0
Fork 0

Updating ad-hominem to version 2024-10-07+20250317 (9ede6bc).

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-13 13:09:37 +02:00
parent b79431e56e
commit 2dec6c784b
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
63 changed files with 2318 additions and 1765 deletions

View file

@ -3,13 +3,14 @@
* DokuWiki Information about a page in JSON format
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Sascha Leib <sascha.leib (at) kolmio.com>
* @author Sascha Leib <sascha (dot) leib (at) kolmio (dot) com>
*/
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
//ini_set('display_errors', '1');
// Turn off all error reporting
//error_reporting(0);
/* connect to DokuWiki: */
if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching)
@ -17,7 +18,7 @@ if (!defined('DOKU_INC')) { define('DOKU_INC', __DIR__ . '/../../../../'); }
require_once(DOKU_INC . 'inc/init.php');
/* get the output style (can be 'preview' or 'all') */
$style = strtolower($_GET['v']);
$style = ( array_key_exists('v', $_GET) ? strtolower($_GET['v']) : 'all' );
if ($style !== 'preview') { $style = 'all'; }
/* initialize the storage: */
@ -33,7 +34,7 @@ if ($id !== null) {
/* get all metadata; */
$meta = p_get_metadata($id);
if ($meta['title'] && $meta['title'] !== null) {
if (array_key_exists('title', $meta) && $meta['title'] !== null) {
if ($style == 'preview') {
$result['type'] = 'preview';
@ -69,15 +70,14 @@ if ($id !== null) {
/* extract the first paragraph:*/
$parts = explode("\n", $meta['description']['abstract']);
$result['extract'] = $parts[2];
$result['extract_html'] = '<p>'.$parts[2].'</p>';
$result['extract'] = ( count($parts) > 2 ? $parts[2] : '' );
$result['extract_html'] = '<p>'. ( count($parts) > 2 ? $parts[2] : '' ) .'</p>';
} else {
/* page does not exist */
$result['extract'] = 'Error: page does not exist.';
$result['extract_html'] = '<p><strong>' . $result['extract'] . '</strong></p>';
}
// $result['conf'] = $conf; /* WARNING: this may expose your configuration to the Internet. Use only for debugging! */
// $result['meta'] = $meta; /* uncomment if you need additional meta information */
}
/* output the result: */