[CODE TAGS REMOVED DUE TO FORUM DISPLAY BUG]
MODERATOR
Well, judging by that single line of PHP you gave us, Id try to remove the two '}' and see what happens.
I removed two '}' as u suggested. Now, I am getting following error:
Parse error: syntax error, unexpected $end in C:\wamp\www\Joomla_1.0.12-Stable-Full_Package\components\com_jbook\jbook.html.php on line 494
<?php
/**
* Course HTML
*
* @ Copyright (C) 2005 Jan Schulz-Hofen
* @ All rights reserved
* @ Released under GNU/GPL License:
http://www.gnu.org/copyleft/gpl.html
* @ This component is derived from the com_booklist component by Yann Bouan which is derived from the mambo com_weblinks component
**/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
//require_once( "includes/HTML_toolbar.php" );
class HTML_Book {
function displaylist( &$categories, &$rows, $catid, &$currentcat ) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase,$mainframe;
?>
<table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane">
<tr>
<td colspan="2">
<table border=0><tr><td width=40%>
<span class="componentheading">
<?php
if (($currentcat->title)<>''){
echo $currentcat->title;
} else {
echo _GENERIC_NAME;
}
?>
</span>
<?
echo "<p />"._CATEGORY.": ".categoryParentLI($catid,"index.php?option=com_jb ook","catid");
?>
</td>
<td width=40% valign=top><div align=right>
<form action=index.php>
<input type=hidden name=option value=com_jbook>
<input type=hidden name=Itemid value=<?=$Itemid?>>
<!-- Hack by ICS : was present twice (+reorder)
<input type=hidden name=option value=com_jbook>
-->
<input type=hidden name=task value=search>
<table><tr><td>
<input type=text name=phrase>
</td><td align=right>
<span align=right>
<input type=submit value='<? echo _SEARCH;?>'>
</span>
</td></tr>
<tr><td colspan=2>
<input type=radio name=mode value='0' checked><? echo _ONLY_TITLE;?>
<input type=radio name=mode value='1'><? echo _TITLE_AND_HTML;?>
</td></tr></table>
</form>
</span>
</td>
</tr>
</table>
</td>
<tr>
<td width="60%" valign="top" class="contentdescription" colspan="2">
<?php if (($currentcat->image)<>'') {
$img='stories/'.$currentcat->image;
$align=$currentcat->image_position;
} else {
$img='stories/courses.jpg';
$align='right';
}
?>
<?php if (($currentcat->description)<>'') {
echo $currentcat->description;
}
?>
</td>
</tr>
<?php
if (count( $categories )) {
foreach ($categories as $cat) {
?>
<tr>
<td valign="top" width="5"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/arrow.png" alt="" /> </td><td>
<a href="<?php echo sefRelToAbs("index.php?option=com_jbook&Itemid =$Itemid&catid=$cat->catid"); ?>" class="category">
<?php echo $cat->title;?></a> <span class="small">(<?php
if ($cat->numlinks==0) echo _BOOK_ZERO;
if ($cat->numlinks==1) echo _BOOK_ONE;
if ($cat->numlinks>1) echo $cat->numlinks._BOOK_MORE;
?>)</span><br /><? echo $cat->catdesc;?></td>
</tr>
<?php
}
?>
</table>
<?php
}
// Hack by ICS : add test on catid
if ($catid<>0){
HTML_Book::displaylistraw($rows );}
?>
<?php
// Hack by ICS : add test on catid
if ($catid=0){
echo "<br>";
echo "<b><a href='javascript
:history.go(-1)'>"._BACK."</a></b>";
echo "<br>";
}
?>
<?php
}
function displaylistraw( &$rows , $showcat=0) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase,$mainframe;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
$tabclass = array("sectiontableentry1", "sectiontableentry2");
$k = 0;
$j=1;
if (sizeof($rows)==0) {
echo _NO_BOOK;
} else {
foreach ($rows as $row) {
if ($row->published==0) continue;
?>
<tr class="<?php echo $tabclass[$k]; ?>">
<td align="left" valign=top>
<?php echo $j++; ?>.
</td>
<td valign=top>
<a class="category" href="<?php echo sefRelToAbs("index.php?option=com_jbook&task=v iew&Itemid=$Itemid&catid=$row->catid&id=$row->id"); ?>">
<?
$cover_s=$mosConfig_live_site."/images/jbook_cover/".$row->id."_s.jpg";
$Abscover_s=$mosConfig_absolute_path."/images/jbook_cover/".$row->id."_s.jpg";
if (!file_exists($Abscover_s)) $cover_s=$mosConfig_live_site."/components/com_jbook/images/nocover.jpg";
echo "<img id=\"covers\" src=\"$cover_s\" border=0>";
?>
</a>
</td>
<td valign=top>
<a href="<?php echo sefRelToAbs("index.php?option=com_jbook&task=v iew&Itemid=$Itemid&catid=$row->catid&id=$row->id"); ?>"><?php echo $row->title; ?></a>
<?
$database->setQuery( "SELECT a.*"
. "\nFROM #__jbauthor AS a"
. "\nLEFT JOIN #__jbbookauth AS ba ON ba.idauth = a.id"
. "\nWHERE ba.idbook=$row->id"
. "\nORDER BY a.name"
);
$authorList = $database->loadObjectList();
if ($authorList) echo _BY_AUTH." ";
foreach ($authorList as $c=>$auth) {
?>
<a href="<?php echo sefRelToAbs("index.php?option=com_jbook&task=v iewAuth&Itemid=$Itemid&catid=$row->catid&id=$auth->id"); ?>"><?php echo $auth->name; ?></a><?php if ($c!=(sizeof($authorList)-1)) echo ", ";
}
?>
<br />
<?php echo substr($row->html,0,100);
if (strlen($row->html)>100) echo _OTHER_DETAIL;
if ($showcat) echo "<br>"._CATEGORY.": ".categoryParentLI($row->catid,"index.php?option=com_jbook","catid");
?>
</td>
</tr>
<tr><td colspan=3>
<!-- Hack by ICS : delete HR
<HR> -->
</td></tr>
<?php $k = 1 - $k; ?>
</table>
<!-- Hack by ICS : add return button for search task -->
<br>
<b><a href='javascript
:history.go(-1)'><?php echo _BACK?></a></b>
<br>
<?php
}
function showItem( &$currItem ,&$currentcat ) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase,$my,
$conf_link_url,$conf_link_alt;
?>
<!-- Hack by ICS : New table structure -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="contentpaneopen">
<tr>
<td valign="top" colspan="2">
<span class="componentheading">
<?php echo $currItem->title; ?>
</span>
<?php
$database->setQuery( "SELECT a.*"
. "\nFROM #__jbauthor AS a"
. "\nLEFT JOIN #__jbbookauth AS ba ON ba.idauth = a.id"
. "\nWHERE ba.idbook=$currItem->id"
. "\nORDER BY a.name" );
$authorList = $database->loadObjectList();
if ($authorList) echo _BY_AUTH." ";
foreach ($authorList as $c=>$auth) {
?>
<a href="<?php echo sefRelToAbs("index.php?option=com_jbook&task=v iewAuth&Itemid=$Itemid&catid=$row->catid&id=$auth->id"); ?>"><?php echo $auth->name; ?></a><?php if ($c!=(sizeof($authorList)-1)) echo ", ";
}
echo "<br>"._CATEGORY.": ".categoryParentLI($currItem->catid,"index.php?option=com_jbook","catid");
echo "<br> <br>";
?>
</td>
</tr>
<tr>
<td valign="top" width="180px">
<?
$cover_l=$mosConfig_live_site."/images/jbook_cover/".$currItem->id."_l.jpg";
$Abscover_l=$mosConfig_absolute_path."/images/jbook_cover/".$currItem->id."_l.jpg";
if (!file_exists($Abscover_l)) $cover_l=$mosConfig_live_site."/components/com_jbook/images/nocover.jpg";
echo "<img id=\"coverl\" src=\"$cover_l\" border=0>";
?>
</td>
<td valign="top" class="contentdescription">
<?php $database->setQuery( "SELECT * FROM #__jbeditor WHERE id=$currItem->ideditor");
$editor = $database->loadObjectList();
// hack by ICS : added strong
if ($editor) echo "<p /><strong>".strtoupper(substr(_EDITOR,0,1)).substr( _EDITOR,1)." : ".$editor[0]->name."</strong>";
if ($currItem->pag) echo "<br /><strong>"._PAGES." : ".$currItem->pag."</strong>";
if ($currItem->price) echo "<br /><strong>"._PRICE." : ".$currItem->price."</strong>" ;
if ($currItem->isbn) echo "<br /><strong>ISBN : <a href='$conf_link_url".$currItem->isbn."' alt='$conf_link_alt'>".$currItem->isbn."</a></strong>";
echo "<br>";
echo $currItem->html;
?>
</td>
</tr>
</table>
<hr>
<!-- Hack by ICS : correct table structure / new table structure -->
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td nowrap="nowrap" valign="top">
<? if ($currItem->vote) {echo _VOTE." : ";}?>
</td>
<td>
<?php
// display voting
for ($i=0;$i<$currItem->vote;$i++)
echo "<img src=\"components/com_jbook/images/star.gif\">";
for ($i=$currItem->vote;$i<5;$i++)
echo "<img src=\"components/com_jbook/images/greystar.gif\">";
// Hack by ICS - lang for votes and hits
echo " - ";
if ($currItem->numvote==0) echo _VOTE_ZERO;
if ($currItem->numvote==1) echo _VOTE_ONE;
if ($currItem->numvote>1) echo $currItem->numvote._VOTE_MORE;
echo " (";
if ($currItem->hits==0) echo _HITS_ZERO;
if ($currItem->hits==1) echo _HITS_ONE;
if ($currItem->hits>1) echo $currItem->hits._HITS_MORE;
echo ")";
?>
</td>
</tr>
<tr>
<td colspan="2">
<?php
if ($my->gid>0) {
// a faire : voir si l'appel à voting est correct ?
echo voting($currItem->id,$Itemid);
?>
<div id="newoption"></div>
<script language=javascript>
function hideShow (toShow) {
elem=document.getElementById('newoption');
if (toShow == 'newComment') {
elem.innerHTML="<div id='newcomment'><form><input type='hidden' name='option' value='com_jbook' /><input type='hidden' name='Itemid' value='<? echo $Itemid; ?>' /><input type='hidden' name='id' value='<? echo $currItem->id; ?>' /><input type='hidden' name='task' value='saveComment' /><textarea name='comment' rows='5' cols='50'></textarea><br><input class='button' type='submit' value='<?php echo _SEND_COMMENT; ?>'><input type='hidden' name='pop' value='0' /><input type='hidden' name='section' value='book' /></form></div>";
}
if (toShow == 'newEmailMessage') {
elem.innerHTML="<div id='newemailmessage'><form><?php echo _YOUR_QUESTION_HERE; ?><br><textarea name='comment' rows='5' cols='50'></textarea><br><input type='checkbox' name='sendcopy' value='1'> <?php echo _SEND_COPY; ?><br><input type='hidden' name='task' value='sendMessage' /><input type='hidden' name='pop' value='0' /><input type='hidden' name='option' value='com_jbook' /><input type='hidden' name='Itemid' value='<? echo $Itemid; ?>' /><input type='hidden' name='id' value='<? echo $currItem->id; ?>' /><input type='hidden' name='section' value='book' /><input type='hidden' name='catid' value='<?php echo $_GET['catid']; ?>'><input class='button' type='submit' value='<?php echo _SEND_MESSAGE; ?>'></form></div>";
}
}
</script>
<?
}
else {
echo _NO_RATE_USER;
}
?>
</td>
</tr>
</table>
<!-- Hack by ICS : correct table structure / new table structure -->
<table width="100%">
<tr>
<td>
<?
$sql="SELECT #__jbcomment.*,#__users.name,#__users.username FROM #__jbcomment "
. "\nLEFT JOIN #__users ON #__jbcomment.userid=#__users.id"
. "\nWHERE bookid=".$currItem->id;
$database->setQuery($sql);
$database->query();
$rows = $database->loadObjectList();
HTML_Book::showComment($rows);
?>
</td>
</tr>
</table>
<br>
<b><a href='javascript
:history.go(-1)'><?php echo _BACK?></a></b>
<br>
<?php
}
function showAuth( &$currItem ) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase;
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="contentpaneopen">
<tr>
<td valign="top">
<span class="componentheading">
<?php
echo $currItem->name;
?>
</span>
<p />
<?
if ($currItem->html) echo $currItem->html;
?>
<!-- Hack by ICS : add br -->
<br /> <br />
</td>
</tr>
<tr>
<td valign="top" class="contentdescription">
<?
$sql="SELECT * FROM #__jbbook LEFT JOIN #__jbbookauth ON #__jbbookauth.idbook=#__jbbook.id WHERE #__jbbookauth.idauth=".$currItem->id;
$database->setQuery($sql);
$rows = $database->loadObjectList();
if ($rows) {
// hack by ICS : add class
echo "<div class=\"contentheading\">"._OTHER_BOOKS_SAME_AUTH. "</div><p />";
HTML_Book::displaylistraw( $rows ,1);
}
else {
echo "<hr>"._NO_OTHER_BOOKS_SAME_AUTH."<p />";
}
?>
</td>
</tr>
</table>
<br />
<!-- Hack by ICS : duplicate
<b>
<a href='javascript
:history.go(-1)'><?php echo _BACK?></a></b>
<br /> -->
<?php
}
// Hack by ICS : add table header, correct table structure
function showComment( $rows) {
global $Itemid, $mosConfig_live_site,$mosConfig_absolute_path,$dat abase,$mainframe,$my;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
$tabclass = array("sectiontableentry1", "sectiontableentry2");
$k = 0;
$j=1;
if (sizeof($rows)==0) {
echo _NO_COMMENT;
}
else {
?>
<tr>
<td class="sectiontableheader">
<?php echo _COMMENT_BY ?>
</td>
<td class="sectiontableheader">
<?php echo _COMMENTS ?>
</td>
</tr>
<?php
foreach ($rows as $row) {
if (($row->published==0) AND ($my->gid!=2))continue;
?>
<tr class="<?php echo $tabclass[$k]; ?>">
<td valign=top>
<?
if ($my->gid>=2) {
$img = $row->published ? 'tick.png' : 'publish_x.png';
$status=$row->published? 0:1;
$url = "index.php?Itemid=$Itemid&id=$row->id&task=modifyComment&option=com_jbook§ion=bo ok&status=$status";
?>
<a href="<?php echo $url; ?>">
<img src="images/<?php echo $img; ?>" border="0"></a>
<?
}
echo $row->name;
?>
</td>
<td valign=top>
<?php echo $row->text; ?>
</td>
</tr>
<?php $k = 1 - $k; }} ?>
</table>
<?php
}
}
function voting($id,$Itemid) {
$html .= '<form method="post" action="' . sefRelToAbs( 'index.php' ) . '">';
$img = '';
$url = @$_SERVER['REQUEST_URI'];
$url = ampReplace( $url );
$html .= '<span class="content_vote">';
$html .= '<input class="button" type="submit" name="submit_vote" value="'. _RATE_BOOK .'" /> ';
$html .= _VOTE_POOR;
$html .= '<input type="radio" alt="vote 1 star" name="user_rating" value="1" />';
$html .= '<input type="radio" alt="vote 2 star" name="user_rating" value="2" />';
$html .= '<input type="radio" alt="vote 3 star" name="user_rating" value="3" />';
$html .= '<input type="radio" alt="vote 4 star" name="user_rating" value="4" />';
$html .= '<input type="radio" alt="vote 5 star" name="user_rating" value="5" checked="checked" />';
$html .= _VOTE_BEST;
$html .= '<p>';
$html .= '<input class="button" type="button" name="show" value="'. _COMMENT_BOOK .'" onClick="javascript
:hideShow (\'newComment\')">';
$html .= '<input class="button" type="button" name="show" value="'. _ASK_MORE_INFO .'" onClick="javascript
:hideShow (\'newEmailMessage\')">';
$html .= '<input type="hidden" name="task" value="vote" />';
$html .= '<input type="hidden" name="pop" value="0" />';
$html .= '<input type="hidden" name="option" value="com_jbook" />';
$html .= '<input type="hidden" name="Itemid" value="'. $Itemid .'" />';
$html .= '<input type="hidden" name="id" value="'. $id .'" />';
$html .= '<input type="hidden" name="section" value="book" />';
$html .= '</span>';
$html .= '</form>';
return $html;
}
?>
hope you can help.