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}"); } }
private function _statuscode_test($data, $client) { ob_start(); var_dump($data); $a = ob_get_contents(); ob_end_clean(); if (isset($data["ocs"]["meta"]["statuscode"])) { echo '<span style="color:green">ok!</span>(statuscode:' . $data["ocs"]["meta"]["statuscode"] . ')'; echo '<a onclick="alert(\''; echo str_replace("lkjjjnnh", "\\n", addslashes(htmlspecialchars(str_replace("\n", "lkjjjnnh", $a)))); echo '\')">[show full response]</a></p>'; } else { echo '<span style="color:red">failed!</span></p>'; ELog::pd($client->get_last_raw_result()); } }
<?php include "gfx3/lib.php"; $prevpage = EPageProperties::get_previous_page(); $type = EHeaderDataParser::db_post("type"); $content = EHeaderDataParser::db_post("content"); $content2 = EHeaderDataParser::db_post("content2"); $parent = EHeaderDataParser::db_post("parent"); $subject = EHeaderDataParser::db_post("subject"); $message = EHeaderDataParser::db_post("message"); $postdata = array("type" => $type, "content" => $content, "content2" => $content2, "parent" => $parent, "subject" => $subject, "message" => $message); $client = new OCSClient(); $client->set_auth_info(EUser::nick(), EUser::password()); $client->set_post_data($postdata); $res = $client->post("v1/comments/add"); if ($res["ocs"]["meta"]["statuscode"] == "100") { header("Location: game.php/id/{$content}"); } else { ELog::pd($res); }
<?php include "gfx3/lib.php"; $prevpage = EPageProperties::get_previous_page(); $contentid = EHeaderDataParser::db_get("id"); $client = new OCSClient(); $client->set_auth_info(EUser::nick(), EUser::password()); $addfan = $client->post("v1/fan/remove/{$contentid}"); ELog::pd($client->get_last_raw_result()); if ($addfan["ocs"]["meta"]["statuscode"] == "100") { header("Location: {$prevpage}"); } else { ELog::pd($addfan); }
<?php include "gfx3/lib.php"; $prevpage = EPageProperties::get_previous_page(); $id = EHeaderDataParser::db_post("idcontent"); $name = EHeaderDataParser::db_post("name"); $downloadname1 = EHeaderDataParser::db_post("downloadname1"); $downloadlink1 = EHeaderDataParser::db_post("downloadlink1"); $description = EUtility::nl2br(EHeaderDataParser::db_post("description")); $version = EHeaderDataParser::db_post("version"); $summary = EHeaderDataParser::db_post("summary"); $changelog = nl2br(EHeaderDataParser::db_post("changelog")); $postdata = array("name" => $name, "summary" => $summary, "downloadname1" => $downloadname1, "downloadlink1" => $downloadlink1, "description" => $description, "version" => $version, "changelog" => $changelog); $client = new OCSClient(); $client->set_auth_info(EUser::nick(), EUser::password()); $mod = $client->post("v1/content/edit/{$id}", $postdata); if ($mod["ocs"]["meta"]["statuscode"] == "100") { header("Location: {$prevpage}"); } else { ELog::pd($mod); die; header("Location: {$prevpage}"); }