function postObject($folderId, $objectName, $objectType, $properties = array(), $content = null, $content_type = "application/octet-stream", $options = array()) { // Yes $myURL = $this->getLink($folderId, "down"); // TODO: Need Proper Query String Handling // Assumes that the 'down' link does not have a querystring in it $myURL = CMISRepositoryWrapper::getOpUrl($myURL, $options); static $entry_template; if (!isset($entry_template)) { $entry_template = CMISService::getEntryTemplate(); } if (is_array($properties)) { $hash_values = $properties; } else { $hash_values = array(); } if (!isset($hash_values["cmis:objectTypeId"])) { $hash_values["cmis:objectTypeId"] = $objectType; } $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 ($content) { $hash_values["CONTENT"] = CMISService::getContentEntry($content, $content_type); } if (!isset($hash_values['title'])) { $hash_values['title'] = preg_replace("/[^A-Za-z0-9\\s.&; ]/", '', htmlentities($objectName)); } if (!isset($hash_values['summary'])) { $hash_values['summary'] = preg_replace("/[^A-Za-z0-9\\s.&; ]/", '', htmlentities($objectName)); } $post_value = CMISRepositoryWrapper::processTemplate($entry_template, $hash_values); $ret = $this->doPost($myURL, $post_value, MIME_ATOM_XML_ENTRY); // print "DO_POST\n"; // print_r($ret); $obj = $this->extractObject($ret->body); $this->cacheEntryInfo($obj); return $obj; }
/** * @internal */ function postEntry($url, $properties = array(), $content = null, $content_type = "application/octet-stream", $options = array()) { // TODO: Fix Hack HERE -- get type if it is there otherwise retrieve it -- $objectType = ""; if (isset($properties['cmis:objectTypeId'])) { $objType = $properties['cmis:objectTypeId']; } else { if (isset($properties["cmis:objectId"])) { $objType = $this->getObjectType($properties["cmis:objectId"]); } } $myURL = CMISRepositoryWrapper::getOpUrl($url, $options); //DEBUG print "DEBUG: postEntry: myURL = " . $myURL; static $entry_template; if (!isset($entry_template)) { $entry_template = CMISService::getEntryTemplate(); } print "DEBUG: postEntry: entry_template = " . $entry_template; $properties_xml = $this->processPropertyTemplates($objType, $properties); print "DEBUG: postEntry: properties_xml = " . $properties_xml; if (is_array($options)) { $hash_values = $options; } else { $hash_values = array(); } $hash_values["PROPERTIES"] = $properties_xml; $hash_values["SUMMARY"] = CMISService::getSummaryTemplate(); if ($content) { $hash_values["CONTENT"] = CMISService::getContentEntry($content, $content_type); } print "DEBUG: postEntry: hash_values = " . print_r($hash_values, true); $post_value = CMISRepositoryWrapper::processTemplate($entry_template, $hash_values); print "DEBUG: postEntry: post_value = " . $post_value; $ret = $this->doPost($myURL, $post_value, MIME_ATOM_XML_ENTRY); $obj = $this->extractObject($ret->body); $this->cacheObjectInfo($obj); return $obj; }