public function listFriends($id) { $client = new OCSClient(); $self = new OCSUser(); $client->set_auth_info($self->login(), EHeaderDataParser::get_cookie("password")); return $client->get("/v1/friend/data/{$id}"); }
public static function client_logout() { $login = EHeaderDataParser::get_cookie("login"); $password = EHeaderDataParser::get_cookie("password"); EHeaderDataParser::del_cookie("login"); EHeaderDataParser::del_cookie("password"); }
public function delData($id) { $client = new OCSClient(); $client->set_auth_info(EHeaderDataParser::get_cookie("login"), EHeaderDataParser::get_cookie("password")); $client->post("v1/content/delete/{$id}"); $prevpage = EPageProperties::get_previous_page(); header("Location: {$prevpage}"); }
public static function checklogin() { $password = EHeaderDataParser::get_cookie(EProtect::$localkey); if ($password) { if ($password == EConfig::$data['generic']['password']) { return true; } } if (isset($_POST['password'])) { $password = $_POST['password']; if ($password == EConfig::$data['generic']['password']) { EHeaderDataParser::set_cookie(EProtect::$localkey, $password, 60); //60seconds*30 = max 30 minutes session return true; } } return false; }
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}"); } }
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"]; } }