26

(11 replies, posted in PunBB 1.2 troubleshooting)

Ok removed the 'g' no error , but nothing appear in the post !

Fixed working great now.

Thank you very much master Elbekko

27

(11 replies, posted in PunBB 1.2 troubleshooting)

I have this error :

Warning: preg_replace() [function.preg-replace]: Unknown modifier 'g' in /include/parser.php on line 394

Some lines before the line 394 in include/parser.php :

// This thing takes a while! :)
    $text = preg_replace($pattern, $replace, $text);
    $text = preg_replace('/\[ariegenews\]([^\[]+)\[\/ariegenews\]/gi', '<script type="text/javascript"
src="http://www.ariegenews.com/data/rss/video-$1.html"></script>', $text);
    return $text;
}

28

(11 replies, posted in PunBB 1.2 troubleshooting)

The Webmaster gives to me the solution :

[ariegenews]video-1375.html[/ariegenews]

But i have to include this function :

preg_replace(
  '/\[ariegenews\]([^\[]+)\[\/ariegenews\]/gi',
  '<script type="text/javascript"
src="http://www.ariegenews.com/data/rss/video-$1.html"></script>',
  $post
);

Where and how do i have to include this function ,including it in parser.php as is give me a lot of errors.

My first idea was to include it after the youtube bbcode  in parser.php here is the modifications already done :

#
#---------[ 1. OPEN ]---------------------------------------------------------
#
include/parser.php
#
#---------[ 2. FIND (line: 316) ]---------------------------------------------
#
                    '#\[u\](.*?)\[/u\]#s',

#
#---------[ 3. AFTER, ADD ]---------------------------------------------------
#
                     '#\[youtube\]http://www.youtube.com/watch\?v=(.*?)\[/youtube\]#s',

#
#---------[ 4. FIND (line: 326) ]---------------------------------------------
#
                     '<span class="bbu">$1</span>',

#
#---------[ 5. AFTER, ADD ]---------------------------------------------------
#
                     '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',
#
#---------[ 6. SAVE/UPLOAD ]-------------------------------------------------
#

Any advice ?

Anyone can ask to the question i've posted before about activating MySQL's query cache and install eaccelerator for a non php spécialist ?

CodeXP wrote:

There are actually many ways one can improve performance without actually modifying the PunBB source-code, but some of my favourites are:

1. Drop Apache, and go for the much faster lighttpd with PHP running as fastcgi.
2. Ensure you're using MySQL's query cache. Although a forum by nature updates frequently, it should still prove to improve performance quite a bit in certain cases.
3. Install eaccelerator (the 0.9.5 rc1 was recently released, and works very well with the latest PHP versions). This *will* massively improve performance of PHP scripts, and I'd highly recommend it to anyone.
4. Be sure to enable gzip compression. This will result in much smaller pages being served to compatible clients (just about every single somewhat modern browser), which not only improves performance but will also result in a lot of saved bandwidth. Please note though that for this to work with lighttpd, you should enable it in your php.ini file instead of using something like the module for apache.

Hope this helps out smile

Is it easy for someone who is not familiar with manipulating php or database to activate MySQL's query cache and install eaccelerator.
I would like to do that but i don't know how ?

Regards

Perfect wink

Thank you very much for this mod.

Easy to install,works very well.
But i have a problem when i activate spell checking,look at those pictures.

Before spell checking
http://img82.imageshack.us/img82/1513/beforexu8.png

When i activate spell checking it's hard to read the words.
http://img82.imageshack.us/img82/9414/afterdo7.png

Is there a way to change background and foreground colors.

Great mod pokemon_jojo ! wink

Ok Smarty's i'll do that.
Many,many thanks to you and Elbekko for your great support.
Bye wink

Ok thanks Smarty's i've opened topics table in Mysql and i didn't see how to solve the problem ?

Sorry Smarty's i didn't read carrefully
Made the modifications
Solved the problem but the subject link doesn't appear in 'Last Post' column as before ?

Ok that's what happen when i removed the line suggested by Smarty's

elbekko wrote:

Enable debug mode.

How do you do that ?

Smartys wrote:

Remove

LEFT JOIN '.$db->prefix.'topics AS t ON f.last_post_id=t.last_post_id
and
, t.subject

