Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Unanswered Threads

Asked Modified Viewed 2,495 times
H
HobbyMan
H
Just some Guy
  • Veteran Member, joined since
  • Contributed 1,486 posts on the community forums.
  • Started 91 threads in the forums
  • Started this discussions
asked
Veteran Member

Add this into a custom page and set access to suit.

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: unanswered_threads.php
| Author: Nick Jones (Digitanium)
| Adapted by Philip
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/

require_once "maincore.php";
require_once THEME."theme.php";

if (!iADMIN) { redirect(BASEDIR."index.php"wink; }

global $lastvisited;

if (!isset($lastvisited) || !isnum($lastvisited)) { $lastvisited = time(); }

if (isset($_GET['rowstart']) && isnum($_GET['rowstart'])) {
$rowstart = $_GET['rowstart'];
} else {
$rowstart = 0;
}

$result = dbquery(
"SELECT tt.thread_id, tt.thread_subject, tt.thread_views, tt.thread_lastuser, tt.thread_lastpost,
tt.thread_poll, tf.forum_id, tf.forum_name, tf.forum_access, tt.thread_lastpostid, tt.thread_postcount, tu.user_id, tu.user_name
FROM ".DB_THREADS." tt
INNER JOIN ".DB_FORUMS." tf ON tt.forum_id=tf.forum_id
INNER JOIN ".DB_USERS." tu ON tt.thread_lastuser=tu.user_id
WHERE tf.forum_id !='50' AND tf.forum_id !='77' AND tf.forum_id !='78' AND tf.forum_id !='79' AND tf.forum_id !='80' AND tf.forum_id !='83'
AND ".groupaccess('tf.forum_access'wink." AND tt.thread_postcount = 1
ORDER BY tt.thread_lastpost DESC LIMIT $rowstart,50
"wink;


if (dbrows($result)) {

$thread_count = (dbcount("(thread_id)", DB_THREADS, "thread_postcount = 1"wink);
$week_time = (time() + ($settings['timeoffset'] * 3600));
$week_utotal = (dbcount("(thread_id)", DB_THREADS, "thread_lastpost + 604800 > $week_time AND thread_postcount = 1"wink);
$week_total = (dbcount("(thread_id)", DB_THREADS, "thread_lastpost + 604800 > $week_time"wink);

$all_utotal = (dbcount("(thread_id)", DB_THREADS, "thread_postcount = 1"wink);
$all_total = (dbcount("(thread_id)", DB_THREADS));

$i = 0;
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
echo "<td class='tbl2'>&nbsp;</td>\n";
echo "<td class='tbl2'><strong>Total Threads: ".$all_total."<br />
Total Unanswered: ".$thread_count."<br />
Overall percentage: ".round($all_utotal*100/$all_total)."%
</strong></td>\n";

echo "<td class='tbl2' align='left' colspan='3'><strong>Total this week: ".$week_total."<br />
Unanswered: ".$week_utotal."<br />
Weeks percentage: ".round($week_utotal*100/$week_total)."%
</strong></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl2'>&nbsp;</td>\n";
echo "<td width='100%' class='tbl2'><strong>".$locale['global_044']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_045']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_046']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_047']."</strong></td>\n";
echo "</tr>\n";
while ($data = dbarray($result)) {

$row_color = ($i % 2 == 0 ? "tbl1" : "tbl2"wink;
echo "<tr>\n<td class='".$row_color."'>";
if ($data['thread_lastpost'] > $lastvisited) {
$thread_match = $data['thread_id']."\|".$data['thread_lastpost']."\|".$data['forum_id'];
if (iMEMBER && preg_match("(^\.{$thread_match}$|\.{$thread_match}\.|\.{$thread_match}$)", $userdata['user_threads'])) {

echo "<img src='".get_image("folder"wink."' alt='' />";
} else {
echo "<img src='".get_image("foldernew"wink."' alt='' />";
}

} else {
echo "<img src='".get_image("folder"wink."' alt='' />";
}

if ($data['thread_poll']) {

$thread_poll = "<span class='small' style='font-weight:bold'>[".$locale['global_051']."]</span> ";
} else {

$thread_poll = "";
}

echo "</td>\n";
echo "<td width='100%' class='".$row_color."'>".$thread_poll."<a href='".FORUM."viewthread.php?thread_id=".$data['thread_id']."&amp;pid=".$data['thread_lastpostid']."#post_".$data['thread_lastpostid']."' title='".$data['thread_subject']."'>".trimlink($data['thread_subject'], 30)."</a><br />\n".$data['forum_name']."</td>\n";
echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'>".$data['thread_views']."</td>\n";
echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'>".($data['thread_postcount']-1)."</td>\n";
echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'><a href='".BASEDIR."profile.php?lookup=".$data['thread_lastuser']."'>".$data['user_name']."</a><br />\n".showdate("forumdate", $data['thread_lastpost'])."</td>\n";
echo "</tr>\n";
$i++;
}

echo "</table>\n";
}

if ($thread_count > 50) echo "<div align='center' style=';margin-top:5px;'>\n".makepagenav($rowstart,50,$thread_count,3,FUSION_SELF."?page_id=".$_GET['page_id']."&amp;"wink."\n</div>\n";

?>[/syntaxhighlighter]
Edited by HobbyMan on 16-12-2010 21:08,
0 replies

1 post

P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Bugfix:
//require_once "maincore.php";
//require_once THEME."theme.php";
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 1 post
  • Votes 0 votes
  • Topic users 2 members

2 participants

H
H
Just some Guy
  • Veteran Member, joined since
  • Contributed 1,486 posts on the community forums.
  • Started 91 threads in the forums
  • Started this discussions
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet