well, it seems to me, that DB does not affect this bug
i tried SQL_ASCII, UNICODE and KOI8 encodings

i'm running postgres, punbb database locale is set to koi8
maybe i should change it to unicode or latin1 ? apache  server charset is koi8, server itself locale is set to koi8 also

Strange thing. this happens on my server, but this is not repeated here. So when i post a reply or just a new post with russian character "?", exactly this small character is completely stripped out from post, even when i try to edit it - there are no these characters at all.
but when i preview my post "?" is present there :(.
My server and punbb charset is koi8-r, there were no such problems in 1.1.5 version.

79

(12 replies, posted in Archive)

???????? ????? ? ????, ??????-?? ??? ???????? ? ???? ?? ?????? ????????? ?????????? "?" ?? ?????, ?????? ??? ??????????????? ????????? ??? ????

thx a lot

want to know your opinion about performance, reliability, convinience etc.,
applying to web hosting. especially about performance under (heavy)loads

Seems like its it smile thanks.

is it possible ? a have experimented, but couldn't find nice solution, or its always fixed in some place, or its floating like a frame and overfloating other blocks

BTW, when i try to update user's status to administrator i get

Bad request. The link you followed is incorrect or outdated.

but the user status is updated.
PS. i have changed the main URL and changed it in admin options before this

hm.. i may try to help you, just tell me what to do smile

File: /mnt/dev/www/dev/admin_groups.php
Line: 245

PunBB reported: Unable to fetch group forum permission list

Database reported: ERROR: current transaction is aborted, commands ignored until end of transaction block

I use PostgreSQL 7.4.6 and PunBB 1.2beta

2 Lynx: try this http://punbb.org/forums/viewtopic.php?id=5297
maybe its not the prettiest solution, but it works however smile

i've made _some_ corrections
BTW you can do them yourself, as for me, i have no time for this optimising now, and as far as i remember, i placed this code  outside main cycle not just  for fun,  there were some issues with it...

done

ok, i'll try to make this more readable.

91

(99 replies, posted in Programming)

BTW Eclipse + PHPEclipse plugin - not lightweight but very nice free development environment

92

(99 replies, posted in Programming)

hmmmm... if you now speak about warez, then Zend Development Suite is the best thing you can ever find for PHP development.

??? ? ???? ????, ??? ?????????
http://punbb.org/forums/viewtopic.php?id=5297

Connorhd wrote:

for any other pages you want to make

you've forgotten
require $pun_root.'header.php';

95

(277 replies, posted in PunBB 1.2 discussion)

sverrir wrote:

In Soviet Russia register regstrates you!

lol :)))))))))))))))))))))))))))))))))))))))))
ROFL..... i've almost died :)))))))))) help me somebody %)))))))))))
I hadn't seen such foolish statement already for a looooong time :))
BTW where have you seen SOVIET Russia ? :))))

Rickard wrote:

You should send it to me (rickard @ this domain). However, if you feel up to it, I would prefer if you could update the language pack to work with PunBB 1.2 which will be released shortly.

sorry for offtop, how shortly is it going to be released ? smile

thx, im not very good coder... an it was written in simple text editor smile i can change all this. BTW, about viewtopic & viewforum, how can i optimise my queries?

So, after my unsuccessful try to resurrect improved new message mod, I have rewritten phorum.org "new marking" system.
Its not very pretty, but it works smile There may be some mistakes, so be careful smile

go to file lang/en_common.php
find line:

    'Mark all as read'        =>    'Mark all forums as read',

replace with:

    'Mark all as read'        =>    'Mark forum as read',

go to file  include/functions.php
add:

     function explode_haveread($var){
    global $haveread;
    $haveread[$var]=true;
  }

go to file idex.php
find :

 if (!$cookie['is_guest'] &&($cur_forum['last_post'] > $cur_user['last_post']))
 {
                if ($cur_user['show_img'] == '1')
                        $icon = '<img src="img/'.$cur_user['style'].'_new.png" w
                else
                        $icon = '<span class="puntext"><b>?</b></span>';
        }
        else
                $icon = ' ';

