Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
wiz
Involved
Involved



Joined: Oct 09, 2006
Posts: 413
Location: UK

PostPosted: Mon Jun 18, 2007 9:33 pm Reply with quote

Not sure where this goes, but 'general' seems good enough.

Now this may seem stupid, but in admin.php we have 2 areas, Administration and Modules Administration.

What decides where the link goes,because some modules with there own admin appear in the Admin part and not the Mod Admin, is that just bad writing of code?

The reason i ask is. We know that from the Admin setup we can grant access to all or individual parts of the Modules admin.
Well, we have a custom admin section that doesnt go into the Nuke admin by default, so i would like to add it to the the Modules Admin, and grant 1 specific person a login just for that.

Therefore my Q is...
If i want to make the link visible in Modules admin, what file do i edit? and if each module has its own file for making the link, can you suggest a simple stock one i can copy to change the link to the actual page.

Hope that all makes sense
Cheers
WIZ
 
View user's profile Send private message Visit poster's website AIM Address
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Tue Jun 19, 2007 8:00 am Reply with quote

A module that uses the Modules Administration section has the following admin files
modules/YOUR_MODULE/admin/case.php
modules/YOUR_MODULE/admin/links.php
modules/YOUR_MODULE/admin/index.php

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
wiz







PostPosted: Sat Jul 14, 2007 3:54 pm Reply with quote

Cheers Evaders99 and sorry for the delay.

Ok i have now made the relevant case/links/index files.

It shows in modules admin for me (God) it links ok (it is currently in the site menu)i can assign an account and grant it access to that module admin.

However, whne i tested the admin account, there was no access to that module, all i saw was the usual if u didnt assign any modules to that admin. IE logout...news stories blah blah.

Have i missed something?


Last edited by wiz on Sun Jul 15, 2007 10:29 am; edited 1 time in total 
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Sat Jul 14, 2007 4:46 pm Reply with quote

Just to elaborate what Evaders said, down at around line 483 of admin.php there is this code:

Code:


$result = $db->sql_query('SELECT title FROM '.$prefix.'_modules ORDER BY title ASC');
while (list($mod_title) = $db->sql_fetchrow($result)) {
      if (file_exists('modules/'.$mod_title.'/admin/index.php') AND file_exists('modules/'.$mod_title.'/admin/links.php') AND file_exists('modules/'.$mod_title.'/admin/case.php')) {
      include_once('modules/'.$mod_title.'/admin/case.php');
      }
   }



This looks for the three files Evaders referenced in the /admin directory of every module. If all three exist it then includes the case.php. That file in turn will include the /admin/case.php for your module if a legitimate "op" is passed to it for that module. This process allows authors of "other" modules to write administrative components independently (so to speak) of the core Nuke and have it execute them.

Now as to the immediate question, when you go into the graphicsadmin function of admin.php there is this code:

Code:
   $result = $db->sql_query('SELECT title, admins FROM '.$prefix.'_modules ORDER BY title ASC');

   $row2 = $db->sql_fetchrow($db->sql_query('SELECT name FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\''));
   while ($row = $db->sql_fetchrow($result)) {
      $admins = explode(',', $row['admins']);
      $auth_user = 0;
      for ($i=0; $i < sizeof($admins); $i++) {
         if ($row2['name'] == $admins[$i]) {
            $auth_user = 1;
         }
      }
      if ($radminsuper == 1 OR $auth_user == 1) {
         if (file_exists('modules/'.$row['title'].'/admin/index.php') AND file_exists('modules/'.$row['title'].'/admin/links.php') AND file_exists('modules/'.$row['title'].'/admin/case.php')) {
            include_once('modules/'.$row['title'].'/admin/links.php');
         }
      }
   }


Sorry for the length, but the key element is that it's looking in the "admins" field of the modules table for a comma separated list of admins for that module. If you are a super user or if you are one of the authorized admins of that module then you would have the a graphic for that module shown on the admin screen.

So to diagnose the problem I would first look into the admins field of the modules table and see if the particular admin that is not seeing the module listed in getting in there. If not, we'd have to trace back further in the code and see why.
 
View user's profile Send private message Visit poster's website
wiz







PostPosted: Sat Jul 14, 2007 4:52 pm Reply with quote

ok Fkelly Cheers, ill get onto it tomorrow after work. Length of post to answer is not an issue as it explains more (usually), So thanks. Ill post back when ive done what you said, lets see if that make sit work.

Cheers
WIZ
 
wiz







PostPosted: Sun Jul 15, 2007 10:31 am Reply with quote

ok guys, i have checked the admin field of the modules table. The author i want, is listed there. However still no cigar.
hmmm
 
fkelly







PostPosted: Sun Jul 15, 2007 2:48 pm Reply with quote

Can you post what's in the /admin/links.php of the module you are trying to get to show up. Here's the line from your account for comparison:

Code:
adminmenu($admin_file.'.php?op=mod_users', _USERS, 'users.gif');


