Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
SMF low level bridge for PN.8
  • Posted: 05.10.2007, 06:42
     
    rank:
    Softmore Softmore
    registered:
     February 2005
    Status:
    offline
    last visit:
    26.07.08
    Posts:
    61
    Hello

    On the Daimonin test site http://static.88-198…ents.your-server.de i have installed my new low level bridge for SMF which i call a DB/Session-Hook - because it don't integrates SMF into PostNuke but syncronizing the DB and sessions.

    You can download the needed files here: *I removed the zip file, please use the code posts at the bottom *

    I had written a also included readme - which i now post:

    PostNuke SMF DB/Session-Hook 0.1

    Warning: TESTING VERSION ONLY - DON'T INSTALL ON A LIVE OR PRODUCTION SITE
    USE A TEST INSTALLATION OR BACKUP FIRST
    THIS MAY EXPLODE YOUR COMPUTER AND DESTROY THE UNIVERSE
    Your are warned

    Warning: This is only tested with PostNuke .8 RC1 and SMF 1.1.4

    What it does
    ------------

    This DB/Session-Hook is very special kind of bridge which will fully integrate
    SMF under PostNuke 0.8 on Session and Database (user) level but NOT
    on the higher level functions like theme engine, cache or module
    handling.

    That means SMF is NOT integrated in PostNuke - its remote controlled on
    user, DB and session level. If you are logged in PostNuke, then you will
    be also loged in SMF. You can't login on the SMF site, you don't have
    even there valid passwords. If you register in PostNuke you will automatically
    added to smf when you access it.

    There are 3 interfaces for avatars, email and profile settings which allow
    to set that on PostNuke site. The interfaces for that on SMF side are closed.

    SMF will be under full "remote control" of PostNuke but don't know it.
    For that, SMF will always "overtake" the PostNuke session and automatically
    login the user, even adding the user to the SMF DB when needed and sync the
    session and DB.

    The advantages:

    - SMF use their own caching and template system
    - Fully and total user & session sync.
    - both have still their own DB
    - one login, one logout, one registration
    - no URL fixing, no output fixing
    - the fastest way to connect both without touching their DB
    - NO changes to PostNuke except a changed entry file setting
    - only a few changes in SMF code to close interfaces and redirect
    - all extensions for SMF should work
    - very secure because SMF isn't callable direct without PostNuke

    The disadvantages:
    - SMF use their own caching & template - no integration possible on that level
    - harder to install as a normal bridge but then nearly flawless

    How to install
    --------------

    BE WARNED! This is not a normal bridge installation. It use a few tricks to speed things
    up and give PostNuke & SMF the impression they are not connected. In fact they don't notice
    each other. Both have still their DB entries unchanged, both have still an own session just
    synchron with the same user.

    For the session thingy we must ensure that PostNuke and SMF think they are installed on the same
    root. To avoid the installation of SMF folder over the PostNuke folder, we have to do a small
    trick, calling PostNuke not by their default index.php but through a different file.

    The index.php is a hook part - that file will call postnukes login procedure, setup the user and
    then calling SMF, which is in a different root (directory). There it is including the original
    SMF index.php and starting the forum normally, just sneaking in at one point the PostNuke user.

    Step-by-Step
    ------------

    ANOTHER WARNING: please use exactly the names and directory names i give here because in the
    current version most things are hard coded in the hook.

    1.) install PostNuke .8 where you want with DB name you want (for example pntest). Create the "admin" user
    2.) install SMF INSIDE the directory where you installed PostNuke in the directory /smf.
    NOTE: Create the admin user in SMF with SAME name and password as in PostNuke!
    3.) IMPORTANT: use the same database name as for PostNuke (for example pntest)
    4.) you can change the DB prefix to what you want, just be sure its not the same as for PostNuke

    At this point you have 2 not connected installations - PostNuke and SMF. Now we connect them.

    5.) find the original index.php in the PostNuke root and COPY it
    6.) name the copy pn.php and copy it next to the index.php
    7.) Login as admin to PostNuke and go to admin area. Go there to System/Settings
    8.) find the colum "Start Page Settings" and there the entry "Site entry point (Default: index.php)"
    9.) change the entry there from index.php to pn.php and safe. Test PostNuke - it should now be called through pn.php

    At this point we still have nothing really changed - that was the basic setup and we still have 2 not connected installs.
    Now we start to apply changes.

    10.) copy the index.php and pnsmf.php from the hook zip into the PostNuke root directory. The PostNuke index.php should be overwritten by that
    11.) Now you have 2 choices:
    11a.) copy the pnsmf.diff and apply it! That should work with other SMF as 1.1.4 perhaps too - test it.
    11b.) use the files from the smf1.1.4.changes.zip and copy them over the SMF files in your /smf folder - BEWARE: it must be 1.1.4 unchanged!
    12.) go into your /smf folder and find the file Settings.php
    13.) find the line "$boardurl = ..." which should show like "$boardurl = 'http:///smf'" or something
    14.) change that line to "$boardurl = 'http://'" so it points to the PostNuke root
    15.) Done!

    Now test it.

    http:// should show your PostNuke site.
    http:///pn.php should also show your PostNuke site
    http:///index.php should show your SMF Forum

    Now login or register a new user in PostNuke and go to your SMF forum. You should be loged in automatically now,
    as you it should be done from a bridge too.

    The Hook comes with 3 functions to copy every profile change done in PostNuke to SMF.
    That works on my example site but because the current PostNuke .8 is a RC and under
    heavy development i don't give examples where to add it now. But the functions
    are pretty self explaining, look into the pnsmf.php.

    -----------------------------------------------------------

    Well, thats how to install it - again you can visit it on the link at the top of this thread.

    I have fully added the SMF profile settings and avatar to the PostNuke ones.
    I used for that the Avatar module and a modified Profile standard module, using
    the hooks in pnsmf.php.

    ATM it works flawless - but i am not a very experienced SMF or PostNuke developer.
    I have posted this text to both dev forums - PostNuke and SMF.

    The other thread is here: http://www.simplemachines.org/community/index.php?topic=198703.0

    If there are interest or when you have questions, please let me know.
    I also very interested that some smf and PostNuke gurus give the code a look
    to see what can be done better.

    One problem is that we have ONE $_SESSION array - SMF is storing some into it.
    It seems not to make any bad problems but i would like to be sure.

    The great, great big advantage of this kind of special bridge is not only the
    speed but also that is nearly 100% compatible. As you can see i installed on the
    demo site SEO4SMF. There was no problems or side effects to install it.

    Except i had to copy the bridge index.php and name the copy seo4smf-redirect.php,
    calling the real seo4smf-redirect.php into the /smf directory. But thats how
    it should work. And it works as you can see.

    The great thing is, that the SMF forum is really closed to outside. You can't
    call it direct through the /smf/index.php without using a bridge entry from
    above. Thats important to avoid attacks targeting the SMF/Postnuke DB sync.

    Well, i like to hear what you people think - ATM i want use this on my own,
    but when i get enough response i will make a real package.

    On the SMF side, you can see the autologin function inside the pnsmf.php file.
    The code patches are in the pnsmf.diff - as you can see its only the hook
    into the index.php to login/logout the PostNuke users and some redirect and
    returns to close interfaces we have now on PostNuke side.

    The PostNuke code is small as it can be, using the unchanged startup interface:

    Code

    include 'includes/pnAPI.php';
    include 'pnsmf.php';

    pnInit(PN_CORE_ALL & ~(PN_CORE_AJAX|PN_CORE_LANGS|PN_CORE_MODS|PN_CORE_TOOLS|PN_CORE_DECODEURLS|PN_CORE_THEME));

    // we store the user data in a neutral variable for moving it to SMF
    $pnuser = pnUserGetVars(pnUserGetVar('uid'));

    // hook into SMF
    define('PNSMFEXT', 1);
    require_once('smf/index.php');


    cu
    MT



    edited by: michtoen, Oct 05, 2007 - 07:49 AM
  • Posted: 05.10.2007, 07:28
     
    rank:
    Softmore Softmore
    registered:
     February 2005
    Status:
    offline
    last visit:
    26.07.08
    Posts:
    61
    smf don't liked the zip file - so i removed it.

    I post the content of the index.php & pnsmf.php file as described above and
    the diff which patches SMF.

    Sorry, its some line of code but i really don't make from the testing code
    a upload packages for SMF just because they fear about their licence.

    index.php:

    Code

    <?php
    include 'includes/pnAPI.php';
    include 'pnsmf.php';

    pnInit(PN_CORE_ALL & ~(PN_CORE_AJAX|PN_CORE_LANGS|PN_CORE_MODS|PN_CORE_TOOLS|PN_CORE_DECODEURLS|PN_CORE_THEME));

    $pnuser = pnUserGetVars(pnUserGetVar('uid'));

    // hook into SMF
    define('PNSMFEXT', 1);
    require_once('smf/index.php');

    ?>


    pnsmf.php - PART 1:

    Code

    <?php

    if (eregi('pnsmf.php', $_SERVER['PHP_SELF'])) {
        die ('You can\'t access this file directly...');
    }

    function SetSMFAvatar($avatarurl)
    {
            $dbconn =& pnDBGetConn(true);
            $pntable =& pnDBGetTables();
        $sdl = "UPDATE smf_members SET avatar='".$avatarurl."' WHERE memberName = '".pnUserGetVar('uname')."'";
        $dbconn->Execute($sdl);
    }

    // direct hook for email setting modules
    function SetSMFEmail($email)
    {
            $dbconn =& pnDBGetConn(true);
            $pntable =& pnDBGetTables();
        $sdl = "UPDATE smf_members SET emailAddress='".$email."' WHERE memberName = '".pnUserGetVar('uname')."'";
        $dbconn->Execute($sdl);
    }

    // main profile setting hook
    // on default we hide the email in SMF. Change the hideEmail to 0 to show emails in SMF
    function SetSMFProfile($pnuser)
    {
            $items = pnModAPIFunc('Profile', 'user', 'getallactive');

        $realName='';
        $webtitle='';
        $weburl='';
        $bdate='';
        $avatar='';
        $location='';
        $signature='';
        $aim='';
        $icq='';
        $yim='';
        $msn='';

        $email = pnUserGetVar('email');
        if(isset($pnuser['_UREALNAME']))
            $realName = $pnuser['_UREALNAME'];
        if(isset($pnuser['_WEBTITLE']))
            $webtitle = $pnuser['_WEBTITLE'];
        if(isset($pnuser['_YOURHOMEPAGE']))
            $weburl = $pnuser['_YOURHOMEPAGE'];

        if(isset($pnuser['_YOURAVATAR']))
        {
            $avatar = $pnuser['_YOURAVATAR'];
            $avatar = pnGetBaseUrl() .'/'. pnModGetVar('Avatar', 'avatardir') .'/'.$avatar;
        }

        // SMF wants both set
        if($weburl=="" || $webtitle=="")
        {
            $webtitle="";
            $weburl="";
        }
             
        if(isset($pnuser['_YLOCATION']))
            $location = $pnuser['_YLOCATION'];
        if(isset($pnuser['_SIGNATURE']))
            $signature = $pnuser['_SIGNATURE'];
        if(isset($pnuser['_YAIM']))
            $aim = $pnuser['_YAIM'];
        if(isset($pnuser['_YICQ']))
            $icq = $pnuser['_YICQ'];
        if(isset($pnuser['_YYIM']))
            $yim = $pnuser['_YYIM'];
        if(isset($pnuser['_YMSNM']))
            $msn = $pnuser['_YMSNM'];

        // with the default PN profile system, a drop down table is stored as text
        $gender = 0;
        if(isset($pnuser['_GENDER']))
        {
            $gender = $pnuser['_GENDER'];
            if(!strcmp($gender, "male"))
                $gender = 1;
            else if(!strcmp($gender, "female"))
                $gender = 2;
            else
                $gender = 0;
        }

        if(isset($pnuser['_BIRTHDATE']))
        {
            $bdate = $pnuser['_BIRTHDATE'];
            // oh well, different formats... strptime() is php 5+
            $first = strpos($bdate, '-');
            $last = strrpos($bdate, '-');
            $bdate = sprintf('%04d-%02d-%02d',substr($bdate, 0, $first),substr($bdate, $first + 1, $last - $first - 1 ),substr($bdate, $last + 1));
        }
        $dbconn =& pnDBGetConn(true);
            $pntable =& pnDBGetTables();
        $sdl = "UPDATE smf_members SET hideEmail=1, emailAddress='".$email."', avatar='".$avatar."', gender='".$gender."',location='".$location."',signature='".$signature."', MSN='".$msn."',AIM='".$aim."',YIM='".$yim."',ICQ='".$icq."', websiteTitle='".$webtitle."',websiteURL='".$weburl."', realName='".$realName."',birthdate='".$bdate."' WHERE memberName = '".pnUserGetVar('uname')."'";
        $dbconn->Execute($sdl);
    }




    edited by: michtoen, Oct 05, 2007 - 08:06 AM
  • Posted: 05.10.2007, 12:57
     
    rank:
    Softmore Softmore
    registered:
     February 2005
    Status:
    offline
    last visit:
    26.07.08
    Posts:
    61
    And pnsmf.php PART 2:

    Code

    function AutoRegisterExt($pnuser)
    {
        // Set the options needed for registration.
        $regOptions = array(
            'interface' => 'postnuke',
            'username' => $pnuser['uname'],
            'email' => $pnuser['email'],
            'password' => $pnuser['pass'], // SMF wants a unique password
            'password_check' => $pnuser['pass'],
            'check_reserved_name' => true,
            'check_password_strength' => true,
            'check_email_ban' => true,
            'send_welcome_email' => '', // ?
            'require' => 'nothing',
            'extra_register_vars' => array(),
            'theme_vars' => array(),
        );
        // register our pn user
        $memberID = registerMember($regOptions);
        // and copy over the profile data
        SetSMFProfile($pnuser);
    }

    function AutoLoginExt($pnuser)
    {
        global $txt, $db_prefix, $scripturl, $user_info, $user_settings;
        global $cookiename, $maintenance, $ID_MEMBER, $modSettings, $context, $sc;
        global $sourcedir;

        // Load cookie authentication stuff.
        require_once($sourcedir . '/Subs-Auth.php');


        // Set up the default/fallback stuff.
        $context['default_username'] = isset($_REQUEST['user']) ? htmlspecialchars(stripslashes($_REQUEST['user'])) : '';
        $context['default_password'] = '';
        $context['never_expire'] = $modSettings['cookieTime'] == 525600 || $modSettings['cookieTime'] == 3153600;
        $context['login_error'] = &$txt[106];
        $context['page_title'] = $txt[34];

        $autoname = $pnuser['uname'];
        // Load the data up!
        $request = db_query("
            SELECT passwd, ID_MEMBER, ID_GROUP, lngfile, is_activated, emailAddress, additionalGroups, memberName, passwordSalt
            FROM {$db_prefix}members
            WHERE memberName = '$autoname'
            LIMIT 1"
    , __file__, __line__);
        // Probably mistyped or their email, try it as an email address. (memberName first, though!)
        if (mysql_num_rows($request) == 0)
        {
            mysql_free_result($request);
           
            // This must be the first visit - lets insert the PN user
            require_once($sourcedir . '/Subs-Members.php');
            AutoRegisterExt($pnuser);

            // Load the data up again!
            $request = db_query("
                SELECT passwd, ID_MEMBER, ID_GROUP, lngfile, is_activated, emailAddress, additionalGroups, memberName, passwordSalt
                FROM {$db_prefix}members
                WHERE memberName = '$autoname'
                LIMIT 1"
    , __file__, __line__);
               
            // Sanity check: This should not happen because we just added the user to the DB
            // lets adds here later a admin notice later and handle the user as guest
            if (mysql_num_rows($request) == 0)
            {
                mysql_free_result($request);
                return;
            }
        }

        $user_settings = mysql_fetch_assoc($request);
        mysql_free_result($request);


        if ($usser_settings['passwordSalt'] == '')
        {
            $user_settings['passwordSalt'] = substr(md5(rand()), 0, 4);
            updateMemberData($user_settings['ID_MEMBER'], array('passwordSalt' => '\'' . $user_settings['passwordSalt'] . '\''));
        }

        // Get ready to set the cookie...
        $username = $user_settings['memberName'];
        $ID_MEMBER = $user_settings['ID_MEMBER'];

        // Bam!  Cookie set.  A session too, just incase.
        setLoginCookie(60 * $modSettings['cookieTime'], $user_settings['ID_MEMBER'], sha1($user_settings['passwd'] . $user_settings['passwordSalt']));

        $user_info['is_guest'] = false;
        $user_settings['additionalGroups'] = explode(',', $user_settings['additionalGroups']);
        $user_info['is_admin'] = $user_settings['ID_GROUP'] == 1 || in_array(1, $user_settings['additionalGroups']);

        // Are you banned?
        is_not_banned(true);

        // You've logged in, haven't you?
        updateMemberData($ID_MEMBER, array('lastLogin' => time(), 'memberIP' => '\'' . $user_info['ip'] . '\'', 'memberIP2' => '\'' . $_SERVER['BAN_CHECK_IP'] . '\''));

        // Get rid of the online entry for that old guest....
        db_query("
            DELETE FROM {$db_prefix}log_online
            WHERE session = 'ip$user_info[ip]'
            LIMIT 1"
    , __file__, __line__);
        $_SESSION['log_time'] = 0;
    }

    ?>




    edited by: michtoen, Oct 05, 2007 - 08:01 AM
  • Posted: 05.10.2007, 13:03
     
    rank:
    Softmore Softmore
    registered:
     February 2005
    Status:
    offline
    last visit:
    26.07.08
    Posts:
    61
    And here is the diff - copy it to the /smf root and patch it with -p1:

    Code

    diff -Naur old\index.php new\index.php
    --- old\index.php   Tue Sep 25 19:27:08 2007
    +++ new\index.php   Thu Oct 04 05:56:43 2007
    @@ -34,6 +34,11 @@
        with the URL index.php?action=action-in-url.  Relatively simple, no?
     */
     
    +// PN-SESSION-HOOK - START
    +if (!defined('PNSMFEXT'))
    +   die('Hacking attempt...');
    +// PN-SESSION-HOOK - END
    +
     $forum_version = 'SMF 1.1.4';
     
     // Get everything started up...
    @@ -142,6 +147,66 @@
     
        // Load the user's cookie (or set as guest) and load their settings.
        loadUserSettings();
    +
    +   // PN-SESSION-HOOK - START
    +
    +   // lets do some sanity checks to avoid pages and actions we don't want show
    +   if (isset($_REQUEST['action']))
    +   {
    +       if ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'login')
    +           header("Location: http://".$_SERVER['SERVER_NAME']."/pn.php?module=Users&func=loginscreen");
    +       if ($_REQUEST['action'] == 'register')
    +           header("Location: http://".$_SERVER['SERVER_NAME']."/pn.php?module=Users&func=register");
    +   }
    +
    +   // now lets do the autologin
    +   global $pnuser;
    +   if($user_info['username'] != $pnuser['uname'])
    +   {
    +       if($pnuser['uid'] > 0) // PN user is valid
    +       {
    +           AutoLoginExt($pnuser); // login user - add to DB when needed
    +           loadUserSettings(); // reload user data for control
    +
    +           // should be the same now - if not we force a SMF logout
    +           if($user_info['username'] != $pnuser['uname'])
    +           {              
    +               // 2 different user?
    +               if(!$user_info['is_guest']) // how? 2 user, one computer for example
    +               {
    +                   require_once($sourcedir . '/LogInOut.php');
    +                   Logout(true);
    +                   loadUserSettings();
    +
    +                   if(!$user_info['is_guest']) // sanity check
    +                   {
    +                       // pure sanity check: is this ever happens we have to check the code
    +                       echo "SMF guest mode failed! Contact the Admins.";
    +                       exit();
    +                   }
    +               }
    +               else // PN user is active, SMF is guest
    +               {
    +                   // add redirect here when we want disallow this
    +                   // this is NOT a bug - user can be banned in SMF
    +               }
    +           }
    +       }
    +       // PN is guest but old SMF is loged - not good
    +       else if(!$user_info['is_guest'])
    +       {
    +           require_once($sourcedir . '/LogInOut.php');
    +           Logout(true);
    +           loadUserSettings(); // SMF should now in guest mode
    +
    +           if(!$user_info['is_guest']) // sanity check
    +           {
    +               echo "SMF guest mode failed! Contact the Admins.";
    +               exit();
    +           }
    +       }
    +   }
    +   // PN-SESSION-HOOK - END
     
        // Load the current board's information.
        loadBoard();
    diff -Naur old\Sources\LogInOut.php new\Sources\LogInOut.php
    --- old\Sources\LogInOut.php    Tue Sep 25 19:27:34 2007
    +++ new\Sources\LogInOut.php    Thu Sep 27 21:09:05 2007
    @@ -459,6 +459,7 @@
     
        // Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
        setLoginCookie(-3600, 0);
    +return; // PN-SESSION-HOOK
     
        // Off to the merry board index we go!
        if (empty($_SESSION['logout_url']))
    diff -Naur old\Sources\Profile.php new\Sources\Profile.php
    --- old\Sources\Profile.php Tue Sep 25 19:27:36 2007
    +++ new\Sources\Profile.php Thu Oct 04 01:11:02 2007
    @@ -126,12 +126,12 @@
            'trackUser' => array(array('moderate_forum'), array('moderate_forum')),
            'trackIP' => array(array('moderate_forum'), array('moderate_forum')),
            'showPermissions' => array(array('manage_permissions'), array('manage_permissions')),
    -       'account' => array(array('manage_membergroups', 'profile_identity_any', 'profile_identity_own'), array('manage_membergroups', 'profile_identity_any')),
    -       'forumProfile' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any')),
    +// PN-SESSION-HOOK     'account' => array(array('manage_membergroups', 'profile_identity_any', 'profile_identity_own'), array('manage_membergroups', 'profile_identity_any')),
    +// PN-SESSION-HOOK     'forumProfile' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any')),
            'theme' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any')),
            'notification' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any')),
    -       'pmprefs' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any')),
    -       'deleteAccount' => array(array('profile_remove_any', 'profile_remove_own'), array('profile_remove_any')),
    +// PN-SESSION-HOOK     'pmprefs' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any')),
    +// PN-SESSION-HOOK     'deleteAccount' => array(array('profile_remove_any', 'profile_remove_own'), array('profile_remove_any')),
        );
     
        // Set the profile layer to be displayed.
    @@ -345,13 +345,13 @@
        */
     
        $sa_allowed = array(
    -       'account' => array(array('manage_membergroups', 'profile_identity_any', 'profile_identity_own'), array('manage_membergroups', 'profile_identity_any'), 'post', true),
    -       'forumProfile' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'),
    +// PN-SESSION-HOOK     'account' => array(array('manage_membergroups', 'profile_identity_any', 'profile_identity_own'), array('manage_membergroups', 'profile_identity_any'), 'post', true),
    +// PN-SESSION-HOOK     'forumProfile' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'),
            'theme' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'),
            'notification' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'),
    -       'pmprefs' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'),
    -       'deleteAccount' => array(array('profile_remove_any', 'profile_remove_own'), array('profile_remove_any'), 'post', true),
    -       'activateAccount' => array(array(), array('moderate_forum'), 'get'),
    +// PN-SESSION-HOOK     'pmprefs' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'),
    +// PN-SESSION-HOOK     'deleteAccount' => array(array('profile_remove_any', 'profile_remove_own'), array('profile_remove_any'), 'post', true),
    +// PN-SESSION-HOOK     'activateAccount' => array(array(), array('moderate_forum'), 'get'),
        );
     
        // Is the current sub-action allowed?
    @@ -1026,6 +1026,7 @@
     {
        global $modSettings, $sourcedir, $db_prefix;
     
    +return; // PN-SESSION-HOOK
        if (!isset($_POST['avatar_choice']) || empty($memID))
            return;
     
    diff -Naur old\Sources\Subs-Auth.php new\Sources\Subs-Auth.php
    --- old\Sources\Subs-Auth.php   Tue Sep 25 19:27:38 2007
    +++ new\Sources\Subs-Auth.php   Thu Sep 27 21:09:34 2007
    @@ -164,6 +164,7 @@
        }
     
        $_COOKIE[$cookiename] = $data;
    +return; // PN-SESSION-HOOK
     
        // Make sure the user logs in with a new session ID.
        if (!isset($_SESSION['login_' . $cookiename]) || $_SESSION['login_' . $cookiename] !== $data)
    diff -Naur old\Themes\default\BoardIndex.template.php new\Themes\default\BoardIndex.template.php
    --- old\Themes\default\BoardIndex.template.php  Tue Sep 25 19:27:42 2007
    +++ new\Themes\default\BoardIndex.template.php  Thu Oct 04 05:56:43 2007
    @@ -420,7 +420,7 @@
        }
     
        // Show the login bar. (it's only true if they are logged out anyway.)
    -   if ($context['show_login_bar'])
    +   if ($context['show_login_barX'])
        {
            echo '
                    <tr>
    diff -Naur old\Themes\default\index.template.php new\Themes\default\index.template.php
    --- old\Themes\default\index.template.php   Tue Sep 25 19:27:44 2007
    +++ new\Themes\default\index.template.php   Thu Oct 04 05:56:43 2007
    @@ -270,25 +270,6 @@
            echo '              </span>';
        }
        // Otherwise they're a guest - this time ask them to either register or login - lazy bums...
    -   else
    -   {
    -       echo '              </span>
    -                              
    -
    -                               <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" class="middletext" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
    -                                   <input type="text" name="user" size="10" /> <input type="password" name="passwrd" size="10" />
    -                                   <select name="cookielength">
    -                                       <option value="60">', $txt['smf53'], '</option>
    -                                       <option value="1440">', $txt['smf47'], '</option>
    -                                       <option value="10080">', $txt['smf48'], '</option>
    -                                       <option value="43200">', $txt['smf49'], '</option>
    -                                       <option value="-1" selected="selected">', $txt['smf50'], '</option>
    -                                   </select>
    -                                   <input type="submit" value="', $txt[34], '" />
    -                                   <span class="middletext">', $txt['smf52'], '</span>
    -                                   <input type="hidden" name="hash_passwrd" value="" />
    -                               </form>';
    -   }
     
        echo '
                                </td>
    @@ -514,12 +495,18 @@
                    <tr>
                        <td class="maintab_' , $first , '"> </td>';
     
    +       $serv = $_SERVER['SERVER_NAME'];
        // Show the [home] button.
        echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
                    <td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
    -                   <a href="', $scripturl, '">' , $txt[103] , '</a>
    +                   <a href="http://'.$serv.'/pn.php">' , $txt[103] , '</a>
                    </td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
     
    +   echo ($current_action=='forums' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
    +               <td valign="top" class="maintab_' , $current_action == 'forums' ? 'active_back' : 'back' , '">
    +                   <a href="http://'.$serv.'/Daimonin-Forums.html"> Forums </a>
    +               </td>' , $current_action == 'forums' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
    +
        // Show the [help] button.
        echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
                    <td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
    @@ -573,7 +560,7 @@
        if ($context['user']['is_guest'])
            echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
                    <td valign="top" class="maintab_' , $current_action == 'login' ? 'active_back' : 'back' , '">
    -                   <a href="', $scripturl, '?action=login">' , $txt[34] , '</a>
    +                   <a href="http://'.$serv.'/pn.php?module=Users&func=loginscreen">' , $txt[34] , '</a>
                    </td>' , $current_action == 'login' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
     
     
    @@ -581,7 +568,7 @@
        if ($context['user']['is_guest'])
            echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
                    <td valign="top" class="maintab_' , $current_action == 'register' ? 'active_back' : 'back' , '">
    -                   <a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
    +                   <a href="http://'.$serv.'/pn.php?module=Users&func=register">' , $txt[97] , '</a>
                    </td>' , $current_action == 'register' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
     
     
    @@ -589,7 +576,7 @@
        if ($context['user']['is_logged'])
            echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
                    <td valign="top" class="maintab_' , $current_action == 'logout' ? 'active_back' : 'back' , '">
    -                   <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
    +                   <a href="http://'.$serv.'/pn.php?module=Users&func=logout">' , $txt[108] , '</a>
                    </td>' , $current_action == 'logout' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
     
        // The end of tab section.




    edited by: michtoen, Oct 05, 2007 - 08:05 AM
  • Posted