delete all this, and add then:

$f_id = $cur_forum['fid'];
$forum_id = $f_id;

$new_cookie="pun-new-$forum_id";
$haveread_cookie="pun-haveread-$forum_id";

$res = $db->query('Select last_post_id as f_maxid FROM '.$db->prefix.'forums WHERE id='.$f_id.'');
$f_maxid = $db->result($res,0);
if(!IsSet($$new_cookie)){
    $$new_cookie='0';
}
$use_haveread=false;
if(IsSet($$haveread_cookie)) {
    $arr=explode(".", $$haveread_cookie);
    $old_message=reset($arr);
    array_walk($arr, "explode_haveread");
    $use_haveread=true;
}
else{
    $old_message=$$new_cookie;
}
$isnew=false;
if($use_haveread){
    if ($old_message<$f_maxid) {
        if(!IsSet($haveread[$f_maxid])) {
            $isnew=true;
        }
    }
}
elseif($old_message<$f_maxid){
    $isnew=true;
}
if($isnew)
{
    if (!$cookie['is_guest'])
 {
                if ($cur_user['show_img'] == '1')
                        $icon = '<img src="img/'.$cur_user['style'].'_new.png" w
                else
                        $icon = '<span class="puntext"><b>?</b></span>';
        }
        else
                $icon = '<img src="img/'.$pun_config['o_default_style'].'_new.png" width="16" height="16" alt="">';
}
else
$icon = ' ';

go to file  misc.php
find line:

 elseif ($action == 'markread') 
{
....................
}

and replace whole elsif expression with:

    elseif ($action == 'markread')
{
    $forum_id = intval($_GET['fid']);

    $new_cookie="pun-new-$forum_id";
    $haveread_cookie="pun-haveread-$forum_id";

    $res = $db->query('Select last_post_id as max_id FROM '.$db->prefix.'forums WHERE id='.$forum_id.'');
    //$aryRow=$q->getrow();
    $aryRow= $db->fetch_array($res);
    if(isset($aryRow['max_id'])){
        $max_id=$aryRow['max_id'];
        $$new_cookie=$max_id;
        SetCookie($new_cookie,$$new_cookie,time()+ 31536000);
        SetCookie($haveread_cookie,$$new_cookie); //destroy session cookie
        unset($$haveread_cookie);
    }

    redirect($_SERVER['HTTP_REFERER'], $lang_misc['Mark read redirect']);
}

go to file viewforum.php

find line:

<td class="punright" style="width: 19%; white-space: nowrap"><b><?php echo $post_link ?></b></td>

after it add:

<td><?php echo '  <b><a href="misc.php?action=markread&fid='.$id.'">'.$lang_common['Mark forum read'].'</b></a>' ?></td>

   
find:

            if (!$cookie['is_guest'] && $cur_topic['last_post'] > $cur_user['last_visit'] && $cur_topic['moved_to'] == null)
        {
            if ($cur_user['show_img'] == '1')
                $icon = '<img src="img/'.$cur_user['style'].'_new.png" width="16" height="16" alt="">';
            else
                $icon = '<span class="puntext"><b>?</b></span>';

            $subject = '<b>'.$subject.'</b>';
            //New posts in the topic
            $subject_new_posts = '[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]';
        }
        else
        {
            $icon = ' ';
            $subject_new_posts = null;
        }

replace whole this block with:

$forum_id = $id;
$new_cookie="pun-new-$forum_id";
$haveread_cookie="pun-haveread-$forum_id";
$t_id = $cur_topic['id'];

$res = $db->query('Select last_post_id as t_maxid FROM '.$db->prefix.'topics WHERE id='.$cur_topic['id'].'');
$t_maxid = $db->result($res,0);
if(!IsSet($$new_cookie)){
    $$new_cookie='0';
}

$use_haveread=false;
if(IsSet($$haveread_cookie)) {
    $arr=explode(".", $$haveread_cookie);
    $old_message=reset($arr);
    array_walk($arr, "explode_haveread");
    $use_haveread=true;
}
else{
    $old_message=$$new_cookie;
}

$isnew=false;

