|
@@ -58,9 +58,9 @@ discard block |
|
|
block discarded – undo |
|
58
|
58
|
///learning_path/ppt_dirname directory |
|
59
|
59
|
$this->created_dir = $result['dir']; |
|
60
|
60
|
if (substr($this->created_dir, -1, 1) == '/') { |
|
61
|
|
- $this->file_path = $this->created_dir . api_replace_dangerous_char($file['name']); |
|
|
61
|
+ $this->file_path = $this->created_dir.api_replace_dangerous_char($file['name']); |
|
62
|
62
|
} else { |
|
63
|
|
- $this->file_path = $this->created_dir . '/' . api_replace_dangerous_char($file['name']); |
|
|
63
|
+ $this->file_path = $this->created_dir.'/'.api_replace_dangerous_char($file['name']); |
|
64
|
64
|
} |
|
65
|
65
|
|
|
66
|
66
|
//var_dump($this->file_name, $this->file_path, $this->base_work_dir, $this->created_dir); |
|
@@ -104,18 +104,18 @@ discard block |
|
|
block discarded – undo |
|
104
|
104
|
$perm = api_get_setting('permissions_for_new_files'); |
|
105
|
105
|
|
|
106
|
106
|
if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
|
107
|
|
- $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
108
|
|
- $class_path = $converter_path . ';' . $converter_path . '/jodconverter-2.2.2.jar;' . $converter_path . '/jodconverter-cli-2.2.2.jar'; |
|
|
107
|
+ $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
|
108
|
+ $class_path = $converter_path.';'.$converter_path.'/jodconverter-2.2.2.jar;'.$converter_path.'/jodconverter-cli-2.2.2.jar'; |
|
109
|
109
|
//$cmd = 'java -cp "'.$class_path.'" DokeosConverter'; |
|
110
|
|
- $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $class_path . '" DokeosConverter'; |
|
|
110
|
+ $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$class_path.'" DokeosConverter'; |
|
111
|
111
|
} else { |
|
112
|
|
- $converter_path = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
|
112
|
+ $converter_path = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
113
|
113
|
//$class_path = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar'; |
|
114
|
114
|
$class_path = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar'; |
|
115
|
|
- $cmd = 'cd ' . $converter_path . ' && java ' . $class_path . ' DokeosConverter'; |
|
|
115
|
+ $cmd = 'cd '.$converter_path.' && java '.$class_path.' DokeosConverter'; |
|
116
|
116
|
} |
|
117
|
117
|
|
|
118
|
|
- $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
|
118
|
+ $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
119
|
119
|
// Call to the function implemented by child. |
|
120
|
120
|
$cmd .= $this->add_command_parameters(); |
|
121
|
121
|
// To allow openoffice to manipulate docs. |
|
@@ -124,7 +124,7 @@ discard block |
|
|
block discarded – undo |
|
124
|
124
|
@chmod($this->base_work_dir.$this->file_path, 0777); |
|
125
|
125
|
|
|
126
|
126
|
$locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere. |
|
127
|
|
- putenv('LC_ALL=' . $locale); |
|
|
127
|
+ putenv('LC_ALL='.$locale); |
|
128
|
128
|
|
|
129
|
129
|
$files = array(); |
|
130
|
130
|
$return = 0; |
|
@@ -150,12 +150,12 @@ discard block |
|
|
block discarded – undo |
|
150
|
150
|
$result = $this->_get_remote_ppt2lp_files($file, $size); |
|
151
|
151
|
$result = unserialize($result); |
|
152
|
152
|
// Save remote images to server |
|
153
|
|
- chmod($this->base_work_dir . $this->created_dir, api_get_permissions_for_new_directories()); |
|
|
153
|
+ chmod($this->base_work_dir.$this->created_dir, api_get_permissions_for_new_directories()); |
|
154
|
154
|
if (!empty($result['images'])) { |
|
155
|
155
|
foreach ($result['images'] as $image => $img_data) { |
|
156
|
156
|
$image_path = $this->base_work_dir.$this->created_dir; |
|
157
|
|
- @file_put_contents($image_path . '/' . $image, base64_decode($img_data)); |
|
158
|
|
- @chmod($image_path . '/' . $image, 0777); |
|
|
157
|
+ @file_put_contents($image_path.'/'.$image, base64_decode($img_data)); |
|
|
158
|
+ @chmod($image_path.'/'.$image, 0777); |
|
159
|
159
|
} |
|
160
|
160
|
} |
|
161
|
161
|
|
|
@@ -199,7 +199,7 @@ discard block |
|
|
block discarded – undo |
|
199
|
199
|
$uri = ''; |
|
200
|
200
|
$result = preg_match('/^([a-zA-Z0-9]*):\/\/([^\/]*)\//', $ppt2lp_host, $matches); |
|
201
|
201
|
if ($result) { |
|
202
|
|
- $uri = $matches[1] . '://' . $matches[2] . '/'; |
|
|
202
|
+ $uri = $matches[1].'://'.$matches[2].'/'; |
|
203
|
203
|
} else { |
|
204
|
204
|
$uri = $ppt2lp_host; |
|
205
|
205
|
} |
|
@@ -218,7 +218,7 @@ discard block |
|
|
block discarded – undo |
|
218
|
218
|
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9, |
|
219
|
219
|
); |
|
220
|
220
|
if (substr($ppt2lp_host, 0, 5) === 'https') { |
|
221
|
|
- $options['ssl_method'] = SOAP_SSL_METHOD_TLS; |
|
|
221
|
+ $options['ssl_method'] = SOAP_SSL_METHOD_TLS; |
|
222
|
222
|
} |
|
223
|
223
|
$client = new SoapClient(null, $options); |
|
224
|
224
|
$result = ''; |
|
@@ -239,7 +239,7 @@ discard block |
|
|
block discarded – undo |
|
239
|
239
|
//error_log('['.time().'] Calling wsConvertPpt webservice on ' . $ppt2lp_host); |
|
240
|
240
|
$result = $client->__call('wsConvertPpt', array('pptData' => $params)); |
|
241
|
241
|
} catch (Exception $e) { |
|
242
|
|
- error_log('['.time().'] Chamilo SOAP call error: ' . $e->getMessage()); |
|
|
242
|
+ error_log('['.time().'] Chamilo SOAP call error: '.$e->getMessage()); |
|
243
|
243
|
} |
|
244
|
244
|
// Make sure we destroy the SOAP client as it may generate SSL connection |
|
245
|
245
|
// binding issue (if using SSL) |
|
@@ -272,38 +272,38 @@ discard block |
|
|
block discarded – undo |
|
272
|
272
|
$ppt2lpHost = api_get_setting('service_ppt2lp', 'host'); |
|
273
|
273
|
$permissionFile = api_get_permissions_for_new_files(); |
|
274
|
274
|
$permissionFolder = api_get_permissions_for_new_directories(); |
|
275
|
|
- if (file_exists($this->base_work_dir . '/' . $this->created_dir)) { |
|
|
275
|
+ if (file_exists($this->base_work_dir.'/'.$this->created_dir)) { |
|
276
|
276
|
|
|
277
|
277
|
return $ids; |
|
278
|
278
|
} |
|
279
|
279
|
|
|
280
|
280
|
if ($ppt2lpHost == 'localhost') { |
|
281
|
281
|
if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
|
282
|
|
- $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
283
|
|
- $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar'; |
|
284
|
|
- $cmd = 'java -Dfile.encoding=UTF-8 -jar "' . $classPath . '/jodconverter-2.2.2.jar"'; |
|
|
282
|
+ $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
|
283
|
+ $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar'; |
|
|
284
|
+ $cmd = 'java -Dfile.encoding=UTF-8 -jar "'.$classPath.'/jodconverter-2.2.2.jar"'; |
|
285
|
285
|
} else { |
|
286
|
|
- $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
|
286
|
+ $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
287
|
287
|
$classPath = ' -Dfile.encoding=UTF-8 -jar jodconverter-cli-2.2.2.jar'; |
|
288
|
|
- $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' '; |
|
|
288
|
+ $cmd = 'cd '.$converterPath.' && java '.$classPath.' '; |
|
289
|
289
|
} |
|
290
|
290
|
|
|
291
|
|
- $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
|
291
|
+ $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
292
|
292
|
// Call to the function implemented by child. |
|
293
|
|
- $cmd .= ' "' . $this->base_work_dir . '/' . $this->file_path . '" "' . $this->base_work_dir . '/' . $this->created_dir . '"'; |
|
|
293
|
+ $cmd .= ' "'.$this->base_work_dir.'/'.$this->file_path.'" "'.$this->base_work_dir.'/'.$this->created_dir.'"'; |
|
294
|
294
|
// To allow openoffice to manipulate docs. |
|
295
|
295
|
@chmod($this->base_work_dir, $permissionFolder); |
|
296
|
|
- @chmod($this->base_work_dir . '/' . $this->file_path, $permissionFile); |
|
|
296
|
+ @chmod($this->base_work_dir.'/'.$this->file_path, $permissionFile); |
|
297
|
297
|
|
|
298
|
298
|
$locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere. |
|
299
|
|
- putenv('LC_ALL=' . $locale); |
|
|
299
|
+ putenv('LC_ALL='.$locale); |
|
300
|
300
|
|
|
301
|
301
|
$files = array(); |
|
302
|
302
|
$return = 0; |
|
303
|
303
|
$shell = exec($cmd, $files, $return); |
|
304
|
304
|
// TODO: Chown is not working, root keep user privileges, should be www-data |
|
305
|
|
- @chown($this->base_work_dir . '/' . $this->created_dir, 'www-data'); |
|
306
|
|
- @chmod($this->base_work_dir . '/' . $this->created_dir, $permissionFile); |
|
|
305
|
+ @chown($this->base_work_dir.'/'.$this->created_dir, 'www-data'); |
|
|
306
|
+ @chmod($this->base_work_dir.'/'.$this->created_dir, $permissionFile); |
|
307
|
307
|
|
|
308
|
308
|
if ($return != 0) { // If the java application returns an error code. |
|
309
|
309
|
switch ($return) { |
|
@@ -342,14 +342,14 @@ discard block |
|
|
block discarded – undo |
|
342
|
342
|
*/ |
|
343
|
343
|
} |
|
344
|
344
|
|
|
345
|
|
- if (file_exists($this->base_work_dir . '/' . $this->created_dir)) { |
|
|
345
|
+ if (file_exists($this->base_work_dir.'/'.$this->created_dir)) { |
|
346
|
346
|
|
|
347
|
347
|
// Register Files to Document tool |
|
348
|
348
|
$ids[] = add_document( |
|
349
|
349
|
$_course, |
|
350
|
|
- '/' . $this->created_dir, |
|
|
350
|
+ '/'.$this->created_dir, |
|
351
|
351
|
'file', |
|
352
|
|
- filesize($this->base_work_dir . '/' . $this->created_dir), |
|
|
352
|
+ filesize($this->base_work_dir.'/'.$this->created_dir), |
|
353
|
353
|
$convertedTitle, |
|
354
|
354
|
sprintf( |
|
355
|
355
|
get_lang('FileConvertedFromXToY'), |