예제 #1
0
  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();
  }
예제 #2
0
  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();
  }
  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)
  {
    $post = array();

    global $REQUESTTYPES;
    if ($REQUESTTYPES[ $_POST["requestType"] ])
    {
      $error = $REQUESTTYPES[ $_POST["requestType"] ]::ValidateRequest($data,$post);
      if ($error) return $error;
    }
    else
    {
      return array("no such request type!");
    }
    $a = array();
    $a["requestType"] = $data["requestType"];
    if($_REQUEST["prod"])
    {
      $a["itemID"] = (int)$_REQUEST["prod"];
      $a["itemType"] = "prod";
    }
    $a["requestDate"] = date("Y-m-d H:i:s");
    $a["userID"] = get_login_id();

    $a["requestBlob"] = serialize($post);

    global $reqID;
    $reqID = SQLLib::InsertRow("modification_requests",$a);

    return array();
  }
예제 #5
0
 function Create() {
   $a = array();
   $a["id"] = $this->id;
   $a["nickname"] = $this->nickname;
   $a["avatar"] = $this->avatar;
   $a["registerDate"] = date("Y-m-d H:i:s");
   $a["lastip"] = $_SERVER["REMOTE_ADDR"];
   $a["lasthost"] = gethostbyaddr($_SERVER["REMOTE_ADDR"]);
   SQLLib::InsertRow("users",$a);
 }
예제 #6
0
  function Commit( $data )
  {
    $a = array();
    $a["name"] = trim($data["name"]);
    $a["desc"] = $data["desc"];
    $a["upkeeper"] = get_login_id();
    $a["addedUser"] = get_login_id();
    $a["addedDate"] = date("Y-m-d H:i:s");
    $this->listID = SQLLib::InsertRow("lists",$a);

    return array();
  }
  function Commit( $data )
  {
    $a = array();
    $a["download"] = trim($data["download"]);
    $a["csdb"] = $data["csdbID"];
    //$a["zxdemo"] = $data["zxdemoID"];
    $a["demozoo"] = $data["demozooID"];
    $a["slengpung"] = $data["slengpungID"];
    $a["artcity"] = $data["artcity"];
    SQLLib::InsertRow("partylinks",$a);

    return array();
  }
예제 #8
0
  function Commit($data)
  {
    global $currentUser;

    $filename = strtolower( basename( $_FILES["logo"]["name"] ) );

    move_uploaded_file_fake( $_FILES["logo"]["tmp_name"], POUET_CONTENT_LOCAL . "/logos/".$filename );

    $a = array();
    $a["author1"] = $currentUser->id;
    $a["author2"] = NULL;
    $a["file"] = $filename;
    SQLLib::InsertRow("logos",$a);

    return array();
  }
  function Commit($post)
  {
    global $currentUser;
    $message = trim($post["message"]);

  	$a = array();
  	$a["who"] = $currentUser->id;
  	$a["addedDate"] = date("Y-m-d H:i:s");
  	$a["message"] = $message;

    SQLLib::InsertRow("oneliner",$a);

    $this->ForceCacheUpdate();

    return array();
  }
예제 #10
0
  function Commit($data)
  {
    global $groupID;

    $a = array();
    $a["name"] = trim($data["name"]);
    $a["acronym"] = $data["acronym"];
    $a["web"] = $data["website"];
    $a["addedUser"] = get_login_id();
    $a["csdb"] = $data["csdbID"];
    //$a["zxdemo"] = $data["zxdemoID"];
    $a["demozoo"] = $data["demozooID"];
    $a["addedDate"] = date("Y-m-d H:i:s");
    $this->groupID = SQLLib::InsertRow("groups",$a);

    return array();
  }
