Example #1
0
            } else {
                libAuth::resourceLimiter('view threads', 20);
                $tabl = $DB->sql_tabl("SELECT id, subject, message, timeSent FROM wD_ForumMessages\r\n\t\t\t\t\tWHERE fromUserID = " . $UserProfile->id . " AND type='ThreadStart'\r\n\t\t\t\t\tORDER BY timeSent DESC");
                $buf = '<h4>' . l_t('Threads posted:') . '</h4>
					<ul>';
                while (list($id, $subject, $message, $timeSent) = $DB->tabl_row($tabl)) {
                    $buf .= '<li><em>' . libTime::text($timeSent) . '</em>:
						<a href="forum.php?threadID=' . $id . '">' . $subject . '</a><br />' . $message . '</li>';
                }
                $buf .= '</ul>';
                file_put_contents($dir . '/profile_threads.html', $buf);
                print $buf;
            }
            break;
        case 'replies':
            $dir = User::cacheDir($UserProfile->id);
            if (file_exists($dir . '/profile_replies.html')) {
                print file_get_contents($dir . '/profile_replies.html');
            } else {
                libAuth::resourceLimiter('view replies', 20);
                $tabl = $DB->sql_tabl("SELECT f.id, a.id, a.subject, f.message, f.timeSent\r\n\t\t\t\t\tFROM wD_ForumMessages f INNER JOIN wD_ForumMessages a ON ( f.toID = a.id )\r\n\t\t\t\t\tWHERE f.fromUserID = " . $UserProfile->id . " AND f.type='ThreadReply'\r\n\t\t\t\t\tORDER BY f.timeSent DESC");
                $buf = '<h4>' . l_t('Replies:') . '</h4>
					<ul>';
                while (list($id, $threadID, $subject, $message, $timeSent) = $DB->tabl_row($tabl)) {
                    $buf .= '<li><em>' . libTime::text($timeSent) . '</em>: <a href="forum.php?threadID=' . $threadID . '#' . $id . '">Re: ' . $subject . '</a><br />' . $message . '</li>';
                }
                $buf .= '</ul>';
                file_put_contents($dir . '/profile_replies.html', $buf);
                print $buf;
            }
            break;