コード例 #1
0
ファイル: editGameModal.php プロジェクト: KDE/ocs-server
<?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    ";
コード例 #2
0
ファイル: editGameAction.php プロジェクト: KDE/ocs-server
<?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}");
}
コード例 #3
0
ファイル: steps.controller.php プロジェクト: KDE/ocs-server
 public function step2()
 {
     EStructure::view("header");
     if ($this->arg_key('save')) {
         $ocsserver_path = ELoader::$prev_path . '/config/ocsserver.conf.php';
         $cf = new EConfigFile();
         $cf->set_abs_file($ocsserver_path);
         $name = $cf->get('name');
         $host = $cf->get('host');
         $website = $cf->get('website');
         $contact = $cf->get('contact');
         $location = $cf->get('location');
         $ssl = $cf->get('ssl');
         $format = $cf->get('format');
         $termsofuse = $cf->get('termsofuse');
         $register = $cf->get('register');
         $version = $cf->get('version');
         $serverid = $cf->get('serverid');
         $provider = OCSXML::generate_providers($serverid, $name, $location, $termsofuse, $register, $ssl = false);
         $provider_path = ELoader::$prev_path . '/providers.xml';
         $stream = fopen($provider_path, 'w');
         fwrite($stream, $provider);
         fclose($stream);
         EStructure::view('wizard/step2save');
     }
     $serverid = EHeaderDataParser::post('serverid');
     $name = EHeaderDataParser::post('name');
     $host = EHeaderDataParser::post('host');
     $website = EHeaderDataParser::post('website');
     $location = EHeaderDataParser::post('location');
     $termsofuse = EHeaderDataParser::post('termsofuse');
     $register = EHeaderDataParser::post('register');
     $contact = EHeaderDataParser::post('contact');
     $ssl = EHeaderDataParser::post('ssl');
     $format = EHeaderDataParser::post('format');
     $version = OCSUser::version();
     //try to guess correct values
     if (empty($host)) {
         $host = $_SERVER["SERVER_NAME"];
     }
     if (empty($website)) {
         $website = EUtility::get_domain($host);
     }
     if (empty($name)) {
         $name = ucfirst(EUtility::get_clear_domain($host)) . ' OCS Server';
     }
     if (empty($serverid)) {
         $serverid = 'ocs_' . EUtility::get_clear_domain($host);
     }
     if (empty($location)) {
         $location = 'http://' . ELoader::$root_path . '/v1/';
     }
     if ($ssl == 'yes') {
         $location = str_replace('http://', 'https://', $location);
     } else {
         $location = str_replace('https://', 'http://', $location);
     }
     //initialize everything to empty string
     $ssly = '';
     $ssln = '';
     $jsony = '';
     $jsonn = '';
     //set the correct value for each menu
     if ($ssl == 'yes') {
         $ssly = 'selected';
     } else {
         $ssln = 'selected';
     }
     if ($format == 'json') {
         $jsony = 'selected';
     } else {
         $jsonn = 'selected';
     }
     $ocsserver_path = ELoader::$prev_path . '/config/ocsserver.conf.php';
     $cf = new EConfigFile();
     $cf->set_abs_file($ocsserver_path);
     $cf->set('name', $name);
     $cf->set('host', $host);
     $cf->set('website', $host);
     $cf->set('contact', $contact);
     $cf->set('location', $location);
     $cf->set('ssl', $ssl);
     $cf->set('format', $format);
     $cf->set('termsofuse', $termsofuse);
     $cf->set('register', $register);
     $cf->set('version', $version);
     $cf->set('serverid', $serverid);
     $cf->save();
     $data = array();
     $data['serverid'] = $serverid;
     $data['name'] = $name;
     $data['website'] = $website;
     $data['host'] = $host;
     $data['location'] = $location;
     $data['termsofuse'] = $termsofuse;
     $data['register'] = $register;
     $data['contact'] = $contact;
     $data['ssln'] = $ssln;
     $data['ssly'] = $ssly;
     $data['jsonn'] = $jsonn;
     $data['jsony'] = $jsony;
     $data['exampleprovider'] = htmlspecialchars(OCSXML::generate_providers($serverid, $name, $location, $termsofuse, $register, $ssl = false), ENT_QUOTES);
     //performing /v1/config get request
     $s = new ENetworkSocket($location);
     EUtility::hide_output();
     $c = $s->get('config');
     if (empty(EUtility::show_output())) {
         $data['configcall'] = htmlspecialchars($c);
     } else {
         $data['configcall'] = 'We couldn\'t connect to OCS server. Check SSL settings and server location entries.';
     }
     EStructure::view('wizard/step2', $data);
     EStructure::view("footer");
 }
