function Commit($post) { $message = trim($post["message"]); $r = SQLLib::SelectRow("SELECT count(0) as c FROM bbs_posts WHERE topic=".$this->topic); $a = array(); $a["userlastpost"] = get_login_id(); $a["lastpost"] = date("Y-m-d H:i:s"); $a["count"] = $r->c; SQLLib::UpdateRow("bbs_topics",$a,"id=".$this->topic); $a = array(); $a["added"] = date("Y-m-d H:i:s"); $a["author"] = get_login_id(); $a["post"] = $message; $a["topic"] = $this->topic; SQLLib::InsertRow("bbs_posts",$a); @unlink("cache/pouetbox_latestbbs.cache"); return array(); }
function Commit($data) { global $partyID; $sql = array(); $sql["download"] = $data["download"]; $sql["csdb"] = $data["csdbID"]; $sql["slengpung"] = $data["slengpungID"]; //$sql["zxdemo"] = $data["zxdemoID"]; $sql["demozoo"] = $data["demozooID"]; $sql["artcity"] = $data["artcity"]; $links = SQLLib::selectRow(sprintf_esc("select * from partylinks where party = %d and year = %d",$this->id,$this->year)); if ($links) { SQLLib::UpdateRow("partylinks",$sql,sprintf_esc("party = %d and year = %d",$this->id,$this->year)); } else { $sql["party"] = $this->id; $sql["year"] = $this->year; SQLLib::InsertRow("partylinks",$sql); } if (is_uploaded_file($_FILES["results"]["tmp_name"])) { move_uploaded_file_fake($_FILES["results"]["tmp_name"],get_local_partyresult_path($this->id,$this->year)); } gloperator_log( "party", (int)$this->id, "party_edit_links", array("year"=>$this->year) ); return array(); }
function Commit($data) { global $currentUser; $a = array(); if ($currentUser->IsAdministrator() && array_search($data["level"],$this->levels)!==false) $a["level"] = $data["level"]; $a["permissionSubmitItems"] = $data["permissionSubmitItems"] == "on"; SQLLib::UpdateRow("users",$a,"id=".(int)$this->user->id); }
function Commit($data) { global $partyID; $a = array(); $a["name"] = trim($data["name"]); $a["web"] = $data["website"]; SQLLib::UpdateRow("parties",$a,"id=".$this->id); gloperator_log( "party", $this->id, "party_edit" ); return array(); }
function Commit($data) { global $groupID; $a = array(); $a["category"] = $data["category"]; $a["closed"] = $data["closed"]=="on"; SQLLib::UpdateRow("bbs_topics",$a,"id=".$this->topic->id); gloperator_log( "topic", $this->topic->id, "topic_edit" ); return array(); }
function Commit($data) { global $groupID; $a = array(); $a["name"] = trim($data["name"]); $a["acronym"] = $data["acronym"]; $a["web"] = $data["website"]; $a["csdb"] = $data["csdbID"]; // $a["zxdemo"] = $data["zxdemoID"]; $a["demozoo"] = $data["demozooID"]; SQLLib::UpdateRow("groups",$a,"id=".$this->id); gloperator_log( "group", $this->id, "group_edit" ); return array(); }
function Commit($data) { global $currentUser; $req = SQLLib::SelectRow(sprintf_esc("select itemID,requestType,requestBlob,approved from modification_requests where id = %d",$data["requestID"])); if ($req->approved !== NULL) return array("this request was already processed"); if ($data["requestDeny"]) { $a = array(); $a["gloperatorID"] = $currentUser->id; $a["approved"] = 0; $a["comment"] = $data["comment"]; $a["approveDate"] = date("Y-m-d H:i:s"); SQLLib::UpdateRow("modification_requests",$a,"id=".(int)$data["requestID"]); return array(); } $reqData = unserialize($req->requestBlob); global $REQUESTTYPES; if ($REQUESTTYPES[$req->requestType]) { $errors = $REQUESTTYPES[$req->requestType]::Process($req->itemID,$reqData); if ($errors) return $errors; gloperator_log( $REQUESTTYPES[$req->requestType]::GetItemType(), $req->itemID, $req->requestType, $reqData ); } else { return array("no such request type!"); } $a = array(); $a["gloperatorID"] = $currentUser->id; $a["approved"] = 1; $a["approveDate"] = date("Y-m-d H:i:s"); SQLLib::UpdateRow("modification_requests",$a,"id=".(int)$data["requestID"]); return array(); }
function Commit($data) { global $currentUser; $a = array(); $a["category"] = $data["category"]; $a["question"] = $data["question"]; $a["answer"] = $data["answer"]; $a["deprecated"] = $data["deprecated"] == "on"; if ($data["faqID"]) { //gloperator_log( "faq", $data["faqID"], "faq_edit" ); SQLLib::UpdateRow("faq",$a,"id=".(int)$data["faqID"]); } else { //gloperator_log( "faq", 0, "faq_add" ); SQLLib::InsertRow("faq",$a); } return array(); }
function Commit($data) { global $boardID; $a = array(); $a["name"] = trim($data["name"]); $a["sysop"] = trim($data["sysop"]); if( $data["started_year"] && $data["started_month"] && checkdate( (int)$data["started_month"], 15, (int)$data["started_year"]) ) $a["started"] = sprintf("%04d-%02d-15",$data["started_year"],$data["started_month"]); else if ($data["started_year"]) $a["started"] = sprintf("%04d-00-15",$data["started_year"]); if( $data["closed_year"] && $data["closed_month"] && checkdate( (int)$data["closed_month"], 15, (int)$data["closed_year"]) ) $a["closed"] = sprintf("%04d-%02d-15",$data["closed_year"],$data["closed_month"]); else if ($data["closed_year"]) $a["closed"] = sprintf("%04d-00-15",$data["closed_year"]); $a["phonenumber"] = trim($data["phonenumber"]); $a["telnetip"] = trim($data["telnetip"]); SQLLib::UpdateRow("boards",$a,"id=".$this->id); $data["platform"] = array_unique($data["platform"]); SQLLib::Query(sprintf_esc("delete from boards_platforms where board = %d",(int)$this->id)); foreach($data["platform"] as $v) { $a = array(); $a["board"] = (int)$this->id; $a["platform"] = $v; SQLLib::InsertRow("boards_platforms",$a); } gloperator_log( "board", $this->id, "board_edit" ); return array(); }
function Commit($data) { $this->LoadFromDB(); $prodID = (int)$this->prod->id; $sql = array(); if ($this->fields["releaseDate"]) { if ($data["releaseDate_month"] && $data["releaseDate_year"] && checkdate( (int)$data["releaseDate_month"], 15, (int)$data["releaseDate_year"]) ) $sql["releaseDate"] = sprintf("%04d-%02d-15",$data["releaseDate_year"],$data["releaseDate_month"]); else if ($data["releaseDate_year"]) $sql["releaseDate"] = sprintf("%04d-00-15",$data["releaseDate_year"]); else $sql["releaseDate"] = null; } if ($this->fields["partyCompo"]) $sql["party_compo"] = nullify($data["partyCompo"]); if ($this->fields["partyRank"]) $sql["party_place"] = $data["partyRank"]; if ($sql) SQLLib::UpdateRow("prods",$sql,"id=".$prodID); if ($this->fields["screenshot"]) { if(is_uploaded_file($_FILES["screenshot"]["tmp_name"])) { foreach( array( "jpg","gif","png" ) as $v ) @unlink( get_local_screenshot_path( $prodID, $v ) ); list($width,$height,$type) = GetImageSize($_FILES["screenshot"]["tmp_name"]); $extension = "_"; switch($type) { case 1:$extension="gif";break; case 2:$extension="jpg";break; case 3:$extension="png";break; } move_uploaded_file_fake( $_FILES["screenshot"]["tmp_name"], get_local_screenshot_path( $prodID, $extension ) ); $a = array(); $a["prod"] = $prodID; $a["user"] = get_login_id(); $a["added"] = date("Y-m-d H:i:s"); SQLLib::InsertRow("screenshots",$a); } } if ($this->fields["nfofile"]) { if(is_uploaded_file($_FILES["nfofile"]["tmp_name"])) { move_uploaded_file_fake( $_FILES["nfofile"]["tmp_name"], get_local_nfo_path( $prodID ) ); $a = array(); $a["prod"] = $prodID; $a["user"] = get_login_id(); $a["added"] = date("Y-m-d H:i:s"); SQLLib::InsertRow("nfos",$a); } } return array(); }
function GetSceneIDData( $cached = true ) { if ($cached) { if (time() - strtotime( $this->sceneIDLastRefresh ) < 60 * 60 * 12) { if ($this->sceneIDData) return unserialize( $this->sceneIDData ); } } /* if ((int)$rv["returnCode"] == 10) { //if ($cached) return $rv["user"]; } else { return NULL; } */ global $sceneID; try { //if (!get_login_id()) { $sceneID->GetClientCredentialsToken(); } $data = $sceneID->User( $this->id ); { SQLLib::UpdateRow("users",array( "sceneIDLastRefresh"=>date("Y-m-d H:i:s"), "sceneIDData"=>serialize($data["user"]) ),sprintf_esc("id=%d",$this->id)); } return $data; } catch(SceneID3Exception $e) { return die($e->getMessage()); } }
function Commit($data) { if ($data["delAffil"]) { SQLLib::Query("delete from affiliatedprods where id=".(int)$data["delAffil"]); gloperator_log( "prod", (int)$this->prod->id, "prod_rel_del" ); return array(); } list($direction,$type) = explode(":",$data["type"],2); $a = array(); $a["type"] = $type; $a["original"] = $direction == "o" ? $this->prod->id : $data["prod"]; $a["derivative"] = $direction == "d" ? $this->prod->id : $data["prod"]; if ($data["editAffilID"]) { SQLLib::UpdateRow("affiliatedprods",$a,"id=".(int)$data["editAffilID"]); $a["id"] = $data["editAffilID"]; gloperator_log( "prod", (int)$this->prod->id, "prod_rel_edit", array("id"=>$a["id"]) ); } else { $a["id"] = SQLLib::InsertRow("affiliatedprods",$a); gloperator_log( "prod", (int)$this->prod->id, "prod_rel_add", array("id"=>$a["id"]) ); } if ($data["partial"]) { $o = toObject($a); $o->prodOriginal = PouetProd::Spawn($a["original"]); $o->prodDerivative = PouetProd::Spawn($a["derivative"]); $this->RenderNormalRow($o); $this->RenderNormalRowEnd($o); exit(); } return array(); }
function Commit($data) { global $currentUser; global $currentUserSettings; global $ephemeralStorage; require_once("include_pouet/default_usersettings.php"); $a = get_object_vars( $DEFAULT_USERSETTINGS ); if (SQLLib::SelectRow(sprintf_esc("select id from usersettings where id=%d",(int)$currentUser->id))) SQLLib::UpdateRow("usersettings",$a,"id=".(int)$currentUser->id); else SQLLib::InsertRow("usersettings",array_merge(array("id"=>(int)$currentUser->id),$a) ); $currentUserSettings = $DEFAULT_USERSETTINGS; $ephemeralStorage->set( "settings:".$currentUser->id, $currentUserSettings ); return array(); }
static function UpdateOrInsertRow($table,$o,$where) { if (SQLLib::SelectRow(sprintf("SELECT * FROM %s WHERE %s",$table,$where))) return SQLLib::UpdateRow($table,$o,$where); else return SQLLib::InsertRow($table,$o); }
static function Process($itemID, $reqData) { $a = array(); $a["download"] = $reqData["downloadLink"]; SQLLib::UpdateRow("prods",$a,"id=".(int)$itemID); SQLLib::Query(sprintf_esc("delete from prods_linkcheck where prodID = %d",$itemID)); return array(); }
function Commit($post) { $message = trim($post["comment"]); $rating = $post["rating"]; if ($this->myVote) $rating = "isok"; // user already has a vote $vote = 0; switch($rating) { case "rulez": $vote = 1; break; case "sucks": $vote = -1; break; default: $vote = 0; break; } $a = array(); $a["addedDate"] = date("Y-m-d H:i:s"); $a["who"] = get_login_id(); $a["which"] = $this->prod; $a["comment"] = $message; $a["rating"] = $vote; SQLLib::InsertRow("comments",$a); $rulez=0; $piggie=0; $sucks=0; $total=0; $checktable = array(); $r = SQLLib::SelectRows("SELECT rating,who FROM comments WHERE which=".$this->prod); foreach ($r as $t) if(!array_key_exists($t->who, $checktable) || $t->rating != 0) $checktable[$t->who] = $t->rating; foreach($checktable as $k=>$v) { if($v==1) $rulez++; else if($v==-1) $sucks++; else $piggie++; $total++; } if ($total!=0) $avg = sprintf("%.2f",(float)($rulez*1+$sucks*-1)/(float)$total); else $avg = "0.00"; $a = array(); $a["voteup"] = $rulez; $a["votepig"] = $piggie; $a["votedown"] = $sucks; $a["voteavg"] = $avg; SQLLib::UpdateRow("prods",$a,"id=".$this->prod); @unlink("cache/pouetbox_latestcomments.cache"); @unlink("cache/pouetbox_topmonth.cache"); @unlink("cache/pouetbox_stats.cache"); return array(); }