public function edit($args) { $id = $args; $name = EHeaderDataParser::secure_post("inputTitle"); $type = EHeaderDataParser::secure_post("type"); $downloadname1 = EHeaderDataParser::secure_post("inputDownloadName"); $downloadlink1 = EHeaderDataParser::secure_post("inputDownloadLink"); $description = EHeaderDataParser::secure_post("inputDescription"); $summary = EHeaderDataParser::secure_post("inputSummary"); $version = EHeaderDataParser::secure_post("inputVersion"); $changelog = EHeaderDataParser::secure_post("inputChangelog"); $personid = OCSUser::login(); $postdata = array("name" => $name, "type" => $type, "downloadname1" => $downloadname1, "downloadlink1" => $downloadlink1, "description" => $description, "summary" => $summary, "version" => $version, "changelog" => $changelog, "personid" => $personid); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info($personid, EHeaderDataParser::get_cookie("password")); $check = $client->post("v1/content/edit/{$id}", $postdata); if ($check["ocs"]["meta"]["statuscode"] == "100") { $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info($personid, EHeaderDataParser::get_cookie("password")); if (!empty($_FILES['inputDownloadFile'])) { $client->set_upload_file($_FILES['inputDownloadFile']['tmp_name']); $result = $client->post("v1/content/uploaddownload/{$id}"); } if (!empty($_FILES['inputScreenshot1'])) { $client->set_upload_file($_FILES['inputScreenshot1']['tmp_name']); $result = $client->post("v1/content/uploadpreview/{$id}/1"); ELog::pd($result); if (!empty($_FILES['inputScreenshot2'])) { $client->set_upload_file($_FILES['inputScreenshot2']['tmp_name']); $result = $client->post("v1/content/uploadpreview/{$id}/2"); if (!empty($_FILES['inputScreenshot3'])) { $client->set_upload_file($_FILES['inputScreenshot3']['tmp_name']); $result = $client->post("v1/content/uploadpreview/{$id}/3"); if ($result["ocs"]["meta"]["statuscode"] == "100") { //ELog::pd($check); //cosa fare se va a buon fine } } } } //else {ELog::pd($result);} //cosa fare se va a buon fine header("Location: /plasmastore/app_description/show/{$id}"); } }
<?php include "gfx3/lib.php"; $prevpage = EPageProperties::get_previous_page(); $idcontent = EHeaderDataParser::db_post("idcontent"); $n = EHeaderDataParser::db_post("number"); if (!empty($_FILES['localfile'])) { $client = new OCSClient(); $client->set_auth_info(EUser::nick(), EUser::password()); $client->set_upload_file($_FILES['localfile']['tmp_name']); $result = $client->post("v1/content/uploadpreview/{$idcontent}/{$n}"); header("Location: {$prevpage}"); }
<?php include "gfx3/lib.php"; $prevpage = EPageProperties::get_previous_page(); $idcontent = EHeaderDataParser::db_post("idcontent"); if (!empty($_FILES['localfile'])) { $tmp_name = $_FILES['localfile']['tmp_name']; $name = $_FILES['localfile']['name']; $client = new OCSClient(); $client->set_auth_info(EUser::nick(), EUser::password()); $abs_name = EFileSystem::rename_file($tmp_name, "/tmp/" . $name); $client->set_upload_file("/tmp/" . $name); $result = $client->post("v1/content/uploaddownload/{$idcontent}"); if ($result["ocs"]["meta"]["statuscode"] == "100") { header("Location: {$prevpage}"); } else { //echo $client->get_last_raw_result(); ELog::error("something went wrong"); } }