コード例 #4
0
ファイル: game.php プロジェクト: KDE/ocs-server
    $client->set_auth_info(EUser::nick(), EUser::password());
    $isfan = $client->get("v1/fan/status/{$gameid}");
    if ($isfan["ocs"]["data"]["status"] == "notfan") {
        echo "<a class=\"btn btn-success\" href=\"/becomeFan.php?id={$gameid}\"><i class=\"icon-thumbs-up icon-white\"></i> Like this!</a>";
    } else {
        echo "<a class=\"btn btn-success\" href=\"/removeFan.php?id={$gameid}\"><i class=\"icon-thumbs-down icon-white\"></i> Don't like \nthis!</a>";
    }
} else {
    echo "<a class=\"btn btn-success\" href=\"#\"><i class=\"icon-thumbs-up icon-white\"></i> Log in to vote!</a>";
}
EStructure::insert("becomefan_button");
EStructure::code();
$score = $data["ocs"]["data"]["content"]["score"];
echo "<div class=\"dynamic-rating\" id=\"" . $score . "_" . $gameid . "\"></div>";
EStructure::insert("setscore_button");
EStructure::code();
$score = $data["ocs"]["data"]["content"]["score"];
echo "<div class=\"static-rating\" id=\"" . $score . "_" . $gameid . "\"></div>";
EStructure::insert("averagescore");
EStructure::code();
$comments = $client->get("v1/comments/data/1/{$gameid}/1&page=1&pagesize=10");
if (isset($comments["ocs"]["data"]["comment"])) {
    foreach ($comments["ocs"]["data"]["comment"] as $comment) {
        echo "<div class=\"span6 columns\">\n\t\t\t\t<h4>" . EUtility::stripslashes($comment["subject"]) . "</h4>\n\t\t\t\t<div class=\"span6\">" . EUtility::stripslashes($comment["text"]) . "</div>\n\t\t\t\twritten by <a data-toggle=\"modal\" href=\"#viewSelfProfileModal\" class=\"modalButton bold\" target=\"/viewProfileModal.php?login="******"user"] . "\">" . $comment["user"] . "</a>\n\t\t\t\t<hr>\n\t\t\t\t</div>";
    }
} else {
    echo "No comments found :(.";
}
echo "<div class=\"span6 columns\">\n\t<form class=\"form-vertical\" action=\"/addComment.php\" target=\"_self\" method=\"post\">\n\t<table style=\"width:100%\">\n    <tr><td><input type=\"hidden\" name=\"type\" value=\"1\">\n    <input type=\"hidden\" name=\"content\" value=\"{$gameid}\">\n    <input type=\"hidden\" name=\"content2\" value=\"1\">\n    <input type=\"hidden\" name=\"parent\" value=\"0\">\n    <input type=\"text\" name=\"subject\" placeholder=\"Subject\" style=\"width:100%\"></td></tr>\n    <br>\n    <tr><td><textarea name=\"message\" class=\"input-xlarge\" style=\"width:100%\"></textarea><br></td></tr>\n    <tr><td><input type=\"submit\" class=\"btn btn-warning\" value=\"Write\"></td></tr>\n    </table>\n    </form>\n\t</div>";
EStructure::insert("game_comments");
EStructure::unload();