function LoadFromDB() {
   $s = new BM_query();
   $s->AddField("message");
   $s->AddField("addedDate");
   $s->AddTable("oneliner");
   $s->attach(array("oneliner"=>"who"),array("users as user"=>"id"));
   //$s->AddOrder("oneliner.addedDate desc, oneliner.id desc");
   $s->AddOrder("oneliner.id desc");
   $s->SetLimit(POUET_CACHE_MAX);
   $this->data = $s->perform();
   $this->data = array_reverse($this->data);
 }
Ejemplo n.º 2
0
  function LoadFromDB() {
    $s = new BM_query();
    $s->AddField("bbs_topics.id as id");
    $s->AddField("bbs_topics.topic as topic");
    $s->AddField("bbs_topics.count as count");
    $s->AddField("bbs_topics.category as category");
    $s->AddField("bbs_topics.lastpost as lastpost");
    $s->AddField("bbs_topics.closed as closed");
    $s->AddTable("bbs_topics");
    $s->attach(array("bbs_topics"=>"userfirstpost"),array("users as firstuser"=>"id"));
    $s->attach(array("bbs_topics"=>"userlastpost"),array("users as lastuser"=>"id"));
    $s->AddOrder("lastpost desc");
    $s->SetLimit(POUET_CACHE_MAX);

    $this->data = $s->perform();
  }
Ejemplo n.º 3
0
  function LoadFromDB() {
    $s = new SQLSelect();

    $perPage = get_setting("bbsbbstopics");
    $this->page = (int)max( 1, (int)$_GET["page"] );

    $s = new BM_query();
    $s->AddField("bbs_topics.id as id");
    $s->AddField("bbs_topics.lastpost as lastpost");
    $s->AddField("bbs_topics.firstpost as firstpost");
    $s->AddField("bbs_topics.topic as topic");
    $s->AddField("bbs_topics.count as count");
    $s->AddField("bbs_topics.category as category");
    $s->AddTable("bbs_topics");
    $s->attach(array("bbs_topics"=>"userfirstpost"),array("users as firstuser"=>"id"));
    $s->attach(array("bbs_topics"=>"userlastpost"),array("users as lastuser"=>"id"));


    $dir = "DESC";
    if ($_GET["reverse"])
      $dir = "ASC";

    switch($_GET["order"])
    {
      case "firstpost": $s->AddOrder("bbs_topics.firstpost ".$dir); break;
      case "userfirstpost": $s->AddOrder("bbs_topics_firstuser.nickname ".$dir); break;
      case "userlastpost": $s->AddOrder("bbs_topics_lastuser.nickname ".$dir); break;
      case "topic": $s->AddOrder("bbs_topics.topic ".$dir); break;
      case "category": $s->AddOrder("bbs_topics.category ".$dir); break;
      case "count": $s->AddOrder("bbs_topics.count ".$dir); break;
      case "lastpost":
      default: $s->AddOrder("bbs_topics.lastpost ".$dir); break;
    }
    $s->AddOrder("bbs_topics.lastpost ".$dir);
    $s->SetLimit( $perPage, (int)(($this->page - 1) * $perPage) );

    if ($_GET["category"])
      $s->AddWhere(sprintf_esc("category='%s'",$_GET["category"]));
    //echo $s->GetQuery();

    $this->topics = $s->performWithCalcRows( $this->count );
    //PouetCollectPlatforms($this->prods);

    //$this->maxtopics = SQLLib::SelectRow("SELECT MAX(views) as m FROM prods")->m;
  }