Made some modifications to original gallery
DEMO: http://hostel.nstu.ru/resources/gallery.php
Info: http://punres.org/viewtopic.php?pid=4678#p4678

2

(9 replies, posted in Archive)

??? ????????? ????? ???-?? ?? ??????? ???-?? ???????????? ????... ??? ????????? ????? ?????? ? ???? ???? ??-?? ?????..

3

(9 replies, posted in Archive)

??, ??? PunBB.
????????? ?? ??? ???????????.. ??.. ?? ? ???????????? 16? ????? ????, ? ??? ????? 60? ?????
????????? ??????? ?????, ?????? ??? ??????? ?? ??? ????
??? ???? ? ?? ???????, ???? ?? ?? ??? ?????? ???????? ??????????? smile

No matter smile Anyway, if you want your forum to be more scalable you should think of rewriting search.php
BTW i don't know insiders of phpBB's search, but there are no such troubles there

so. done by myself, 6 Kb of code from search.php was removed. Searching of 3 words through ~110K messages and ~13K topics takes ~5-10 sec(~100 users online)
Adapting has taken ~8 hours

desided to use postgresql's Tsearch2 full-text search engine, and to adapt punbb so

Hi,
is there any progress ?

Thx a lot

>Yes, but it's a bigger change for search.php. It's not just one or two lines that need to be changed.
Really sad sad Are you going to look it through in near future or its better to think a bit and make it myself?
Honestly, I have no desire to do this smile) Just have no time, but this bug is really annoying sad

BTW: include/search_idx.php
function strip_search_index($post_ids)

DELETE FROM '.$db->prefix.'search_words WHERE id IN(SELECT word_id FROM '.$db->prefix.'search_matches WHERE word_id IN(SELECT word_id FROM '.$db->prefix.'search_matches WHERE post_id IN('.$post_ids.') GROUP BY word_id) GROUP BY word_id HAVING COUNT(word_id)=1)

Here is check for db type, it would be logical to add the same to search.php

Hmmm, mysql 4.1.x(mb mysql 4.x) already has subqueries
could you please rewrite search a bit, mb just add a check for mysql version ?

So, my AthlonXP 1800+, 512Mb RAM, 1gb SWAP, FreeBSD 6, PostgreSQL 8.1 gets fully stuck when smb searches forum because of this query:
SELECT t.id FROM pun_posts AS p INNER JOIN pun_topics AS t ON t.id=p.topic_id INNER JOIN pun_forums AS f ON f.id=t.forum_id LEFT JOIN pun_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 )) AND p.id IN(40258,57627,82690,17797,76558,.......!!!30_pages_of_numbers_here!!!..........88788,88772,89720,88784,50439,63671,29725,87854,71274,62780,29053) AND t.forum_id = 10 GROUP BY t.id
-----
So, is there a nice solution for this(except manually flushing search words cache ?

13

(4 replies, posted in PunBB 1.2 show off)

thx! smile

14

(4 replies, posted in PunBB 1.2 show off)

Here it is smile http://hostel.nstu.ru/
Just "a little bit" modified punbb smile

if anybody wants, i can put this kind of news somewhere.
without comments displayed
with comments displayed
this is a little modified Connorhd's miniportal mod

well, actually i don't know if it's a punbb bug, or smth mine...
so..lets begin far away: i've modified update_users_online() to let me make the current online users location page (this is my PunOnline mod)

function update_users_online()
{
    global $db, $pun_config, $pun_user;

    $now = time();

    $pathinfo = pathinfo($_SERVER['PHP_SELF']);
    $current_page = $pathinfo['basename'];
    $current_ip = get_remote_address();
    $current_page_full = $_SERVER['PHP_SELF'];

    if ($current_page == "viewforum.php" || $current_page == "viewtopic.php" || $current_page == "profile.php" || $current_page == "post.php" || $current_page == "edit.php")
    {
        if (isset($_GET['id'])) { $current_page_id = intval($_GET['id']); }
        else if (isset($_GET['pid'])) {
            $current_topic_id = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id=\''.intval($_GET["pid"]).'\'') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
            $tmp = $db->result($current_topic_id, 0);
            $current_page_id = ($tmp != '') ? $tmp : '0' ;
        }
        else if (isset($_GET['tid']))
        { $current_page_id = intval($_GET['tid']); }
        else if (isset($_GET['fid']))
        { $current_page_id = intval($_GET['fid']); }
        else $current_page_id = 0;
    }
    else  $current_page_id = 0;

    if($pun_user['id'] > 1)
    {
        $db->query('UPDATE '.$db->prefix.'online SET current_page=\''.$current_page_full.'\', current_ip=\''.$current_ip.'\', current_page_id=\''.$current_page_id.'\' WHERE user_id=\''.$pun_user['id'].'\'') or error('Unable to update online list', __FILE__, __LINE__, $db->error());

    }
    else $db->query('UPDATE '.$db->prefix.'online SET current_page=\''.$current_page_full.'\', current_ip=\''.$current_ip.'\', current_page_id=\''.$current_page_id.'\' WHERE ident=\''.$current_ip.'\'') or error('Unable to update online list', __FILE__, __LINE__, $db->error());

    // Fetch all online list entries that are older than "o_timeout_online"
    $result = $db->query('SELECT * FROM '.$db->prefix.'online WHERE logged<'.($now-$pun_config['o_timeout_online'])) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
    while ($cur_user = $db->fetch_assoc($result))
    {
        // If the entry is a guest, delete it
        if ($cur_user['user_id'] == '1')
        $db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.$db->escape($cur_user['ident']).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
        else
        {
            // If the entry is older than "o_timeout_visit", update last_visit for the user in question, then delete him/her from the online list
            if ($cur_user['logged'] < ($now-$pun_config['o_timeout_visit']))
            {
                //$db->query('UPDATE '.$db->prefix.'users SET last_visit='.$cur_user['logged'].' WHERE id='.$cur_user['user_id']) or error('Unable to update user visit data', __FILE__, __LINE__, $db->error());
                // MOD: MARK TOPICS AS READ - 1 LINE MODIFIED CODE FOLLOWS
                $db->query('UPDATE '.$db->prefix.'users SET last_visit='.$cur_user['logged'].', read_topics=NULL WHERE id='.$cur_user['user_id']) or error('Unable to update user visit data', __FILE__, __LINE__, $db->error());

                $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id='.$cur_user['user_id']) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
            }
            else if ($cur_user['idle'] == '0')
            $db->query('UPDATE '.$db->prefix.'online SET idle=1 WHERE user_id='.$cur_user['user_id']) or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
        }
    }
}

