Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updating phpShop 0.81 - adding the forum module -
  • Loading branch information
ulisoft committed Oct 30, 2008
1 parent 12bc4a1 commit eeaaefd
Show file tree
Hide file tree
Showing 2 changed files with 345 additions and 0 deletions.
183 changes: 183 additions & 0 deletions phpshop1/WEB-INF/modules/shop/html/topic_list.ihtml
@@ -0,0 +1,183 @@
<?php
// if ($data["forum"]==1) {
if ($topic_return) {
echo $topic_return;
}

$topic_group_id=1000;
$utg=$topic_group_id + 1;

echo "<center>";
echo "<H4> $topic_list_str </H4>";

$navi_db = new ps_DB;
$q = "SELECT * ";
$q .= "FROM topic_groups WHERE topic_group_id <'$utg' ";
$q .= "AND language='$lang'";

$navi_db->query($q);

while ($navi_db->next_record()) {
$url = SECUREURL . "?page=$modulename/topic_list&show=";
echo "<A class=\"bLink\" HREF=";
echo $sess->url(SECUREURL . "?page=$modulename/topic_list&show=" . $navi_db->f("topic_group_id"));
echo "><B>";
echo $navi_db->f("topic_group_name")."</B></A> | ";
}

$url = SECUREURL . "?page=$modulename/topic_list";
echo "<A class=\"bLink\" HREF=".$sess->url($url)."><B> $show_all_lbl </B></A><BR>";

?>

</center><BR>

<?php

if (empty($offset))
$offset=0;

if ($keyword) {
$list = "SELECT topic_num, topic_id, topic_status, topics.mdate, topic_subject, topic_content, topics.topic_group_id,forum_name ";
$list .= "FROM topics,auth_user_md5 WHERE ";
$count = "SELECT count(*) as num_rows FROM topics, auth_user_md5 WHERE ";
$q = "(topics.topic_subject LIKE '%$keyword%' ";
$q .= "OR topics.topic_content LIKE '%$keyword%' ";
$q .= "OR auth_user_md5.forum_name LIKE '%$keyword%' ";
$q .= ") ";
$q .= "AND topics.user_id=auth_user_md5.user_id ";
$q .= "AND topics.vendor_id='$ps_vendor_id' ";
$q .= "AND topics.topic_group_id < '$utg' ";
$q .= "AND topics.language = '$lang' ";

$q .= "ORDER BY mdate DESC";
$list .= $q . " LIMIT $offset, " . SEARCH_ROWS;
$count .= $q;
}

else {
$q = "";
$list = "SELECT topic_num, topic_id, topic_status, topic_subject, topics.mdate,topics.topic_group_id,forum_name ";
$list .= "FROM topics,auth_user_md5 WHERE ";
$count = "SELECT count(*) as num_rows FROM topics, auth_user_md5 WHERE ";
$q .= "topics.user_id=auth_user_md5.user_id ";
$q .= "AND topics.vendor_id='$ps_vendor_id' ";
$q .= "AND topics.topic_group_id < '$utg' ";
$q .= "AND topics.language = '$lang' ";


if ($show)
$q .= "AND topics.topic_group_id = '$show' ";
$q .= "ORDER BY mdate DESC";
$list .= $q . " LIMIT $offset, " . SEARCH_ROWS;
$count .= $q;
}

$db->query($count);
$db->next_record();
$num_rows = $db->f("num_rows");

if ($num_rows == 0) {
echo "$notopics <BR>";

}
else {

search_header($topic_list_lbl, $modulename, "topic_list");
?>

<table width="100%" BORDER="0" cellspacing="0" cellpadding="0" align="center" class="RecordsTable">
<tr>
<td NOWRAP class="RecordsTableHeader">
<?php
echo $from_str;

if ($topic_group_name) {
echo " &nbsp &nbsp Group: $topic_group_name";
}
?>
</td>

<td NOWRAP class="RecordsTableHeader"><?php echo $topic_list_cdate ?></td>
<td NOWRAP class="RecordsTableHeader"><?php echo $subject_lbl ?></td>
<td NOWRAP class="RecordsTableHeader"><?php echo $group_str ?></td>
</tr>

<?php
$db->query($list);
$i = 0;
while ($db->next_record()) {

if ($i++ % 2)
$bgcolor=SEARCH_COLOR_1;
else
$bgcolor=SEARCH_COLOR_2;
?>
<tr BGCOLOR=<?php echo $bgcolor ?>>
<td>

<?php
echo $db->f("forum_name");
?>

<td NOWRAP>
<?php
echo strftime("%d-%b-%y %H:%M", $db->f("mdate"));
?>
</td>

<?php
$q = "SELECT topic_status FROM topics WHERE ";
$q .= "topic_id = '" . $db->f("topic_id") . "'";
$q .= "AND language='$lang'";
$dbps = new ps_DB;
$dbps->query($q);
$dbps->next_record();
?>
<td NOWRAP>

<?php

if ($auth["user_id"]) {
$url = $sess->url(SECUREURL . "?page=account/topic_print&topic_id=" . $db->f("topic_id"));
echo "<A class=\"bLink\" HREF=$url>";
echo $db->f("topic_subject");
echo "</A><BR>";
}

else {
$url = $sess->url(URL . "?page=shop/topic_print&topic_id=" . $db->f("topic_id"));
echo "<A class=\"bLink\" HREF=$url>";
echo $db->f("topic_subject");
echo "</A><BR>";
}
?>
</td>

<td NOWRAP>

<?php

$q = "SELECT topic_group_name FROM topic_groups WHERE ";
$q .= "topic_group_id = '" . $db->f("topic_group_id") . "'";
$dbps = new ps_DB;
$dbps->query($q);
$dbps->next_record();
echo $dbps->f("topic_group_name");
echo "<BR>";
?>
</td>

</tr>
<?php
}
?>
</table>

<?php
search_footer($modulename, "topic_list", $offset, $num_rows, $keyword . "&show=$show");
}
// }
?>


