2013-06-03 09:24:31 +00: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 09:00:44 +00:00
|
|
|
//both, libreoffice backend and php fallback, need imagick
|
2014-03-05 14:53:12 +00:00
|
|
|
if (extension_loaded('imagick')) {
|
2013-10-14 22:15:45 +00:00
|
|
|
|
2014-03-05 14:53:12 +00:00
|
|
|
$checkImagick = new Imagick();
|
|
|
|
|
|
|
|
if(count($checkImagick->queryFormats('PDF')) === 1) {
|
|
|
|
$isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec');
|
|
|
|
|
|
|
|
// LibreOffice preview is currently not supported on Windows
|
|
|
|
if (!\OC_Util::runningOnWindows()) {
|
2014-03-06 10:55:45 +00:00
|
|
|
$whichLibreOffice = ($isShellExecEnabled ? shell_exec('command -v libreoffice') : '');
|
2014-03-05 14:53:12 +00:00
|
|
|
$isLibreOfficeAvailable = !empty($whichLibreOffice);
|
2014-03-06 10:55:45 +00:00
|
|
|
$whichOpenOffice = ($isShellExecEnabled ? shell_exec('command -v libreoffice') : '');
|
2014-03-05 14:53:12 +00: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');
|
|
|
|
}
|
2013-10-14 22:15:45 +00:00
|
|
|
}
|
2013-06-11 09:00:44 +00:00
|
|
|
}
|
2013-10-14 22:15:45 +00:00
|
|
|
}
|