//
// ------------------------------------------------------------------------ //
// 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 //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
include 'header.php';
function listsections()
{
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 "
";
printf(_MD_WELCOMETOSEC,$xoopsConfig['sitename']);
echo "
";
echo _MD_HEREUCANFIND.'
';
$count = 0;
while ( list($secid, $secname, $image) = $xoopsDB->fetchRow($result) ) {
$secname = $myts->makeTboxData4Show($secname);
$image = $myts->makeTboxData4Show($image);
if ( $count == 2 ) {
echo "";
$count = 0;
}
echo " ";
$count++;
if ( $count == 2 ) {
echo " |
";
}
echo "";
}
echo "
";
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 "
";
printf(_MD_THISISSECTION,$secname);
echo "
"._MD_THEFOLLOWING."
";
while ( list($artid, $secid, $title, $content, $counter) = $xoopsDB->fetchRow($result) ) {
$title = $myts->makeTboxData4Show($title);
$content = $myts->makeTareaData4Show($content);
echo " · $title";
printf(" (read: %s times)",$counter);
echo "  |
";
}
echo "
[
"._MD_RETURN2INDEX." ]
";
include '../../footer.php';
}
function viewarticle($artid,$page)
{
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);
$result2 = $xoopsDB->query("SELECT secid, secname FROM ".$xoopsDB->prefix("sections")." WHERE secid=$secid");
list($secid, $secname) = $xoopsDB->fetchRow($result2);
$secname = $myts->makeTboxData4Show($secname);
$words = count(explode(" ", $content));
//echo "";
/* 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 "";
include '../../footer.php';
}
function PrintSecPage($artid)
{
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);
echo "
".$xoopsConfig['sitename']."
";
}
$op = isset($HTTP_GET_VARS['op']) ? trim($HTTP_GET_VARS['op']) : '';
$secid = isset($HTTP_GET_VARS['secid']) ? intval($HTTP_GET_VARS['secid']) : 0;
$page = isset($HTTP_GET_VARS['page']) ? intval($HTTP_GET_VARS['page']) : 0;
$artid = isset($HTTP_GET_VARS['artid']) ? intval($HTTP_GET_VARS['artid']) : 0;
switch ( $op ) {
case "viewarticle":
viewarticle($artid, $page);
break;
case "listarticles":
listarticles($secid);
break;
case "printpage":
PrintSecPage($artid);
break;
default:
listsections();
break;
}
?>