162 changes: 162 additions & 0 deletions phpshop1/WEB-INF/modules/shop/html/topic_print.ihtml
@@ -0,0 +1,162 @@
<?php
// if ($data["forum"]==1) {
$utg=1001;

$q = "SELECT * FROM topics WHERE topic_id='$topic_id' AND language='$lang' AND topic_group_id < '$utg' AND vendor_id='$ps_vendor_id'";
$db->query($q);

if ($db->next_record()) {
$topic_user_id=$db->f("user_id");
$topic_status=$db->f("topic_status");
$topic_view=$db->f("topic_view") + 1;
$mdate=$db->f("mdate");
$topic_subject=$db->f("topic_subject");
$topic_content=$db->f("topic_content");
$topic_group_id=$db->f("topic_group_id");

$q = "SELECT * FROM topic_groups WHERE ";
$q .= "topic_group_id='$topic_group_id' ";
$q .= "AND language='$lang'";
$db->query($q);
$db->next_record();
$topic_group_name=$db->f("topic_group_name");

$q = "UPDATE topics SET ";
$q .= "topic_view= '$topic_view'";
$q .= " WHERE topic_id='$topic_id' AND language='$lang'";
$db->query($q);
$db->next_record();
?>

<TABLE WIDTH=100% ALIGN=CENTER BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR VALIGN=TOP BGCOLOR=<?php echo $leftbar_title_bgcolor?>>
<TD ALIGN=RIGHT>
<a class=bLink href=<?php $sess->purl(SECUREURL . "?page=account/topic_add");?>>
<?php echo $new_topic_title ?></a>
&nbsp &nbsp
<a class=bLink href=<?php $sess->purl(SECUREURL . "?page=account/topic_reply&topic_id=$topic_id");?>>
<?php echo $reply_str ?></a>
&nbsp &nbsp

</TD>
</TR>
</TABLE>
</form>

<table width="100%" BORDER="1" cellspacing="0" cellpadding="2" align="center" class="RecordsTable">
<TR BGCOLOR=#FFcc00>

<TD colspan=2><B><?php echo $info_lbl ?></B></TD>
</TR>
<TR>
<TD width="50%"><?php echo $group_str ?></TD>
<TD width="50%">
<a class=bLink href="<?php $sess->purl(SECUREURL . "?page=shop/topic_list&show=$topic_group_id") ?>"><?php echo $topic_group_name ?>
</TD>
</TR>

<TR>
<TD><?php echo $topic_list_id ?></TD>
<TD><?php echo $topic_id ?></TD>
</TR>

<TR>
<TD><?php echo $date_lbl ?></TD>
<TD><?php echo date("d-M-Y H:i", $mdate); ?></TD>
</TR>

<TR>
<TD><?php echo $ftp_list_status ?></TD>
<TD>
<?php
$q = "SELECT topic_status_name FROM topic_status WHERE ";
$q .= "topic_status_id = '$topic_status' AND language='$lang' ";
$dbos = new ps_DB;
$dbos->query($q);
$dbos->next_record();
echo $dbos->f("topic_status_name");
?>

</TD>
</TR>

<TR>
<TD><?php echo $from_str ?></TD>

<TD><?php
$q = "SELECT user_id FROM topics WHERE ";
$q .= "topic_id = '$topic_id' AND language='$lang' ";
$dbos = new ps_DB;
$dbos->query($q);
$dbos->next_record();
$uid=$dbos->f("user_id");

$q = "SELECT * FROM auth_user_md5 WHERE user_id = '$uid'";
$dbos = new ps_DB;
$dbos->query($q);
$dbos->next_record();
$un=$dbos->f("forum_name");
echo $un;
?>

</TD>
</TR>

<TR>
<TD><?php echo $clicks_lbl ?></TD>
<TD><?php echo $topic_view ?></TD>
</TR>

<TR BGCOLOR=#FFcc00 VALIGN=top>
<TD colspan=2 width=100%><B><?php echo $topic_lbl ?></B></TD>
</TR>

<TR>
<TD COLSPAN=2><B><?php echo $subject_lbl ?></B>:&nbsp
<?php echo $topic_subject ?></TD>
</TR>

<TR>
<TD colspan=2>
<?php
$topic_content=str_replace(" ","&nbsp;",$topic_content);
$topic_content=str_replace("&lt;a&nbsp;href","<a href",$topic_content);
$topic_content=str_replace("&lt;/a&gt;","</a>",$topic_content);
$topic_content=str_replace("&gt;",">",$topic_content);
echo $topic_content;
?>
<br>
</TD>
</TR>

<?php
$db = new ps_DB;
$q = "SELECT * FROM topic_reply WHERE ";
$q .= "topic_id = '$topic_id' AND language='$lang' ";
$db->query($q);

$i=0;
while ($db->next_record()) {
$i++;

if ($i==1) {
echo "<tr><td colspan=2>";
echo "<B>$reply_list_mnu</B><BR>";
}

$rs=$db->f("reply_subject");
$reply_id=$db->f("reply_id");
$url = SECUREURL . "?page=shop/reply_print&reply_id=";
$url .= $reply_id;
echo "<A class=\"bLink\" HREF=".$sess->url($url).">$rs</A><BR>";
}

if ($i > 0) {
echo "</td></tr>";
}
?>
</table>
<?php
}
// }
?>

0 comments on commit eeaaefd

Please sign in to comment.