2013-06-03 13:24:31 +04:00
|
|
|
<?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.
|
|
|
|
*/
|
2013-06-11 13:00:44 +04:00
|
|
|
//both, libreoffice backend and php fallback, need imagick
|
2014-02-04 15:59:14 +04:00
|
|
|
if (extension_loaded('imagick') && count(\Imagick::queryFormats("PDF")) === 1) {
|
2014-01-07 17:52:18 +04:00
|
|
|
$isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec');
|
2013-10-15 02:15:45 +04:00
|
|
|
|
2013-10-17 17:19:15 +04:00
|
|
|
// LibreOffice preview is currently not supported on Windows
|
2013-10-15 02:15:45 +04:00
|
|
|
if (!\OC_Util::runningOnWindows()) {
|
2013-10-17 16:31:07 +04:00
|
|
|
$whichLibreOffice = ($isShellExecEnabled ? shell_exec('which libreoffice') : '');
|
2013-10-15 02:15:45 +04:00
|
|
|
$isLibreOfficeAvailable = !empty($whichLibreOffice);
|
2013-10-17 16:31:07 +04:00
|
|
|
$whichOpenOffice = ($isShellExecEnabled ? shell_exec('which libreoffice') : '');
|
2013-10-15 02:15:45 +04:00
|
|
|
$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');
|
|
|
|
}
|
|
|
|
} else {
|
2013-06-11 13:00:44 +04:00
|
|
|
//in case there isn't, use our fallback
|
2013-08-19 14:16:55 +04:00
|
|
|
require_once('office-fallback.php');
|
2013-06-11 13:00:44 +04:00
|
|
|
}
|
2013-10-15 02:15:45 +04:00
|
|
|
}
|