ok so if faax's mod does'nt work, does anybody know how to include it on the index (i'd do it by myself but i'm noob @ JavaScript)
check wich mod you use...
You are not logged in. Please login or register.
PunBB Forums → Posts by faax
ok so if faax's mod does'nt work, does anybody know how to include it on the index (i'd do it by myself but i'm noob @ JavaScript)
check wich mod you use...
ops... sorry! sorry! sorry!
there is language (Bosnian - utf-8 or windows-1250)
<?php
// Language definitions used in chatbox.php
$lang_chatbox = array(
'Page_title' => 'Porukice',
'Chatbox' => 'Porukice',
'Posts' => ' komentari',
'Sending' => 'Slanje komentara...',
'No Read Permission' => 'Vi nemate pristupa ?itati porukice!',
'No Post Permission' => 'Vi nemate pristupa upisivati porukice',
'No Message' => 'Trenutno nema porukica...',
'Message' => 'Poruka',
'Btn Send' => 'Po?alji',
'Autoscroll' => 'Automatski scroll',
'Error Title' => 'Gre?ka',
'Error No message' => 'Morate upisati porukicu.',
'Error Too long message' => 'Va?a poruka je preduga!',
);
now i check your chatbox, looks better and ... i must include this in index.php ...
sorry my fault :S
ajax chatbox testing? why? see here it's work...
faax,
Please tell how do u include chatbox on index.php your forum?
it's simple... set up height and width of chatbox from admin plugins and
open index.php
find (line ~39):
require PUN_ROOT.'header.php';
add after
include PUN_ROOT.'chatbox.php';
save/upload
and now there is modification of ajax_chat.js (located in /include/js)
// Some misc. definitions
var sending = false;
// Check if our browser will support this...
function createRequestObject() {
var req;
if(window.XMLHttpRequest){
// Firefox, Safari, Opera...
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
// Internet Explorer 5+
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
return true; // Revert to the regular .php script if there isn't any ajax support. Will throw some JS errors, but hey, what can you do, right? ;)
}
return req;
}
// Make the XMLHttpRequest object
var http = createRequestObject();
// Function used for posting a new entry on the chat page
function sendRequestPost(form_sent, form_user, req_message) {
var req_username = "";
var req_email = "";
var email = "";
getInput = document.getElementsByTagName("input");
for (i=0; i< getInput.length; i++) {
if(getInput[i].name == "req_username") {
req_username = getInput[i].value;
}
if(getInput[i].name == "req_email") {
req_email = getInput[i].value;
}
if(getInput[i].name == "email") {
email = getInput[i].value;
}
}
// Open PHP script for requests
http.open('POST', 'index.php', true);
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
var postvars = 'form_sent=' + form_sent + '&form_user=' + form_user.replace(/&/g,"%26") + '&req_message=' + req_message.replace(/&/g,"%26") + '&ajax=1' + '&submit=1' + '&req_username=' + req_username + '&req_email=' + req_email + '&email=' + email;
http.onreadystatechange = handleResponse;
http.send(postvars);
// Disable input fields while posting or refreshing
disableThis = document.getElementsByTagName("input");
for (i=0; i< disableThis.length; i++) {
disableThis[i].disabled = true;
}
sending = true; // Let the script know that we're trying to post. Used to empty the textarea afterwards, if successful, while not touching it on a refresh
}
// Function to refresh the chatbox
function refreshBox() {
// Open PHP script for requests
http.open('POST', 'index.php', true);
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
var postvars = 'ajax=1';
http.onreadystatechange = handleResponse;
http.send(postvars);
// Disable input fields while posting or refreshing
disableThis = document.getElementsByTagName("input");
for (i=0; i< disableThis.length; i++) {
disableThis[i].disabled = true;
}
}
function getHost(hostId) {
// Open PHP script for requests
http.open('POST', 'index.php?get_host='+hostId, true);
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
var postvars = 'ajax=1';
http.onreadystatechange = handleResponse;
http.send(postvars);
}
// Function to delete specific chatbox posts
function deleteMsg(delThis, usrPostCount) {
// Open PHP script for requests
http.open('POST', 'index.php?del='+delThis+'&usr='+usrPostCount, true);
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
var postvars = 'ajax=1';
http.onreadystatechange = handleResponse;
http.send(postvars);
document.getElementById('del'+delThis).innerHTML = 'deleting message…';
}
// Function to handle the data we recieve back from the script.
function handleResponse() {
if(http.readyState == 4 && http.status == 200){
// Text returned FROM the PHP script
var response = http.responseText;
if(response) {
// UPDATE page with new content
document.getElementById("scrollbox").innerHTML = response;
if(window.sending === true) {
document.getElementById("req_message").value = "";
}
// Re-enable input fields after posting or refreshing
disableThis = document.getElementsByTagName("input");
for (i=0; i< disableThis.length; i++) {
disableThis[i].disabled = false;
}
}
}
}
save/upload
i think this is ugly way... but simple?
sorry 4 my bad english
bosnian language (charset - utf-8 or windows-1250)
<?php
// Language definitions used in chatbox.php
// jezik za podatak chatbox.php
$lang_chatbox = array(
'Page_title' => 'Na brzaka...',
'Chatbox' => 'Brzinski ;)',
'Posts' => ' komentari',
'Sending' => 'upisivanje u toku...',
'No Read Permission' => 'Nemate pristupa, registrujte se!',
'No Post Permission' => 'Nemate pristupa, registrujte se!',
'No Message' => 'Nema poruka...',
'Message' => 'Poruka',
'Btn Send' => 'Po?alji',
'Btn Refresh' => 'Osvje?i',
'Error No message' => 'Morate upisati poruku.',
'Error Too long message' => 'Va?a poruka je preduga...',
);
i use chatbox here is still under developing
...why links open in _self why not in _blank ? i don't understeand how is _self better of _blank...
thanks 4 copy/paste
i write first
sorry... i didn't see this
how to set default avatar for all new users and for users without avatar?
etc ... image with text no avatar yet
see extern.php in PUN_ROOT directory
i use mod active topics
<?php
/*
PunBB Active Topics
Copyright 2004-2005 Alex King, http://www.alexking.org/
This is a mod for PunBB, http://punbb.org/
PunBB is Copyright (C) 2002, 2003, 2004 Rickard Andersson (rickard@punbb.org)
This file is based on the viewtopic.php file in PunBB.
-------------------------------
*/
$ak_limit = 5; // change this to the number of active topics you want to display.
$result = $db->query('
SELECT t.*
FROM '.$db->prefix.'topics AS t
INNER JOIN '.$db->prefix.'forums AS f
ON f.id=t.forum_id
LEFT JOIN '.$db->prefix.'forum_perms AS fp
ON (
fp.forum_id=f.id
AND fp.group_id='.$pun_user['g_id'].'
)
WHERE (
fp.read_forum IS NULL
OR fp.read_forum=1
)
ORDER BY t.last_post DESC
LIMIT '.$ak_limit
) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
?>
<div id="vf" class="blocktable">
<h2><span><font color="#FFFFFF"><u>Posljednji komentari...</u></font></span></h2>
<div class="box">
<div class="inbox">
<table cellspacing="0">
<thead>
<tr>
<th class="tcl" scope="col"><?php echo $lang_common['Topic'] ?></th>
<th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
<th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
</tr>
</thead>
<tbody>
<?php
// If there are topics in this forum.
if ($db->num_rows($result))
{
while ($cur_topic = $db->fetch_assoc($result))
{
$icon_text = $lang_common['Normal icon'];
$item_status = '';
$icon_type = 'icon';
if ($cur_topic['moved_to'] == null)
$last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
else
$last_post = ' ';
if ($pun_config['o_censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
if ($cur_topic['moved_to'] != 0)
$subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
else if ($cur_topic['closed'] == '0')
$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
else
{
$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
$icon_text = $lang_common['Closed icon'];
$item_status = 'iclosed';
}
if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'] && $cur_topic['moved_to'] == null)
{
$icon_text .= ' '.$lang_common['New icon'];
$item_status .= ' inew';
$icon_type = 'icon inew';
$subject = '<strong>'.$subject.'</strong>';
$subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]</span>';
}
else
$subject_new_posts = null;
// Should we display the dot or not? :)
if (1 == 0 && !$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')
{
if ($cur_topic['has_posted'] == $pun_user['id'])
$subject = '<strong>·</strong> '.$subject;
else
$subject = ' '.$subject;
}
if ($cur_topic['sticky'] == '1')
{
$subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
$item_status .= ' isticky';
$icon_text .= ' '.$lang_forum['Sticky'];
}
$num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
if ($num_pages_topic > 1)
$subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
else
$subject_multipage = null;
// Should we show the "New posts" and/or the multipage links?
if (!empty($subject_new_posts) || !empty($subject_multipage))
{
$subject .= ' '.(!empty($subject_new_posts) ? $subject_new_posts : '');
$subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
}
?>
<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
<td class="tcl">
<div class="intd">
<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div>
<div class="tclcon">
<?php echo $subject."\n" ?>
</div>
</div>
</td>
<td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
<td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
<td class="tcr"><?php echo $last_post ?></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td class="tcl" colspan="4"><?php echo $lang_forum['Empty forum'] ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
put this code in file mod_active_topics.php
and open index.php
find:
require PUN_ROOT.'header.php';
after add:
include('mod_active_topics.php');
or where you want put this include...
how to change charset? i replace utf-8 with central european windows-1250 and messages still Ä?Ä?????Ä? > ?????
i don't need "smilar" like this... see post located here [url]http://punbb.org/forums/viewtopic.php?pid=67268#p67268[url]there is my rss.php ... so i need something in format like this
TOPIC NAME
Author: USERNAME wrote: MESSAGE
i have done with TOPICNAME and MESSAGE line but how to add author USERNAME ?
sorry about my bad english hope to understeand
how to show poster?
i use rss include on webpage, how to put autors name for topic? there is rss.php code
<?php
/**
* BLOG:CMS: PHP/MySQL Personal Content Management System
* http://blogcms.com/
* http://forum.blogcms.com/
*
* 2003-2004, (c) Radek HULAN
* http://hulan.cz/
*
* Mod by Bert Garcia for PunBB 1.2.1
* http://nupusi.com
*
* Additional changes Copyright 2005 by Alex King
* Now creates feeds for categories, forums, topics
* http://www.alexking.org/software/
*
* Please see the enclosed readme.txt file for usage
*
* 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, or (at your option) any later version.
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// *****************************************************************
**/
define('PUN_ROOT', './');
@include PUN_ROOT.'config.php';
// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');
// Disable error reporting for uninitialized variables
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Turn off magic_quotes_runtime
set_magic_quotes_runtime(0);
// Load the functions script
require PUN_ROOT.'include/functions.php';
require PUN_ROOT.'include/parser.php';
// Load DB abstraction layer and try to connect
require PUN_ROOT.'include/dblayer/common_db.php';
// Get the forum config
$result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error());
while ($cur_config_item = $db->fetch_row($result))
$pun_config[$cur_config_item[0]] = $cur_config_item[1];
// Make sure we (guests) have permission to read the forums
$result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
if ($db->result($result) == '0')
exit('No permission');
// Attempt to load the common language file
@include PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php';
if (!isset($lang_common)) exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.');
// parse RSS
ob_start();
// make feed
/* original query
$result = $db->query(
"select p.id as id, p.message as message, p.posted as postposted, t.subject as subject ".
"from ".$db->prefix."posts as p, ".$db->prefix."topics as t ".
"where p.topic_id=t.id ".
"order by postposted desc ".
"limit 0,15")
or error('Unable to fetch forum posts', __FILE__, __LINE__, $db->error());;
*/
if (!empty($_GET["cid"])) {
$where = " AND c.id = '".intval($_GET['cid'])."'";
$title = 'cid';
}
else if (!empty($_GET["fid"])) {
$where = " AND f.id = '".intval($_GET['fid'])."'";
$title = 'fid';
}
else if (!empty($_GET["tid"])) {
$where = " AND t.id = '".intval($_GET['tid'])."'";
$title = 'tid';
}
else {
$where = '';
$title = '';
}
$result = $db->query("
SELECT p.id AS id, p.message AS message, p.posted AS postposted, t.subject AS subject, f.forum_name, c.cat_name
FROM ".$db->prefix."posts p
LEFT JOIN ".$db->prefix."topics t
ON p.topic_id=t.id
INNER JOIN ".$db->prefix."forums AS f
ON f.id=t.forum_id
LEFT JOIN ".$db->prefix."categories AS c
ON f.cat_id = c.id
LEFT JOIN ".$db->prefix."forum_perms AS fp
ON (
fp.forum_id=f.id
AND fp.group_id=3
)
WHERE (
fp.read_forum IS NULL
OR fp.read_forum=1
)
$where
ORDER BY postposted DESC
LIMIT 0,15
") or error('Unable to fetch forum posts', __FILE__, __LINE__, $db->error());;
$i = 0;
while ($cur = $db->fetch_assoc($result)) {
if ($i == 0) {
putHeader($cur, $title);
$i++;
}
putPost($cur);
}
putEnd();
// get feed into $feed
$feed = ob_get_contents();
ob_end_clean();
// create ETAG (hash of feed)
$eTag = '"'.md5($feed).'"';
header('Etag: '.$eTag);
// compare Etag to what we got
if ($eTag == $_SERVER['HTTP_IF_NONE_MATCH']) {
header("HTTP/1.0 304 Not Modified");
header('Content-Length: 0');
} else {
// dump feed
header ("Content-type: text/xml");
echo $feed;
}
/* entity to unicode decimal value */
function entity_to_decimal_value($string){
static $entities_dec = false;
if (!is_array($entities_dec)) {
$entities_named = array(" ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","ƒ","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","•","…","?","?","?","?","?","?","?","™","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",""","&","<",">","Œ","œ","Š","š","Ÿ","ˆ","˜","?","?","?","?","?","?","?","–","—","‘","’","‚","“","”","„","†","‡","‰","‹","›","€","'");
$entities_decimal = array(" ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","ƒ","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","•","…","?","?","?","?","?","?","?","™","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",""","&","<",">","Œ","œ","Š","š","Ÿ","ˆ","˜","?","?","?","?","?","?","?","–","—","‘","’","‚","“","”","„","†","‡","‰","‹","›","€","'");
if (function_exists('array_combine'))
$entities_dec=array_combine($entities_named,$entities_decimal);
else {
$i=0;
foreach ($entities_named as $_entities_named) $entities_dec[$_entities_named]=$entities_decimal[$i++];
}
}
return preg_replace( "/&[A-Za-z]+;/", " ", strtr($string,$entities_dec) );
}
function encode_xml($data){
// line breaks
$data=str_replace('<br(.*?)>',"\n",$data);
// ending html tags into line breaks
$data=preg_replace("/<\/(pre|ul|li|p|table|tr)>/","\n",$data);
// remove other html tags
$data=preg_replace("/<(.*?)>/","",$data);
// remove multiple newlines
$data=preg_replace("/\n\n+/","\n\n",$data);
return entity_to_decimal_value($data);
}
function putHeader($cur, $title) {
switch ($title) {
case "cid":
$title = ' : '.$cur['cat_name'];
break;
case "fid":
$title = ' : '.$cur['cat_name'].' : '.$cur['forum_name'];
break;
case "tid":
$title = ' : '.$cur['cat_name'].' : '.$cur['forum_name'].' : '.$cur['subject'];
break;
default:
$title = '';
break;
}
global $lang_common,$pun_config;
echo '<'.'?xml version="1.0" encoding="'.$lang_common['lang_encoding'].'"?'.'>'."\n";
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";
echo "<title>".entity_to_decimal_value(htmlspecialchars($pun_config['o_board_title'].$title))."</title>\n";
echo "<link>".$pun_config['o_base_url']."</link>\n";
echo "<description>".entity_to_decimal_value(htmlspecialchars($rss_description.' '.$pun_config['o_board_title']))."</description>\n";
echo "<language>en</language>\n";
echo "<docs>http://backend.userland.com/rss</docs>\n";
}
function putPost($cur) {
global $pun_config;
echo "<item>\n";
echo "<title>".entity_to_decimal_value(htmlspecialchars($cur['subject']))."</title>\n";
$link = $pun_config['o_base_url'].'/viewtopic.php?pid='.strval($cur['id']).'#'.strval($cur['id']);
echo "<link>".entity_to_decimal_value(htmlspecialchars($link))."</link>\n";
echo '<guid isPermaLink="false">'.strval($cur['id']).'@'.$pun_config['o_base_url'].'</guid>'."\n";
$data = "-(~ ".parse_message($cur['message'],0);
echo "<description>".encode_xml($data)."</description>\n";
// echo "<content:encoded><![CDATA[".$data."]]></content:encoded>\n";
echo "<pubDate>".strval(date("r",$cur['postposted']))."</pubDate>\n";
echo "</item>\n";
}
function putEnd() {
echo "</channel>\n";
echo "</rss>\n";
}
?>
how to show username like Author: Blah ?
i remowe serach link from functions.php and deselect "use search" from all groups ... edited show last post ... becouse i can't include serach.php to my site.. evrything seems to work cool
i agree (: i include evry file except search.php ... :S some errors about header :S but look's cool?
again stupid me ... it's fix'd now :S
Powered by Rickard and many others, so i remove part of footer (not replace with any copygright) it's problem?
PunBB Forums → Posts by faax
Powered by PunBB, supported by Informer Technologies, Inc.