IMO PHP Nuke is good sometimes...but it's crap like this that makes its sloppy code fail :(
PHP Nuke: Sections errorAny ideas anyone??
25 Replies - 2923 Views - Last Post: 25 August 2001 - 02:36 AM
#16
Re: PHP Nuke: Sections error
Posted 16 August 2001 - 11:49 PM
#17
Re: PHP Nuke: Sections error
Posted 17 August 2001 - 02:11 PM
Here is an exact copy of the one I wish to repair:
<?php
/************************************************************/
/* Theme Defaults Definition */
/* */
/* Control the header for your site. You need to define the */
/* BODY tag and in some part of the code call the blocks */
/* function for left side with: block(left); */
/************************************************************/
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
$thename = "Kaput2";
$bgcolor1 = "#FFFFFF"; # primary background color
$bgcolor2 = "#FFFFFF"; # header and footer background color
$bgcolor3 = "#FFFFFF"; # block area background color
$bgcolor4 = "#FFFFFF"; # center block background color
$bgcolor5 = "#7b91AC"; # left and right block background color
$textcolor1 = "#000000"; # center block default title text color
$textcolor2 = "#000000"; # left and right block default title text color
$textcolor3 = "#505050"; # upper center block default text color
$textcolor4 = "#999999"; # lower center block default text color
$textcolor5 = "#000000"; # right and left block default text color
$textcolor6 = "#000000"; # header and footer default text color
$welcomeMessage = "[Insert your message here]";
/************************************************************/
/* Function OpenTable() */
/* */
/* Beginning of the Block formating for the header and */
/* footer of your site */
/************************************************************/
function OpenTable() {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
echo "<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="15" height="15"><img src="themes/$thename/images/up-left2.gif" alt="" border="0"></td>
<td background="themes/$thename/images/up2.gif" align="center" width="100%" height="15"><font size=1> </font></td>
<td><img src="themes/$thename/images/up-right2.gif" width="15" height="15" alt="" border="0"></td>
</tr>
<tr>
<td background="themes/$thename/images/left2.gif" width="15"><font size=1> </font></td>
<td bgcolor="$bgcolor2" width="100%">";
}
/************************************************************/
/* Function OpenTable2() */
/* */
/* Beginning of the Block formating for the poll results */
/* and other blocks */
/************************************************************/
function OpenTable2() {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
echo "<table border="0" cellspacing="0" cellpadding="0" align="center"><tr>
<td width="15" height="15"><img src="themes/$thename/images/up-left2.gif" alt="" border="0"></td>
<td background="themes/$thename/images/up2.gif" align="center" height="15"><font size=1> </font></td>
<td><img src="themes/$thename/images/up-right2.gif" width="15" height="15" alt="" border="0"></td>
</tr>
<tr>
<td background="themes/$thename/images/left2.gif" width="15"><font size=1> </font></td>
<td bgcolor="ffffff">";
}
/************************************************************/
/* Function CloseTable() */
/* */
/* Ending of the Block formating for the header and */
/* footer of your site */
/************************************************************/
function CloseTable() {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
echo "</td>
<td background="themes/$thename/images/right2.gif"><font size=1> </font></td></tr>
<tr>
<td width="15" height="15"><img src="themes/$thename/images/down-left2.gif" alt="" border="0"></td>
<td background="themes/$thename/images/down2.gif" align="center" height="15"><font size=1> </font></td>
<td><img src="themes/$thename/images/down-right2.gif" width="15" height="15" alt="" border="0"></td>
</tr>
</td></tr></table>
<br>";
}
/************************************************************/
/* Function CloseTable2() */
/* */
/* Ending of the Block formating for the poll results */
/* and other blocks */
/************************************************************/
function CloseTable2() {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
echo "</td>
<td background="themes/$thename/images/right2.gif"><font size=1> </font></td></tr>
<tr>
<td width="15" height="15"><img src="themes/$thename/images/down-left2.gif" alt="" border="0"></td>
<td background="themes/$thename/images/down2.gif" align="center" height="15"><font size=1> </font></td>
<td><img src="themes/$thename/images/down-right2.gif" width="15" height="15" alt="" border="0"></td>
</tr>
</td></tr></table>
<br>";
}
/************************************************************/
/* Function FormatStory() */
/* */
/* Displays the news item text in the center blocks */
/************************************************************/
function FormatStory($thetext, $notes, $aid, $informant) {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
global $anonymous;
if ($notes != "") {
$notes = "<b>"._NOTE."</b> <i>$notes</i>
";
} else {
$notes = "";
}
if ("$aid" == "$informant") {
echo "<font size="2" color="$textcolor3">$thetext<br>$notes</font>
";
} else {
if($informant != "") {
$boxstuff = "<a href="user.php?op=userinfo&uname=$informant">$informant</a> ";
} else {
$boxstuff = "$anonymous ";
}
$boxstuff .= ""._WRITES." <i>"$thetext"</i> $notes
";
echo "<font size="2" color="$textcolor3">$boxstuff</font>
";
}
}
/************************************************************/
/* Function themeheader() */
/* */
/* Control the header for your site. You need to define the */
/* BODY tag and in some part of the code call the blocks */
/* function for left side with: blocks(left); */
/************************************************************/
function themeheader() {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
global $user, $sitename;
cookiedecode($user);
$username = $cookie[1];
if ($username == "") {
$username = "Anonymous";
}
echo "<body bgcolor="$bgcolor1" text="#000000" link="#363636" vlink="#363636" alink="#d5ae83">
"
."<br>
";
if ($banners) {
include("banners.php");
}
OpenTable();
/******************************/
/* If you comment this echo statement and uncomment the statment below this one you can */
/* replace the search with a the welcome statement defined above. I liked this option */
/* better since the search and menu are in blocks of the portal. */
/******************************/
echo "<table border="0" width="100%"><tr><td rowspan="2">"
."<a href="index.php"><img src="themes/$thename/images/logo.gif" border="0" alt=""._WELCOMETO." $sitename" align="left"></a></td>"
."<td align=right width=100%>"
."<form action="search.php" method="post">"
."<font size="2" color="$textcolor6"><b>"._SEARCH." </b>"
."<input type="text" name="query" size="14"></font></form>"
."</td></tr><tr>"
."<td align="right" valign="bottom" width="100%">"
."<font size="2"><b>"
."<A href="/">Home</a> · <A href="topics.php">"._TOPICS."</a> · "
."<A href="download.php">"._DOWNLOADS."</a> · <A href="user.php">"._USERLOGIN."</a>"
." · <A href="forum.php">"._FORUMS."</a> · <A href="top.php">"._TOP10."</a>"
."</b></font></td></tr></table>
";
/******************************/
/* If you uncomment this echo statement and comment off the above you can replace the search */
/* with a welcome statement. I liked this option better since the search and menu are in */
/* blocks of the portal. */
/******************************/
/*
echo "<table border="0" width="100%"><tr><td>"
."<a href="index.php"><img src="themes/$thename/images/logo.gif" border="0" alt=""._WELCOMETO." $sitename" align="left"></a></td>"
."<td width=100%><font color="$textcolor6">"
.$welcomeMessage
."</font></td></tr></table>
";
*/
CloseTable();
echo "<table cellpadding="0" cellspacing="0" width="99%" border="0" align="center" bgcolor="$bgcolor3">
"
."<tr><td valign="top">
";
blocks(left);
echo "</td><td><img src="themes/$thename/images/pixel.gif" width="15" height="1" border="0" alt=""></td><td width="100%" valign=top>
";
}
/************************************************************/
/* Function themefooter() */
/* */
/* Control the footer for your site. You don't need to */
/* close BODY and HTML tags at the end. In some part call */
/* the function for right blocks with: blocks(right); */
/* Also, $index variable need to be global and is used to */
/* determine if the page your're viewing is the Homepage or */
/* and internal one. */
/************************************************************/
function themefooter() {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
global $index;
if ($index == 1) {
echo "</td><td><img src="themes/$thename/images/pixel.gif" width="15" height="1" border="0" alt=""></td><td valign="top" width="150">
";
blocks(right);
}
echo "</td></tr></table>
";
}
/************************************************************/
/* Function themeindex() */
/* */
/* Displays the center blocks */
/************************************************************/
function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
global $anonymous, $tipath;
echo "<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="15" height="15"><img src="themes/$thename/images/up-left2.gif" alt="" border="0"></td>
<td background="themes/$thename/images/up2.gif" align="center" width="100%" height="15"><font size=1> </font></td>
<td width="15" height="15"><img src="themes/$thename/images/up-right2.gif" width="15" height="15" alt="" border="0"></td>
</tr>
<tr>
<td background="themes/$thename/images/left2.gif" width="15"><font size=1> </font></td>
<td bgcolor="$bgcolor4" width="100%">
<font color="$textcolor4"><b><a href="search.php?query=&topic=$topic"><img src="$tipath$topicimage" border="0" Alt="$topictext" align="right" hspace="10" vspace="10"></a></B></font>
<font color="$textcolor1"><b>$title</b></font>
<font color="$textcolor3">";
FormatStory($thetext, $notes, $aid, $informant);
echo "</font>
</td>
<td background="themes/$thename/images/right2.gif"><font size=1> </font></td>
</tr>
<tr>
<td width="15" height="15"><img src="themes/$thename/images/middle-left.gif" alt="" border="0"></td>
<td background="themes/$thename/images/middle.gif" align="center" height="15"><font size=1> </font></td>
<td><img src="themes/$thename/images/middle-right.gif" width="15" height="15" alt="" border="0"></td>
</tr>
<tr>
<td background="themes/$thename/images/left3.gif" width="15"><font size=1> </font></td>
<td align=center bgcolor="$bgcolor4">
<font color="$textcolor4" size="1">"._POSTEDBY." ";
formatAidHeader($aid);
echo " "._ON." $time $timezone ($counter "._READS.")<br></font>
<font size="2">$morelink</font>
</td>
<td background="themes/$thename/images/right3.gif" width="15"><font size=1> </font></td>
</tr>
<tr>
<td width="15" height="11" valign=top><img src="themes/$thename/images/down-left3.gif" alt="" border="0"></td>
<td background="themes/$thename/images/down3.gif" align="center" height="11" width=100%><font size=1> </font></td>
<td width="15" height="11" valign=top><img src="themes/$thename/images/down-right3.gif" alt="" border="0"></td>
</tr>
</table>
<br>";
}
/************************************************************/
/* Function themearticle() */
/* */
/* Controls how an article appears when read. */
/************************************************************/
function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
global $admin, $sid, $tipath;
Opentable();
echo "<font size="3" color="#363636"><b>$title</b></font><br>
"
."<font size="2">"._POSTEDON." $datetime by ";
formatAidHeader($aid);
if (is_admin($admin)) {
echo "<br>[ <a href="admin.php?op=EditStory&sid=$sid">"._EDIT."</a> | <a href="admin.php?op=RemoveStory&sid=$sid">"._DELETE."</a> ]
";
}
echo "";
echo "<a href="search.php?query=&topic=$topic"><img src="$tipath$topicimage" border="0" Alt="$topictext" align="right" hspace="10" vspace="10"></a>
";
FormatStory($thetext, $notes="", $aid, $informant);
echo "<br>
";
CloseTable();
}
/************************************************************/
/* Function themeidebox() */
/* */
/* left and right block formating */
/************************************************************/
function themesidebox($title, $content) {
global $thename,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2,$textcolor3,$textcolor4,$textcolor5,$textcolor6,$welcomeMessage;
echo "<table border=0 cellspacing=0 cellpadding=0 width=150><tr>"
."<td width=17 height=17><img src=themes/$thename/images/up-left.gif alt="" border=0></td>"
."<td background=themes/$thename/images/up.gif align=center width=100% height=17><font size=1> </font></td>"
."<td width=17 height=17><img src=themes/$thename/images/up-right.gif width=17 height=17 alt="" border=0></td></tr>"
."<tr>"
."<td background=themes/$thename/images/left.gif width=17><font size=1> </font></td>"
."<td bgcolor="$bgcolor5" width=126><center><font color="$textcolor2" size=2><b>$title</b></font></center><br><font color="$textcolor5">$content</font></td>"
."<td background=themes/$thename/images/right.gif><font size=1> </font></td></tr>"
."<tr>"
."<td width=17 height=17><img src=themes/$thename/images/down-left.gif alt="" border=0></td>"
."<td background=themes/$thename/images/down.gif align=center width=100% height=17><font size=1> </font></td>"
."<td width=17 height=17><img src=themes/$thename/images/down-right.gif width=17 height=17 alt="" border=0></td></tr>"
."</td></tr></table>"
."<br>";
}
?>
Now, which part is making the tables fuqqed up?!! If you viewsource on the sections page, you can see clearly what the problem is. It's got an extra unclosed table added into it. But where to change that?!!
#18
Re: PHP Nuke: Sections error
Posted 17 August 2001 - 03:51 PM
tsmoke
#19
Re: PHP Nuke: Sections error
Posted 17 August 2001 - 05:21 PM
Most likely something is wrong with the sections.php where it is printing multiple opentable() functions for some unknown obscure reason..
#20
Re: PHP Nuke: Sections error
Posted 19 August 2001 - 04:30 PM
Take a look at your email if you haven't checked it yet. I did send a modified version of your file back to you to see if your web site will work with it.
tsmoke
#21
Re: PHP Nuke: Sections error
Posted 20 August 2001 - 09:41 PM
#22
Re: PHP Nuke: Sections error
Posted 20 August 2001 - 09:51 PM
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright © 2001 by Francisco Burzi (fbc@mandrakesoft.com) */
/* http://phpnuke.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. */
/************************************************************************/
if(!isset($mainfile)) { include("mainfile.php"); }
function listsections() {
global $sitename, $prefix;
include ('header.php');
$result = mysql_query("select secid, secname, image from $prefix"._sections." order by secname");
OpenTable();
echo "
<center>"._SECWELCOME." $sitename.<br><br>
"._YOUCANFIND."</center><br><br>
<table border="0" align="center">";
$count = 0;
while (list($secid, $secname, $image) = mysql_fetch_row($result)) {
if ($count==2) {
echo "<tr>";
$count = 0;
}
echo "<td><a href="sections.php?op=listarticles&secid=$secid"><img src="images/sections/$image" border="0" Alt="$secname"></a>";
$count++;
if ($count==2) {
echo "</tr>";
}
echo "</td>";
}
mysql_free_result($result);
echo "</table></center>";
CloseTable();
include ('footer.php');
}
function listarticles($secid) {
global $prefix;
include ('header.php');
$result = mysql_query("select secname from $prefix"._sections." where secid=$secid");
list($secname) = mysql_fetch_row($result);
mysql_free_result($result);
$result = mysql_query("select artid, secid, title, content, counter from $prefix"._seccont." where secid=$secid");
OpenTable();
$result2 = mysql_query("select image from $prefix"._sections." where secid=$secid");
list($image) = mysql_fetch_row($result2);
echo "<center><img src="images/sections/$image" border="0" alt=""><br><br>
<font class="option">
"._THISISSEC." <b>$secname</b>.<br>"._FOLLOWINGART."</font></center><br><br>
<table border="0" align="center">";
while (list($artid, $secid, $title, $content, $counter) = mysql_fetch_row($result)) {
echo "
<tr><td align="left" nowrap><font class="content">
<li><a href="sections.php?op=viewarticle&artid=$artid">$title</a> ($counter "._READS.")
<a href="sections.php?op=printpage&artid=$artid"><img src="images/print.gif" border="0" Alt=""._PRINTER."" width="15" height="11"></a>
</td></tr>
";
}
echo "</table>
<br><br><br><center>
[ <a href="sections.php">"._SECRETURN."</a> ]</center>";
CloseTable();
mysql_free_result($result);
include ('footer.php');
}
function viewarticle($artid, $page) {
global $prefix;
include("header.php");
if (($page == 1) OR ($page == "")) {
mysql_query("update $prefix"._seccont." set counter=counter+1 where artid='$artid'");
}
$result = mysql_query("select artid, secid, title, content, counter from $prefix"._seccont." where artid=$artid");
list($artid, $secid, $title, $content, $counter) = mysql_fetch_row($result);
$result2 = mysql_query("select secid, secname from $prefix"._sections." where secid=$secid");
list($secid, $secname) = mysql_fetch_row($result2);
$words = sizeof(explode(" ", $content));
echo "<center>";
OpenTable();
$contentpages = explode( "", $content );
$pageno = count($contentpages);
if ( $page=="" || $page < 1 )
$page = 1;
if ( $page > $pageno )
$page = $pageno;
$arrayelement = (int)$page;
$arrayelement --;
echo "<font class="option"><b>$title</b></font><br><br><font class="content">";
if ($pageno > 1) {
echo ""._PAGE.": $page/$pageno<br>";
}
echo "($words "._TOTALWORDS.")<br>"
."($counter "._READS.") "
."<a href="sections.php?op=printpage&artid=$artid"><img src="images/print.gif" border="0" Alt=""._PRINTER."" width="15" height="11"></a>"
."</font><br><br><br><br>
";
echo "$contentpages[$arrayelement]";
if($page >= $pageno)
{
$next_page = "";
} else {
$next_pagenumber = $page + 1;
if ($page != 1) {
$next_page .= "<img src="images/blackpixel.gif" width="10" height="2" border="0" alt=""> ";
}
$next_page .= "<a href="sections.php?op=viewarticle&artid=$artid&page=$next_pagenumber">"._NEXT." ($next_pagenumber/$pageno)</a> <a href="sections.php?op=viewarticle&artid=$artid&page=$next_pagenumber"><img src="images/download/right.gif" border="0" alt=""._NEXT.""></a>";
}
if($page <= 1)
{
$previous_page = "";
} else {
$previous_pagenumber = $page - 1;
$previous_page = "<a href="sections.php?op=viewarticle&artid=$artid&page=$previous_pagenumber"><img src="images/download/left.gif" border="0" alt=""._PREVIOUS.""></a> <a href="sections.php?op=viewarticle&artid=$artid&page=$previous_pagenumber">"._PREVIOUS." ($previous_pagenumber/$pageno)</a>";
}
echo "</td></tr>"
."<tr><td align="center">"
."$previous_page $next_page<br><br>"
."[ <a href="sections.php?op=listarticles&secid=$secid">"._BACKTO." $secname</a> | "
."<a href="sections.php">"._SECINDEX."</a> ]";
CloseTable();
echo "</center>";
mysql_free_result($result);
mysql_free_result($result2);
include ('footer.php');
}
function PrintSecPage($artid) {
global $site_logo, $nukeurl, $sitename, $datetime, $prefix;
$result=mysql_query("select title, content from $prefix"._seccont." where artid=$artid");
list($title, $content) = mysql_fetch_row($result);
echo "
<html>
<head><title>$sitename</title></head>
<body bgcolor="#FFFFFF" text="#000000">
<table border="0"><tr><td>
<table border="0" width="640" cellpadding="0" cellspacing="1" bgcolor="#000000"><tr><td>
<table border="0" width="640" cellpadding="20" cellspacing="1" bgcolor="#FFFFFF"><tr><td>
<center>
<img src="images/$site_logo" border="0" alt=""><br><br>
<font class="content">
<b>$title</b></font><br>
</center><font class="content">
$content<br><br>";
echo "</td></tr></table></td></tr></table>
<br><br><center>
<font class="content">
"._COMESFROM." $sitename<br>
<a href="$nukeurl">$nukeurl</a><br><br>
"._THEURL."<br>
<a href="$nukeurl/sections.php?artid=$artid">$nukeurl/sections.php?artid=$artid</a></font></center>
</td></tr></table>
</body>
</html>
";
}
switch($op) {
case "viewarticle":
viewarticle($artid, $page);
break;
case "listarticles":
listarticles($secid);
break;
case "printpage":
PrintSecPage($artid);
break;
default:
listsections();
break;
}
?>
I hilighted the open and close tags for ease of reading. I know it's RIGHT there in front of us.... See anythng?
(Edited by Lord Manimal at 3:56 am on Aug. 21, 2001)
#23
Re: PHP Nuke: Sections error
Posted 20 August 2001 - 10:02 PM
#24
Re: PHP Nuke: Sections error
Posted 24 August 2001 - 03:27 PM
Can you tell me where you got the theme that you use. I 've just dloaded php nuke and was looking at trying out your script. I don't get errors in any of the themes that come with it, but I have replaced the themes.php file in one of the theme folders and got the error. Just figure if I could set it as it's own theme, then I could see it with the images and what not.
#25
Re: PHP Nuke: Sections error
Posted 24 August 2001 - 11:08 PM
the other problem might be some kind of looping error -- but I doubt it.
If I had the time I'd help you out more..but my advice here is all I can spare :)
#26
Re: PHP Nuke: Sections error
Posted 25 August 2001 - 02:36 AM
|
|

New Topic/Question
Reply





MultiQuote


|