nextcloud/lib/preview/office.php

22 lines
931 B
PHP
Raw Normal View History

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.
*/
//both, libreoffice backend and php fallback, need imagick
if (extension_loaded('imagick')) {
2013-07-30 14:29:12 +04:00
$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
2013-07-30 14:29:12 +04:00
if($isShellExecEnabled && ($isLibreOfficeAvailable || $isOpenOfficeAvailable || is_string(\OC_Config::getValue('preview_libreoffice_path', null)))) {
2013-08-19 14:16:55 +04:00
require_once('office-cl.php');
}else{
//in case there isn't, use our fallback
2013-08-19 14:16:55 +04:00
require_once('office-fallback.php');
}
2013-06-03 13:24:31 +04:00
}