コード例 #1
0
 /**
  * @internal
  */
 function doRequest($url, $method = "GET", $content = null, $contentType = null, $charset = null)
 {
     // Process the HTTP request
     // 'til now only the GET request has been tested
     // Does not URL encode any inputs yet
     if (is_array($this->auth_options)) {
         $url = CMISRepositoryWrapper::getOpUrl($url, $this->auth_options);
     }
     $session = curl_init($url);
     curl_setopt($session, CURLOPT_HEADER, false);
     curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
     if ($this->username) {
         curl_setopt($session, CURLOPT_USERPWD, $this->username . ":" . $this->password);
     }
     curl_setopt($session, CURLOPT_CUSTOMREQUEST, $method);
     if ($contentType) {
         curl_setopt($session, CURLOPT_HTTPHEADER, array("Content-Type: " . $contentType));
     }
     if ($content) {
         curl_setopt($session, CURLOPT_POSTFIELDS, $content);
     }
     if ($method == "POST") {
         curl_setopt($session, CURLOPT_POST, true);
     }
     // apply addl. cURL options
     // WARNING: this may override previously set options
     if (count($this->_addlCurlOptions)) {
         foreach ($this->_addlCurlOptions as $key => $value) {
             curl_setopt($session, $key, $value);
         }
     }
     //TODO: Make this storage optional
     $retval = new stdClass();
     $retval->url = $url;
     $retval->method = $method;
     $retval->content_sent = $content;
     $retval->content_type_sent = $contentType;
     $retval->body = curl_exec($session);
     $retval->code = curl_getinfo($session, CURLINFO_HTTP_CODE);
     $retval->content_type = curl_getinfo($session, CURLINFO_CONTENT_TYPE);
     $retval->content_length = curl_getinfo($session, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
     curl_close($session);
     $this->last_request = $retval;
     return $retval;
 }
コード例 #2
0
 function updateProperties($objectId, $properties = array(), $options = array())
 {
     // Yes
     $varmap = $options;
     $varmap["id"] = $objectId;
     $objectName = $this->getTitle($objectId);
     $objectType = $this->getObjectType($objectId);
     $obj_url = $this->getLink($objectId, "edit");
     $obj_url = CMISRepositoryWrapper::getOpUrl($obj_url, $options);
     static $entry_template;
     if (!isset($entry_template)) {
         $entry_template = CMISService::getEntryTemplate();
     }
     if (is_array($properties)) {
         $hash_values = $properties;
     } else {
         $hash_values = array();
     }
     $properties_xml = $this->processPropertyTemplates($objectType, $hash_values);
     if (is_array($options)) {
         $hash_values = $options;
     } else {
         $hash_values = array();
     }
     $hash_values["PROPERTIES"] = $properties_xml;
     $hash_values["SUMMARY"] = CMISService::getSummaryTemplate();
     if (!isset($hash_values['title'])) {
         $hash_values['title'] = $objectName;
     }
     if (!isset($hash_values['summary'])) {
         $hash_values['summary'] = $objectName;
     }
     $put_value = CMISRepositoryWrapper::processTemplate($entry_template, $hash_values);
     // print $put_value; // RRM DEBUG
     $ret = $this->doPut($obj_url, $put_value, MIME_ATOM_XML_ENTRY);
     $obj = $this->extractObject($ret->body);
     $this->cacheObjectInfo($obj);
     return $obj;
 }
コード例 #3
0
 function updateProperties($objectId, $properties = array(), $options = array())
 {
     // Yes
     $varmap = $options;
     $varmap["id"] = $objectId;
     $objectName = $this->getTitle($objectId);
     $objectType = $this->getObjectType($objectId);
     $obj_url = $this->getLink($objectId, "edit");
     $obj_url = CMISRepositoryWrapper::getOpUrl($obj_url, $options);
     static $entry_template;
     if (!isset($entry_template)) {
         $entry_template = CMISService::getEntryTemplate();
     }
     if (is_array($properties)) {
         $hash_values = $properties;
     } else {
         $hash_values = array();
     }
     $properties_xml = $this->processPropertyTemplates($objectType, $hash_values);
     if (is_array($options)) {
         $hash_values = $options;
     } else {
         $hash_values = array();
     }
     $fixed_hash_values = array("PROPERTIES" => $properties_xml, "SUMMARY" => CMISService::getSummaryTemplate());
     // merge the fixes hash values first so that the processing order is correct
     $hash_values = array_merge($fixed_hash_values, $hash_values);
     if (!isset($hash_values['title'])) {
         $hash_values['title'] = $objectName;
     }
     if (!isset($hash_values['summary'])) {
         $hash_values['summary'] = $objectName;
     }
     $put_value = CMISRepositoryWrapper::processTemplate($entry_template, $hash_values);
     $ret = $this->doPut($obj_url, $put_value, MIME_ATOM_XML_ENTRY);
     $obj = $this->extractObject($ret->body);
     $this->cacheEntryInfo($obj);
     return $obj;
 }
コード例 #4
0
 function removeObjectFromFolder($objectId, $targetFolderId, $options = array())
 {
     //Probably
     $hash_values = $options;
     $myURL = $this->workspace->collections['unfiled'];
     $myURL = CMISRepositoryWrapper::getOpUrl($myURL, $hash_values);
     $ret = $this->postEntry($myURL, array("cmis:objectId" => $objectId), null, null, array("removeFrom" => $targetFolderId));
     $obj = $this->extractObject($ret->body);
     $this->cacheObjectInfo($obj);
     return $obj;
 }