/** * Executes addComment action, which returns a form enabling the insertion of a comment * The request may include 1 fields: entry id. */ protected function executeImpl(kshow $kshow, entry &$entry) { $version = @$_REQUEST["version"]; // it's a path on the disk if (kString::beginsWith($version, ".")) { // someone is trying to hack in the system return sfView::ERROR; } // in case we're making a roughcut out of a regular invite, we start from scratch if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW || $entry->getDataPath($version) === null) { $this->xml_content = "<xml></xml>"; return; } // fetch content of file from disk - it should hold the XML $file_name = myContentStorage::getFSContentRootPath() . "/" . $entry->getDataPath($version); //echo "[$file_name]"; if (kString::endsWith($file_name, "xml")) { if (file_exists($file_name)) { $this->xml_content = kFile::getFileContent($file_name); // echo "[" . $this->xml_content . "]" ; } else { $this->xml_content = "<xml></xml>"; } myMetadataUtils::updateEntryForPending($entry, $version, $this->xml_content); } else { return sfView::ERROR; } // this is NOT an xml file we are looking for ! }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $entry_id = $this->getP("entry_id"); $kshow_id = $this->getP("kshow_id"); // Make sure the request is for a ready roughcut $c = entryPeer::getCriteriaFilter()->getFilter(); $c->addAnd(entryPeer::STATUS, entryStatus::READY, Criteria::EQUAL); list($kshow, $entry, $error, $error_obj) = myKshowUtils::getKshowAndEntry($kshow_id, $entry_id); if ($error_obj) { $this->addError($error_obj); return; } $version = $this->getP("version"); // it's a path on the disk if (kString::beginsWith($version, ".")) { // someone is trying to hack in the system return sfView::ERROR; } elseif ($version == "-1") { $version = null; } // in case we're making a roughcut out of a regular invite, we start from scratch $entry_data_path = kFileSyncUtils::getLocalFilePathForKey($entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $version)); //replaced__getDataPath if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW || $entry_data_path === null) { $this->xml_content = "<xml></xml>"; return; } $sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $version); $file_name = kFileSyncUtils::getReadyLocalFilePathForKey($sync_key, false); // fetch content of file from disk - it should hold the XML if (kString::endsWith($file_name, "xml")) { $xml_content = kFileSyncUtils::file_get_contents($sync_key, false, false); if (!$xml_content) { $xml_content = "<xml></xml>"; } myMetadataUtils::updateEntryForPending($entry, $version, $xml_content); $this->addMsg("metadata", $xml_content); } else { $this->addError(APIErrors::INVALID_FILE_NAME, $file_name); } }