1

(4 replies, posted in Programming)

Yes the "preview" seems to be so cool. smile
Can' t wait.

Just wanna simplify your life smile
I think such bugs are loose of time for the PunBB developpers,
contrary to the work that they have to finalize 1.3 features.

3

(4 replies, posted in Programming)

Why noy install and uninstall via the regular methods?

Because it' s the method that i don' t wan' t to use wink

Actually, what I will be doing is writing code in the PunBB files, and then putting it into a manifest file once it's finished.

So simple that i haven' t think about that ^^.
Thx.

4

(4 replies, posted in Programming)

Does anyone started an extension?

I couldn' t found a better way to test my extension (localy) than delete and recache the hooks in the db on each page.

Do you know a better way to "develop" an extension?

If it can help someone, there is the patch ^^ :

Index: admin/extensions.php
===================================================================
--- admin/extensions.php    (revision 928)
+++ admin/extensions.php    (working copy)
@@ -26,7 +26,8 @@
 define('PUN_ROOT', '../');
 require PUN_ROOT.'include/common.php';
 require PUN_ROOT.'include/common_admin.php';
-require PUN_ROOT.'include/xml.php';
+if(!PUN_EXTDEV)
+    require PUN_ROOT.'include/xml.php';
 
 
 if ($pun_user['g_id'] != PUN_ADMIN)
Index: include/common.php
===================================================================
--- include/common.php    (revision 928)
+++ include/common.php    (working copy)
@@ -24,6 +24,7 @@
 
 // Enable DEBUG mode by removing // from the following line
 define('PUN_DEBUG', 1);
+define('PUN_EXTDEV', 0);
 
 // This displays all executed queries in the page footer.
 // DO NOT enable this in a production environment!
@@ -114,6 +115,8 @@
 
 
 // Load hooks
+if(!PUN_EXTDEV)
+{
 if (file_exists(PUN_ROOT.'cache/cache_hooks.php'))
     include PUN_ROOT.'cache/cache_hooks.php';
 
@@ -123,8 +126,44 @@
     generate_hooks_cache();
     require PUN_ROOT.'cache/cache_hooks.php';
 }
+}
+else
+{
+    include PUN_ROOT.'include/xml.php';
+    $result = $db->query('SELECT id FROM '.$db->prefix.'extensions') or error('Unable to fetch extension', __FILE__, __LINE__, $db->error());
+    while($row = $db->fetch_row($result))
+    {
+        $id = $row[0];
+        $ext_data = xml_to_array(file_get_contents(PUN_ROOT.'extensions/'.$id.'/manifest.xml'));
+        $errors = validate_manifest($ext_data, $id);
+        if (!empty($errors))
+        {
+            echo "\t\t\t\t\t".'<p class="field"><strong class="alabel error">'.$lang_admin['Extension error'].'<span>: </span></strong> <span class="input">'.sprintf($lang_admin['Extension loading error'], htmlspecialchars($id)).' '.implode(' ', $errors).'</span></p>'."\n";
+        }
+        else
+        {
+            $db->query('DELETE FROM '.$db->prefix.'extension_hooks WHERE extension_id=\''.$db->escape($id).'\'') or error('Unable to delete extension hooks', __FILE__, __LINE__, $db->error());
+            $hooks = $ext_data['extension']['hooks']['hook'];
+            if (!is_array(current($hooks)))
+                $hooks = array($hooks);
+            foreach ($hooks as $hook)
+                $db->query('INSERT INTO '.$db->prefix.'extension_hooks (id, extension_id, code, installed) VALUES(\''.$db->escape(trim($hook['attributes']['id'])).'\', \''.$db->escape($id).'\', \''.$db->escape(trim($hook['content'])).'\', '.time().')') or error('Unable to create extension hook', __FILE__, __LINE__, $db->error());
+        }
+    }
+    $d = dir(PUN_ROOT.'cache');
+    while (($entry = $d->read()) !== false)
+    {
+        if (substr($entry, strlen($entry)-4) == '.php')
+        @unlink(PUN_ROOT.'cache/'.$entry);
+    }
+    $d->close();
+    require_once PUN_ROOT.'include/cache.php';
+    generate_hooks_cache();
+    require PUN_ROOT.'cache/cache_hooks.php';
+}
 
 
+
 // A good place to add common functions for your extension
 ($hook = get_hook('co_common')) ? eval($hook) : null;

When i read the help.php i saw two problems :

Notice: Undefined index: User wrote on line 102
And the "Code:" in the block was "bizare" tongue

So a mini-patch, it' s on my ftp cause of the BBcode in the patch, sorry for the inconvenience.
http://jiboo.freesarox.free.fr/2.patch

Bye.

Hello all,

Just posting how i see the Per-Style templates...
It' s the last item of the 1.3 features and i think it' s in alpha stage etc.. don't flame me.

@Devs:
Some of you are the most user-friendly devs i have ever seen, and..
I know 1.3 is less than alpha ect..
But i just like to post simple fix/patch ...
Simply ignore my posts wink

Index: header.php
===================================================================
--- header.php    (revision 928)
+++ header.php    (working copy)
@@ -37,7 +37,9 @@
 header('Content-type: text/html; charset=utf-8');
 
 // Load the main template
-if (substr(PUN_PAGE, 0, 5) == 'admin')
+if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/'.PUN_PAGE.'.tpl'))
+    $tpl_main = file_get_contents(PUN_ROOT.'style/'.$pun_user['style'].'/'.PUN_PAGE.'.tpl');
+else if (substr(PUN_PAGE, 0, 5) == 'admin')
 {
     if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/admin.tpl'))
         $tpl_main = file_get_contents(PUN_ROOT.'style/'.$pun_user['style'].'/admin.tpl');

7

(1 replies, posted in PunBB 1.2 bug reports)

Hi all.
Seems like we can't post tickets on track hmm
Just a minor fix..
Rome wasn't built on a day.

See you,
Jiboo.

Avertissement : assignment to undeclared variable matched
Fichier source : http://127.0.0.1/upload/include/js/common.js
Ligne : 94

Index: include/js/common.js
===================================================================
--- include/js/common.js    (revision 927)
+++ include/js/common.js    (working copy)
@@ -91,7 +91,7 @@
     /* return array of elements for which FN(ARR[i]) is true */
     arrayOfMatched: function(fn, arr)
     {
-        matched = [];
+        var matched = [];
         for (var i=0,len=arr.length; i<len; i++)
         {
             if (fn(arr[i])) matched.push(arr[i])
@@ -101,7 +101,7 @@
     /* flattens multi-dimentional arrays into simple arrays */
     flatten: function(arr)
     {
-        flt = [];
+        var flt = [];
         for (var i=0,len=arr.length; i<len; i++)
         {
             if (typeof arr[i] == 'object' && arr.length) {