1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
use Bitweaver\KernelTools;
require_once '../../../kernel/includes/setup_inc.php';
include_once KERNEL_PKG_INCLUDE_PATH . 'simple_form_functions_lib.php';
$gBitSystem->verifyPermission( 'p_admin' );
$feedback = [];
$pdfSettings = [
'pdftotext_path' => [
'label' => 'Path to pdf text layer extractor',
'note' => 'Path to pdftotext executable.',
'type' => 'text',
],
'convert_path' => [
'label' => 'Path to image extractor from pdf file',
'note' => 'Path to convert executable.',
'type' => 'text',
],
'pdf_thumbnails' => [
'label' => 'PDF Upload Thumbnails',
'note' => 'Create thumbnails for PDF uploads.',
'type' => 'checkbox',
],
];
if( function_exists( 'shell_exec' )) {
$pdfSettings['pdftotext_path']['default'] = shell_exec( 'which pdftotext' );
} else {
$feedback['error'] = "You can not execute binaries on your server. You can not make use of this plugin.";
}
$gBitSmarty->assign( 'pdfSettings', $pdfSettings );
if( !empty( $_REQUEST['plugin_settings'] )) {
foreach( $pdfSettings as $item => $data ) {
if( $data['type'] == 'checkbox' ) {
simple_set_toggle( $item, LIBERTY_PKG_NAME );
} elseif( $data['type'] == 'numeric' ) {
simple_set_int( $item, LIBERTY_PKG_NAME );
} else {
simple_set_value( $item, LIBERTY_PKG_NAME );
}
}
$feedback['success'] = KernelTools::tra( 'The plugin was successfully updated' );
}
$gBitSmarty->assign( 'feedback', $feedback );
$gBitSystem->display( 'bitpackage:liberty/mime/pdf/admin.tpl', KernelTools::tra( 'PDF Plugin Settings' ), [ 'display_mode' => 'admin' ]);
|