$files, 'images' => $images ); deleteDirectory($tempPath); deleteDirectory($tempPathNewFiles); return serialize($data); } else { deleteDirectory($tempPath); deleteDirectory($tempPathNewFiles); return false; } } /** * @param $directoryPath * @return bool */ function deleteDirectory($directoryPath) { $files = array_diff(scandir($directoryPath), array('.', '..')); foreach ($files as $file) { if (is_dir("$directoryPath/$file")) { deleteDirectory("$directoryPath/$file"); } else { unlink("$directoryPath/$file"); } } return rmdir($directoryPath); } /** * Helper function to create the directory structure for the PPT converter * @param string $tempPath * @param string $tempPathNewFiles * @param string $fileName * @param string $perms * @return void */ function pptConverterDirectoriesCreate($tempPath, $tempPathNewFiles, $fileName, $perms) { if (!is_dir($tempPath)) { mkdir($tempPath, $perms, true); } if (!is_dir($tempPathNewFiles)) { mkdir($tempPathNewFiles, $perms, true); } if (!is_dir($tempPathNewFiles.$fileName)) { mkdir($tempPathNewFiles.$fileName, $perms, true); } } /** * Helper function to build the command line parameters for the converter * @return string $cmd */ function pptConverterGetCommandBaseParams() { if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar'; $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$classPath.'" DokeosConverter'; } else { $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; $classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar'; $cmd = 'cd '.$converterPath.' && java '.$classPath.' DokeosConverter'; } $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); return $cmd; } $webPath = api_get_path(WEB_PATH); $webCodePath = api_get_path(WEB_CODE_PATH); $options = array( 'uri' => $webPath, 'location' => $webCodePath.'webservices/additional_webservices.php' ); $soapServer = new SoapServer(NULL, $options); $soapServer->addFunction('wsConvertPpt'); $soapServer->handle();