示例#1
0
  function Commit($data)
  {
    if ($data["delParty"])
    {
      SQLLib::Query("delete from prodotherparty where id=".(int)$data["delParty"]);
      gloperator_log( "prod", (int)$this->prod->id, "prod_party_del" );
      return array();
    }

    $a = array();
    $a["party"] = $data["partyID"];
    $a["party_year"] = $data["partyYear"];
    $a["party_place"] = $data["partyPlace"];
    $a["party_compo"] = nullify($data["partyCompo"]);
    if ($data["editPartyID"])
    {
      SQLLib::UpdateRow("prodotherparty",$a,"id=".(int)$data["editPartyID"]);
      $a["id"] = $data["editPartyID"];
      gloperator_log( "prod", (int)$this->prod->id, "prod_party_edit", array("id"=>$a["id"]) );
    }
    else
    {
      $a["prod"] = $this->prod->id;
      $a["id"] = SQLLib::InsertRow("prodotherparty",$a);
      gloperator_log( "prod", (int)$this->prod->id, "prod_party_add", array("id"=>$a["id"]) );
    }
    if ($data["partial"])
    {
      $o = toObject($a);
      $o->party = PouetParty::Spawn($a["party"]);
      $this->RenderNormalRow($o);
      $this->RenderNormalRowEnd($o);
      exit();
    }
    return array();
  }
示例#2
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();
  }
示例#3
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();
  }