Author Topic: Auto module detector (V@no something for future installation?)  (Read 9405 times)

0 Members and 1 Guest are viewing this topic.

Offline LJL_Houben

  • Newbie
  • *
  • Posts: 34
    • View Profile
Auto module detector (V@no something for future installation?)
« on: September 25, 2006, 07:09:12 PM »
Hi all

I made an automatic module importer for the admin. If you want to use add in's (modules) you can put them in a directory Modules. All changes are then made automaticaly to the admin menu. I'm currently working on an annotation module that can be used with this extra function.

How to:
Find next code in the admin/index.php file

Code: [Select]
          if (@is_dir("plugins")) {
            show_nav_header("PlugIns");
            $handle = @opendir("plugins/");
            while ($file = @readdir($handle)) {
              if (eregi("^\.{1,2}$", $file) || !eregi("\.php$", $file)) {
                continue;
              }
              $plugin_file = file("./plugins/".$file);
              $plugin_file[0] = trim($plugin_file[0]);
              if (preg_match("/PLUGIN_TITLE:([a-zäöüß0-9\-_ ]+)/i", $plugin_file[0], $regs)) {
                show_nav_option(trim($regs[1]), "./plugins/".$file);
              }
              else {
                show_nav_option($file, "./plugins/".$file);
              }
            }
            @closedir($handle);
          }

After this code instal next code:
Code: [Select]
//
// NEW!!! Module Handler v1.0
//
// Author: Ing. Dipl.Ing. (FH) L.J.L. Houben
// Http://seilbahn.homaris.nl - Image Gallery
//
//

// Directory Listing
$startdir="../Modules/";
    $ignoredDirectory[] = ".";
    $ignoredDirectory[] = "..";
    if (is_dir($startdir)) {
    if ($dh = opendir($startdir)) {
        while (($directoy = readdir($dh)) !== false) {
                if (!(array_search($directoy,$ignoredDirectory) > -1)) {
          if (filetype($startdir . $directoy) == "dir") {
              show_nav_header("Mod ".$directoy);

// Internal functions listing
            $handle = opendir($startdir.$directoy);
if(!is_file("./".$startdir.$directoy."/install.php"))
{
          while ($file = @readdir($handle))
{
            if (eregi("^\.{1,2}$", $file) || !eregi("\.php$", $file))
{
                  continue;
                }
              $plugin_file = file("./".$startdir.$directoy."/".$file);
              $plugin_file[0] = trim($plugin_file[0]);
              if (preg_match("/MODULE_TITLE:([a-zäöüß0-9\-_ ]+)/i", $plugin_file[0], $regs))
{
                show_nav_option(trim($regs[1]), "./".$startdir.$directoy."/".$file);
              }
              else
{
                show_nav_option($file, "./".$startdir.$directoy."/".$file);
              }
            }
}
else
{
              $plugin_file = file("./".$startdir.$directoy."/install.php");
              $plugin_file[0] = trim($plugin_file[0]);
if (preg_match("/MODULE_TITLE:([a-zäöüß0-9\-_ ]+)/i", $plugin_file[0], $regs))
{
                show_nav_option(trim($regs[1]), "./".$startdir.$directoy."/install.php");
              }
              else
{
                show_nav_option($file, "./".$startdir.$directoy."/install.php");
              }
}
            @closedir($handle);
          // End function listing

            }
}
}
}
    closedir($dh);
}

//
// END Module handler
//

That's all.

Now you can make you own modules. Here is a example of a map


C:\4 Images 1.7.3\
  |-  Admin\
  |-  Cache\
  |-  Captcha\
  |-   ........
  |-  Modules\
  |      |-  Example map\               (This is shown in the admin site as a module name/header)
  |      |      |    Annotate.php       (This is shown as a clickable link to the *.php file)
  |      |      |    Install.php            (If this file is present, all others are ignored, so you can make your own installer)
  |      |      |- OwnMap1
  |      |      |- OwnMap2
  |      |-  Example map2\
  |-  Templates




« Last Edit: September 26, 2006, 12:45:20 AM by LJL_Houben »

Offline LJL_Houben

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Auto module detector
« Reply #1 on: September 25, 2006, 07:15:10 PM »
First module for the module handler

Module: Annotation

This is still in a test phase so sorry if it isn't complete ly working yet.

How to:
If you have installed the module handler in the admin/index.php, just copy the files to a map Modules under the rootdirectory


Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: Auto module detector
« Reply #2 on: September 25, 2006, 11:27:09 PM »
i think this is a fine thing. just tryed it out.. i see it is not completed yet(like you already wrote).
anyway, good work.
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline LJL_Houben

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Auto module detector
« Reply #3 on: September 26, 2006, 12:41:52 AM »
Well played again with it.

For Image Magic everything is working fine now. It just has to be configured right. So here's beta v1.1

I'm going to test it myself on GD, but I don't have NetPMB, so could anyone test this for me?

Cheers

Ludo



Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Auto module detector (V@no something for future installation?)
« Reply #4 on: September 26, 2006, 12:49:30 AM »
Isn't it the same thing as the plugins feature that is already build in?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline LJL_Houben

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Auto module detector (V@no something for future installation?)
« Reply #5 on: September 26, 2006, 07:26:09 PM »
Hi vano

Not quite the same. (although I copied from it) The module handler looks for submaps in a Modules folder, that is in the map root directory. It copies the directory name to the admin site as a header like "plugins". Than it looks if a install.php is present in the root of the map.
If present it only shows the "install" feature. After installation the install.php file will be removed and the admin site is reloaded to load the actual functions in the module map.

If the users programm own modules, that can operate with this handler, you don't have to change anything in the main code to get it in the adminsite. Also if there is a new version of the gallery, you can just copy your module folders and all extra options are then also in your new gallery.

Cheers

Ludo

PS first module is ready see also http://www.4homepages.de/forum/index.php?topic=14814.msg79633#msg79633
« Last Edit: September 26, 2006, 08:52:04 PM by LJL_Houben »

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Re: Auto module detector (V@no something for future installation?)
« Reply #6 on: November 01, 2006, 02:03:37 AM »
good to heard this , if anyone [ developer ] could support this idea then all mood will be one in comment.