Dangerous Minds
Main Menu
Help Support This Site
Site Sections
Sponsors
Please click
MDPro-Module-Gallery Hacking

Hacking Gallery From scratch


There are a few reasons I am documenting these steps. We have hopes that the Gallery people will start supporting Embedded MDPro support to run gallery as a full working theme capable module. As new versions come out you can hack your own copy and share it with us so we do not have to take on all the work. You can see what we have done and find ways to improve our hack.

Be sure to review our How-To Read our How-To's before you begin this. It will explain some of our syntax standards to you.

Notes...
  • You may want to download and view our current mdGallery code for reference.
  • Some items we ask you to search for text and then tell you to repeat the step in many files. The line numbers may or may not be specified but the steps are pretty much the same. So you should have no trouble finding the right place to modify.
  • All hacks are tagged with [D$M] so that we can track them easier later if needed.
  • Some lines that we list for you to insert are word-wrapped so watch out for that.

The below directions are based on Gallery Version 1.5
  1. Download Gallery as a normal program from the gallery site.
  2. Follow the "Gallery Install" steps above and stop when you get to the "Getting the Theme Working" section then come back here.
  3. In the Gallery folder we will edit the following files and make the following changes.. Be aware that all changes should be tagged in the beginning with "
    [D$M]: Changed to allow full theme support in MD-Pro/PostNuke" and at the end with "
    [D$M]: End Hack". You can see our module for examples of this.
    • config.php
      • Good chance that the below code will be lost if you ever save the config from the wizard so be ready for that. Place this BELOW the line #47 that sets: "$gallery->app->skinname"
        global $GALLERY_EMBEDDED_INSIDE_TYPE;
        If($GALLERY_EMBEDDED_INSIDE_TYPE=="PostNuke") {
        $gallery->app->skinname = pnUserGetTheme();
        }
    • util.php
      • On line 1237 replace
        if (!$skinname && isset($gallery->app) && isset($gallery->app->skinname) && !$GALLERY_EMBEDDED_INSIDE) {
        With...
        global $GALLERY_EMBEDDED_INSIDE_TYPE;
        if (!$skinname && isset($gallery->app) && isset($gallery->app->skinname) && (!$GALLERY_EMBEDDED_INSIDE OR $GALLERY_EMBEDDED_INSIDE_TYPE=='MD-Pro' OR $GALLERY_EMBEDDED_INSIDE_TYPE=='PostNuke')) {
    • html_wrap/gallery.header.default
      • On line 27 (just above the "?>" and below the "if lineincludeTemplate" line.) insert
        global $GALLERY_EMBEDDED_INSIDE_TYPE, $modname;
        if ($GALLERY_EMBEDDED_INSIDE_TYPE=='MD-Pro' OR $GALLERY_EMBEDDED_INSIDE_TYPE=='PostNuke') {
        Print('<style><!-- @import url(modules/'.$modname.'/skins/'.$skinname.'/css/embedded_style.css); --></style>');
        Print('<div class="mdGallery">');
        }
      • In the first "<table" area below change the width from "100%" to "99%". (This fixes the right border not showing up)
      • Repeat this for the following files in the "html_wrap" folder: album.header.default, photo.header.default, search.header.default, slideshow.header.default, stats.header.default
    • html_wrap/gallery.footer.default
      • On line 61 (place just below the "<?php" at the bottom) insert
        global $GALLERY_EMBEDDED_INSIDE_TYPE;
        if ($GALLERY_EMBEDDED_INSIDE_TYPE=='MD-Pro' OR $GALLERY_EMBEDDED_INSIDE_TYPE=='PostNuke') {
        Print('</div>');
        }
      • Repeat this for the following files in the "html_wrap" folder: album.footer.default, photo.footer.default, search.footer.default, slideshow.footer.default, stats.footer.default
  4. The following Hacks are for MD-Pro only.
    • lang.php
      • On line 110 (under the "break;")insert
        case 'MD-Pro':
        if (isset($_SESSION['PNSVlang'])) {
        $envLang = $_SESSION['PNSVlang'];
        }
        break;
    • url.php
      • On line 50 (under the "case 'PostNuke':" add
        case 'MD-Pro':
    • ml_pulldown.inc
      • On line 72 insert
        elseif ($GALLERY_EMBEDDED_INSIDE_TYPE == 'MD-Pro') {
        /* MD-Pro */
        if (! isset($nls['MD-Pro'][$value])) continue;
        $new_lang=$nls['MD-Pro'][$value];
        }
    • init.php
      • On line 197 take that entire PostNuke section through the "break;" line and copy it and change 'PostNuke' to 'MD-Pro'.
    • wrapper.footer.default
      • On line 11 add
        case 'MD-Pro':
    • wrapper.header.default
      • On line 13 replace
        ($GALLERY_EMBEDDED_INSIDE_TYPE == 'PostNuke' && !defined("LOADED_AS_MODULE")) ||
        With...
        (($GALLERY_EMBEDDED_INSIDE_TYPE == 'PostNuke' OR $GALLERY_EMBEDDED_INSIDE_TYPE == 'MD-Pro') && !defined("LOADED_AS_MODULE")) ||
      • On Line 26 under the "PostNuke" insert
        case 'MD-Pro':
  5. Fix the security bug
    • Edit gallery/classes/!PostNuke0.7.1/User.php
    • On line 27 add ", $modname" so it will look like...
      • global $name, $modname; /* Gallery PN module name */
    • oN line 60 change "$name" to "$modname" so it will look like....
      • $this->isAdmin = (pnSecAuthAction(0, "$modname::", '::', ACCESS_ADMIN));
  6. Now Initialize gallery in MDPro and Activate it. (More details on that in the other docs)
  7. Now all that leaves is modifying the .css files and setting up a skin folder. That is all covered in the other docs.

Last edited on May 31, 2005. Recent Changes | Find Page | | LikePages

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2002 by me
This web site was made with MD-Pro, a web portal system written in PHP. MD-Pro is Free Software released under the GNU/GPL license.
You can syndicate our news using the file backend.php

Powered by MD-Pro