| Tutorials Main Latest Tutorials Popular Tutorials Top Rated Tutorials |
| Login to See your Favorite Tutorials |
| Description: Have you ever found a module that wont work with 7.6+ Well this is how to convert it ! | |
| Version: 1.0 | |
| Added on: 06 February 2008 | |
| Author: Telli | |
| Difficulty Level: Difficult | |
| Views: 6984 | |
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:
| 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)) { |
| Code: |
| #############################
$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) { ############################# |
| Code: |
| } else {
echo "Access Denied"; } |
| Code: |
| } 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"); } |
| Code: |
| if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); } |
| Code: |
| if (!eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); }
$module_name = "FAQ"; include_once("modules/$module_name/admin/language/lang-".$currentlang.".php"); |
| Code: |
| include("admin/modules/adminfaq.php"); |
| Code: |
| include("modules/$module_name/admin/index.php"); |
| 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"); } |
| Code: |
| if (!eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); }
adminmenu("admin.php?op=FAQ", ""._FAQ."", "faq.gif"); |