1

(6 replies, posted in Supported extensions)

Hi,

pun_admin_log won't install while punBB is running with PostgreSQL because the double quotes aren't considered like string but like columns.

The patch :

Index: manifest.xml
===================================================================
--- manifest.xml    (révision 1596)
+++ manifest.xml    (copie de travail)
@@ -41,21 +41,21 @@
         $query_log = array(
             'INSERT'    => 'conf_name, conf_value',
             'INTO'        => 'config',
-            'VALUES'    => '"o_pun_admin_path_log_file", "'.$forum_db->escape(realpath(FORUM_ROOT.'/extensions/'.$id.'/forum.log')).'"',
+            'VALUES'    => '\'o_pun_admin_path_log_file\', \''.$forum_db->escape(realpath(FORUM_ROOT.'/extensions/'.$id.'/forum.log')).'\'',
         );
         $forum_db->query_build($query_log) or error(__FILE__, __LINE__);
 
         $query_log = array(
             'INSERT'    => 'conf_name, conf_value',
             'INTO'        => 'config',
-            'VALUES'    => '"o_pun_admin_log_write_file", "1"'
+            'VALUES'    => '\'o_pun_admin_log_write_file\', \'1\''
         );
         $forum_db->query_build($query_log) or error(__FILE__, __LINE__);
 
         $query_log = array(
             'INSERT'    => 'conf_name, conf_value',
             'INTO'        => 'config',
-            'VALUES'    => '"o_pun_admin_log_write_db", "1"'
+            'VALUES'    => '\'o_pun_admin_log_write_db\', \'1\''
         );
         $forum_db->query_build($query_log) or error(__FILE__, __LINE__);
 
@@ -355,4 +355,4 @@
 }
         ]]></hook>
     </hooks>
-</extension>
\ No newline at end of file
+</extension>

Charly.

2

(118 replies, posted in Supported extensions)

Yes, but I fixed it by myself and I have to redistribute it under the GPL.
And it's the only way I found ...

There is another way to contribute ?

3

(118 replies, posted in Supported extensions)

KeyDog wrote:

but either way you're right... the bug needs to be fixed in extension....

Yes, that's why I posted a patch !

4

(118 replies, posted in Supported extensions)

What DBMS are you using ?

I'm using punBB 1.3.4 with PostgreSQL 8.3.4 and downloads aren't counted if the transaction isn't ended correctly.
In all cases, it is important to end the transaction and close the connection properly.

Charly.

5

(118 replies, posted in Supported extensions)

Hi all,

Another patch that uses format_time for better date display:

Index: include/attach_func.php
===================================================================
--- include/attach_func.php    (révision 1592)
+++ include/attach_func.php    (copie de travail)
@@ -226,7 +226,7 @@
                 $show_image = false;
             $download_link = !empty($attach['secure_str']) ? forum_link($attach_url['misc_download_secure'], array($attach['id'], $attach['secure_str'])) : forum_link($attach_url['misc_download'], $attach['id']);
             $view_link = !empty($attach['secure_str']) ? forum_link($attach_url['misc_view_secure'], array($attach['id'], $attach['secure_str'])) : forum_link($attach_url['misc_view'], $attach['id']);
-            $attach_info = format_size($attach['size']).', '.($attach['download_counter'] ? sprintf($lang_attach['Since'], $attach['download_counter'], date('Y-m-d', $attach['uploaded_at'])) : $lang_attach['Never download']).'&nbsp;';
+            $attach_info = format_size($attach['size']).', '.($attach['download_counter'] ? sprintf($lang_attach['Since'], $attach['download_counter'], format_time($attach['uploaded_at'],1)) : $lang_attach['Never download']).'&nbsp;';
 
             ?>
             <div class="<?php echo $show_image ? 'ct-set' : 'sf-set'; ?> set<?php echo ++$forum_page['item_count'] ?>">
@@ -292,7 +292,7 @@
             $show_image = false;
         $download_link = forum_link($attach_url['misc_download'], $attach['id']);
 
