server/lib/private/preview/office.php

30 lines
1.1 KiB
PHP
Raw Normal View History

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.
*/
//both, libreoffice backend and php fallback, need imagick
if (extension_loaded('imagick')) {
$isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec');
2013-10-17 13:19:15 +00:00
// LibreOffice preview is currently not supported on Windows
if (!\OC_Util::runningOnWindows()) {
2013-10-17 12:31:07 +00:00
$whichLibreOffice = ($isShellExecEnabled ? shell_exec('which libreoffice') : '');
$isLibreOfficeAvailable = !empty($whichLibreOffice);
2013-10-17 12:31:07 +00:00
$whichOpenOffice = ($isShellExecEnabled ? 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');
}
} else {
//in case there isn't, use our fallback
2013-08-19 10:16:55 +00:00
require_once('office-fallback.php');
}
}