1 (edited by kierownik 2008-02-10 20:25)

Topic: [ AddOn ] list_Extensions.php

This page will show all your extensions and who made them etc.

just copy and paste:

list_extensions.php

<?php 
if ( !defined ( 'PUN_ROOT' ) )
  define ( 'PUN_ROOT', './' );
define ( 'PUN_PAGE', 1 );
require PUN_ROOT.'include/common.php';

// Load the language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
/*if ( file_exists ( 'extensions/simple_gallery/lang/'.$pun_user['language'].'/gallery.php' ) ) {
  require PUN_ROOT.'extensions/simple_gallery/lang/'.$pun_user['language'].'/gallery.php';
} else {
  require PUN_ROOT.'extensions/simple_gallery/lang/English/gallery.php';
}*/
  

//Set the page title here
$pun_page['crumbs'] = array(
    array( $pun_config['o_board_title'], pun_link ( $pun_url['index'] ) ),
    'List Extensions'
    );
define ( 'PUN_ALLOW_INDEX', 1 );
require PUN_ROOT.'header.php';

$query = array(
    'SELECT'  => 'title, version, description, author, disabled',
    'FROM'    => 'extensions',
    'ORDER BY' => 'title ASC'
  );

  $result = $db->query_build($query, true) or error(__FILE__, __LINE__);
  
?>
<div id="pun-main" class="main sectioned">
  <div class="main-head">
    List Extensions
  </div>

  <div class="main-content frm">
    <table summary="list mods">
      <tr>
        <th>Name extension</th>
        <th>Author</th>
        <th>Version</th>
        <th>Description</th>
        <th>Enables/Disabled</th>
      </tr>
      <tbody>
        <?php
          while ( $data = $db->fetch_assoc( $result ) ) {
            if ( $data['disabled'] == '0' ) {
              $data['disabled'] = 'Enabled';
            } else {
              $data['disabled'] = 'Disabled';
            }
            echo '<tr><td>'.$data['title'].'</td><td>'.$data['author'].'</td><td>'.$data['version'].'</td><td>'.$data['description'].'</td><td>'.$data['disabled'].'</td></tr>';
          }
        ?>
      </tbody>
    </table>
  </div>
</div>
<?php
require PUN_ROOT.'footer.php';

Re: [ AddOn ] list_Extensions.php

This is not an extension...........

Re: [ AddOn ] list_Extensions.php

I know but i did not know how to call it, do you have a name for it wink big_smile

Re: [ AddOn ] list_Extensions.php

It's not an extension and should not be treated as such. If you want to release it as an extension, you need to package it up with a proper manifest.xml

5

Re: [ AddOn ] list_Extensions.php

He has never actually said it is an extension though, has he? He merely said it lists what extensions are installed.

Re: [ AddOn ] list_Extensions.php

yes i did, but in the subject of the topic i put in [ extenstion release ] big_smile
because i did not know how to call it smile

7 (edited by MattF 2008-02-10 20:23)

Re: [ AddOn ] list_Extensions.php

Ah, right. I never saw that bit. big_smile

Re: [ AddOn ] list_Extensions.php

I should note that this type of release isn't something we're going to promote in 1.3. Instead, people should write an extension and put the file within that.

Re: [ AddOn ] list_Extensions.php

so then the page is in the database and then, how would you call it so everybody could see it?

Re: [ AddOn ] list_Extensions.php

The page wouldn't be in the database unless you put the code in a hook (like the one in misc.php) rather than a separate file. If you were to do that, you would call it however you would call a normal page. If not, you would have to give the full URL to the file. The idea, as I said, is to keep the extension code and core code separate.

Re: [ AddOn ] list_Extensions.php

So that is than also the case with my simple gallery where i put gallery.php straight in the root of punbb, or is that not what you mean?

Re: [ AddOn ] list_Extensions.php

Yes, you would not be putting files in the root of PunBB. That makes extensions a nightmare to remove. The idea is to make them self-contained entities.

13 (edited by kierownik 2008-02-10 21:17)

Re: [ AddOn ] list_Extensions.php

Aha thanks, then I will change my extension so gallery.php is in the extension/simple_gallery directory.

14

Re: [ AddOn ] list_Extensions.php

Without running kierownik's code to see what it does, or indeed having a working copy of Punbb 1.3 beta around at the moment to check on either smile, shouldn't this functionality be part of the admin interface to 1.3 anyhow?

Just like in Firefox, for example under Tools>Add-Ons you can see what extensions are loaded, shouldn't you be able to see from the standard admin interface to 1.3 what extensions are loaded in PunBB?

Re: [ AddOn ] list_Extensions.php

sirena: It is, this page displays it in a different format though. And to everyone. Including guests.

16

Re: [ AddOn ] list_Extensions.php

Smartys wrote:

sirena: It is, this page displays it in a different format though. And to everyone. Including guests.

Thanks Smartys. That's good to know.

Hmmm. I'm not sure *guests* need to know the list of extensions a 1.3 forum has running, as kierownik's extension does. That might invite trouble.