예제 #11
0
  function ParsePostMessage($post)
  {
    global $currentUser;
    if (!$currentUser)
      return "you have to be logged in!";

    if (!$currentUser->CanPostInBBS())
      return "not allowed lol.";

    $message = trim($post["message"]);
    if (!$message)
      return "not too meaningful, is it...";

    $title = trim($post["topic"]);
    if (strlen($title) < 2)
      return "not too meaningful, is it...";

    $r = SQLLib::SelectRow(sprintf_esc("SELECT id FROM bbs_topics where topic='%s'",$title));
    if ($r)
      return "DOUBLEPOST == ROB IS JARIG";

  	$a = array();
  	$a["topic"] = $title;
  	$a["category"] = $post["category"];
  	$a["userfirstpost"] = $a["userlastpost"] = get_login_id();
  	$a["firstpost"] = $a["lastpost"] = date("Y-m-d H:i:s");

    $id = SQLLib::InsertRow("bbs_topics",$a);

  	$a = array();
  	$a["added"] = date("Y-m-d H:i:s");
  	$a["author"] = get_login_id();
  	$a["post"] = $message;
  	$a["topic"] = $id;

    SQLLib::InsertRow("bbs_posts",$a);

    @unlink("cache/pouetbox_latestbbs.cache");

    return "";

  }
예제 #12
0
  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();
  }
예제 #13
0
  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();
  }
예제 #14
0
  function Commit( $data )
  {
    global $currentUser;
    
    $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"]);

    $a["addedUser"] = $currentUser->id;
    $a["addedDate"] = date("Y-m-d H:i:s");

    $this->boardID = SQLLib::InsertRow("boards",$a);

    $data["platform"] = array_unique($data["platform"]);
    foreach($data["platform"] as $k=>$v)
    {
      $a = array();
      $a["board"] = $this->boardID;
      $a["platform"] = $v;
      SQLLib::InsertRow("boards_platforms",$a);
    }
    return array();
  }
예제 #15
0
파일: prod.php 프로젝트: neodyme60/pouet2.0
}

$csrf = new CSRFProtect();
if ($_POST["wlAction"] && $currentUser)
{
  if (!$csrf->ValidateToken())
    exit();
  
  if ($_POST["wlAction"]=="removeFromWatchlist")
  {
    SQLLib::Query(sprintf_esc("delete from watchlist where prodID = %d and userID = %d",$prodid,$currentUser->id));
  }
  else if ($_POST["wlAction"]=="addToWatchlist")
  {
    $a = array("prodID"=>$prodid,"userID"=>$currentUser->id);
    SQLLib::InsertRow("watchlist",$a);
  }
  if ($_POST["partial"])
  {
    $csrf->PrintToken();
    if ($_POST["wlAction"]=="addToWatchlist")
    {
      echo "<input type='hidden' name='wlAction' value='removeFromWatchlist'>";
      echo "<input type='submit' value='remove from watchlist' class='remove'/>";
    }
    else if ($_POST["wlAction"]=="removeFromWatchlist")
    {
      echo "<input type='hidden' name='wlAction' value='addToWatchlist'>";
      echo "<input type='submit' value='add to watchlist' class='add'/>";
    }
    exit();
예제 #16
0
  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();
  }
예제 #17
0
 function Commit($post)
 {
   $items = array("prod","group","party","user");
   $added = false;
   foreach($items as $v)
   {
     if ($post[$v."ID"])
     {
       $a = array();
       $a["list"] = $this->list->id;
       $a["type"] = $v;
       $a["itemid"] = $post[$v."ID"];
       SQLLib::InsertRow("listitems",$a);
       $added = true;
     }
   }
   return $added ? array() : array("you didn't add anything ! :(");
 }
예제 #18
0
if (get_login_id() && $_POST["logoID"] && $_POST["submit"])
{
  $vote = 0;
  if ($_POST["submit"] == "rulez") $vote = 1;
  if ($_POST["submit"] == "sucks") $vote = -1;

  $csrf = new CSRFProtect();
  if ($vote && $csrf->ValidateToken())
  {
    SQLLib::Query(sprintf_esc("delete from logos_votes where logo = %d and user = %d",$_POST["logoID"],$currentUser->id));

    $a = array();
    $a["logo"] = (int)$_POST["logoID"];
    $a["user"] = $currentUser->id;
    $a["vote"] = $vote;
    SQLLib::InsertRow("logos_votes",$a);
  }

  SQLLib::Query(sprintf_esc("update logos set vote_count = (select sum(vote) from logos_votes where logo = %d) where id = %d",(int)$_POST["logoID"],(int)$_POST["logoID"]));

  // ajax
  if ($_POST["partial"]==1)
  {
    $s = clone $sel;
    $visibleLogos = $_POST["visibleLogos"];
    foreach($visibleLogos as $k=>$v) $visibleLogos[$k] = (int)$v;
    $s->AddWhere(sprintf_esc("logos.id not in (%s)",implode(",",$visibleLogos)));
    $s->SetLimit(1);
    $logo = SQLLib::SelectRow($s->GetQuery());

    if ($logo)
예제 #19
0
 static function Process($itemID, $reqData)
 {
   $a = array();
   $a["prodID"] = $itemID;
   $a["userID"] = $reqData["userID"];
   $a["role"] = $reqData["userRole"];
   SQLLib::InsertRow("credits",$a);
   return array();
 }
예제 #20
0
  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();
  }
예제 #21
0
function gloperator_log( $itemType, $itemID, $action, $additionalData = array() )
{
  global $currentUser;

  $sql = array();
  $sql["gloperatorID"] = $currentUser->id;
  $sql["itemID"] = $itemID;
  $sql["itemType"] = $itemType;
  $sql["action"] = $action;
  $sql["date"] = date("Y-m-d H:i:s");
  $sql["additionalData"] = json_encode($additionalData);
  SQLLib::InsertRow("gloperator_log",$sql);
}
예제 #22
0
  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();
  }
예제 #23
0
 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);
 }
