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"]; } }
public function register() { $mail = EHeaderDataParser::db_get("mail"); $nick = EHeaderDataParser::db_get("nick"); $res = $this->find("verified", "where mail=\"" . $mail . "\" LIMIT 1"); if (isset($res[0])) { if ($res[0]["verified"] == "yes") { return 101; } } $res = $this->find("verified", "where nick=\"" . $nick . "\" LIMIT 1"); if (isset($res[0])) { if ($res[0]["verified"] == "yes") { return 102; } } $this->delete("mail=\"" . $mail . "\""); $this->insert(array("nick", "pass", "mail", "verified")); return 100; }
public function categories($args) { EStructure::view("header"); $categories_path = ELoader::$prev_path . '/config/ocs_categories.conf.php'; $cf = new EConfigFile(); $cf->set_abs_file($categories_path); //$cf->del('4'); //$cf->save(); if (isset($args[0])) { $key = EHeaderDataParser::get('key'); $value = EHeaderDataParser::get('value'); if (!empty($key)) { if ($args[0] == 'mod') { $cf->set($key, $value); $cf->save(); header("location: /admin/status/categories"); } if ($args[0] == 'del') { $cf->del($key); $cf->save(); header("location: /admin/status/categories"); } } } echo '<h3>Categories</h3>'; echo '<p>Current OCS categories on server:</p>'; $data = $cf->get_data(); echo "<ul>"; foreach ($data as $key => $value) { echo "<li>{$key} | {$value}</li>"; } echo "</ul>"; echo ' <form action="/admin/status/categories/mod" method="get"> <input type="text" name="key" placeholder="key"><input type="text" name="value" placeholder="value"> <input type="submit" value="modify/add category"></form> '; echo ' <form action="/admin/status/categories/del" method="get"> <input type="text" name="key" placeholder="key"> <input type="submit" value="delete category"></form> '; EStructure::view("footer"); }
//including all modules ELoader::loadAllModules(); //loading current website configuration EConfig::load(); //protecting whole website with auth and enabled EProtect::load(); //rewrite url if needed if (EConfig::$data['generic']['rewrite'] == "yes") { ERewriter::enable(); ERewriter::load(); } else { ERewriter::disable(); } //loading get/post if (EConfig::$data['generic']['protectheaders'] == "yes") { EHeaderDataParser::load(); } //loading database if (EConfig::$data['generic']['database'] == "yes") { EDatabase::load(); } //loading user system if (EConfig::$data['generic']['users'] == "yes") { OCSUser::client_login(); } //rendering the page if (EConfig::$data['generic']['mvc'] == "yes") { if (EConfig::$data['generic']['rewrite'] == "yes") { EStructure::render(); //rendering default page } else {
<?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}"); }
<?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"; $idcontent = EHeaderDataParser::db_get("id"); $n = EHeaderDataParser::db_get("n"); echo "<div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×</button>\n <h3>Upload a screenshot</h3>\n </div>\n \n <form class=\"form-horizontal\" action=\"/addScreenShotGameAction.php\" enctype=\"multipart/form-data\" target=\"_self\" method=\"post\">\n <div class=\"modal-body\">\n <fieldset>\n \n <div class=\"control-group\">\n <label class=\"control-label\" for=\"name\">Image</label>\n <div class=\"controls\">\n <input type=\"file\" name=\"localfile\" class=\"input-xlarge\" id=\"localfile\">\n <input type=\"hidden\" name=\"idcontent\" class=\"input-xlarge\" id=\"idcontent\" value=\"{$idcontent}\">\n <input type=\"hidden\" name=\"number\" class=\"input-xlarge\" id=\"number\" value=\"{$n}\">\n <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"10000000\" /> \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>";
<?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!"); }
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(); $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); }
<?php include "gfx3/lib.php"; EStructure::load("gamelist"); $from = EHeaderDataParser::db_get("from"); $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>"; }
public function step3() { if ($this->arg_key('save')) { $pass1 = EHeaderDataParser::post('pass'); $pass2 = EHeaderDataParser::post('pass2'); if ($pass1 == $pass2) { $cf = new EConfigFile('generic'); $cf->set('password', $pass1); $cf->set('enabled', 'protected'); $cf->save(); } EStructure::view('wizard/step3save'); } else { $data = array(); if (isset(EConfig::$data['generic']['password'])) { $data['pass'] = EConfig::$data['generic']['password']; } else { $data['pass'] = ''; } EStructure::view('wizard/step3', $data); } }
<?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"; $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"; if (EHeaderDataParser::exists_get("id")) { $id = EHeaderDataParser::db_get("id"); $users = new EData("ocs_person"); $user_info = $users->find("firstname,lastname,email,login", "where id={$id} limit 1"); $user_info = $user_info[0]; //taking first element } elseif (EHeaderDataParser::exists_get("login")) { $login = EHeaderDataParser::db_get("login"); $users = new EData("ocs_person"); $user_info = $users->find("firstname,lastname,email,login", "where login='******' limit 1"); $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>Personal info of " . $user_info["firstname"] . " " . $user_info["lastname"] . "</h3>\n</div>\n\n <div class=\"modal-body\">\n <table class=\"mytable\">\n\t\t<tr><td>First Name:</td><td><span class=\"right\">" . $user_info["firstname"] . "</span></td></tr>\n\t\t<tr><td>Last Name:</td><td><span class=\"right\">" . $user_info["lastname"] . "</span></td></tr>\n\t\t<tr><td>User Name:</td><td><span class=\"right\">" . $user_info["login"] . "</span></td></tr>\n\t\t<tr><td>E-mail:</td><td><span class=\"right\">" . $user_info["email"] . "</span></td></tr>\n </table>\n <br>\n <a href=\"#\">Find all games from this user</a><br>\n\t<a href=\"#\">Find all games liked by this user</a>\n </div>\n \n <div class=\"modal-footer\" style=\"background-color:#F5F5F5;\">\n <a href=\"#\" class=\"btn\" data-dismiss=\"modal\">Close</a>\n </div>\n\n ";
<?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 ";
<?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); }
<?php include "gfx3/lib.php"; $label = EHeaderDataParser::get("label"); header("Location: /gamelist.php/label/{$label}");
<?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"); } }
public static function add_from_string($str) { $chunks = explode("&", $str); foreach ($chunks as $chunk) { $data = explode("=", $chunk); EHeaderDataParser::add_get($data[0], $data[1]); } }
<?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); }
public static function render($url = "") { //setting default if (empty($url)) { $url = $_SERVER['REQUEST_URI']; } //getting correct input $uri = explode("?", $url); //ignoring all normal get part as for now $input = trim($uri[0], "/"); $chunks = explode("/", $input); if (isset($chunks[0])) { $controller = $chunks[0]; unset($chunks[0]); } if (isset($chunks[1])) { $method = $chunks[1]; unset($chunks[1]); } //building controller name $controller = ucfirst($controller) . "Controller"; $args = $chunks; $string_args = array(); //resetting array index and getting last element $args = array_values($args); $last = end($args); $extraargs = explode("?", $last); if (count($extraargs) >= 2) { unset($args[count($args) - 1]); //erase last raw unparsed element //add last element if (!empty($extraargs[1])) { $args[] = $extraargs[0]; } //manually injecting get data EHeaderDataParser::add_from_string($extraargs[1]); } /* TODO: reevaluate this //the final arrays cointains also the string version of the argument //eg. $args['save'] = 0; foreach($args as $arg){ $string_args[$arg] = 1; //just some random data } */ //checking if controller is available if (class_exists($controller)) { $current_controller = new $controller(); $current_controller->set_args($args); if (empty($method)) { if (method_exists($current_controller, 'index')) { $current_controller->index($chunks); } } else { if ($method[0] != '_') { //makes methods with _ not callable if (method_exists($current_controller, $method)) { $current_controller->{$method}($args); } else { ELog::warning($controller . "->" . $method . "() is not defined. Please define it."); } } } } else { ELog::warning($controller . " class is not defined. Please define it."); } }
public function update($where = "", $allowed_fields = array()) { if (!$this->is_ready_test()) { return; } //recupero le informazioni di where if (!empty($where)) { $where = " WHERE " . $where . " "; } //recupero le informazioni automaticamente if (!empty($allowed_fields)) { foreach ($this->fields as $field) { if ($field['field'] != "id") { if (EHeaderDataParser::exists_post($field['field']) and in_array($field['field'], $allowed_fields)) { $entries[] = array("field" => $field['field'], "value" => EHeaderDataParser::db_post($field['field']), "type" => $field['type']); } } } } else { foreach ($this->fields as $field) { if ($field['field'] != "id") { if (EHeaderDataParser::exists_post($field['field'])) { $entries[] = array("field" => $field['field'], "value" => EHeaderDataParser::db_post($field['field']), "type" => $field['type']); } } } } //costruisco la query ed eseguo se ho le informazioni in entries if (!empty($entries)) { $sql = "UPDATE " . $this->table . " SET "; foreach ($entries as $entry) { $sql = $sql . $entry['field'] . "="; if ($entry['type'] == "int") { if (!is_numeric($entry['value'])) { //data type error echo "<span style=\"font-family:Arial,sans-serif\">Warning! GFX3 <span style=\"color:red\">EData Object Error</span>: wrong data passed for <i><big>`" . $field['field'] . "`</big></i> with type `INT`! freezing...</span><br>"; die; } $sql = $sql . $entry['value'] . ","; } else { $sql = $sql . "'" . $entry['value'] . "',"; } } $sql = rtrim($sql, ",") . " {$where}"; if ($this->noquery == false) { EDatabase::q($sql); } else { echo $sql; } } else { //ELog::warning("EData->update called with empty entries"); } }
<?php if (EHeaderDataParser::out_get("e")) { $error = EHeaderDataParser::out_get("e"); echo "<script language=\"javascript\">\n\talert('" . $error . "');\n\t</script>"; }
public static function get_previous_page() { $prevpage = $_SERVER['HTTP_REFERER']; $prevpage = EHeaderDataParser::erase_get_data($prevpage); return $prevpage; }