9-2
/index.php
003 | include_once "header.php" ; |
004 | $xoopsOption [ 'template_main' ] = set_bootstrap( "tad_ebook_index.html" ); |
005 | include_once XOOPS_ROOT_PATH. "/header.php" ; |
010 | function show_page( $page_sn = "" ){ |
011 | global $xoopsTpl , $xoopsDB ; |
013 | $tbl = $xoopsDB ->prefix( 'tad_ebook_page' ); |
016 | $sql = "update {$tbl} set `page_counter`= `page_counter` + 1 where `page_sn`='{$page_sn}'" ; |
017 | $xoopsDB ->queryF( $sql ) or redirect_header( "index.php" ,3, mysql_error()); |
019 | $sql = "select * from `{$tbl}` where `page_sn` = '{$page_sn}'" ; |
020 | $result = $xoopsDB ->query( $sql ) or redirect_header( "index.php" ,3, mysql_error()); |
021 | $page = $xoopsDB ->fetchArray( $result ); |
023 | $xoopsTpl ->assign( 'page' , $page ); |
024 | $xoopsTpl ->assign( 'op' , 'show_page' ); |
029 | global $xoopsTpl , $xoopsDB ; |
031 | include_once XOOPS_ROOT_PATH. "/modules/tadtools/TadUpFiles.php" ; |
032 | $TadUpFiles = new TadUpFiles( "tad_ebook" ); |
035 | $today = date ( "Y-m-d" ); |
036 | $tbl = $xoopsDB ->prefix( 'tad_ebook' ); |
037 | $sql = "select * from `{$tbl}` where `ebook_publish_date` <= '{$today}' order by `ebook_publish_date` desc" ; |
039 | $result = $xoopsDB ->query( $sql ) or redirect_header( "index.php" ,3, mysql_error()); |
042 | while ( $ebook = $xoopsDB ->fetchArray( $result )){ |
044 | $all_ebook [ $i ]= $ebook ; |
046 | $TadUpFiles ->set_col( 'ebook_sn' , $ebook [ 'ebook_sn' ]); |
047 | $all_ebook [ $i ][ 'ebook_pic' ]= $TadUpFiles ->get_pic_file( 'thumb' ); |
053 | $xoopsTpl ->assign( 'all_ebook' , $all_ebook ); |
054 | $xoopsTpl ->assign( 'op' , 'show_all' ); |
059 | function show_ebook( $ebook_sn = "" ){ |
060 | global $xoopsTpl , $xoopsDB ; |
062 | $tbl = $xoopsDB ->prefix( 'tad_ebook_page' ); |
063 | $sql = "select * from `{$tbl}` where `ebook_sn` = '{$ebook_sn}'" ; |
065 | $result = $xoopsDB ->query( $sql ) or redirect_header( "index.php" ,3, mysql_error()); |
067 | while ( $page = $xoopsDB ->fetchArray( $result )){ |
070 | $xoopsTpl ->assign( 'all_page' , $all_page ); |
071 | $xoopsTpl ->assign( 'op' , 'show_ebook' ); |
076 | $op = empty ( $_REQUEST [ 'op' ])? "" : $_REQUEST [ 'op' ]; |
077 | $page_sn = empty ( $_REQUEST [ 'page_sn' ])? "" : intval ( $_REQUEST [ 'page_sn' ]); |
078 | $ebook_sn = empty ( $_REQUEST [ 'ebook_sn' ])? "" : intval ( $_REQUEST [ 'ebook_sn' ]); |
089 | include_once XOOPS_ROOT_PATH. '/include/comment_view.php' ; |
091 | show_ebook( $ebook_sn ); |
100 | $xoopsTpl ->assign( "toolbar" , toolbar_bootstrap( $interface_menu )) ; |
101 | include_once XOOPS_ROOT_PATH. '/footer.php' ; |