So now, if 10+ users are online i sometimes have db errors like this

ERROR:  deadlock detected
DETAIL:  Process 38554 waits for ShareLock on transaction 29676567; blocked by process 38553.
        Process 38553 waits for ShareLock on transaction 29676569; blocked by process 38554.
STATEMENT:  DELETE FROM pun_online WHERE ident='?.?.?.?'

or

ERROR:  deadlock detected
DETAIL:  Process 673 waits for ShareLock on transaction 14821791; blocked by process 674.
        Process 674 waits for ShareLock on transaction 14821789; blocked by process 673.
STATEMENT:  UPDATE pun_online SET idle=1 WHERE user_id=?

i don't know if the bug is reproducible at vanilla punbb install, but if look at the queries in the errors i see that these are original punbb ones
can anyone help with debugging this or a solution ?

2 Azakur4:

mod description wrote:

##  * Changed lang file, LOOK it through!

else if (!isset($lang_online[$user_data['current_page']])
change to:
else if (!isset($lang_online[$user_data['current_page']]))
i've missed bracket, when posting here

else if ((@$lang_online[$user_data['current_page']]) == '')
        echo"\t\t\t\t\t".'<td>'.$lang_online['Hiding Somewhere'].'</td>'."\n";
    else
        echo"\t\t\t\t\t".'<td><a href="'.$user_data['current_page'].'">'.$lang_online[$user_data['current_page']].'</a></td>'."\n";

replace with

else if (!isset($lang_online[$user_data['current_page']])
        echo"\t\t\t\t\t".'<td>'.$lang_online['Hiding Somewhere'].'</td>'."\n";
    else
        echo"\t\t\t\t\t".'<td><a href="'.$user_data['current_page'].'">'.$lang_online[$user_data['current_page']].'</a></td>'."\n";

http://dev.hostel.nstu.ru/

21

(8 replies, posted in Archive)

parser.php

Austral wrote:

Connorhd

How I can separate news from one day, in index.php?

P.S. my bad english sad

http://hostel.nstu.ru/~xumuk/index.zip
???, ?????? ??? ????????? ????? ? ???????? ? ??????? ?????, ? ????? ???????? ???? ?????, ??????? ??? ??????

??, ??? ?????
?????? ? ????? ??????? smile
Edit:
done
http://www.punres.org/files.php?pid=65

thx. uploaded to punres!

##        Mod title:  PunOnline
##
##      Mod version:  1.2.1
##   Works on PunBB:  1.2.*
##     Release date:  2004-04-18
##           Author:  XuMiX/orig author Chippa (xumuk@ngs.ru)
##
##      Description:  Adds a list of where the users are on your site.
##
##   Affected files:  include/functions.php
##
##       Affects DB:  Yes
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##
## This has been supressed in 1.2.1 version, but the problem is still here.
##  * Changed lang file, LOOK it through!
##  * Fixed errors like "Notice: Undefined index: antileech.php in /full/path/to/online.php on line 56"
##  * Changed '.$db->prefix.'online table -> "current_page" column increased to VARCHAR(100), to fit new data-storing format
##  * Some cosmetic fixes
#

Get it here
Demo