1

(0 replies, posted in PunBB 1.4 bug reports)

I've noticed that when setting my time zone in Profile > Settings, the time zone changes correctly (e.g. 7:02 becomes 1:02), but the "UTC" tail doesn't go away.  So when I set my time zone to CST (UTC -6), I get "14:04:07 UTC".   As far as I can tell, this is a bug--anyone know how to fix it?

Check out Fancy Stop SPAM here: http://punbb.informer.com/forums/topic/ … stop-spam/

I would also be interested in this.

4

(47 replies, posted in PunBB 1.4 additions)

I think it may have something to do with the distance between your server and me (I'm in Oklahoma, USA).

5

(47 replies, posted in PunBB 1.4 additions)

I'd love to check out your new Hydrogen v2, but I'm getting an error 504 on your site.

6

(1 replies, posted in PunBB 1.4 additions)

This version works with 1.4, but you have to change the manifest.xml file.  Find the line that says

<maxtestedon>1.3.6</maxtestedon>

and change it to

<maxtestedon>1.4.2</maxtestedon>

My edit doesn't work right, you mean? Or the extension overall?

Thanks again!

Looks like you either forgot to change the version number in the manifest.xml, or you forgot to upload the new version.

10

(2 replies, posted in PunBB 1.4 troubleshooting)

Thanks, I appreciate the help.

11

(2 replies, posted in PunBB 1.4 troubleshooting)

Just a quick question here:  I have a lot of banned users on my user list, and I want to get them out of there.  If I delete them all, their bans still stay in effect, right?  I don't want to get swamped by spammers just because I've done a bit of spring cleaning. tongue Thanks much!

Just a heads-up:  I don't see any announcements on the mobile site with this extension.  I love your themes though!  I've been using a slightly modified Hydrogen theme on my forums for a while now. smile

I noticed a problem with this plugin. The coding for alt-text on mouse hover (for the thumb and cancel icons) was a bit off.  Around line 245 of the manifest.xml, there was an alt="..." tag on an image, but that image was being blocked by the link overlaying it (in Google Chrome at least). So, I moved the alt="..." tag to the link in the form of <a href="link here" TITLE="alt text here"> and deleted alt="..." tag from the image. 

This was done for the thumbs up, thumbs down, and cancel icons.  For the lazy, here's the full file for you to copy and paste.  I was going to use a spoiler tag, but I forgot they're not available without an extension. tongue  Anyway:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/**
 * Adds karma/reputation to posts.
 *
 * @copyright (C) 2008-2009 PunBB
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * @package pun_karma
 */
-->

<extension engine="1.0">
    <id>pun_karma</id>
    <title>Post karma</title>
    <version>1.1.3</version>
    <description>Adds karma/reputation to posts with additional Icons.</description>
    <author>PunBB Development Team</author>
    <minversion>1.3</minversion>
    <maxtestedon>1.4.1</maxtestedon>

    <install><![CDATA[
if (!$forum_db->table_exists('pun_karma'))
{
    $schema = array(
        'FIELDS'    => array(
            'user_id'    =>    array(
                'datatype'        => 'INT(10) UNSIGNED',
                'allow_null'    => false
            ),
            'post_id'    =>    array(
                'datatype'        => 'INT(10) UNSIGNED',
                'allow_null'    => false
            ),
            'mark' => array(
                'datatype'        => 'TINYINT(1)',
                'allow_null'    => false
            ),
            'updated_at'    =>    array(
                'datatype'        => 'INT(10) UNSIGNED',
                'allow_null'    => false
            )
        ),
        'PRIMARY KEY'    => array('user_id', 'post_id'),
        'INDEXES'        => array('karmapost_idx' => array('post_id'))
    );
    $forum_db->create_table('pun_karma', $schema);
}

$forum_db->add_field('posts', 'karma', 'INT(10)', TRUE);
$forum_db->add_field('users', 'karma', 'INT(10)', TRUE);

//Upgrading
if (defined('EXT_CUR_VERSION') && version_compare(EXT_CUR_VERSION, '1.0', '<='))
{
    @set_time_limit(0);
    $pun_karma_query = array(
        'SELECT'    =>    'poster_id, SUM(mark) AS user_karma',
        'FROM'        =>    $forum_db->prefix.'posts AS p, '.$forum_db->prefix.'pun_karma AS pk',
        'WHERE'        =>    'p.id = pk.post_id',
        'GROUP BY'    =>    'poster_id',
        'PARAMS'    =>    array(
            'NO_PREFIX'    =>    true
        )
    );
    $pun_karma_res = $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);

    if ($forum_db->num_rows($pun_karma_res) > 0)
    {
        while ($cur_karma = $forum_db->fetch_assoc($pun_karma_res))
        {
            $pun_karma_update_query = array(
                'UPDATE'    =>    'users',
                'SET'        =>    'karma = '.$cur_karma['user_karma'],
                'WHERE'        =>    'id = '.$cur_karma['poster_id']
            );
            $forum_db->query_build($pun_karma_update_query) or error(__FILE__, __LINE__);
        }
    }
}

// Add extension options to the config table
$pun_karma_config = array(
    'o_pun_karma_minus_cancel'            => '0',
    'o_pun_karma_minus_interval'        => '2',
    'o_pun_karma_plus_interval'            => '2'
);

foreach ($pun_karma_config as $conf_name => $conf_value)
{
    if (!array_key_exists($conf_name, $forum_config))
    {
        $query = array(
            'INSERT'    => 'conf_name, conf_value',
            'INTO'        => 'config',
            'VALUES'    => '\''.$conf_name.'\', \''.$conf_value.'\''
        );

        $forum_db->query_build($query) or error(__FILE__, __LINE__);
    }
}
    ]]></install>

    <uninstall><![CDATA[
$forum_db->drop_table('pun_karma');
$forum_db->drop_field('posts', 'karma');
$forum_db->drop_field('users', 'karma');
$query = array(
    'DELETE'    =>    'config',
    'WHERE'        =>    'conf_name IN (\'o_pun_karma_minus_cancel\', \'o_pun_karma_minus_interval\', \'o_pun_karma_plus_interval\')'
);
$forum_db->query_build($query) or error(__FILE__, __LINE__);
    ]]></uninstall>

    <hooks>
        <hook id="hd_head"><![CDATA[
if (FORUM_PAGE == 'viewtopic')
    $forum_head['style_karma'] = '<link rel="stylesheet" type="text/css" media="screen" href="'.$ext_info['url'].'/styles.css" />';
        ]]></hook>
        <hook id="re_rewrite_rules"><![CDATA[
$forum_rewrite_rules['/^post[\/_-]([0-9]+)[\/_-]karma(plus|minus|cancel)[\/_-]([a-z0-9]+)(\.html?|\/)?$/i'] = 'viewtopic.php?pid=$1&karma$2&csrf_token=$3';
        ]]></hook>
        <hook id="vt_qr_get_posts"><![CDATA[
$query['SELECT'] .= ', p.karma AS post_karma, u.karma AS user_karma';
$pun_karma_posts = array();
$pun_karma_authors = array();
        ]]></hook>
        <hook id="vt_row_pre_post_actions_merge"><![CDATA[
if (!is_null($cur_post['user_karma']) && !isset($user_data_cache[$cur_post['poster_id']]['author_info']))
    $forum_page['author_info']['karma'] = '<li><span>'.$lang_pun_karma['User Karma'].' <strong>'.forum_number_format($cur_post['user_karma']).'</strong></span></li>';
        ]]></hook>
        <hook id="vt_modify_topic_info"><![CDATA[
//Including lang file
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
    require $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
else
    require $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
require $ext_info['path'].'/url/'.$forum_config['o_sef'].'/forum_urls.php';
require $ext_info['path'].'/functions.php';
if (!$forum_user['is_guest'] && (isset($_GET['karmaplus']) || isset($_GET['karmaminus']) || isset($_GET['karmacancel'])))
{
    //Check if user tries to vote for his own post
    $pun_karma_query = array(
        'SELECT'    => '1',
        'FROM'        => 'posts',
        'WHERE'        => 'poster_id = '.$forum_user['id'].' AND id = '.$pid
    );
    $result = $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);
    if ($forum_db->num_rows($result) > 0)
        message($lang_pun_karma['Vote error']);

    if (isset($_GET['karmaplus']))
    {
        if (!isset($_GET['csrf_token']) || ($_GET['csrf_token'] != generate_form_token('karmaplus'.$pid)))
            csrf_confirm_form();
        $pun_karma_query = array(
            'SELECT'    =>    'MAX(updated_at)',
            'FROM'        =>    'pun_karma',
            'WHERE'        =>    'user_id = '.$forum_user['id'].' AND mark = 1'
        );
        $pun_karma_result = $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);
        if ($forum_db->num_rows($pun_karma_result) > 0)
        {
            list($updated_at) = $forum_db->fetch_row($pun_karma_result);
            if ((time() - $updated_at) < $forum_config['o_pun_karma_plus_interval'] * 60 && (time() - $updated_at) >= 0)
                message(sprintf($lang_pun_karma['Plus interval rest'], $forum_config['o_pun_karma_plus_interval']));
        }
        karma_plus($pid);
    }
    else if (isset($_GET['karmaminus']))
    {
        if (!isset($_GET['csrf_token']) || ($_GET['csrf_token'] != generate_form_token('karmaminus'.$pid)))
            csrf_confirm_form();
        $pun_karma_query = array(
            'SELECT'    =>    'MAX(updated_at)',
            'FROM'        =>    'pun_karma',
            'WHERE'        =>    'user_id = '.$forum_user['id'].' AND mark = -1'
        );
        $pun_karma_result = $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);
        if ($forum_db->num_rows($pun_karma_result) > 0)
        {
            list($updated_at) = $forum_db->fetch_row($pun_karma_result);
            if ((time() - $updated_at) < $forum_config['o_pun_karma_minus_interval'] * 60 && (time() - $updated_at) >= 0)
                message(sprintf($lang_pun_karma['Minus interval rest'], $forum_config['o_pun_karma_minus_interval']));
        }
        karma_minus($pid);
    }
    else if (isset($_GET['karmacancel']))
    {
        if (!isset($_GET['csrf_token']) || ($_GET['csrf_token'] != generate_form_token('karmacancel'.$pid)))
            csrf_confirm_form();
        karma_cancel($pid);
    }
}
        ]]></hook>
        <hook id="aop_features_pre_header_load"><![CDATA[
//Including lang file
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
    require $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
else
    require $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
require $ext_info['path'].'/url/'.$forum_config['o_sef'].'/forum_urls.php';
        ]]></hook>
        <hook id="vt_post_loop_start"><![CDATA[
$pun_karma_posts[$cur_post['id']] = $cur_post['post_karma'];
$pun_karma_authors[$cur_post['id']] = $cur_post['poster_id'];
        ]]></hook>
        <hook id="vt_row_pre_display"><![CDATA[
$forum_page['post_options']['karma'] = '<p class="post-karma">'.$cur_post['id'].'</p>';
        ]]></hook>
        <hook id="vt_end"><![CDATA[
$pun_karma_query = array(
    'SELECT'    =>    'post_id',
    'FROM'        =>    'pun_karma',
    'WHERE'        =>    'user_id = '.$forum_user['id'].' AND post_id IN ('.implode(',', array_keys($pun_karma_posts)).')'
);
$pun_karma_result = $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);

$user_karma_posts = array();
if ($forum_db->num_rows($pun_karma_result) > 0)
{
    while ($cur_id = $forum_db->fetch_assoc($pun_karma_result))
        $user_karma_posts[] = $cur_id['post_id'];
}

$buffer = forum_trim(ob_get_contents());
$karma_matches = array();
preg_match_all('~<p class="post-karma">([0-9]+)</p>~', $buffer, $karma_matches);
foreach ($karma_matches[0] as $match_index => $match_string)
{
    $post_karma = '';
    if (!is_null($pun_karma_posts[$karma_matches[1][$match_index]]))
        $post_karma = '<strong>'.($pun_karma_posts[$karma_matches[1][$match_index]] === '0' ? '0' : ($pun_karma_posts[$karma_matches[1][$match_index]] > 0 ? '+' : '&minus;').abs($pun_karma_posts[$karma_matches[1][$match_index]])).'</strong>';
    //Is user author of post?
    if ($pun_karma_authors[$karma_matches[1][$match_index]] == $forum_user['id'])
        $post_karma = '<p class="post-karma">'.$post_karma.'</p>';
    else
    {
        //User vote for this post?
        if (in_array($karma_matches[1][$match_index], $user_karma_posts))
            $post_karma = '<p class="post-karma">'.$post_karma.' <a href="'.forum_link($forum_url['karmacancel'], array($karma_matches[1][$match_index], generate_form_token('karmacancel'.$karma_matches[1][$match_index]))).'" TITLE="'.$lang_pun_karma['Alt cancel'].'"><img src="'.$ext_info['url'].'/icons/cancel.png" /></a></p>';
        else
            $post_karma = '<p class="post-karma"><a href="'.forum_link($forum_url['karmaplus'], array($karma_matches[1][$match_index], generate_form_token('karmaplus'.$karma_matches[1][$match_index]))).'" TITLE="'.$lang_pun_karma['Alt thumbs up'].'" ><img src="'.$ext_info['url'].'/icons/rate_yes.png" /></a> '.$post_karma.($forum_config['o_pun_karma_minus_cancel'] == '0' ? ' <a href="'.forum_link($forum_url['karmaminus'], array($karma_matches[1][$match_index], generate_form_token('karmaminus'.$karma_matches[1][$match_index]))).'" TITLE="'.$lang_pun_karma['Alt thumbs down'].'" ><img src="'.$ext_info['url'].'/icons/rate_no.png" /></a>' : '').'</p>';
    }
    $buffer = str_replace($match_string, $post_karma, $buffer);
}
$tpl_main = str_replace('<!-- forum_main -->', $buffer, $tpl_main);
        ]]></hook>
        <hook id="aop_features_validation"><![CDATA[
if (!isset($form['pun_karma_minus_cancel']) || $form['pun_karma_minus_cancel'] != '1')
    $form['pun_karma_minus_cancel'] = '0';
if (!isset($form['pun_karma_plus_interval']))
    $form['pun_karma_plus_interval'] = 2;
else
    $form['pun_karma_plus_interval'] = intval($form['pun_karma_plus_interval']);
if (!isset($form['pun_karma_minus_interval']))
    $form['pun_karma_minus_interval'] = 2;
else
    $form['pun_karma_minus_interval'] = intval($form['pun_karma_minus_interval']);
        ]]></hook>
        <hook id="aop_features_avatars_fieldset_end"><![CDATA[

$forum_page['group_count'] = $forum_page['item_count'] = 0;

?>
<div class="content-head">
    <h2 class="hn"><span><?php echo $lang_pun_karma['Karma features'] ?></span></h2>
</div>
<fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>">
    <legend class="group-legend"><span><?php echo $lang_pun_karma['Karma legend'] ?></span></legend>
    <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
        <div class="sf-box checkbox">
            <span class="fld-input"><input type="checkbox" id="fld<?php echo ++$forum_page['fld_count'] ?>" name="form[pun_karma_minus_cancel]" value="1"<?php if ($forum_config['o_pun_karma_minus_cancel'] == '1') echo ' checked="checked"' ?> /></span>
            <label for="fld<?php echo $forum_page['fld_count'] ?>"><span><?php echo $lang_pun_karma['Disable minus'] ?></span> <?php echo $lang_pun_karma['Disable minus info'] ?></label>
        </div>
    </div>
    <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
        <div class="sf-box text">
            <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_pun_karma['Plus interval'] ?></span><small><?php echo $lang_pun_karma['Plus interval info'] ?></small></label><br />
            <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[pun_karma_plus_interval]" size="6" maxlength="6" value="<?php echo $forum_config['o_pun_karma_plus_interval'] ?>" /></span>
        </div>
    </div>
    <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
        <div class="sf-box text">
            <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_pun_karma['Minus interval'] ?></span><small><?php echo $lang_pun_karma['Minus interval info'] ?></small></label><br />
            <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[pun_karma_minus_interval]" size="6" maxlength="6" value="<?php echo $forum_config['o_pun_karma_minus_interval'] ?>" /></span>
        </div>
    </div>
</fieldset>
<?php

        ]]></hook>
        <hook id="fn_delete_topic_end"><![CDATA[
if (!empty($post_ids))
{
    $query = array(
        'DELETE'    =>    'pun_karma',
        'WHERE'        =>    'post_id IN('.implode(',', $post_ids).')'
    );
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
}
        ]]></hook>
        <hook id="fn_delete_post_end"><![CDATA[
$query = array(
    'DELETE'    =>    'pun_karma',
    'WHERE'        =>    'post_id = '.$post_id
);
$forum_db->query_build($query) or error(__FILE__, __LINE__);
        ]]></hook>
        <hook id="mr_confirm_delete_posts_pre_redirect"><![CDATA[
if (!empty($posts))
{
    $query = array(
        'DELETE'    =>    'pun_karma',
        'WHERE'        =>    'post_id IN('.implode(',', $posts).')'
    );
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
}
        ]]></hook>
        <hook id="mr_confirm_delete_topics_pre_redirect"><![CDATA[
if (!empty($post_ids))
{
    $query = array(
        'DELETE'    =>    'pun_karma',
        'WHERE'        =>    'post_id IN('.implode(',', $post_ids).')'
    );
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
}
        ]]></hook>
    </hooks>
</extension>