Blame view

sources/lib/private/preview/office.php 1.08 KB
31b7f2792   Kload   Upgrade to ownclo...
1
2
3
4
5
6
7
8
9
  <?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')) {
31b7f2792   Kload   Upgrade to ownclo...
10

6d9380f96   Cédric Dupont   Update sources OC...
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  	$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()) {
  			$whichLibreOffice = ($isShellExecEnabled ? shell_exec('command -v libreoffice') : '');
  			$isLibreOfficeAvailable = !empty($whichLibreOffice);
  			$whichOpenOffice = ($isShellExecEnabled ? shell_exec('command -v 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');
  			}
31b7f2792   Kload   Upgrade to ownclo...
26
  		}
31b7f2792   Kload   Upgrade to ownclo...
27
28
  	}
  }