Knowledge Base Navigation
Articles: 51 Categories: 8
KB Article: How to update older modules to work in PHP Nuke 7.5
Article: | How to update older modules to work in PHP Nuke 7.5 |
Submitted By: | Telli |
Date Added: | 09-24-2004 6:01:33 |
Hits: | 10,016 |
A brief description of how to update older modules to work in the new version of PHP Nuke 7.5
For this tutroial we are going to use the FAQ module. All you would do is replace the name for any module that you wanted to update follow these simple instructions and you will be able to use your older modules in PHP Nuke 7.5. First we make a directory in the modules/ folder called 'FAQ' then one sub-directories in that new module called admin and language. So when your done you should have a new module folder called 'FAQ' with one folder inside of it named 'admin' and inside the 'admin' folder one folder called 'language'. 'OLD STRUCTURE' -admin/case/case.adminfaq.php -admin/links/links.faq.php -admin/modules/adminfaq.php -admin/language/lang-english.php Second we need to get the old admin files and rename them. The new admin structure uses the admin/modules/adminfaq.php as a index.php for the 'admin' folder. So for the 'FAQ' module we would rename the admin/modules/adminfaq.php to index.php and then save it. For the other 3 files left we name the admin/modules/case.adminfaq.php to just case.php and then save that, same for admin/links/links.faq.php just rename it to links.php and save it. Now we can start editing the files. Open the file index.php and find the following code: $row = $db->sql_fetchrow($db->sql_query("SELECT radminfaq, radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'")); if (($row['radminfaq'] == 1) OR ($row['radminsuper'] == 1)) { Replace that section of code with this: ############################# $row = $db->sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='$module_name'")); $row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".$prefix."_authors WHERE aid='$aname'")); $admins = explode(",", $row['admins']); $auth_user = 0; for ($i=0; $i < sizeof($admins); $i++) { if ($row2['name'] == "$admins[$i]" AND $row['admins'] != "") { $auth_user = 1; } } if ($row2['radminsuper'] == 1 || $auth_user == 1) { ############################# Find the following code: } else { echo "Access Denied"; } Replace that section of code with this: } else { include("header.php"); GraphicAdmin(); OpenTable(); echo "<center><b>"._ERROR."</b><br><br>You Dont have permission for\"$module_name\"</center>"; CloseTable(); include("footer.php"); } Open the file case.php and find the following code: if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); } Replace that section of code with: if (!eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); } $module_name = "FAQ"; include_once("modules/$module_name/admin/language/lang-".$currentlang.".php"); Find the following code: include("admin/modules/adminfaq.php"); Replace that section of code with: include("modules/$module_name/admin/index.php"); Open the file links.php and find the following code: if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); } if (($radminsuper==1) OR ($radminfaq==1)) { adminmenu("admin.php?op=FAQ", ""._FAQ."", "faq.gif"); } Replace that section of code with: if (!eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); } adminmenu("admin.php?op=FAQ", ""._FAQ."", "faq.gif"); Save all your changes and upload them into the new structure you made. 'NEW STRUCTURE' -modules/FAQ/admin/case.php -modules/FAQ/admin/links.php -modules/FAQ/admin/index.php -modules/FAQ/admin/language/lang-english.php If we did everything correctly you should be able to go in to the Admin control panel and under the 'Edit Admins' we should see a new permission's box for FAQ. Now I do realize that this modules is already done when you use the new PHP Nuke 7.5, this is just to be used as guide so you understand how it was done. |
Current rating: 9.01 by 352 users
Please take one second and rate this article... |
Not a Chance | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Absolutely |
Please register or sign-in to post comments.