Browse Source

Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

jmontoyaa 8 years ago
parent
commit
de15b7ceee

+ 7 - 5
main/inc/lib/webservices/Rest.php

@@ -415,10 +415,12 @@ class Rest extends WebService
         $agenda->setType('course');
         $result = $agenda->parseAgendaFilter(null);
 
-        $start = new DateTime('now');
-        $start->modify('first day of month');
-        $end = new DateTime('now');
-        $end->modify('first day of month');
+        $start = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));
+        $start->modify('first day of this month');
+        $start->setTime(0, 0, 0);
+        $end = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));
+        $end->modify('last day of this month');
+        $end->setTime(23, 59, 59);
 
         $groupId = current($result['groups']);
         $userId = current($result['users']);
@@ -506,7 +508,7 @@ class Rest extends WebService
                 'title' => $forumInfo['forum_title'],
                 'description' => $forumInfo['forum_comment'],
                 'image' => $forumInfo['forum_image'] ? ($webCoursePath . $forumInfo['forum_image']) : '',
-                'numberOfThreads' => intval($forumInfo['number_of_threads']),
+                'numberOfThreads' => isset($forumInfo['number_of_threads']) ? intval($forumInfo['number_of_threads']) : 0,
                 'lastPost' => null
             ];
 

+ 6 - 1
main/lp/openoffice_document.class.php

@@ -205,6 +205,7 @@ abstract class OpenofficeDocument extends learnpath
             'trace' => 1,
             'exception' => 1,
             'cache_wsdl' => WSDL_CACHE_NONE,
+            'keep_alive' => false,
         );
         $client = new SoapClient(null, $options);
         $result = '';
@@ -221,7 +222,11 @@ abstract class OpenofficeDocument extends learnpath
             'service_ppt2lp_size' => $size,
         );
 
-        $result = $client->__call('wsConvertPpt', array('pptData' => $params));
+        try {
+            $result = $client->__call('wsConvertPpt', array('pptData' => $params));
+        } catch (Exception $e) {
+            error_log($e->getMessage());
+        }
 
         return $result;
     }

+ 14 - 1
main/webservices/additional_webservices.php

@@ -17,6 +17,15 @@ $libpath = api_get_path(LIBRARY_PATH);
  */
 function wsConvertPpt($pptData)
 {
+    global $_configuration;
+    $ip = trim($_SERVER['REMOTE_ADDR']);
+    // If an IP filter array is defined in configuration.php,
+    // check if this IP is allowed
+    if (!empty($_configuration['ppt2lp_ip_filter'])) {
+        if (!in_array($ip, $_configuration['ppt2lp_ip_filter'])) {
+            return false;
+        }
+    }
     $fileData = $pptData['file_data'];
     $dataInfo = pathinfo($pptData['file_name']);
     $fileName =  basename($pptData['file_name'], '.' . $dataInfo['extension']);
@@ -33,7 +42,10 @@ function wsConvertPpt($pptData)
     $tempPathNewFiles = $tempArchivePath . 'wsConvert/' . $fileName . '-n/';
 
     $oldumask = umask(0);
-    $perms = api_get_permissions_for_new_directories();
+    //$perms = api_get_permissions_for_new_directories();
+    // Set permissions the most permissively possible: these files will
+    // be deleted below and we need a parallel process to be able to write them
+    $perms = 0777;
     pptConverterDirectoriesCreate($tempPath, $tempPathNewFiles, $fileName, $perms);
 
     $file = base64_decode($fileData);
@@ -42,6 +54,7 @@ function wsConvertPpt($pptData)
     $cmd = pptConverterGetCommandBaseParams();
     $cmd .= ' -w ' . $w . ' -h ' . $h . ' -d oogie "' . $tempPath . $fullFileName.'"  "' . $tempPathNewFiles . $fileName . '.html"';
 
+    //$perms = api_get_permissions_for_new_files();
     chmod($tempPathNewFiles . $fileName, $perms);
 
     $files = array();

+ 1 - 1
main/webservices/registration.soap.php

@@ -6298,7 +6298,7 @@ $server->register(
  * Web service to get a session list filtered by name, description or short description extra field
  * @param array $params Contains the following parameters
  *   string $params['term'] Search term
- *   string $params['extra_fields'] Extrafields to include in request result
+ *   string $params['extrafields'] Extrafields to include in request result
  *   string $params['secret_key'] Secret key to check
  * @return array The list
  */

+ 7 - 3
main/webservices/soap.test.php

@@ -25,7 +25,7 @@ $lpid = 1; // set to your learnpath ID
 $lpiid = 1; // set to your learnpath item ID
 
 // Build the server's SOAP script address
-$server = api_get_path(WEB_CODE_PATH).'webservices/soap.php?wsdl';
+$server = api_get_path(WEB_CODE_PATH).'webservices/registration.soap.php?wsdl';
 
 /**
  * Call the webservice
@@ -35,10 +35,14 @@ $server = api_get_path(WEB_CODE_PATH).'webservices/soap.php?wsdl';
 $client = new SoapClient($server, array('cache_wsdl' => WSDL_CACHE_NONE));
 
 // Call the function we want with the right params...
-$response = $client->{'WSReport.test'}();
+try {
+    $response = $client->{'WSSearchSession'}(array('term' => 'a', 'extrafields' => array(), 'secret_key' => $signature));
+} catch (Exception $e) {
+    error_log(print_r($e->getMessage(), 1));
+}
 //$response = $client->{'WSReport.GetLearnpathStatusSingleItem'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid, $lpiid);
 //$response = $client->{'WSReport.GetLearnpathProgress'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid);
 //$response = $client->{'WSReport.GetLearnpathHighestLessonLocation'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid);
 // Print the output, or do whatever you like with it (it's the status for this item):
-echo '<pre>'.$response.'</pre>';
+echo '<pre>'.print_r($response, 1).'</pre>';
 // This should print "complete", "incomplete" or any other active status.