Exemplo n.º 1
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();
  }
Exemplo n.º 2
0
  function LoadFromDB()
  {
    parent::LoadFromDB();

    $this->fields["name"]["value"] = $this->board->name;
    $this->fields["sysop"]["value"] = $this->board->sysop;
    $this->fields["phonenumber"]["value"] = $this->board->phonenumber;
    $this->fields["telnetip"]["value"] = $this->board->telnetip;
    $this->fields["started"]["value"] = $this->board->started;
    $this->fields["closed"]["value"] = $this->board->closed;

    $platforms = SQLLib::SelectRows(sprintf_esc("select * from boards_platforms where board = %d",$this->board->id));
    foreach($platforms as $v)
      $this->fields["platform"]["value"][] = $v->platform;
  }
Exemplo n.º 3
0
  function LoadFromDB()
  {
    global $currentUser;
    $ids = SQLLib::SelectRows(sprintf_esc("select prodID from watchlist where userID = %d",$currentUser->id));
    if (!count($ids)) return;
    
    $i = array();
    foreach($ids as $v) $i[] = $v->prodID;
  
    $s = new BM_Query("prods");
    $s->AddWhere( sprintf_esc("prods.id in (%s)",implode(",",$i) ) );
    $this->prods = $s->perform();

    PouetCollectPlatforms($this->prods);
  }
Exemplo n.º 4
0
 function LoadFromDB() {
   global $currentUser;
   if (!$currentUser) return;
   
   $ids = SQLLib::SelectRows(sprintf_esc("select prodID from watchlist where userID = %d",$currentUser->id));
   if (!count($ids)) return;
   
   $i = array();
   foreach($ids as $v) $i[] = $v->prodID;
   
   $s = new BM_Query();
   //$s->AddTable(sprintf_esc("(select * from comments where comments.which in (%s) order by comments.addedDate desc) as c ",implode(",",$i)));
   $s->AddTable(sprintf_esc("(select *, max(comments.addedDate) as maxDate from comments where comments.which in (%s) group by comments.which) as c ",implode(",",$i)));
   $s->AddJoin("left","comments","c.maxDate = comments.addedDate and c.which = comments.which");
   $s->attach(array("comments"=>"which"),array("prods as prod"=>"id"));
   $s->attach(array("comments"=>"who"),array("users as user"=>"id"));
   //$s->AddGroup("c.which");
   $s->AddOrder("comments.addedDate desc");
   $s->AddField("comments.id as commentID");
   $s->SetLimit((int)$this->limit);
   $this->data = $s->perform();
 }
Exemplo n.º 5
0
  function LoadFromDB() 
  {
    $this->board = SQLLib::SelectRow(sprintf_esc("select * from boards where id = %d",$this->id));
    if (!$this->board) return;

    $a = SQLLib::SelectRows(sprintf_esc("select * from boards_platforms where board = %d",$this->id));
    $this->platforms = array();
    foreach($a as $v) $this->platforms[] = $v->platform;

    $this->addedUser = PouetUser::Spawn($this->board->addedUser);

    $this->nfos = SQLLib::SelectRows(sprintf_esc("select * from othernfos where refid = %d",$this->id));

    $s = new BM_Query("affiliatedboards");
    $s->AddField("affiliatedboards.type");
    $s->Attach(array("affiliatedboards"=>"group"),array("groups as group"=>"id"));
    $s->AddWhere(sprintf_esc("affiliatedboards.board = %d",$this->id));
    $this->groups = $s->perform();

    $s = new BM_Query("prods");
    $s->AddWhere(sprintf_esc("prods.boardID = %d",$this->id));
    $this->bbstros = $s->perform();
  }
Exemplo n.º 6
0
if (count($prod->groups))
{
  $xml->demo->addChild("authors");
  foreach($prod->groups as $v)
    $xml->demo->authors->addChild("group",_html($v->name))->addAttribute("pouet_id",$v->id);
}

$xml->demo->addChild("support");
$xml->demo->support->addChild("configuration");
foreach($prod->platforms as $v)
  $xml->demo->support->configuration->addChild("platform",_html($v["name"]))->addAttribute("type",_html($v["slug"]));

$xml->demo->addChild("download");
$xml->demo->download->addChild("url",_html($prod->download))->addAttribute("type","download");

$downloads = SQLLib::SelectRows(sprintf_esc("select * from downloadlinks where prod = %d",$prod->id));
foreach($downloads as $v)
  $xml->demo->download->addChild("url",_html($v->link))->addAttribute("type",$v->type);


$shot = find_screenshot($prod->id);
if ($shot)
{
  $xml->demo->addChild("screenshot");
  $xml->demo->screenshot->addChild("url",_html(POUET_CONTENT_URL.$shot));
}

$dom = dom_import_simplexml($xml)->ownerDocument;
$dom->formatOutput = true;
echo $dom->saveXML();
Exemplo n.º 7
0
  function PouetBoxAdminEditProdLinks( $prod )
  {
    parent::__construct();

    $this->uniqueID = "pouetbox_prodeditprodlinks";
    $this->prod = $prod;
    $this->title = "additional links";

    $this->headers = array("type","link");
    $this->data = SQLLib::SelectRows(sprintf_esc("select * from downloadlinks where prod = %d",$this->prod->id));
  }
Exemplo n.º 8
0
 function LoadFromDB()
 {
   // Get all the buttons ordered by type of buttons, randomly within each type
   $this->buttons = SQLLib::SelectRows("SELECT type, url, img, alt FROM buttons WHERE dead = 0 ORDER BY type ASC, RAND()");
 }
Exemplo n.º 9
0
 function LoadFromDB()
 {
   $this->nicks = SQLLib::SelectRows(sprintf_esc("select * from oldnicks where user = %d",$this->id));
 }
Exemplo n.º 10
0
  static function GetFields($data,&$fields,&$js)
  {
    $l = SQLLib::SelectRows(sprintf_esc("select * from downloadlinks where prod = %d",$data["prod"]));
    foreach($l as $v)
      $links[$v->id] = sprintf("[%s] %s",$v->type,$v->link);

    if (!$links)
      return "this prod has no extra links to remove !";

    $fields = array(
      "linkID" => array(
        "name"=>"select link you want removed",
        "type"=>"select",
        "fields"=>$links,
        "assoc"=>true,
      ),
      "reason" => array(
        "name"=>"why should this link be deleted",
        "type"=>"textarea",
        "info"=>"moderator's note: abuse of this feature will result in retaliation. have a nice day.",
        "required"=>true,
      ),
      "finalStep" => array(
        "type"=>"hidden",
        "value"=>1,
      ),
    );
  }
Exemplo n.º 11
0
 function LoadFromDB()
 {
   $this->entries = SQLLib::SelectRows("select * from faq where deprecated = 0 order by category, id");
 }
Exemplo n.º 12
0
    exit();
  }
}

$TITLE = "vote for logos !";

require_once("include_pouet/header.php");
require("include_pouet/menu.inc.php");

echo "<div id='content'>\n";

if (get_login_id())
{
  $s = clone $sel;
  $s->SetLimit(5);
  $logos = SQLLib::SelectRows($s->GetQuery());

  if ($logos)
  {
    foreach($logos as $logo)
    {
      $box = new PouetBoxLogoVote($logo);
      $box->Render();
    }
  }
  else
  {
    $box = new PouetBoxLogoLama();
    $box->Render();
  }