I try translate punbb into polish ,i change encoding to ISO-8859-2 and works good in one place but in other i get strange sings .Anyway when i close language file and open it again i find strange characters like" w³"( i put some parts of my language common file here) in other file i have same problem i see strange characters in language file or on my forum .
Any idea?


'Never'                   =>    'Nigdy',
'Today'                =>    'Dziœ',       but  should be  Dzi?
'Yesterday'            =>    'Wczoraj',
'Info'                    =>    'Info',        // a common table header
'Go back'                =>    'Go back',
'Maintenance'            =>    'Maintenance',
'Redirecting'            =>    'Redirecting',
'Click redirect'                =>    'Click here if you do not want to wait any longer (or if your browser does not automatically forward you)',
'Login required'                =>    'Only logged in users are allowed to read this forum.',
'on'                    =>    'w³',        // as in "BBCode is on"  should be w?
'off'                    =>    'wy³',
'Invalid e-mail'                =>    'The e-mail address you entered is invalid.',
'required field'                =>    'is a required field in this form.',    // for javascript form validation
'Last post'                =>    'Ostatnia akcja',
'by'                    =>    'napisa³',    // as in last post by someuser
'in'                    =>    'w',    // as in last post by someuser
'New posts'            =>    'New posts',    // the link that leads to the first new post (use   for spaces)
'New posts info'        =>    'Go to the first new post in this topic.',    // the popup text for new posts links
'Username'            =>    'Nazwa u¿ytkownika',
'Password'                =>    'Has³o',
'E-mail'                =>    'E-mail',
'Send e-mail'            =>    'Send e-mail',
'Registered'            =>    'Do³¹czy³',
'Subject'                =>    'Subject',

2

(4 replies, posted in PunBB 1.2 discussion)

Paul wrote:

I stopped updating it so I took it down. I will probably do a new version when PunBB 1.2 is released.

ok thanks for your answer .Btw mayby you can send me a copy ? if you still have this mod.

3

(4 replies, posted in PunBB 1.2 discussion)

where i find this mod ? I try download but site is offline sad

Maciek wrote:
Smartys wrote:

I just tried the code and had no problems with it smile

You mean works good .... no double post ,subject and other strange things?
Mac can you send me your post.php on email.

heh everything works good now smile you are great man

Hi
Thanks for answer and help .
I test your code right now and i must say it's works but i have one small problem hmm.
When i post new topic i have double subject in viewforum.php sad anyway take a look at screen .

image

I try display last topic subject in last post row in index.php

I change this in function.php

//
// Update posts, topics, last_post, last_post_id and last_poster for a forum (redirect topics are not included)
// If $transaction == PUN_TRANS_END, this function will end the current transaction
//
function update_forum($forum_id, $transaction = 0)
{
    global $db;

    $result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE moved_to IS NULL AND forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error());
    list($num_topics, $num_posts) = $db->fetch_row($result);

    $num_posts = $num_posts + $num_topics;        // $num_posts is only the sum of all replies (we have to add the topic posts)

    $result = $db->query('SELECT last_post, last_post_id, last_poster, subject FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' AND moved_to IS NULL ORDER BY last_post DESC LIMIT 1') or error('Unable to fetch last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result))        // There are topics in the forum
    {
        list($last_post, $last_post_id, $last_poster) = $db->fetch_row($result);

        $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.addslashes($last_poster).'\', subject=\''.addslashes($subject).'\' WHERE id='.$forum_id, $transaction) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
    }
    else    // There are no topics
        $db->query('UPDATE '.$db->prefix.'forums SET num_topics=0, num_posts=0, last_post=NULL, last_post_id=NULL, last_poster=NULL, subject=NULL WHERE id='.$forum_id, $transaction) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
}

this in index.php

// Print the categories and forums
$extra_sql = ($cur_user['status'] < PUN_MOD) ? ' WHERE f.admmod_only=\'0\'' : '';

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.closed, f.subject FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra_sql.' ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