if($use_haveread){
    if ($old_message<$t_maxid) {
        if(!IsSet($haveread[$t_maxid])) {
            $isnew=true;
        }
    }
}
elseif($old_message<$t_maxid){
    $isnew=true;
}

if($isnew){
    //New posts in the topic
    $subject_new_posts = '[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'"><font color=orange>New</font></a> ]';
}
else{
    $subject_new_posts = null;}
            

go to file viewtopic.php

find:

 else if (isset($_GET['action']) && $_GET['action'] == 'new' && !$cookie['is_guest'])
{
      $result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted >'.$cur_user['last_visitonline']) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
  $first_new_post_id = $db->result($result, 0);

replace whole block with:

else if (isset($_GET['action']) && $_GET['action'] == 'new')
{
    $res = $db->query('Select id from '.$db->prefix.'posts where topic_id='.$id.' ORDER BY id');
    $rec = $db->fetch_row($res);
    While($rec){
        $msgarr[]=$rec[0];
        $rec = $db->fetch_row($res);
    }
    $res = $db->query('Select forum_id from '.$db->prefix.'topics where topic_id='.$id.'');
    $forum_id = $db->result($res,0);

    $new_cookie="pun-new-$forum_id";
    $haveread_cookie="pun-haveread-$forum_id";

    $arr=explode(".", $$haveread_cookie);

    function newmsg($a, $b) {
        $al = sizeof($a);
        $bl = sizeof($b);
        sort($a);

        if ($b[$bl-1]<$a[0]) return $b[$bl-1];

        $i = 0; $j = 0;
        while(1) {
            if ($a[$i] < $b[$j]) {
                $i++;
                if ($i == $al) return $b[$j];
            } else if($a[$i] == $b[$j]) {
                $j++;
                if ($j == $bl) return $b[$bl-1];
            } else {
                return $b[$j];
            }
        }
    }

    $first_new_post_id = newmsg($arr, $msgarr);

   
find line:

$footer_style = 'topic';

before add:

$new_cookie="pun-new-$forum_id"; 
$haveread_cookie="pun-haveread-$forum_id";


 if(!IsSet($$new_cookie)){
    $$new_cookie='0';
}

$use_haveread=false;
if(IsSet($$haveread_cookie)) {
    $arr=explode(".", $$haveread_cookie);
    $old_message=@reset($arr);
    array_walk($arr, "explode_haveread");
    $use_haveread=true;
}
else{
    $old_message=$$new_cookie;
}


$res = $db->query('Select id from '.$db->prefix.'posts where topic_id='.$id.' ORDER BY id');
$rec = $db->fetch_row($res);

While($rec){
    $headers[]=$rec;
    $rec = $db->fetch_row($res);
}
$madechange=false;
@reset($headers);
$row=@current($headers);
while(!empty($row[0])){

    if(empty($haveread[$row[0]]) && $row[0] > $old_message){
        $madechange=true;
        if(empty($$haveread_cookie)){
            $haveread[$$new_cookie] = true;
            $$haveread_cookie=$$new_cookie;
        }
        $$haveread_cookie.=".";
        $$haveread_cookie.=$row[0];
    }
    $haveread[$row[0]] = true;
    $max_id=$row[0];
    $row=next($headers);
}
if ($madechange) {
    SetCookie($haveread_cookie,$$haveread_cookie,0);
}




if($$new_cookie<$max_id){
        $$new_cookie=$max_id;
        SetCookie($new_cookie,$$new_cookie,time()+ 31536000);
}

That's all ! smile

lang/en_common.php

find :
    'Mark all as read'        =>    'Mark all forums as read',

replace:
    'Mark all as read'        =>    'Mark forum as read',

include/functions.php

add:
     function explode_haveread($var){
    global $haveread;
    $haveread[$var]=true;
  }

idex.php

find: if (!$cookie['is_guest'] &&($cur_forum['last_post'] > $cur_user['last_post']))
delete it, and add:
    $f_id = $cur_forum['fid'];
     $forum_id = $f_id;

    $new_cookie="pun-new-$forum_id";
    $haveread_cookie="pun-haveread-$forum_id";

        $res = $db->query('Select last_post_id as f_maxid FROM '.$db->prefix.'forums WHERE id='.$f_id.'');
            $f_maxid = $db->result($res,0);
        if(!IsSet($$new_cookie)){
                $$new_cookie='0';
        }
      $use_haveread=false;
           if(IsSet($$haveread_cookie)) {
           $arr=explode(".", $$haveread_cookie);
           $old_message=reset($arr);
           array_walk($arr, "explode_haveread");
           $use_haveread=true;
           }
           else{
               $old_message=$$new_cookie;
    }
              $isnew=false;
             if($use_haveread){
              if ($old_message<$f_maxid) {
                  if(!IsSet($haveread[$f_maxid])) {
                    $isnew=true;
                    }
                  }
          }
              elseif($old_message<$f_maxid){
                $isnew=true;
        }
       if($isnew)
{
                $icon = '<img src="img/'.$pun_config['o_default_style'].'_new.png" width="16" height="16" alt="">';
        }
    else
        icon = ' ';

misc.php

find: elseif ($action == 'markread') and replace whole elsif with:
    elseif ($action == 'markread')
{
           $forum_id = intval($_GET['fid']);
           
    $new_cookie="pun-new-$forum_id";
    $haveread_cookie="pun-haveread-$forum_id";
   
        $res = $db->query('Select last_post_id as max_id FROM '.$db->prefix.'forums WHERE id='.$forum_id.'');
        //$aryRow=$q->getrow();
        $aryRow= $db->fetch_array($res);
        if(isset($aryRow['max_id'])){
            $max_id=$aryRow['max_id'];
            $$new_cookie=$max_id;
            SetCookie($new_cookie,$$new_cookie,time()+ 31536000);
            SetCookie($haveread_cookie,$$new_cookie); //destroy session cookie
            unset($$haveread_cookie);
        }
       
        redirect($_SERVER['HTTP_REFERER'], $lang_misc['Mark read redirect']);
    }
// end marking

viewforum.php

find:
<td class="punright" style="width: 19%; white-space: nowrap"><b><?php echo $post_link ?></b></td>
after add:
<td><?php echo '  <b><a href="misc.php?action=markread&fid='.$id.'">'.$lang_common['Mark forum read'].'</b></a>' ?></td>
   
find:
            if (!$cookie['is_guest'] && $cur_topic['last_post'] > $cur_user['last_visit'] && $cur_topic['moved_to'] == null)
        {
            if ($cur_user['show_img'] == '1')
                $icon = '<img src="img/'.$cur_user['style'].'_new.png" width="16" height="16" alt="">';
            else
                $icon = '<span class="puntext"><b>•</b></span>';

            $subject = '<b>'.$subject.'</b>';
            //New posts in the topic
            $subject_new_posts = '[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]';
        }
        else
        {
            $icon = ' ';
            $subject_new_posts = null;
        }

replace with:

$forum_id = $id;
$new_cookie="pun-new-$forum_id";
$haveread_cookie="pun-haveread-$forum_id";
$t_id = $cur_topic['id'];

    $res = $db->query('Select last_post_id as t_maxid FROM '.$db->prefix.'topics WHERE id='.$cur_topic['id'].'');
    $t_maxid = $db->result($res,0);
    if(!IsSet($$new_cookie)){
        $$new_cookie='0';
    }

    $use_haveread=false;
    if(IsSet($$haveread_cookie)) {
        $arr=explode(".", $$haveread_cookie);
        $old_message=reset($arr);
        array_walk($arr, "explode_haveread");
        $use_haveread=true;
    }
    else{
        $old_message=$$new_cookie;
    }

   $isnew=false;
   
        if($use_haveread){
          if ($old_message<$t_maxid) {
            if(!IsSet($haveread[$t_maxid])) {
              $isnew=true;
            }
          }
        }
        elseif($old_message<$t_maxid){
          $isnew=true;
        }
   
         if($isnew){
                   //New posts in the topic
        $subject_new_posts = '[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'"><font color=orange>New</font></a> ]';
      }
      else{
            $subject_new_posts = null;}

viewtopic.php

find:
else if (isset($_GET['action']) && $_GET['action'] == 'new' && !$cookie['is_guest'])
{
      $result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted >'.$cur_user['last_visitonline']) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
  $first_new_post_id = $db->result($result, 0);

replace with
else if (isset($_GET['action']) && $_GET['action'] == 'new')
{
$res = $db->query('Select id from '.$db->prefix.'posts where topic_id='.$id.' ORDER BY id');
$rec = $db->fetch_row($res);
   While($rec){
       $msgarr[]=$rec[0];
        $rec = $db->fetch_row($res);
        }
$res = $db->query('Select forum_id from '.$db->prefix.'topics where topic_id='.$id.'');
$forum_id = $db->result($res,0);

$new_cookie="pun-new-$forum_id";
$haveread_cookie="pun-haveread-$forum_id";

$arr=explode(".", $$haveread_cookie);                         

        function newmsg($a, $b) {
        $al = sizeof($a);
        $bl = sizeof($b);
        sort($a);
                               
         if ($b[$bl-1]<$a[0]) return $b[$bl-1];
       
        $i = 0; $j = 0;
        while(1) {
        if ($a[$i] < $b[$j]) {
                   $i++;
             if ($i == $al) return $b[$j];
             } else if($a[$i] == $b[$j]) {
                $j++;
            if ($j == $bl) return $b[$bl-1];
                } else {
               return $b[$j];
              }
          }
        }

    $first_new_post_id = newmsg($arr, $msgarr);
   
   
find:
$footer_style = 'topic';
require $pun_root.'footer.php';

before add:
$new_cookie="pun-new-$forum_id";
$haveread_cookie="pun-haveread-$forum_id";


    if(!IsSet($$new_cookie)){
      $$new_cookie='0';
    }

    $use_haveread=false;
    if(IsSet($$haveread_cookie)) {
      $arr=explode(".", $$haveread_cookie);
      $old_message=@reset($arr);
      array_walk($arr, "explode_haveread");
      $use_haveread=true;
    }
    else{
      $old_message=$$new_cookie;
    }
   
   
  $res = $db->query('Select id from '.$db->prefix.'posts where topic_id='.$id.' ORDER BY id');
  $rec = $db->fetch_row($res);

  While($rec){
    $headers[]=$rec;
    $rec = $db->fetch_row($res);
     }
      $madechange=false;
     @reset($headers);
    $row=@current($headers);
      while(!empty($row[0])){

        if(empty($haveread[$row[0]]) && $row[0] > $old_message){
          $madechange=true;
          if(empty($$haveread_cookie)){
            $haveread[$$new_cookie] = true;
            $$haveread_cookie=$$new_cookie;
          }
          $$haveread_cookie.=".";
          $$haveread_cookie.=$row[0];
        }
        $haveread[$row[0]] = true;
        $max_id=$row[0];
        $row=next($headers);
      }
      if ($madechange) {
        SetCookie($haveread_cookie,$$haveread_cookie,0);
      }
   
 

  if($UseCookies){
    if($$new_cookie<$max_id){
      $$new_cookie=$max_id;
      SetCookie($new_cookie,$$new_cookie,time()+ 31536000);
    }
  }

100

(13 replies, posted in PunBB 1.2 show off)

>>NO COPYRIGHT!!!!!!!
>>ADD THIS CODE NOW!!
its still in all the files code , and will be placed in the About pages
the copiright of the forum looks not nice in my context

>>homepage: Page generated in 0.5117199 sec.
>>forum: Page generated in 0.0659509 sec.
yeah.. this is all right, but sad. these are counted separately. fist counts whole page generation time.

>>and all the homepage displays is news
I'm now working under New message system for punbb, it will be finished in ~2-4 days
I'll release it shortly.
Added:
Ups... i've misunderstood you smile are you speaking about News page ? the thing is: page generation time may differ very much, the server is always under load, it has ~100-300 users online at once... so apache may stuck a bit smile
it also serves http://hostel.nstu.ru, our NSTU Campus network site.