summaryrefslogtreecommitdiff
path: root/admin/plugins/mime_pdfx.php
blob: 93b712a89881b06d152237b00cedcc6c303f5d44 (plain)
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
53
54
55
56
57
58
<?php
require_once( '../../../kernel/includes/setup_inc.php' );
include_once( KERNEL_PKG_PATH.'simple_form_functions_lib.php' );

$gBitSystem->verifyPermission( 'p_admin' );

$feedback = array();

$pdfSettings = array(
	'pdf2swf_path' => array(
		'label'   => 'Path to pdf2swf',
		'note'    => 'Path to the pdf2swf executable.',
		'type'    => 'text',
	),
	'swfcombine_path' => array(
		'label'   => 'Path to swfcombine',
		'note'    => 'Path to the swfcombine executable.',
		'type'    => 'text',
	),
	'mwconvert_path' => array(
		'label'   => 'Path to ImageMagick convert',
		'note'    => 'Path to the ImageMagick convert executable.',
		'type'    => 'text',
	),
	'pdf_thumbnails' => array(
		'label'   => 'PDF Upload Thumbnails',
		'note'    => 'Create thumbnails for PDF uploads.',
		'type'    => 'checkbox',
	),
);

if( function_exists( 'shell_exec' )) {
	$pdfSettings['pdf2swf_path']['default']    =  shell_exec( 'which pdf2swf' );
	$pdfSettings['swfcombine_path']['default'] =  shell_exec( 'which swfcombine' );
	$pdfSettings['mwconvert_path']['default'] =  shell_exec( 'which convert' );
} 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'] = tra( 'The plugin was successfully updated' );
}

$gBitSmarty->assign( 'feedback', $feedback );
$gBitSystem->display( 'bitpackage:liberty/mime/pdf/adminx.tpl', tra( 'PDF Plugin Settings' ), array( 'display_mode' => 'admin' ));
?>