onokazu
onoka****@users*****
2005年 6月 11日 (土) 11:32:49 JST
Index: xoops2jp/html/modules/sections/index.php diff -u xoops2jp/html/modules/sections/index.php:1.2 xoops2jp/html/modules/sections/index.php:1.3 --- xoops2jp/html/modules/sections/index.php:1.2 Fri Mar 18 21:52:38 2005 +++ xoops2jp/html/modules/sections/index.php Sat Jun 11 11:32:49 2005 @@ -1,14 +1,14 @@ <?php -// $Id: index.php,v 1.2 2005/03/18 12:52:38 onokazu Exp $ +// $Id: index.php,v 1.3 2005/06/11 02:32:49 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // // <http://www.xoops.org/> // // ------------------------------------------------------------------------ // -// Based on: // -// myPHPNUKE Web Portal System - http://myphpnuke.com/ // -// PHP-NUKE Web Portal System - http://phpnuke.org/ // -// Thatware - http://thatware.org/ // +// Based on: // +// myPHPNUKE Web Portal System - http://myphpnuke.com/ // +// PHP-NUKE Web Portal System - http://phpnuke.org/ // +// Thatware - http://thatware.org/ // // ------------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -33,116 +33,116 @@ function listsections() { - global $xoopsConfig, $xoopsDB, $xoopsUser, $xoopsTheme, $xoopsLogger, $xoopsModule, $xoopsTpl, $xoopsUserIsAdmin; - include XOOPS_ROOT_PATH.'/header.php'; - $myts =& MyTextSanitizer::getInstance(); + global $xoopsConfig, $xoopsDB, $xoopsUser, $xoopsTheme, $xoopsLogger, $xoopsModule, $xoopsTpl, $xoopsUserIsAdmin; + include XOOPS_ROOT_PATH.'/header.php'; + $myts =& MyTextSanitizer::getInstance(); $result = $xoopsDB->query("SELECT secid, secname, image FROM ".$xoopsDB->prefix("sections")." ORDER BY secname"); - echo "<div style='text-align: center;'>"; - printf(_MD_WELCOMETOSEC,$xoopsConfig['sitename']); - echo "<br /><br />"; + echo "<div style='text-align: center;'>"; + printf(_MD_WELCOMETOSEC,htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)); + echo "<br /><br />"; echo _MD_HEREUCANFIND.'<br /><br /><table border="0">'; - $count = 0; + $count = 0; while ( list($secid, $secname, $image) = $xoopsDB->fetchRow($result) ) { - $secname = $myts->makeTboxData4Show($secname); - $image = $myts->makeTboxData4Show($image); - if ( $count == 2 ) { - echo "<tr>"; - $count = 0; - } - echo "<td><a href='index.php?op=listarticles&secid=$secid'><img src='images/$image' border='0' alt='$secname'></a>"; - $count++; - if ( $count == 2 ) { - echo "</tr>"; - } - echo "</td>"; - } - echo "</table></div>"; - include '../../footer.php'; + $secname = $myts->makeTboxData4Show($secname); + $image = $myts->makeTboxData4Show($image); + if ( $count == 2 ) { + echo "<tr>"; + $count = 0; + } + echo "<td><a href='index.php?op=listarticles&secid=$secid'><img src='images/$image' border='0' alt='$secname' /></a>"; + $count++; + if ( $count == 2 ) { + echo "</tr>"; + } + echo "</td>"; + } + echo "</table></div>"; + include '../../footer.php'; } function listarticles($secid) { - global $xoopsConfig, $xoopsUser, $xoopsDB, $xoopsTheme, $xoopsLogger, $xoopsModule, $xoopsTpl, $xoopsUserIsAdmin; - include '../../header.php'; - $myts =& MyTextSanitizer::getInstance(); - $result = $xoopsDB->query("SELECT secname, image FROM ".$xoopsDB->prefix("sections")." WHERE secid=$secid"); - list($secname, $image) = $xoopsDB->fetchRow($result); - $secname = $myts->makeTboxData4Show($secname); - $image = $myts->makeTboxData4Show($image); - $result = $xoopsDB->query("SELECT artid, secid, title, content, counter FROM ".$xoopsDB->prefix("seccont")." WHERE secid=$secid"); - echo "<div><img src='images/$image' border='0'><br /><br />"; - printf(_MD_THISISSECTION,$secname); - echo "<br />"._MD_THEFOLLOWING."<br /><br /><table border='0'>"; - while ( list($artid, $secid, $title, $content, $counter) = $xoopsDB->fetchRow($result) ) { - $title = $myts->makeTboxData4Show($title); - $content = $myts->makeTareaData4Show($content); - echo "<tr><td align='left'> <strong><big>·</big></strong> <a href='index.php?op=viewarticle&artid=$artid'>$title</a>"; - printf(" (read: %s times)",$counter); - echo "<a href='index.php?op=printpage&artid=$artid'> <img src='".XOOPS_URL."/modules/sections/images/print.gif' border='0' alt='' . _MD_PRINTERPAGE.' /></a></td></tr>"; - } + global $xoopsConfig, $xoopsUser, $xoopsDB, $xoopsTheme, $xoopsLogger, $xoopsModule, $xoopsTpl, $xoopsUserIsAdmin; + include '../../header.php'; + $myts =& MyTextSanitizer::getInstance(); + $result = $xoopsDB->query("SELECT secname, image FROM ".$xoopsDB->prefix("sections")." WHERE secid=$secid"); + list($secname, $image) = $xoopsDB->fetchRow($result); + $secname = $myts->makeTboxData4Show($secname); + $image = $myts->makeTboxData4Show($image); + $result = $xoopsDB->query("SELECT artid, secid, title, content, counter FROM ".$xoopsDB->prefix("seccont")." WHERE secid=$secid"); + echo "<div><img src='images/$image' border='0' /><br /><br />"; + printf(_MD_THISISSECTION,$secname); + echo "<br />"._MD_THEFOLLOWING."<br /><br /><table border='0'>"; + while ( list($artid, $secid, $title, $content, $counter) = $xoopsDB->fetchRow($result) ) { + $title = $myts->makeTboxData4Show($title); + $content = $myts->makeTareaData4Show($content); + echo "<tr><td align='left'> <strong><big>·</big></strong> <a href='index.php?op=viewarticle&artid=$artid'>$title</a>"; + printf(" (read: %s times)",$counter); + echo "<a href='index.php?op=printpage&artid=$artid'> <img src='".XOOPS_URL."/modules/sections/images/print.gif' border='0' alt='' . _MD_PRINTERPAGE.' /></a></td></tr>"; + } echo "</table><br /><br /><br />[ <a href=index.php>"._MD_RETURN2INDEX."</a> ]</div>"; - include '../../footer.php'; + include '../../footer.php'; } function viewarticle($artid,$page) { - global $xoopsConfig, $xoopsUser, $xoopsDB, $xoopsTheme, $xoopsLogger, $xoopsModule, $xoopsTpl, $xoopsUserIsAdmin; - include '../../header.php'; - $myts =& MyTextSanitizer::getInstance(); + global $xoopsConfig, $xoopsUser, $xoopsDB, $xoopsTheme, $xoopsLogger, $xoopsModule, $xoopsTpl, $xoopsUserIsAdmin; + include '../../header.php'; + $myts =& MyTextSanitizer::getInstance(); $xoopsDB->queryF("UPDATE ".$xoopsDB->prefix("seccont")." SET counter=counter+1 WHERE artid=$artid"); - $result = $xoopsDB->query("SELECT artid, secid, title, content, counter FROM ".$xoopsDB->prefix("seccont")." WHERE artid=$artid"); - list($artid, $secid, $title, $content, $counter) = $xoopsDB->fetchRow($result); - $title = $myts->makeTboxData4Show($title); - $content = $myts->makeTareaData4Show($content); + $result = $xoopsDB->query("SELECT artid, secid, title, content, counter FROM ".$xoopsDB->prefix("seccont")." WHERE artid=$artid"); + list($artid, $secid, $title, $content, $counter) = $xoopsDB->fetchRow($result); + $title = $myts->makeTboxData4Show($title); + $content = $myts->makeTareaData4Show($content); $result2 = $xoopsDB->query("SELECT secid, secname FROM ".$xoopsDB->prefix("sections")." WHERE secid=$secid"); - list($secid, $secname) = $xoopsDB->fetchRow($result2); - $secname = $myts->makeTboxData4Show($secname); + list($secid, $secname) = $xoopsDB->fetchRow($result2); + $secname = $myts->makeTboxData4Show($secname); $words = count(explode(" ", $content)); //echo "<center>"; - /* Rip the article into pages. Delimiter string is "[pagebreak]" */ - $contentpages = explode( "[pagebreak]", $content); - $pageno = count($contentpages); - /* Define the current page */ - if ( $page=="" || $page < 1 ) { - $page = 1; - } - if ( $page > $pageno ) { - $page = $pageno; - } - $arrayelement = (int)$page; - $arrayelement --; - echo "<table width='100%'><tr><td><b>$title</b><br /><br />"; - if ( $page >= $pageno ) { - $next_page = '<a href="index.php">' ._MD_RETURN2INDEX.'</a>'; - } else { - $next_pagenumber = $page + 1; - $next_page = "<a href='index.php?op=viewarticle&artid=$artid&page=$next_pagenumber'>"._MD_NEXTPAGE." ".sprintf("(%s/%s)",$next_pagenumber,$pageno)." >></a>"; - } - if( $page <= 1 ) { - $previous_page = '<a href="index.php">' ._MD_RETURN2INDEX.'</a>'; - } else { - $previous_pagenumber = $page -1; - $previous_page = "<a href='index.php?op=viewarticle&artid=$artid&page=$previous_pagenumber'><< "._MD_PREVPAGE." ".sprintf("(%s/%s)",$previous_pagenumber,$pageno)."</a>"; - } + /* Rip the article into pages. Delimiter string is "[pagebreak]" */ + $contentpages = explode( "[pagebreak]", $content); + $pageno = count($contentpages); + /* Define the current page */ + if ( $page=="" || $page < 1 ) { + $page = 1; + } + if ( $page > $pageno ) { + $page = $pageno; + } + $arrayelement = (int)$page; + $arrayelement --; + echo "<table width='100%'><tr><td><b>$title</b><br /><br />"; + if ( $page >= $pageno ) { + $next_page = '<a href="index.php">' ._MD_RETURN2INDEX.'</a>'; + } else { + $next_pagenumber = $page + 1; + $next_page = "<a href='index.php?op=viewarticle&artid=$artid&page=$next_pagenumber'>"._MD_NEXTPAGE." ".sprintf("(%s/%s)",$next_pagenumber,$pageno)." >></a>"; + } + if( $page <= 1 ) { + $previous_page = '<a href="index.php">' ._MD_RETURN2INDEX.'</a>'; + } else { + $previous_pagenumber = $page -1; + $previous_page = "<a href='index.php?op=viewarticle&artid=$artid&page=$previous_pagenumber'><< "._MD_PREVPAGE." ".sprintf("(%s/%s)",$previous_pagenumber,$pageno)."</a>"; + } echo ($contentpages[$arrayelement]); - echo "<br /><table width='100%' border='0' cellspacing='0' cellpadding='2'><tr><td>$previous_page</td> <td align='right'>$next_page</td></tr></table>"; - echo "</td></tr> - <tr><td align='center'>[ <a href='index.php?op=listarticles&secid=$secid'>".sprintf(_MD_BACK2SEC,$secname)."</a> | + echo "<br /><table width='100%' border='0' cellspacing='0' cellpadding='2'><tr><td>$previous_page</td> <td align='right'>$next_page</td></tr></table>"; + echo "</td></tr> + <tr><td align='center'>[ <a href='index.php?op=listarticles&secid=$secid'>".sprintf(_MD_BACK2SEC,$secname)."</a> | <a href='index.php'>"._MD_RETURN2INDEX."</a> | <a href='index.php?op=printpage&artid=$artid'><img src='".XOOPS_URL."/modules/sections/images/print.gif' border='0' alt='" . _MD_PRINTERPAGE."' /></a>]</td></tr></table>"; include '../../footer.php'; } function PrintSecPage($artid) { - global $xoopsConfig, $xoopsUser, $xoopsDB, $xoopsTpl, $xoopsUserIsAdmin; - $myts =& MyTextSanitizer::getInstance(); + global $xoopsConfig, $xoopsUser, $xoopsDB, $xoopsTpl, $xoopsUserIsAdmin; + $myts =& MyTextSanitizer::getInstance(); $result=$xoopsDB->query("SELECT title, content FROM ".$xoopsDB->prefix("seccont")." WHERE artid=$artid"); - list($title, $content) = $xoopsDB->fetchRow($result); - $title = $myts->makeTboxData4Show($title); - $content = $myts->makeTareaData4Show($content); + list($title, $content) = $xoopsDB->fetchRow($result); + $title = $myts->makeTboxData4Show($title); + $content = $myts->makeTareaData4Show($content); echo " <html> - <head><title>".$xoopsConfig['sitename']."</title></head> + <head><title>".htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)."</title></head> <body> <table border='0'><tr><td> <table border='0' width='640' cellpadding='0' cellspacing='1' bgcolor='#000000'><tr><td> @@ -152,8 +152,8 @@ ".str_replace("[pagebreak]","",$content)."<br /><br />"; echo "</td></tr></table></td></tr></table>"; echo "<br /><br />"; - printf(_MD_COMESFROM, $xoopsConfig['sitename']); - echo "<br /><a href='".XOOPS_URL."'>".XOOPS_URL."</a><br /><br />"; + printf(_MD_COMESFROM, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)); + echo "<br /><a href='".XOOPS_URL."'>".XOOPS_URL."</a><br /><br />"; echo _MD_URLFORTHIS."<br /> <a href='".XOOPS_URL."/modules/sections/index.php?op=viewarticle&artid=$artid'>".XOOPS_URL."/modules/sections/index.php?op=viewarticle&artid=$artid</a> </td></tr></table> @@ -169,16 +169,16 @@ switch ( $op ) { case "viewarticle": - viewarticle($artid, $page); + viewarticle($artid, $page); break; case "listarticles": - listarticles($secid); - break; + listarticles($secid); + break; case "printpage": - PrintSecPage($artid); - break; + PrintSecPage($artid); + break; default: - listsections(); - break; + listsections(); + break; } ?> \ No newline at end of file