예제 #1
0
 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}");
 }
예제 #2
0
<?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    ";
예제 #3
0
파일: getcat.php 프로젝트: KDE/ocs-server
<?php

include "gfx3/lib.php";
$client = new OCSClient();
$categories = $client->get("v1/content/categories");
var_dump($categories);
예제 #4
0
 public function search()
 {
     $client = new OCSClient();
     $key = EHeaderDataParser::secure_post("searchInput");
     return $client->get("v1/content/data/?search={$key}");
 }
예제 #5
0
 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");
 }
예제 #6
0
<?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">
예제 #7
0
 public function getData()
 {
     $client = new OCSClient();
     return $client->get($this->OCSCall);
 }
예제 #8
0
파일: gamelist.php 프로젝트: KDE/ocs-server
$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");
EStructure::unload();
예제 #9
0
파일: game.php 프로젝트: KDE/ocs-server
<?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();
예제 #10
0
 public function getUserData($pagenumber)
 {
     $user = new OCSClient();
     $name = $_COOKIE["login"];
     return $user->get("v1/content/data/?user={$name}&page={$pagenumber}");
 }