예제 #24
0
  function Commit($data)
  {
    //////////////////////////////////////////////////////////////////
    // everything has been validated (..., the new album by BT!)

    $a = array();
    $a["name"] = $data["name"];
    $a["download"] = $data["download"];

    $a["addedUser"] = get_login_id();
    $a["addedDate"] = date("Y-m-d H:i:s");

    if( $data["releaseDate_year"] && $data["releaseDate_month"] && checkdate( (int)$data["releaseDate_month"], 15, (int)$data["releaseDate_year"]) )
      $a["releaseDate"] = sprintf("%04d-%02d-15",$data["releaseDate_year"],$data["releaseDate_month"]);
    else if ($data["releaseDate_year"])
      $a["releaseDate"] = sprintf("%04d-00-15",$data["releaseDate_year"]);

    $a["type"] = implode(",",$data["type"]);

    $groups = array();
    if ($data["group1"]) $groups[] = (int)$data["group1"];
    if ($data["group2"]) $groups[] = (int)$data["group2"];
    if ($data["group3"]) $groups[] = (int)$data["group3"];
    $groups = array_unique($groups);
    $a["group1"] = nullify( array_shift($groups) );
    $a["group2"] = nullify( array_shift($groups) );
    $a["group3"] = nullify( array_shift($groups) );

    $a["csdb"] = $data["csdbID"];
    //$a["sceneorg"] = $data["sceneOrgID"];
    //$a["zxdemo"] = $data["zxdemoID"];
    $a["demozoo"] = $data["demozooID"];
    $a["party"] = nullify($data["partyID"]);
    $a["party_year"] = $data["partyYear"];
    $a["party_compo"] = nullify($data["partyCompo"]);
    $a["party_place"] = $data["partyRank"];
    $a["invitation"] = nullify($data["invitationParty"]);
    $a["invitationyear"] = $data["invitationYear"];
    $a["boardID"] = nullify($data["boardID"]);

    $this->prodID = SQLLib::InsertRow("prods",$a);

    $data["platform"] = array_unique($data["platform"]);
    foreach($data["platform"] as $k=>$v)
    {
      $a = array();
      $a["prod"] = $this->prodID;
      $a["platform"] = $v;
      SQLLib::InsertRow("prods_platforms",$a);
    }

    if(is_uploaded_file($_FILES["screenshot"]["tmp_name"]))
    {
      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( $this->prodID, $extension ) );

      $a = array();
      $a["prod"] = $this->prodID;
      $a["user"] = get_login_id();
      $a["added"] = date("Y-m-d H:i:s");
      SQLLib::InsertRow("screenshots",$a);
    }
    if(is_uploaded_file($_FILES["nfofile"]["tmp_name"]))
    {
      move_uploaded_file_fake( $_FILES["nfofile"]["tmp_name"], get_local_nfo_path( $this->prodID ) );

      $a = array();
      $a["prod"] = $this->prodID;
      $a["user"] = get_login_id();
      $a["added"] = date("Y-m-d H:i:s");
      SQLLib::InsertRow("nfos",$a);
    }

    @unlink("cache/pouetbox_latestadded.cache");
    @unlink("cache/pouetbox_latestreleased.cache");
    @unlink("cache/pouetbox_latestparties.cache");

    return array();
  }