summaryrefslogtreecommitdiffstats
path: root/lib/preview/office.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/preview/office.php')
-rw-r--r--lib/preview/office.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/preview/office.php b/lib/preview/office.php
new file mode 100644
index 00000000000..5287bbd6ac1
--- /dev/null
+++ b/lib/preview/office.php
@@ -0,0 +1,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');
+ }
+} \ No newline at end of file