Welcome to mirror list, hosted at ThFree Co, Russian Federation.

office.php « preview « private « lib - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5287bbd6ac1c61ec47f580e88cf05718595124b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/**
 * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
//both, libreoffice backend and php fallback, need imagick
if (extension_loaded('imagick')) {
	$isShellExecEnabled = !in_array('shell_exec', explode(', ', ini_get('disable_functions')));
	$whichLibreOffice = shell_exec('which libreoffice');
	$isLibreOfficeAvailable = !empty($whichLibreOffice);
	$whichOpenOffice = shell_exec('which libreoffice');
	$isOpenOfficeAvailable = !empty($whichOpenOffice);
	//let's see if there is libreoffice or openoffice on this machine
	if($isShellExecEnabled && ($isLibreOfficeAvailable || $isOpenOfficeAvailable || is_string(\OC_Config::getValue('preview_libreoffice_path', null)))) {
		require_once('office-cl.php');
	}else{
		//in case there isn't, use our fallback
		require_once('office-fallback.php');
	}
}