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 function login($nick, $pass) { $postdata = array("login" => $login, "password" => $password); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $check = $client->post("v1/person/check", $postdata); //ELog::pd($client->get_last_raw_result()); if ($check["ocs"]["meta"]["statuscode"] == "100") { EUser::login($login, $password); return true; } else { return false; //TODO: provide an error message } }
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"]; } }
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); } }
public function test() { $total_time = 0; EStructure::view("header"); ETime::measure_from(); $client = new OCSClient(EConfig::$data["ocs"]["host"]); echo '<h3>Sanity OCS test</h3>'; echo '<p>config..........'; $check = $client->get("v1/config"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>person/check..........'; $postdata = array("login" => "test", "password" => "password"); $check = $client->post("v1/person/check", $postdata); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>person/add..........'; $postdata = array("login" => "cavolfiore", "password" => "cavolfiore", "email" => "*****@*****.**", "firstname" => "cavolf", "lastname" => "chiappe"); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $check = $client->post("v1/person/add", $postdata); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>person/data..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/person/data"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>person/data?name=cavol&page=1&pagesize=10..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/person/data?name=cavol&page=1&pagesize=10"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>person/data/[login]..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/person/data/cavolfiore"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>person/self..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/person/self"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/add..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $postdata = array("name" => "esempio", "type" => "0", "downloadname1" => "downloadname1", "downloadlink1" => "downloadlink1", "description" => "description", "summary" => "summary", "version" => "version", "changelog" => "changelog", "personid" => "test"); $client->set_auth_info("test", "password"); $check = $client->post("v1/content/add", $postdata); $contentid = $this->example_contentid = $check['ocs']['data']['content'][0]['id']; $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/categories..........'; $check = $client->get("v1/content/categories"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/licenses..........'; $check = $client->get("v1/content/licenses"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/data..........'; $check = $client->get("v1/content/data"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/data?search=esem..........'; $check = $client->get("v1/content/data?search=esem"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/data/[contentid]..........'; $check = $client->get("v1/content/data/{$contentid}"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/download/[contentid]/1..........'; $check = $client->get("v1/content/download/{$contentid}/1"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/vote/[contentid]..........'; $id = intval($contentid); $rate = floatval(1); $postdata = array("vote" => $rate); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $client->set_post_data($postdata); $check = $client->post("v1/content/vote/{$id}"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>content/edit/[contentid]..........'; $postdata = array("name" => "esempiomod", "summary" => "summarymod", "downloadname1" => "downloadname1mod", "downloadlink1" => "downloadlink1mod", "description" => "descriptionmod", "version" => "versionmod", "changelog" => "changelogmod"); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $client->set_post_data($postdata); $check = $client->post("v1/content/edit/{$id}"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>[get] activity..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/activity"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>[post] activity..........'; $postdata = array("message" => "coding is fun"); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $client->set_post_data($postdata); $check = $client->post("v1/activity"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>fan/add..........'; $postdata = array("idcontent" => $contentid); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $client->set_post_data($postdata); $check = $client->post("v1/fan/add/{$id}"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; ETime::measure_from(); echo '<p>fan/data/[contentid]..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/fan/data/{$id}"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; echo '<p>fan/status/[contentid]..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/fan/status/{$id}"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; echo '<p>fan/remove..........'; $postdata = array("idcontent" => $contentid); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $client->set_post_data($postdata); $check = $client->post("v1/fan/remove/{$id}"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; echo '<p>comments/add..........'; $postdata = array("type" => "1", "content" => $id, "content2" => "1", "parent" => "0", "subject" => "subject", "message" => "message"); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $client->set_post_data($postdata); $check = $client->post("v1/comments/add"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; echo '<p>comments/data/[type]/[contentid1]/[contentid2]..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); //$client->set_auth_info("test","password"); $check = $client->get("v1/comments/data/1/{$id}/1&page=1&pagesize=10"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; //deleting content used for tests echo '<p>content/delete/[contentid]..........'; $postdata = array("contentid" => $id); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $client->set_post_data($postdata); $check = $client->post("v1/content/delete/{$id}"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; /* * TODO: add to OCS specs more returncodes than just 100 */ echo '<p>friend/data/[personid]..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/friend/data/cavolfiore"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; /* * TODO: add to OCS specs more returncodes than just 100 */ echo '<p>friend/receivedinvitations..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $check = $client->get("v1/friend/receivedinvitations"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; /* * TODO: add to OCS specs more returncodes than just 100 */ echo '<p>friend/invite/[personid]..........'; $postdata = array("message" => "would you be my friend?"); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("test", "password"); $client->set_post_data($postdata); $check = $client->post("v1/friend/invite/cavolfiore "); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; echo '<p>friend/approve/[personid]..........'; $postdata = array("message" => "would you be my friend?"); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("cavolfiore", "cavolfiore"); $client->set_post_data($postdata); $check = $client->post("v1/friend/approve/test"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; echo '<p>friend/decline/[personid]..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("cavolfiore", "cavolfiore"); $check = $client->post("v1/friend/decline/test"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )"; echo '<p>friend/cancel/[personid]..........'; $client = new OCSClient(EConfig::$data["ocs"]["host"]); $client->set_auth_info("cavolfiore", "cavolfiore"); $check = $client->post("v1/friend/cancel/test"); $this->_statuscode_test($check, $client); $time = ETime::measure_to(); $total_time += $time; echo "( {$time} )<br>"; echo "This OCS test took: {$total_time}"; EStructure::view("footer"); }
<?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"; $idcontent = EHeaderDataParser::db_get("id"); $postdata = array("contentid" => $idcontent); $client = new OCSClient(); $client->set_auth_info(EUser::nick(), EUser::password()); $client->set_post_data($postdata); $result = $client->post("v1/content/delete/{$idcontent}"); header("Location: /gamelist.php/user/" . EUser::nick());
<?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}"); }
public function getUserData($pagenumber) { $user = new OCSClient(); $name = $_COOKIE["login"]; return $user->get("v1/content/data/?user={$name}&page={$pagenumber}"); }
<?php include "../gfx3/lib.php"; //including gfx3 library $client = new OCSClient(); $categories = $client->get("/gamingfreedom.org/v1/content/categories"); $data = $client->get("/gamingfreedom.org/v1/content/data"); ?> <!DOCTYPE html> <html lang="en"><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content="ocs-server webclient"> <meta name="author" content="woffy"> <title>PlasmaStore</title> <link rel="stylesheet" href="css/bootstrap.css"> <link rel="stylesheet" href="css/dashboard.css"> <link rel="stylesheet" href="css/logo.css"> <link rel="stylesheet" href="css/app.css"> <!--<link rel="stylesheet" href="css/responsive_preview.css">--> </head> <body> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header">
<?php include "gfx3/lib.php"; $client = new OCSClient(); $categories = $client->get("v1/content/categories"); var_dump($categories);
<?php include "gfx3/lib.php"; $gameid = EHeaderDataParser::db_get("id"); $client = new OCSClient(); $data = $client->get("v1/content/data/{$gameid}/"); if (EUser::nick() != $data["ocs"]["data"]["content"]["personid"]) { ELog::error("You are not authorized to view this page!"); } echo "<div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×</button>\n <h3>Modify your game</h3>\n </div>\n \n <form class=\"form-horizontal\" action=\"/editGameAction.php\" target=\"_self\" method=\"post\">\n <div class=\"modal-body\">\n <fieldset>\n \n <div class=\"control-group\">\n <label class=\"control-label\" for=\"name\">Title</label>\n <div class=\"controls\">\n <input type=\"text\" name=\"name\" class=\"input-xlarge\" id=\"name\" value=\"" . EUtility::stripslashes($data["ocs"]["data"]["content"]["name"]) . "\">\n <input type=\"hidden\" name=\"idcontent\" class=\"input-xlarge\" id=\"idcontent\" value=\"{$gameid}\">\n </div>\n </div>\n \n <div class=\"control-group\">\n <label class=\"control-label\" for=\"downloadname1\">Download name</label>\n <div class=\"controls\">\n <input type=\"text\" name=\"downloadname1\" class=\"input-xlarge\" id=\"downloadname1\" \nvalue=\"" . EUtility::stripslashes($data["ocs"]["data"]["content"]["downloadname1"]) . "\">\n <p class=\"help-block\">- this is the label that will be shown to download your game</p>\n </div>\n </div>\n \n <div class=\"control-group\">\n <label class=\"control-label\" for=\"downloadlink1\">Download link</label>\n <div class=\"controls\">\n <input type=\"text\" name=\"downloadlink1\" class=\"input-xlarge\" id=\"downloadlink1\" \nvalue=\"" . EUtility::stripslashes($data["ocs"]["data"]["content"]["downloadlink1"]) . "\">\n <p class=\"help-block\">- this is the direct link to your game. If you want to host it on gamingfreedom server, you can do it uploading\n it after having created this skeleton</p>\n </div>\n </div>\n \n <div class=\"control-group\">\n <label class=\"control-label\" for=\"description\">Summary</label>\n <div class=\"controls\">\n <textarea cols=\"60\" rows=\"3\" name=\"summary\" class=\"input-xlarge\" \nid=\"summary\">" . EUtility::br2nl(EUtility::stripslashes($data["ocs"]["data"]["content"]["summary"])) . "</textarea>\n <p class=\"help-block\">- A short description to your game</p>\n </div>\n </div>\n \n <div class=\"control-group\">\n <label class=\"control-label\" for=\"description\">Features</label>\n <div class=\"controls\">\n <textarea cols=\"60\" rows=\"3\" name=\"description\" class=\"input-xlarge\" \nid=\"description\">" . EUtility::br2nl(EUtility::stripslashes($data["ocs"]["data"]["content"]["description"])) . "</textarea>\n <p class=\"help-block\">- A more in depth description and a list of features.</p>\n </div>\n </div>\n \n <div class=\"control-group\">\n <label class=\"control-label\" for=\"version\">Version</label>\n <div class=\"controls\">\n <input type=\"text\" name=\"version\" class=\"input-xlarge\" id=\"version\" \nvalue=\"" . EUtility::stripslashes($data["ocs"]["data"]["content"]["version"]) . "\">\n <p class=\"help-block\">- set here the version of your application</p>\n </div>\n </div>\n \n <div class=\"control-group\">\n <label class=\"control-label\" for=\"changelog\">Changelog</label>\n <div class=\"controls\">\n <textarea cols=\"60\" rows=\"3\" name=\"changelog\" class=\"input-xlarge\" \nid=\"changelog\">" . EUtility::stripslashes(EUtility::br2nl($data["ocs"]["data"]["content"]["changelog"])) . "</textarea>\n <p class=\"help-block\">- putting changelog helps your fans to know what is changed and what improvements\n have you put</p>\n </div>\n </div>\n \n </fieldset>\n \n </div>\n <div class=\"modal-footer\" style=\"background-color:#FFFFFF;\">\n <input type=\"submit\" class=\"btn btn-primary\" value=\"Next\">\n </div>\n \n </form>\n ";
public function search() { $client = new OCSClient(); $key = EHeaderDataParser::secure_post("searchInput"); return $client->get("v1/content/data/?search={$key}"); }
<?php include "gfx3/lib.php"; $prevpage = EPageProperties::get_previous_page(); $contentid = EHeaderDataParser::db_get("id"); $postdata = array("idcontent" => $contentid); $client = new OCSClient(); $client->set_auth_info(EUser::nick(), EUser::password()); $client->set_post_data($postdata); $addfan = $client->post("v1/fan/add/{$contentid}"); if ($addfan["ocs"]["meta"]["statuscode"] == "100") { header("Location: {$prevpage}"); } else { ELog::pd($addfan); }
<?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"); } }
<?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}"); }
<?php include "gfx3/lib.php"; $gameid = EHeaderDataParser::db_get("id"); EStructure::load("game"); $client = new OCSClient(); $data = $client->get("v1/content/data/{$gameid}/"); if (EUser::nick() == $data["ocs"]["data"]["content"]["personid"]) { EStructure::module("mod_game_menu", "mod_game"); } EStructure::code(); echo stripslashes($data["ocs"]["data"]["content"]["name"]); Estructure::insert("game_title"); EStructure::code(); echo stripslashes($data["ocs"]["data"]["content"]["summary"]); Estructure::insert("game_summary"); //features EStructure::code(); echo stripslashes($data["ocs"]["data"]["content"]["description"]); Estructure::insert("game_description"); EStructure::code(); echo stripslashes($data["ocs"]["data"]["content"]["changelog"]); Estructure::insert("game_changelog"); EStructure::code(); $person = $data["ocs"]["data"]["content"]["personid"]; echo "<a data-toggle=\"modal\" href=\"#viewSelfProfileModal\" class=\"modalButton bold\" target=\"/viewProfileModal.php?login={$person}\">{$person}</a>"; Estructure::insert("game_author"); EStructure::code(); echo stripslashes($data["ocs"]["data"]["content"]["version"]); Estructure::insert("game_version"); EStructure::code();
<?php include "gfx3/lib.php"; $prevpage = EPageProperties::get_previous_page(); $name = EHeaderDataParser::db_post("name"); $type = EHeaderDataParser::db_post("type"); $downloadname1 = EHeaderDataParser::db_post("downloadname1"); $downloadlink1 = EHeaderDataParser::db_post("downloadlink1"); $description = EHeaderDataParser::db_post("description"); $summary = EHeaderDataParser::db_post("summary"); $version = EHeaderDataParser::db_post("version"); $changelog = EHeaderDataParser::db_post("changelog"); $personid = EUser::nick(); $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(EUser::nick(), EUser::password()); $check = $client->post("v1/content/add", $postdata); if ($check["ocs"]["meta"]["statuscode"] == "100") { $id = $check["ocs"]["data"]["content"]["id"]; //nothing hard insert into gamingfreedom database $pname = ERewriter::prettify($name); header("Location: game.php/title/{$pname}/id/{$id}"); } else { echo $client->get_last_raw_result(); // redirecting to main page $message = $check["ocs"]["meta"]["message"]; $message = str_replace(" ", "%20", $message); //header("Location: $prevpage?e=".$message); }
$label = EHeaderDataParser::db_get("label"); $page = EHeaderDataParser::db_get("page"); $user = EHeaderDataParser::db_get("user"); if (!$from) { $from = "new"; } if (!$label) { $label = ""; } if (!$page) { $page = 1; } if (!$user) { $user = ""; } $client = new OCSClient(); $games = $client->get("v1/content/data?search={$label}&page={$page}&pagesize=50&sortmode={$from}&user={$user}"); EStructure::code(); if (isset($games["ocs"]["data"]["content"])) { if (isset($games["ocs"]["data"]["content"]["id"])) { $game = $games["ocs"]["data"]["content"]; echo "\n\t\t\t\t<div class=\"span6\">\n\t\t\t\t<div class=\"row\">\n\t\t\t\t <div class=\"span2\"><img src=\"" . $game["preview1"] . "\"></div>\n\t\t\t\t <div class=\"span4\"><h3><a href=\"/game.php/id/" . stripslashes($game["id"]) . "/title/" . ERewriter::prettify(stripslashes($game["name"])) . "\">" . stripslashes($game["name"]) . "</a></h3>\n\t\t\t\t <div class=\"static-rating\" id=\"" . $game["score"] . "_" . $game["id"] . "\"></div>\n\t\t\t\t <p>" . stripslashes($game["summary"]) . "</p>\n\t\t\t\t from <a data-toggle=\"modal\" href=\"#viewSelfProfileModal\" class=\"modalButton\" target=\"/viewProfileModal.php?login="******"personid"] . "\">" . $game["personid"] . "</a>\n\t\t\t\t </div>\n\t\t\t\t </div>\n\t\t\t\t <hr>\n\t\t\t\t </div>"; } else { foreach ($games["ocs"]["data"]["content"] as $game) { echo "\n\t\t\t\t<div class=\"span6\">\n\t\t\t\t<div class=\"row\">\n\t\t\t\t <div class=\"span2\"><img src=\"" . $game["preview1"] . "\"></div>\n\t\t\t\t <div class=\"span4\"><h3><a href=\"/game.php/id/" . stripslashes($game["id"]) . "/title/" . ERewriter::prettify(stripslashes($game["name"])) . "\">" . stripslashes($game["name"]) . "</a></h3>\n\t\t\t\t <div class=\"static-rating\" id=\"" . $game["score"] . "_" . $game["id"] . "\"></div>\n\t\t\t\t <p>" . stripslashes($game["summary"]) . "</p>\n\t\t\t\t from <a data-toggle=\"modal\" href=\"#viewSelfProfileModal\" class=\"modalButton\" target=\"/viewProfileModal.php?login="******"personid"] . "\">" . $game["personid"] . "</a>\n\t\t\t\t </div>\n\t\t\t\t </div>\n\t\t\t\t <hr>\n\t\t\t\t </div>"; } } } else { echo "Nothing found :("; } EStructure::insert("game_list");
<?php include "gfx3/lib.php"; $aResponse['error'] = false; $aResponse['message'] = ''; if (isset($_POST['action'])) { if (htmlentities($_POST['action'], ENT_QUOTES, 'UTF-8') == 'rating') { $id = intval($_POST['idBox']); $rate = floatval($_POST['rate']); $postdata = array("vote" => $rate); $client = new OCSClient(); $client->set_auth_info(EUser::nick(), EUser::password()); $client->set_post_data($postdata); $result = $client->post("v1/content/vote/{$id}"); if ($result["ocs"]["status"] == "ok") { $success = true; } else { $success = false; } // json datas send to the js file if ($success) { $aResponse['message'] = 'Your rate has been successfuly recorded. Thanks for your rate :)'; echo json_encode($aResponse); } else { $aResponse['error'] = false; $aResponse['message'] = $client->get_last_raw_result(); echo json_encode($aResponse); } } else { $aResponse['error'] = true; $aResponse['message'] = '"action" post data not equal to \'rating\'';
<?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(); $login = EHeaderDataParser::db_post("login"); $password = EHeaderDataParser::db_post("password"); $email = EHeaderDataParser::db_post("email"); $firstname = EHeaderDataParser::db_post("firstname"); $lastname = EHeaderDataParser::db_post("lastname"); $postdata = array("login" => $login, "password" => $password, "email" => $email, "firstname" => $firstname, "lastname" => $lastname); $client = new OCSClient(EConfig::$data["ocs"]["host"]); $check = $client->post("v1/person/add", $postdata); if ($check["ocs"]["meta"]["statuscode"] == "100") { // add a post variable to be inserted EHeaderDataParser::add_post("tgroup", "user"); //wrapper $users = new EData("ocs_person"); $users->insert(array("login", "password", "email", "firstname", "lastname", "tgroup")); header("Location: {$prevpage}?e=Registration%20completed!"); } else { // redirecting to main page $message = $check["ocs"]["meta"]["message"]; $message = str_replace(" ", "%20", $message); header("Location: {$prevpage}?e=" . $message); }
public function getData() { $client = new OCSClient(); return $client->get($this->OCSCall); }