-        $attach_info = format_size($attach['size']).', '.($attach['download_counter'] ? sprintf($lang_attach['Since'], $attach['download_counter'], date('Y-m-d', $attach['uploaded_at'])) : $lang_attach['Never download']).'&nbsp;';
+        $attach_info = format_size($attach['size']).', '.($attach['download_counter'] ? sprintf($lang_attach['Since'], $attach['download_counter'], format_time($attach['uploaded_at'],1)) : $lang_attach['Never download']).'&nbsp;';
         if ($allow_downloading)
         {
             if ($show_image)
@@ -383,4 +383,4 @@
             $forum_db->query_build($attach_query) or error(__FILE__, __LINE__);
         }
     }
-}
\ No newline at end of file
+}

Charly.

6

(118 replies, posted in Supported extensions)

Hi all,

download_counter keeps value 0 in db, because the script exits without ending the transaction.
The patch:

Index: manifest.xml
===================================================================
--- manifest.xml    (révision 1592)
+++ manifest.xml    (copie de travail)
@@ -962,6 +962,12 @@
                     'WHERE'        => 'id = '.$attach_item
                 );
                 $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
+
+                // End the transaction
+                $forum_db->end_transaction();
+
+                // Close the db connection (and free up any result data)
+                $forum_db->close();
             }
             exit();
         }

Charly.

7

(115 replies, posted in Supported extensions)

teplancon wrote:

Hello All,
I'm trying to use punBB 1.3.4 with the poll extension. I downloaded and installed pun poll 1.1.9 through the extension manager. It appeared to install OK but I'm getting errors when trying to use it.

I turned on debugging and the error reads:

The error occurred on line 36 in /var/.../header.php(302) : eval()'d code

Database reported: ERROR: column "rganswers.answer" must appear in the GROUP BY clause or be used in an aggregate function .

Any help here is appreciated and thaks for a great app!

Hi,

I have the same error with pun_poll 1.1.10 and punBB 1.3.4 running with PostgreSQL.
I encountered 2 errors exactly:

Index: manifest.xml
===================================================================
--- manifest.xml    (révision 1592)
+++ manifest.xml    (copie de travail)
@@ -688,7 +688,6 @@
                         'SELECT'    =>    'id, answer',
                         'FROM'        =>    'answers',
                         'WHERE'        =>    'topic_id = '.$id,
-                        'GROUP BY'    =>    'id',
                         'ORDER BY'    =>    'id ASC'
                     );
                     $result_pun_poll = $forum_db->query_build($query_pun_poll) or error(__FILE__, __LINE__);
@@ -745,7 +744,7 @@
                                 )
                             ),
                             'WHERE'        =>    'a.topic_id='.$id,
-                            'GROUP BY'    =>    'a.id',
+                            'GROUP BY'    =>    'a.id, answer',
                             'ORDER BY'    =>    'a.id'
                         );
                         $result_pun_poll = $forum_db->query_build($query_pun_poll) or error(__FILE__, __LINE__);
@@ -901,4 +900,4 @@
             }
         ]]></hook>
     </hooks>
-</extension>
\ No newline at end of file
+</extension>

GROUP BY is useless in the first query, so I removed it and added 'answer' to the GROUP BY clause in the second query.

Charly.

Hi,

I don't know where I have to post this patch, so I decided to create this topic.

It allows to set the group and password of the user.
I didn't create the possibility to put a CSV file for mass import because I prefer to use a script in shell using curl in loop.

Index: lang/English/pun_admin_add_user.php
===================================================================
--- lang/English/pun_admin_add_user.php    (révision 1580)
+++ lang/English/pun_admin_add_user.php    (copie de travail)
@@ -19,7 +19,9 @@
     'There are some errors'                        =>    '<strong>Warning!</strong> There are some errors:',
     'Username'                                    =>    'Username',
     'E-mail'                                    =>    'E-mail',
+    'Password'                                    =>    'Password',
+    'Group'                                        =>    'Group',
     'Edit user identity'                        =>    'Edit User Identity'
 )
 
