<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
 define('IN_IORANGE', true);
 include('include/init.php');

 if (isset($_GET['action']) && $_GET['action'] == 'more')
 {
     $sql = "SELECT B.`bookid`, B.`bookname`, B.`typeid`, T.`typename` FROM `".Book::table()."` AS B
     		 INNER JOIN `".Types::table()."` AS T ON T.`typeid` = B.`typeid`
			 WHERE B.`view` = 1
     		 ORDER BY B.`bookid` DESC";
     $pageObj = new WapPage($db, $sql, 10);
     $pageinfo = $pageObj->getPage();
     $rs = $pageObj->getResult();
     while ($row = $db->getArr($rs))
     {
         $new[]= $row;
     }
 }
 else 
 {
 	$sql = "SELECT B.`bookname`, B.`bookid`, B.`author`, B.`status`, B.`lastchapterid`, B.`lastchaptername`, B.`updatedate`, T.`typeid`, T.`typename`
	 		 FROM `".Book::table()."` AS B
         	 INNER JOIN `".Types::table()."` AS T ON T.`typeid` = B.`typeid`
			 WHERE B.`view` = 1
			 GROUP BY B.`bookid` 
			 ORDER BY B.`updatedate` DESC";
	 $pageObj = new WapPage($db, $sql, 10);
	 $pageinfo = $pageObj->getPage();
     
     $rs = $pageObj->getResult();
     $new = array();
     while ($row = $db->getArr($rs))
	 {
		 $new[] = $row;
	 } 
 }
 
 include(VIEW_DIR ."wq.php");