Membership in multiple departments

Started by clarinet, February 15, 2013, 11:50:24 AM

Previous topic - Next topic

venguard223

You should really have the SSI include right up front. That should be taking care of all the inclusion of SD permissions.

Though if it's a template_main function why are you loading SSI.php exactly? That sort of implies you're doing it through an index.php?action=page type function...

Is it the Coppermine stuff itself throwing it or is it definitely the main page load?

Ice_Drake1

#16
Well, I am not very familiar with SMF modding. I just know that I need to have a SSI include for the following line:


$context['user']['username']


Even though it is preferable to have the include right up front, it doesn't work in a template_main function style.

Furthermore, completely integrating the external pages via index.php?action=page type function requires a lot of modification that is way beyond my current capability.

I don't know how Coppermine is integrated with SMF and whether or not it has the SSI include inside, but it works flawlessly with SMF with absolutely no error. But using the same technique for a different module, which I manually made some code modifications on it, causes notices to appear.

venguard223

So you have a module that you haven't explained, with some changes you haven't explained and sadly I can't help you with that because I'm not a mind reader.

I have absolutely no idea how you've managed to integrate the two because it's using a mash-up of two totally different SMF systems.

I'm sorry, I can't help you with this. Trouble is... I doubt anyone else will be able to either. :(

Ice_Drake1

Well, the module I used is nothing special. It is just a standalone catalog module. I only modified it to better suit my needs since it doesn't have an user system at all. It can basically work on its own without SMF, but I want to allow only certain SMF users to be able to access it and request and borrow items from the catalog system, so throughout the module, I need to use following variable as I mentioned earlier from SMF to verify if the user can request the items and check if the user has requested and borrowed what items:


$context['user']['username']


I basically use a separate database to handle all requests and borrows of the users as well as the details of each items in the catalog. To make it seem to be a part of SMF when it is not, I encapsulate it the same way I did with Coppermine.

So don't give me too much credits of what I am capable of. I am still trying to learn the work of these complicated systems.

These notices also occur for another standalone game engine module called miniNEAB when I use the same variable $context['user']['username'] as username for the game instead of a separate unrelated username. The start game page is loaded in one of the PortaMx script blocks in the manner specified below:


<iframe src="http://ethera.servehttp.com/game/game_load.php" height="200" width="100%" frameborder="0"></iframe>


The notices appear right before the start button.

Even though both modules are handled differently, the only commonality is that I used the SSI include and I use variable $context['user']; thus, I strongly believe that the line 364 changes must be loaded whenever I used the SSI include, because the notices don't appear after but before I use the variable.

venguard223

It's not about giving credit, it's the fact you have one system that manages to ignore both of the standard, accepted and proven-to-work-with-SimpleDesk to integrate something.

Consider it this way: if it works without error when inside SMF but not outside, that would tend to suggest it's not actually SD that's at fault, nor the code changes mentioned above, but with however the bridge to outside is managed.

Ice_Drake1

Oh, I see. Do you have a guide that I can follow to properly handle the bridge then? All I need to access in the external module is the variable $context['user']. I need to know what kind of standard step apart from having a SSI include and the usage of that variable itself I am missing in those modules.

venguard223

I haven't got a guide, sorry.

The standard setup would be to either create a new action, or to start with SSI.php before *anything* else, but your integration is something new and short of examining the code myself, there's not a lot I can do. Unfortunately I have neither the time or inclination to take on such a job right now, sorry.

Ice_Drake1

#22
It seems that you are incorrect about the notices. I created a simple PHP file with the code below and placed it in Coppermine directory:


<?php
require_once('../SSI.php');
?>



Just this code causes the notices to appear and the SSI include alone is causing the problems; thus, your earlier observation is invalid. I did a search of all the files in Coppermine directory. It doesn't even once bring up the SSI include. It must be using a different method to integrate with SMF apart from using SSI include, which explain why the notices didn't appear for Coppermine.

Thus, the code change for line 364 is raising the issue. Again, the notices seem to appear for all registered users except the administrator.

venguard223

I still can't reproduce it but there is no harm in changing the suggested patch to:

if (isset($user_info['shd_permissions'][$perm]) && is_array($user_info['shd_permissions'][$perm]))
$user_info['shd_permissions'][$perm] = array_merge($user_info['shd_permissions'][$perm], $depts[$role]);
else
$user_info['shd_permissions'][$perm] = $depts[$role];


But it's been over two years since I wrote the code originally, I don't remember how most of it works any more. (Yes, I am SD's original developer.)

Ice_Drake1


Flavio93Zena

Quote from: venguard223 on July 03, 2013, 08:50:39 PM
I still can't reproduce it but there is no harm in changing the suggested patch to:

if (isset($user_info['shd_permissions'][$perm]) && is_array($user_info['shd_permissions'][$perm]))
$user_info['shd_permissions'][$perm] = array_merge($user_info['shd_permissions'][$perm], $depts[$role]);
else
$user_info['shd_permissions'][$perm] = $depts[$role];


But it's been over two years since I wrote the code originally, I don't remember how most of it works any more. (Yes, I am SD's original developer.)
YAY :D had the same problem here, put that into the original code and I became really happy when I saw the results :D thanks even if very late, just thanks!