Exemple #1
0
 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}");
     }
 }
Exemple #2
0
 public function leaveComment($id)
 {
     $type = "1";
     $content = $id;
     $content2 = "1";
     $parent = "";
     $subject = EHeaderDataParser::secure_post("inputSubject");
     $message = EHeaderDataParser::secure_post("inputMessage");
     $postdata = array("type" => $type, "content" => $content, "content2" => $content2, "parent" => $parent, "subject" => $subject, "message" => $message);
     $client = new OCSClient(EConfig::$data["ocs"]["host"]);
     $client->set_auth_info(EHeaderDataParser::get_cookie("login"), EHeaderDataParser::get_cookie("password"));
     $check = $client->post("v1/comments/add", $postdata);
     if ($check["ocs"]["meta"]["statuscode"] == "100") {
         //cosa fare se va a buon fine
         header("Location: /plasmastore/app_description/show/{$id}");
     } else {
         echo $check["ocs"]["meta"]["statuscode"];
     }
 }
Exemple #3
0
 public static function client_login()
 {
     $login = EHeaderDataParser::secure_post("login");
     $password = EHeaderDataParser::secure_post("password");
     OCSUser::$login = $login;
     if ($login == false && $password == false) {
         $login = EHeaderDataParser::get_cookie("login");
         $password = EHeaderDataParser::get_cookie("password");
         OCSUser::$login = $login;
     }
     $postdata = array("login" => $login, "password" => $password);
     $client = new OCSClient(EConfig::$data["ocs"]["host"]);
     $check = $client->post("v1/person/check", $postdata);
     if ($check["ocs"]["meta"]["statuscode"] == "100") {
         OCSUser::$logged = true;
         EHeaderDataParser::set_cookie("login", $login);
         EHeaderDataParser::set_cookie("password", $password);
     }
 }
Exemple #4
0
 public function search()
 {
     $client = new OCSClient();
     $key = EHeaderDataParser::secure_post("searchInput");
     return $client->get("v1/content/data/?search={$key}");
 }