Give error ' Impossible de retrouver la liste des catégories et des forums'

The bug is sure comming from modifications i have made roll in index.php and not a PunBB bug witch is perfect as everyone knows wink .
I've send the original one and no problem.

Mods i've added that affect index.php
Private Topic
Icon Specific to a forum name taken from the discussion here :
http://www.punbb.fr/forums/viewtopic.php?id=1828
Members online today (french version) : http://www.punbb.fr/mods/telecharger.php?id=78
View/Hide Category

I'll try to reverse the installation of those mods one by one ( i always backup files and database before doing modifications ) to try to find witch mod gives this bug.

Here is my index.php

<?php
/***********************************************************************

  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB 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.

  PunBB 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.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';


if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);


// Load the index.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
$extra_sql = (isset($cat))?'c.id='.$cat : 'c.visible="on"';
// Print the categories and forums
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.last_post_private, t.subject FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id
LEFT JOIN '.$db->prefix.'topics AS t ON f.last_post_id=t.last_post_id
LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE '.$extra_sql.' AND (fp.read_forum IS NULL OR fp.read_forum=1) ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Impossible de retrouver la liste des catégories et des forums', __FILE__, __LINE__, $db->error());

$cur_category = 0;
$cat_count = 0;
while ($cur_forum = $db->fetch_assoc($result))
{
    $moderators = '';

    if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration?
    {
        if ($cur_category != 0)
            echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";

        ++$cat_count;

?>
<div id="idx<?php echo $cat_count ?>" class="blocktable">
    <h2><span><?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></span></h2>
    <div class="box">
        <div class="inbox">
            <table cellspacing="0">
            <thead>
                <tr>
                    <th class="tc2" scope="col"> </th>
                    <th class="tcl" scope="col"><?php echo $lang_common['Forum'] ?></th>
                    <th class="tc2" scope="col"><?php echo $lang_index['Topics'] ?></th>
                    <th class="tc3" scope="col"><?php echo $lang_common['Posts'] ?></th>
                    <th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
                </tr>
            </thead>
            <tbody>
<?php

        $cur_category = $cur_forum['cid'];
    }

    $item_status = '';
    $icon_text = $lang_common['Normal icon'];
    $icon_type = 'icon';

    // Are there new posts?
    if (!$pun_user['is_guest'] && $cur_forum['last_post'] > $pun_user['last_visit'])
    {
        $item_status = 'inew';
        $icon_text = $lang_common['New icon'];
        $icon_type = 'icon inew';
    }

    // Is this a redirect forum?
    if ($cur_forum['redirect_url'] != '')
    {
        $forum_field = '<h3><a href="'.pun_htmlspecialchars($cur_forum['redirect_url']).'" title="'.$lang_index['Link to'].' '.pun_htmlspecialchars($cur_forum['redirect_url']).'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3>';
        $num_topics = $num_posts = ' ';
        $item_status = 'iredirect';
        $icon_text = $lang_common['Redirect icon'];
        $icon_type = 'icon';
    }
    else
    {
        $forum_field = '<h3><a href="viewforum.php?id='.$cur_forum['fid'].'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a><div style="float:right;"><a href="extern.php?type=rss&action=active&fid='.$cur_forum['fid'].'"><img src="img/rss.png" border="0" height="15" width="27" alt="RSS" align="middle" /></a></div></h3>';
        $num_topics = $cur_forum['num_topics'];
        $num_posts = $cur_forum['num_posts'];
    }

    if ($cur_forum['forum_desc'] != '')
        $forum_field .= "\n\t\t\t\t\t\t\t\t".$cur_forum['forum_desc'];


    // If there is a last_post/last_poster.
    if ($cur_forum['last_post_private'] == 1)
        $last_post = $lang_common['Private topic'];
    elseif ($cur_forum['last_post_private'] == 0 && $cur_forum['last_post'] != '')
    $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.$cur_forum['subject'].'</a> <span class="byuser">'.format_time($cur_forum['last_post']).'  -  '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
    else
        $last_post = ' ';

    if ($cur_forum['moderators'] != '')
    {
        $mods_array = unserialize($cur_forum['moderators']);
        $moderators = array();

        while (list($mod_username, $mod_id) = @each($mods_array))
            $moderators[] = '<a href="profile.php?id='.$mod_id.'">'.pun_htmlspecialchars($mod_username).'</a>';

        $moderators = "\t\t\t\t\t\t\t\t".'<p><em>('.$lang_common['Moderated by'].'</em> '.implode(', ', $moderators).')</p>'."\n";
    }

?>
                 <tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>
                    <td class="tc2"><img src="./img/img_forum_<?php echo $cur_forum['fid']?>.png"></td>
                    <td class="tcl">
                        <div class="intd">
                            <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div>
                            <div class="tclcon">
                                <?php echo $forum_field."\n".$moderators ?>
                            </div>
                        </div>
                    </td>
                    <td class="tc2"><?php echo $num_topics ?></td>
                    <td class="tc3"><?php echo $num_posts ?></td>
                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php

}

// Did we output any categories and forums?
if ($cur_category > 0)
    echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";
else
    echo '<div id="idx0" class="block"><div class="box"><div class="inbox"><p>'.$lang_index['Empty board'].'</p></div></div></div>';


// Collect some statistics from the database
$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Impossible de retrouver le nombre total d\utilisateurs', __FILE__, __LINE__, $db->error());
$stats['total_users'] = $db->result($result);

$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Impossible de retrouver le dernier membre inscrit', __FILE__, __LINE__, $db->error());
$stats['last_user'] = $db->fetch_assoc($result);

$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Impossible de retrouver le nombre de discussions et de messages', __FILE__, __LINE__, $db->error());
list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);

?>
<div id="brdstats" class="block">
    <h2><span><?php echo $lang_index['Board info'] ?></span></h2>
    <div class="box">
        <div class="inbox">
            <dl class="conr">
                <dt><strong><?php echo $lang_index['Board stats'] ?></strong></dt>
                <dd><?php echo $lang_index['No of users'].': <strong>'. $stats['total_users'] ?></strong></dd>
                <dd><?php echo $lang_index['No of topics'].': <strong>'.$stats['total_topics'] ?></strong></dd>
                <dd><?php echo $lang_index['No of posts'].': <strong>'.$stats['total_posts'] ?></strong></dd>
            </dl>
            <dl class="conl">
                <dt><strong><?php echo $lang_index['User info'] ?></strong></dt>
                <dd><?php echo $lang_index['Newest user'] ?>: <a href="profile.php?id=<?php echo $stats['last_user']['id'] ?>"><?php echo pun_htmlspecialchars($stats['last_user']['username']) ?></a></dd>
<?php

if ($pun_config['o_users_online'] == '1')
{
    // Fetch users online info and generate strings for output
    $num_guests = 0;
    $users = array();
    $result = $db->query('SELECT user_id, ident, color FROM '.$db->prefix.'online WHERE idle=0 AND user_id!=2 ORDER BY ident', true) or error('Impossible de retrouver la liste des utilisateurs en ligne', __FILE__, __LINE__, $db->error());

    while ($pun_user_online = $db->fetch_assoc($result))
    {
        if ($pun_user_online['user_id'] > 1)
            $users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'"><span style="color: '.$pun_user_online['color'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</span></a>';
        else
            ++$num_guests;
    }

    $num_users = count($users);
    // utilisateurs en ligne aujourd'hui
    $todaystamp = strtotime(date('Y-m-d'));

    $result = $db->query('SELECT username, id, last_visit from '.$db->prefix.'users WHERE last_visit >= \''.$todaystamp.'\' ORDER by last_visit DESC') or error('Impossible de retrouver la liste des utilisateurs en ligne aujourd\'hui', __FILE__, __LINE__, $db->error());

    $users_today = array();
    while ($pun_user_online_today = $db->fetch_assoc($result))
        $users_today[] .=  "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online_today['id'].'" title="Dernière visite de '.pun_htmlspecialchars($pun_user_online_today['username']).' : '.format_time($pun_user_online_today['last_visit']).'">'.pun_htmlspecialchars($pun_user_online_today['username']).'</a>';
        
    $num_users_today = count($users_today);
    echo "\t\t\t\t".'<dd>'.$lang_index['Users online'].': <strong>'.$num_users.'</strong></dd>'."\n\t\t\t\t".'<dd>'.$lang_index['Users today'].': <strong>'.$num_users_today.'</strong></dd>'."\n\t\t\t\t".'<dd>'.$lang_index['Guests online'].': <strong>'.$num_guests.'</strong></dd>'."\n\t\t\t".'</dl>'."\n";
    


    if ($num_users > 0)
        echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
    else
        echo "\t\t\t".'<div class="clearer"></div>'."\n";
    /// liste utilisateurs en ligne aujourd'hui
    echo "\t\t\t".'<dl id="onlinetodaylist">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online today'].': </strong></dt>';
                
    if ($num_users_today > 0) 
        echo implode(',</dd> ', $users_today).'</dd>'."\n\t\t\t".'</dl>'."\n";
    else
        echo '<dd><em>'.$lang_index['None'].'</em></dd>'."\n\t\t\t".'</dl>'."\n";

}
else
    echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";


?>
        </div>
    </div>
</div>
<?php

$footer_style = 'index';
require PUN_ROOT.'footer.php';

Here is the link :

Forum des Couers

Version 1.2.12 French language and didn't installed subforum mod.

I have a bug on my forum,after posting a reply (this bug doesn't appear when posting a new topic)

What i have before ( 2 posts in this forum ):

http://img116.imageshack.us/img116/1316/beforeor9.png

What's appear after ( there is 3 posts in this forum one sticky post added from another forum ):

http://img116.imageshack.us/img116/8215/aftermc1.png

I'm still searching in viewforum.php , any advice would be helpfull.

Thanks

If you speak french have a look to this i did it in my Forum and it works perfectly.


http://www.punbb.fr/forums/viewtopic.php?id=1828

Found a solution for me perhaps not the perfect one but it works.

Renamed original index.php to stats.php

Created a new index.php with this code inside :

<? header("location:../index.php"); ?>

Added after the first <?php of every of those files : stats.php , show_detailed.php , show_views.php , show_global.php this code :

define('PUN_ROOT',
'Link_to_Forum'
);

require PUN_ROOT.'include/common.php';

if ($pun_user['g_id'] > PUN_ADMIN) exit;

And finally added a navink to stats.php in /include/functions.php only for admins.

I'm not a php specialist,maybe there is some mistakes (don't blame me !) but it works fine for me.

Great tool for PunBB

Is there a way using .htaccess authentification in BBClone directory to restrict access only for the PunBB administrator ?

Great mod Quaker

Exactly what i was looking for , see this topic

http://www.punres.org/viewtopic.php?id=518&p=5

48

(11 replies, posted in PunBB 1.2 troubleshooting)

elbekko wrote:

You could always make a more safe BBCode:

[vid=video150.html]Video[/vid]

Yes Elbekko would be better to not use javascript but how ?
If you could have a look to the code inside the videoxxx.html file i'm just discovering Punbb and Php (3months) here is the french site i was talking about :
http://www.ariegenews.com/index.html
and here is a link where there is a vidéo :
http://www.ariegenews.com/news/news-1-17-1359.html
The opportunity to retrieve the vidéo is given near footer under the line

Pour intégrer cette vidéo dans votre site internet ou votre blog, copiez/collez simplement le code ci-dessous:
<script language="javascript" src="http://www.ariegenews.com/data/rss/video-1359.html"></script>

Any advice ?

49

(11 replies, posted in PunBB 1.2 troubleshooting)

Because if you see the first post the only way to have the vidéo if the site i was talkin about have this form

<script language="javascript" src="http://www............/video150.html"></script>

if the webmaster of this site gives the direct link in another way i would not ask for this ;-)
Inside the video150.html file there is the direct link for the flv file but too much manipulations to retrieve the link.
I was searching for a solution to directly input the code above inside a new bbcode.

50

(11 replies, posted in PunBB 1.2 troubleshooting)

deadram wrote:

Type this (with the url bbcode) on a forum

http://www............/video150.html

Press "preview"

Right click the link and select "save target as..." or the likes

Upload videoXXX.html to you webserver, or review the jscript and figure out how to do it with less work next time tongue

Thanks for the answer but doesn't help so much

Less work ????

I was asking if it's possible to create a javascript bbcode to handle this king of link like this :

[js]<script language="javascript" src="http://www............/video150.html"></script>[/js]

I know that it's complicated and there will be probably a vulnerability problem but is there any way to do that.