while ($cur_forum = $db->fetch_assoc($result))
{
    if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration?
    {


AND THIS

// If there is a last_post/last_poster. 
    if ($cur_forum['last_post'] != '')
        $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#'.$cur_forum['last_post_id'].'">
<img src="'.$pun_config['o_styleimg_dir'].'/lastpost.gif" alt="ostatni post" border="0" align="middle" ></a> '.format_time($cur_forum['last_post']).'<br><b>'.$lang_common['by'].'</b> '.pun_htmlspecialchars($cur_forum['last_poster']).'</br><b>'.$lang_common['in'].'</b>  <span class="postdetails">'.pun_htmlspecialchars($cur_forum['subject']).'</span>';
    else
        $last_post = '<b>'.$lang_common['by'].'</b></br><b>'.$lang_common['in'].'</b>';

i Add new field subject to forums table in database.
I don't get any error but still i can't display last subject .

Any idea?

Rickard wrote:

IIS6 is weird. Try this:

if ($pun_config['o_announcement'] == '1' && basename($_SERVER['SCRIPT_NAME']) == 'index.php')

Work's great now smile thank you very much Rickard

Rickard wrote:

Hmm, ok. What does this output:

dump($_SERVER, basename($SERVER['SCRIPT_FILENAME']));

all page look's like this

Array
(
    [ALLUSERSPROFILE] => E:\\Documents and Settings\\All Users
    [APP_POOL_ID] => DefaultAppPool
    [ClusterLog] => E:\\WINDOWS\\Cluster\\cluster.log
    [CommonProgramFiles] => E:\\Program Files\\Common Files
    [COMPUTERNAME] => MACIEJ-WXRSC38U
    [ComSpec] => E:\\WINDOWS\\system32\\cmd.exe
    [NUMBER_OF_PROCESSORS] => 1
    [OS] => Windows_NT
    [Path] => E:\\WINDOWS\\system32;E:\\WINDOWS;E:\\WINDOWS\\System32\\Wbem
    [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.VBS
    [PROCESSOR_ARCHITECTURE] => x86
    [PROCESSOR_IDENTIFIER] => x86 Family 15 Model 1 Stepping 3, GenuineIntel
    [PROCESSOR_LEVEL] => 15
    [PROCESSOR_REVISION] => 0103
    [ProgramFiles] => E:\\Program Files
    [SystemDrive] => E:
    [SystemRoot] => E:\\WINDOWS
    [TEMP] => E:\\WINDOWS\\TEMP
    [TMP] => E:\\WINDOWS\\TEMP
    [USERPROFILE] => E:\\Documents and Settings\\LocalService
    [windir] => E:\\WINDOWS
    [HTTP_CONNECTION] => Keep-Alive
    [HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_ACCEPT_LANGUAGE] => pl
    [HTTP_COOKIE] => punbb_cookie=a%3A2%3A%7Bi%3A0%3Bs%3A6%3A%22Mac%22%3Bi%3A1%3Bs%3A40%3A%228e7b0ae2d1e3faf46beaee01430f6fa4900dbc7f%22%3B%7D
    [HTTP_HOST] => localhost
    [HTTP_IF_MODIFIED_SINCE] => Wed, 09 Jun 2004 06:02:41 GMT
    [HTTP_REFERER] => http://localhost/test/admin_index.php
    [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)
    [AUTH_TYPE] => 
    [AUTH_PASSWORD] => 
    [AUTH_USER] => 
    [CERT_COOKIE] => 
    [CERT_FLAGS] => 
    [CERT_ISSUER] => 
    [CERT_SERIALNUMBER] => 
    [CERT_SUBJECT] => 
    [CONTENT_LENGTH] => 0
    [CONTENT_TYPE] => 
    [GATEWAY_INTERFACE] => CGI/1.1
    [HTTPS] => off
    [HTTPS_KEYSIZE] => 
    [HTTPS_SECRETKEYSIZE] => 
    [HTTPS_SERVER_ISSUER] => 
    [HTTPS_SERVER_SUBJECT] => 
    [INSTANCE_ID] => 1
    [LOCAL_ADDR] => 127.0.0.1
    [LOGON_USER] => 
    [PATH_INFO] => /test/index.php
    [PATH_TRANSLATED] => e:\\inetpub\\wwwroot\\test\\index.php
    [QUERY_STRING] => 
    [REMOTE_ADDR] => 127.0.0.1
    [REMOTE_HOST] => 127.0.0.1
    [REMOTE_USER] => 
    [REQUEST_METHOD] => GET
    [SCRIPT_NAME] => /test/index.php
    [SERVER_NAME] => localhost
    [SERVER_PORT] => 80
    [SERVER_PORT_SECURE] => 0
    [SERVER_PROTOCOL] => HTTP/1.1
    [SERVER_SOFTWARE] => Microsoft-IIS/6.0
    [UNMAPPED_REMOTE_USER] => 
    [PHP_SELF] => /test/index.php
    [argv] => Array
        (
        )

    [argc] => 0
)

 
Rickard wrote:

It should be $_SERVER, not $SERVER. Do you have any idea how long it took me to notice that? hmm

sorry my fault i change this and forget  ,but this not work anyway.

Rickard wrote:

Could you post your complete header.php?

why not if this help you

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

  Copyright (C) 2002, 2003, 2004  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 G>eneral 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

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


// Send no-cache headers
//header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');    // When yours truly first set eyes on this world! :)
header('Pragma: no-cache');


// Load the main template
$fp = fopen($pun_root.'include/template/main.tpl', 'r');
$tpl_main = trim(fread($fp, filesize($pun_root.'include/template/main.tpl')));
fclose($fp);


// START SUBST - <pun_content_direction>
$tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
// END SUBST - <pun_content_direction>


// START SUBST - <pun_char_encoding>
$tpl_main = str_replace('<pun_char_encoding>', $lang_common['lang_encoding'], $tpl_main);
// END SUBST - <pun_char_encoding>


// START SUBST - <pun_head>
ob_start();

if (isset($destination))
    echo '<meta http-equiv="refresh" content="'.$delay.';URL='.$destination.'">'."\n";
else if (isset($validate_form))
{
    // Output javascript(s)
    // With a quick and dirty hack to not disable submit buttons if user agent is Opera (since Opera
    // refused to re-enable the button if we submit and then go back to this page)

?>
<script type="text/javascript">
<!--
function process_form(theform)
{
<?php

    if (isset($element_names))
    {
        echo "\t".'var element_names = new Object()'."\n";

        while (list($elem_orig, $elem_trans) = @each($element_names))
            echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes($elem_trans).'"'."\n";

?>

    // Check for required elements
    if (document.images) {
        for (i = 0; i < theform.length; ++i) {
            if (theform.elements[i].name.substring(0, 4) == "req_") {
                if ((theform.elements[i].type=="text" || theform.elements[i].type=="textarea" || theform.elements[i].type=="password" || theform.elements[i].type=="file") && theform.elements[i].value=='') {
                    alert("\"" + element_names[theform.elements[i].name] + "\" <?php echo $lang_common['required field'] ?>")
                    return false
                }
            }
        }
    }

<?php

    }

    if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Opera'))
    {

?>
    // Disable any submit buttons we find
    if (document.all || document.getElementById) {
        for (i = 0; i < theform.length; ++i) {
            var elem = theform.elements[i]
            if (elem.type.toLowerCase() == "submit")
                elem.disabled = true
        }
        return true
    }

<?php

    }

?>
    return true
}
// -->
</script>
<?php

}

$style = (isset($cur_user)) ? $cur_user['style'] : $pun_config['o_default_style'];

?>
<title><?php echo $page_title ?></title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $style.'.css' ?>">
<?php

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <pun_head>


// START SUBST - <pun_body>
ob_start();

if (isset($form_name) && isset($focus_element))
    echo ' onLoad="document.getElementById(\''.$form_name.'\').'.$focus_element.'.focus()"';

$tpl_temp = ob_get_contents();
$tpl_main = str_replace('<pun_body>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <pun_body>


// START SUBST - <pun_title>
$tpl_main = str_replace('<pun_title>', pun_htmlspecialchars($pun_config['o_board_title']), $tpl_main);
// END SUBST - <pun_title>


// START SUBST - <pun_desc>
$tpl_main = str_replace('<pun_desc>', $pun_config['o_board_desc'], $tpl_main);
// END SUBST - <pun_desc>


// START SUBST - <pun_navlinks>
$tpl_main = str_replace('<pun_navlinks>', generate_navlinks(), $tpl_main);
// END SUBST - <pun_navlinks>


// START SUBST - <pun_status>
if ($cookie['is_guest'])
    $tpl_temp = $lang_common['Not logged in'];
else
    $tpl_temp = $lang_common['Logged in as'].' <b>'.pun_htmlspecialchars($cur_user['username']).'</b>.<br>'.$lang_common['Last visit'].': '.format_time($cur_user['last_visit']);

if ($cur_user['status'] > PUN_USER)
{
    $result_header = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());

    if ($db->result($result_header, 0))
        $tpl_temp .= '<br><a class="punhot" href="admin_reports.php">There are new reports</a>';

    if ($pun_config['o_maintenance'] == '1')
        $tpl_temp .= '<br><a class="punhot" href="admin_options.php#maintenance"><b>Maintenance mode is enabled!</b></a>';
}

$tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
// END SUBST - <pun_status>


// START SUBST - <pun_announcement>
if ($pun_config['o_announcement'] == '1' && basename($SERVER['SCRIPT_FILENAME']) == 'index.php')
{
    ob_start();

?>
<table class="punspacer" cellspacing="1" cellpadding="4"><tr><td> </td></tr></table>

<table class="punmain" cellspacing="1" cellpadding="4">
    <tr class="punhead">
        <td class="punhead"><?php echo $lang_common['Announcement'] ?></td>
    </tr>
    <tr>
        <td class="puncon2">
            <?php echo $pun_config['o_announcement_message'] ?><br><br>
        </td>
    </tr>
</table>
<?php

    $tpl_temp = trim(ob_get_contents());
    $tpl_main = str_replace('<pun_announcement>', $tpl_temp, $tpl_main);
    ob_end_clean();
}
else
    $tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
// END SUBST - <pun_announcement>


// START SUBST - <pun_main>
ob_start();


define('PUN_HEADER', 1);
Rickard wrote:

It should work. Did you read the whole topic? The code I posted in the beginning of the topic was wrong.

Yes i read whole topic ,and use bouth code

First code announcement still display on all forum
Second announcement will not show anywhere

Is it possible to have the announcement displayed only on the "home" page of my forums?

I try this but when i change header.php code the announcement will not show anywhere.
I use cleane 1.1.4 punbb version

Thanks for any help

Hi
Meyby someone now how do this

Now we have something like this

http://members.lycos.co.uk/mstrona/sb2.gif

but i want have something like this

http://members.lycos.co.uk/mstrona/sb1.gif

I try do this my self but i get mysql error every time.
Thanks for any help