News:

Looking for a good read? Check out the SimpleDesk Team Blog.

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Ice_Drake1

#1
That did the trick. Thanks.  ;)
#2
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.
#3
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.
#4
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.
#5
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.
#6
In order to encapsulate an external page (e.g. http://ethera.servehttp.com/Coppermine/), I used the following codes as a theme template page, which will be called by SMF:


<?php
// Version: 1.1 RC2; Gallery

function template_main()
{
global $context$settings$options$txt$scripturl;

echo '
<script language="JavaScript" type="text/javascript"><!--
function checkAll(onOff)
{
for (var i = 0; i < document.searchform.elements.length; i++)
{
if (document.searchform.elements[i].name.substr(0, 3) == "brd")
document.searchform.elements[i].checked = onOff;
}
}
// --></script>
<form action="'
$scripturl'?action=search2" method="post" name="searchform" id="searchform">

 <script type="text/javascript"><!--

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don\'t support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

// --></script>

<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
<tr>
<td class="windowbg">'
;

// load the gallery
echo '<iframe id="myframe" src="http://ethera.servehttp.com/Coppermine/" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:novisible; width:100%; display:none"></iframe>';

echo '
</td>
</tr>
</table>
</form>'
;
}

?>



I included the following line somewhere in the external page to load up some variables.


...
include_once($_SERVER['DOCUMENT_ROOT'].'/SSI.php');
...


While this setup gives me no error as an administrator, when using as other users, the notices appear.
#7
"Not entirely integrated" meant that SMF encapsulates the external page to be a part of it although it isn't really a part of it. SMF just load up an external page while the external page loads up nothing related to SMF.
#8
Quote from: clarinet on March 04, 2013, 08:42:29 AM
Well, I could not help myself ... it was not that hard. Edit file ./Sources/sd_source/Subs-SimpleDeskPermissions.php, replace line 364


$user_info['shd_permissions'][$perm] = $depts[$role];


with


if(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];


...


This line raises undefined index errors below for any external pages that is not entirely integrated with SMF.


Notice: Undefined index: access_helpdesk in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_private_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_closed_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_new_ticket in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_edit_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_reply_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_edit_reply_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_attachment in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_post_attachment in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_resolve_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_unresolve_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_logs_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_profile_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_profile_log_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_preferences_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_relationships in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_reply_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_staff in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_private_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_closed_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ip_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_edit_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_reply_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_edit_reply_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_post_proxy in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_monitor_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_singleton_email in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_ignore_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_silent_update in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_resolve_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_unresolve_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_logs_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_alter_urgency_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_alter_privacy_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_assign_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_profile_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_profile_log_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_create_relationships in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_relationships in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_access_recyclebin in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_reply_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_restore_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_restore_reply_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_ticket_to_topic in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_topic_to_ticket in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_move_dept_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Is there something I can do to fix this problem?
#9
I found the source of the problem after finally figuring how to debug for it, but I don't know how to fix it. Any advice?

The problem is in this query found in Subs-SimpleDeskPermissions.php:

// 1. Get all the roles that conceivably apply to this user.
$query = $smcFunc['db_query']('', '
SELECT hdrg.id_role, hdr.template
FROM {db_prefix}helpdesk_role_groups AS hdrg
INNER JOIN {db_prefix}helpdesk_roles AS hdr ON (hdrg.id_role = hdr.id_role)
WHERE hdrg.id_group IN ({array_int:groups})',
array(
'groups' => $user_info['groups'],
)
);

$roles = array();


I did an array dump for $roles:

Array
(
    [0] => Array
        (
            [id_role] => 1
            [template] => 1
        )

    [1] => Array
        (
            [id_role] => 2
            [template] => 2
        )
)


This array is missing the array below:

    [2] => Array
        (
            [id_role] => 5
            [template] => 2
        )


The query is wrong because of the wrong merges.


The array $user_info['groups'] is consists of:

Array
(
    [0] => 24
    [1] => 4
    [2] => 17
)


The contents of helpdesk_role_groups are as follows:

 
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
id_roleid_group
111
112
113
114
116
118
124
214
217
32
315
413
414
511
512
524

The contents of helpdesk_roles are as follows:

 
   
   
   
   
   
   
id_roletemplaterole_name
11Helpdesk Users
22Helpdesk Staff
34Helpdesk Managers
41Workdesk Users
52Workdesk Staff
#10
sigh...I gave a try at the codes, but to no avail. :(

The codes are far too complicated for me. There are way too much arrays and variables to keep track of. I gave up! It would take too much time just to figure where the source of the problem is when I have other bugs to fry for my game.

Please let me know whenever you have some ideas or time of where the problem might be. Thanks!
#11
Yeah, that is why I request a pointer on direction and I might be able to figure out how to fix it on my own as I have fixed issues for other mods already.
#12
I guess it is good news that you guys found the source of the problem...any pointer on where I can look for this bug? Or do I just wait?
#13
Could it be coming from PortaMx 1.45? I did encounter a bug with it back then preventing other users from accessing the front page, so I fixed the code on one of their files to fix it.

From this in PortaMX.php:
if(empty($useFront) || !empty($context['pmx']['show_frontpanel']) || !empty($context['pmx']['show_pagespanel']) || !empty($_GET['pmxerror']))

to:
if(!empty($useFront) || !empty($context['pmx']['show_frontpanel']) || !empty($context['pmx']['show_pagespanel']) || !empty($_GET['pmxerror']))

Also, I manually installed SMFPets 0.3 since it doesn't support newer than SMF 1.1.
#14
Oh, I see...here is a link to a duplicate of my forum without the junks: http://ethera.servehttp.com/temp/SMF/

Administrator Account
Username: admin
Password: password

Test Account
Username: test
Password: test

Please feel free to do whatever on it to investigate the problem.
#15
Quote from: venguard223 on August 12, 2012, 10:15:07 AM
Still need to know more about these groups and the users who have these groups, what groups do they have?

Also, go to the profile of a user in these groups and pull up a list of their permissions in the helpdesk, that will show you what permissions they have access to.

I am not sure what more do you want to know about these groups since it is specified clearly on 3rd visual. For instance, from the visual, Regular Members, Family, Game Designer, Game Developer, Alpha Tester, Game Moderator, Beta Tester, and Graphic Designer makes up Helpdesk Users. Regular Members can view Helpdesk, but only membergroups that are part of two departments can't see Helpdesk. That includes Alpha Testers, Game Designers, Game Developers, and Game Moderators.

Here is a visual list of permissions for Helpdesk of a member named "test" I placed temporary as a Game Designer, which you requested for:


As mentioned before, the permission is based on the default permission of Helpdesk Users.