-?>
\ No newline at end of file
+?>
Index: manifest.xml
===================================================================
--- manifest.xml    (révision 1580)
+++ manifest.xml    (copie de travail)
@@ -36,9 +36,14 @@
     
                     $username = trim($_POST['req_username']);
                     $email = strtolower(trim($_POST['req_email']));
+                    $password = trim($_POST['req_passwd']);
     
                     // Validate the username
                     $errors_add_users = validate_username($username);
+
+                    // Validate the password's length
+                    if (utf8_strlen($password) < 4)
+                        $errors_add_users[] = $lang_profile['Pass too short'];
     
                     // ... and the e-mail address
                     require_once FORUM_ROOT.'include/email.php';
@@ -66,13 +71,12 @@
                     if (empty($errors_add_users))
                     {
                         $salt = random_key(12);
-                        $password = random_key(8, true);
                         $password_hash = sha1($salt.sha1($password));
     
                         $errors = add_user(
                             array(
                                 'username'                => $username,
-                                'group_id'                => ($forum_config['o_regs_verify'] == '0') ? $forum_config['o_default_user_group'] : FORUM_UNVERIFIED,
+                                'group_id'                => $_POST['req_group'],
                                 'salt'                    => $salt,
                                 'password'                => $password,
                                 'password_hash'            => $password_hash,
@@ -113,6 +117,8 @@
         <![CDATA[
             if ($forum_user['g_id'] == FORUM_ADMIN)
             {
+                require_once FORUM_ROOT.'lang/'.$forum_user['language'].'/profile.php';
+
                 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
@@ -120,6 +126,7 @@
 
                 $username = '';
                 $email = '';
+                $password = '';
                 $edit_identity = '';
                 $result_message = '';
 
@@ -131,6 +138,7 @@
                     {
                         $username = $_POST['req_username'];
                         $email = $_POST['req_email'];
+                        $password = $_POST['req_passwd'];
                         $edit_identity = isset($_POST['edit_identity']);
                     }
                 }
@@ -194,6 +202,46 @@
                                 </div>
                             </div>
 
+                            <div class="sf-set set4">
+                                <div class="sf-box text">
+                                    <label for="add_user_passwd">
+                                        <span><?php echo $lang_profile['Password'] ?></span>
+                                        <small>
+                                            <?php echo $lang_profile['Password help'] ?>
+                                        </small>
+                                    </label>
+                                    <span class="fld-input"><input type="text" id="add_user_passwd" name="req_passwd" size="35" value="<?php echo $password ?>" /></span>
+                                </div>
+                            </div>
+
+                            <div class="sf-set set5">
+                                <div class="sf-box select">
+                                    <label for="add_user_group"><span><?php echo $lang_admin_add_user['Group'] ?></span></label><br />
+                                    <span class="fld-input"><select id="add_user_group" name="req_group">
+            <?php
+
+                $query = array(
+                    'SELECT'    => 'g.g_id, g.g_title',
+                    'FROM'        => 'groups AS g',
+                    'WHERE'        => 'g.g_id!='.FORUM_GUEST,
+                    'ORDER BY'    => 'g.g_title'
+                );
+
+                ($hook = get_hook('aus_change_group_qr_get_groups')) ? eval($hook) : null;
+                $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
+                while ($cur_group = $forum_db->fetch_assoc($result))
+                {
+                    if ($cur_group['g_id'] == $forum_config['o_default_user_group'])    // Pre-select the default Members group
+                        echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.forum_htmlencode($cur_group['g_title']).'</option>'."\n";
+                    else
+                        echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.forum_htmlencode($cur_group['g_title']).'</option>'."\n";
+                }
+
+            ?>
+                                    </select></span>
+                                </div>
+                            </div>
+
                             <fieldset class="mf-set set3">
                                 <legend><span><?php echo $lang_admin_add_user['Edit user identity'] ?></span></legend>
                                 <div class="mf-box mf-yesno">

Charly.