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();
  }
Esempio n. 2
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();
  }
Esempio n. 3
0
  function Commit($data)
  {
    $filename = strtolower( basename( $_FILES["avatar"]["name"] ) );

    move_uploaded_file_fake( $_FILES["avatar"]["tmp_name"], POUET_CONTENT_LOCAL . "avatars/".$filename );

    return array();
  }
Esempio n. 4
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();
  }
Esempio n. 5
0
  function Commit($data)
  {
    //die("almost there");
    $a = array();
    $a["name"] = $data["name"];
    $a["download"] = $data["download"];

    if ($data["releaseDate_month"] && $data["releaseDate_year"] && 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"]);
    else
      $a["releaseDate"] = null;

    $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);
    if (count($groups)) $a["group1"] = array_shift($groups); else $a["group1"] = null;
    if (count($groups)) $a["group2"] = array_shift($groups); else $a["group2"] = null;
    if (count($groups)) $a["group3"] = array_shift($groups); else $a["group3"] = null;

    $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"]);
    global $prodID;
    SQLLib::UpdateRow("prods",$a,"id=".(int)$this->id);

    $data["platform"] = array_unique($data["platform"]);
    SQLLib::Query(sprintf_esc("delete from prods_platforms where prod = %d",(int)$this->id));
    foreach($data["platform"] as $v)
    {
      $a = array();
      $a["prod"] = (int)$this->id;
      $a["platform"] = $v;
      SQLLib::InsertRow("prods_platforms",$a);
    }

    if ($data["screenshot_delete"])
    {
      SQLLib::Query(sprintf_esc("delete from screenshots where prod = %d",$this->id));
      foreach( array( "jpg","gif","png" ) as $v )
        @unlink( get_local_screenshot_path( (int)$this->id, $v ) );
    }
    else
    {
      if(is_uploaded_file($_FILES["screenshot"]["tmp_name"]))
      {
        foreach( array( "jpg","gif","png" ) as $v )
          @unlink( get_local_screenshot_path( (int)$this->id, $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;
        }
        if ($extension != "_")
          move_uploaded_file_fake( $_FILES["screenshot"]["tmp_name"], get_local_screenshot_path( (int)$this->id, $extension ) );
      }
    }    
    
    if ($data["nfofile_delete"])
    {
      SQLLib::Query(sprintf_esc("delete from nfos where prod = %d",$this->id));
      unlink( get_local_nfo_path( (int)$this->id ) );
    }
    else
    {
      if(is_uploaded_file($_FILES["nfofile"]["tmp_name"]))
      {
        move_uploaded_file_fake( $_FILES["nfofile"]["tmp_name"], get_local_nfo_path( (int)$this->id ) );
      }
    }

    gloperator_log( "prod", (int)$this->id, "prod_edit" );
    
    SQLLib::Query(sprintf_esc("delete from prods_linkcheck where prodID = %d",$this->id));

    return array();
  }
Esempio n. 6
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();
  }