Пример #1
0
 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
     }
 }
Пример #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
<?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\'';
Пример #4
0
<?php

include "gfx3/lib.php";
$prevpage = EPageProperties::get_previous_page();
EUser::logout();
header("Location: {$prevpage}");
Пример #5
0
 public static function refresh()
 {
     $r = EDatabase::q("SELECT * FROM ocs_person WHERE login='******' AND password='******' LIMIT 1");
     while ($row = mysql_fetch_array($r)) {
         EUser::$nick = $_SESSION['nick'] = $row['login'];
         EUser::$id = $_SESSION['id'] = $row['id'];
         EUser::$group = $_SESSION['group'] = $row['tgroup'];
         EUser::$logged = true;
         EUser::$mail = $_SESSION['mail'] = $row['email'];
     }
     return EUser::$logged();
 }
Пример #6
0
<?php

//loading EUser
if (!EUser::logged()) {
    $output = "\n\t<li class=\"dropdown\">\n    <a href=\"#\"\n    class=\"dropdown-toggle\"\n    data-toggle=\"dropdown\">\n    Account\n    <b class=\"caret\"></b>\n    </a>\n    <ul class=\"dropdown-menu\">\n    <li><a data-toggle=\"modal\" href=\"#loginModal\" id=\"loginButton\" class=\"modalButton\" target=\"/loginModal.php\">Login</a></li>\n    <li class=\"divider\"></li>\n    <li><a data-toggle=\"modal\" href=\"#registerModal\" id=\"registerButton\" class=\"modalButton\" target=\"/registerModal.php\">Register</a></li>\n    <li><a href=\"#\">Forgot password</a></li>\n    </ul>\n    </li>\n    \n    <div class=\"modal hide\" id=\"loginModal\">\n    </div>\n    \n    <div class=\"modal hide\" id=\"registerModal\">\n    </div>\n    ";
} else {
    $output = "\n\t<li class=\"dropdown\">\n    <a href=\"#\"\n    class=\"dropdown-toggle\"\n    data-toggle=\"dropdown\">\n    Welcome " . EUser::nick() . "!\n    <b class=\"caret\"></b>\n    </a>\n    <ul class=\"dropdown-menu\">\n    <li><a href=\"/gamelist.php/user/" . EUser::nick() . "\">My games</a></li>\n    <li><a data-toggle=\"modal\" href=\"#addGameModal\" class=\"modalButton\" target=\"/addGameModal.php\">Add game</a></li>\n    <li class=\"divider\"></li>\n    <li><a data-toggle=\"modal\" href=\"#viewSelfProfileModal\" class=\"modalButton\" target=\"/viewProfileModal.php?id=" . EUser::id() . "\">View profile</a></li>\n    <li class=\"divider\"></li>\n    <li><a href=\"/logout.php\">Logout</a></li>\n    </ul>\n    </li>\n    \n    <div class=\"modal hide\" id=\"viewSelfProfileModal\"></div>\n    <div class=\"modal hide\" id=\"addGameModal\"></div>\n    \n\t";
}
echo "<div class=\"modal hide\" id=\"genericModal\"></div>";
echo $output;
Пример #7
0
<?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());
Пример #8
0
<?php

include "gfx3/lib.php";
$prevpage = EPageProperties::get_previous_page();
$login = EHeaderDataParser::db_post("login");
$password = EHeaderDataParser::db_post("password");
$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);
    header("Location: {$prevpage}?e=Logged!");
}
Пример #9
0
<?php

include "gfx3/lib.php";
$id = EHeaderDataParser::db_get("id");
$users = new EData("users");
$user_info = $users->find("firstname,lastname,email,password", "where id=" . EUser::id() . "");
$user_info = $user_info[0];
//taking first element
echo "\n<div class=\"modal-header\">\n    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×</button>\n    <h3>Edit personal info of " . $user_info["firstname"] . " " . $user_info["lastname"] . "</h3>\n</div>\n\n    <form class=\"form-horizontal\" action=\"updateprofileinfo.php\" target=\"_self\" method=\"post\">\n    <div class=\"modal-body\">\n    <fieldset>\n    \n    <div class=\"control-group\">\n    <label class=\"control-label\" for=\"password\">Password</label>\n    <div class=\"controls\">\n    <input type=\"password\" name=\"password\" class=\"input-xlarge\" id=\"password\" value=\"" . $user_info["password"] . "\">\n    <input type=\"hidden\" name=\"id\" value=\"" . EUser::id() . "\">\n    <p class=\"help-block\">* must be a minimum of 8 characters</p>\n    </div>\n    </div>\n    \n    <div class=\"control-group\">\n    <label class=\"control-label\" for=\"email\">E-Mail</label>\n    <div class=\"controls\">\n    <input type=\"text\" name=\"email\" class=\"input-xlarge\" id=\"email\" value=" . $user_info["email"] . ">\n    <p class=\"help-block\">* must be a valid email</p>\n    </div>\n    </div>\n    \n    <div class=\"control-group\">\n    <label class=\"control-label\" for=\"firstname\">Firstname</label>\n    <div class=\"controls\">\n    <input type=\"text\" name=\"firstname\" class=\"input-xlarge\" id=\"firstname\" value=" . $user_info["firstname"] . ">\n    </div>\n    </div>\n    \n    <div class=\"control-group\">\n    <label class=\"control-label\" for=\"lastname\">Lastname</label>\n    <div class=\"controls\">\n    <input type=\"text\" name=\"lastname\" class=\"input-xlarge\" id=\"lastname\" value=" . $user_info["lastname"] . ">\n    </div>\n    </div>\n    \n    </fieldset>\n    \n    \n    </div>\n    <div class=\"modal-footer\" style=\"background-color:#FFFFFF;\">\n    <input type=\"submit\" class=\"btn btn-primary\" value=\"Save\">\n    </div>\n    \n    </form>\n\n    ";