/** * edit a content entry * @param string $format * @param string $contentid * @return string xml/json */ private function contentedit($format, $contentid) { $user = $this->checkpassword(true); $this->checktrafficlimit($user); $content = addslashes($contentid); $categories = EConfig::$data["ocs_categories"]; $numcats = count($categories); // fetch data $con = new OCSContent(); if ($con->load($content) and OCSUser::is_logged() and OCSUser::id() == $con->owner) { $data = array(); if ($this->readdata('name', 'text') != '') { $data['name'] = $this->readdata('name', 'text'); } if ($this->readdata('type', 'text') != '') { $data['type'] = $this->readdata('type', 'text'); } else { $data['type'] = $con->type; } if ($this->readdata('downloadname1', 'text') != $con->downloadname1) { $data['downloadname1'] = $this->readdata('downloadname1', 'text'); } if ($this->readdata('downloadlink1', 'text') != $con->downloadlink1) { $data['downloadlink1'] = $this->readdata('downloadlink1', 'text'); } if ($this->readdata('description', 'text') != '') { $data['description'] = $this->readdata('description', 'text'); } else { $data['description'] = '...'; } if ($this->readdata('summary', 'text') != '') { $data['summary'] = $this->readdata('summary', 'text'); } else { $data['summary'] = '...'; } if ($this->readdata('version', 'text') != '') { $data['version'] = $this->readdata('version', 'text'); } else { $data['version'] = '...'; } if ($this->readdata('changelog', 'text') != '') { $data['changelog'] = $this->readdata('changelog', 'text'); } else { $data['changelog'] = '...'; } if ($this->readdata('license', 'int') >= 0 or $this->readdata('license', 'int') < 5) { $data['license'] = $this->readdata('license', 'int'); } if ($data['name'] != '' or $data['type'] < 0 or $data['type'] > $numcats) { $con->update(array("name", "type", "downloadname1", "downloadlink1", "description", "summary", "version", "changelog", "license")); $xml = array(); $txt = $this->generatexml($format, 'ok', 100, '', $xml, 'content'); } else { $txt = $this->generatexml($format, 'failed', 101, 'please specify all mandatory fields'); } } else { $txt = $this->generatexml($format, 'failed', 102, 'no permission to change content'); } $con->updated(); echo $txt; }