Possibly this is not what is working. I haven't personally tested "delegation" of the admin functions to a sub-administrator. You might want to do this with one of the standard modules that already shows up on the admin modules screen and see if it works.

And what version of Nuke (hopefully RN) are you running? There were some significant changes in the way this functionality works in RN2.10 but nothing that should have unhinged something that was working before.
 
wiz







PostPosted: Sun Jul 15, 2007 3:10 pm Reply with quote

ok FKelly I have uploaded the requested script to our server as a txt file, i am now going to pm you the link. I did it that way for reasons that we shall call 'Sentinel' Idea

And..of course im running 2.1, what other options are there? ROTFL
 
fkelly







PostPosted: Sun Jul 15, 2007 3:56 pm Reply with quote

Well good that you have 2.10. I replied. Basically anyone doing this has to model the links file on one that works. There are plenty of examples out in the distribution. I just did my first admin component of a module so I am no expert. You need to study hard how the ops work ... how they are in both the case.php and /admin/index.php and how everything gets driven thru /admin.php back out to the module/admin/index.php. I don't know if Karakas has an explanation of how to create an admin component in his HOWTO or not. It sure would be nice to have documentation somewhere instead of having to painfully reverse engineer the code and use trial and error to construct an admin component. Like everything else: it's a matter of time ... sigh
 
wiz







PostPosted: Sun Jul 15, 2007 4:21 pm Reply with quote

I agree, it would be nice to have a HOWTO on how to configure an admin component of a custom module, one person that might kow is Gremmie as Gcalendar uses modules admin. Thanks for your Pm reply FKelly ill work on that in a mo.
 
fkelly







PostPosted: Sun Jul 15, 2007 6:09 pm Reply with quote

There are no doubt a number of people here who are quite expert with this. The problem is that it takes time to write all this down and to intersperse code with explanations and edit it all.
 
wiz







PostPosted: Sun Jul 15, 2007 6:17 pm Reply with quote

OK it works...the link appears in the relevant author login now. The problem is, where i want it to link to, is actually written as a normal module. Therefore it now points to 'op=Members_Only_Admin'
 
Gremmie
Former Moderator in Good Standing



Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Sun Jul 15, 2007 6:20 pm Reply with quote

It was all spelled out for me in the "Building Websites with PHP-Nuke" book by Paterson. Smile

_________________
GCalendar - An Event Calendar for PHP-Nuke
Member_Map - A Google Maps Nuke Module 
View user's profile Send private message
fkelly







PostPosted: Sun Jul 15, 2007 6:39 pm Reply with quote

Right Gremmie, I had forgotten about that. I looked at that book last winter and it's excellent. I think Wiz can find it on Amazon, but I'm not sure.

Wiz, I'm not sure I understand. In the administrative side, and I may be mistaken, but I believe that ops are used so that admin.php can be involved in controlling access to the administrative side of all modules. Both the case.php and the index.php in the /admin directory have to have those ops in them. Generally each op will correspond to a separate function within the /admin/index.php. If you want to link between functions so one sends data to another for instance, you can set an op as a hidden field within a given function.

If you have non-administrative content just put it in a program in the /modules/yourmodule directory. Then you can use the action of various forms to link between the programs. If you want to link from an administrative component to a non-administrative one, I'd think you could do it as the action attribute of a form or perhaps as a href. Or just have it accessed in the /modules/yourmodule/index.php and don't go thru admin at all.

Good night Smile
 
wiz







PostPosted: Sun Jul 15, 2007 6:45 pm Reply with quote

Thanks for staying awake FKelly. well basically we have a module, that has an admin side to it, but whoever coded it made the admin side..another (hidden) module, time is time and i think that time has come to put it inside the nuke admin. The bonus is that its more controllable, as i can assign an account to access that section. I have made backups, so i will do as you suggested and trial/error it somehow it will work. The original problem has been answered though..i now have the icon appear in the admin Smile
 
wiz







PostPosted: Thu Jul 19, 2007 7:22 pm Reply with quote

ok it linked great... but one thing it did do is destroy the rest of the modules admin side of admin.php.

Everything down there is a blank whitepage... hmmm

For the record, i am unable to purchase anything online that doesnt use paypal Embarassed
 
fkelly







PostPosted: Thu Jul 19, 2007 8:16 pm Reply with quote

You probably need to put some traces into that part of the admin.php that reads in the admin, case, and links files and find out what it's seeing. Basically it looks at the links files and finds the graphics for each module and displays that. So something is going wrong at that point.
 
wiz







PostPosted: Thu Jul 19, 2007 8:21 pm Reply with quote

maybe theme?
 
fkelly







PostPosted: Thu Jul 19, 2007 9:40 pm Reply with quote

You could change themes and see, but I doubt it. It's just a guess but something in one of the links.php files? This is where having a test system and some good diagnostic techniques ready can be very handy, but that's another topic and another day.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©