home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / phpnuke / PHP-Nuke-7.5.exe / html / modules.php < prev    next >
PHP Script  |  2004-08-07  |  5KB  |  132 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Advanced Content Management System                         */
  5. /* ============================================                         */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* This program is free software. You can redistribute it and/or modify */
  11. /* it under the terms of the GNU General Public License as published by */
  12. /* the Free Software Foundation; either version 2 of the License.       */
  13. /*                                                                      */
  14. /************************************************************************/
  15. /* Additional security checking code 2003 by chatserv                   */
  16. /* http://www.nukefixes.com -- http://www.nukeresources.com             */
  17. /************************************************************************/
  18.  
  19. require_once("mainfile.php");
  20. $module = 1;
  21.  
  22.     $name = trim($name);
  23. if (isset($name)) {
  24. if (eregi("http\:\/\/", $name)) {
  25.     die("Hi and Bye");
  26.     }
  27.     global $nukeuser, $db, $prefix;
  28.     $user = addslashes($user);
  29.     $nukeuser = base64_decode($user);
  30.     $result = $db->sql_query("SELECT active, view FROM ".$prefix."_modules WHERE title='$name'");
  31.     $row = $db->sql_fetchrow($result);
  32.     $mod_active = intval($row['active']);
  33.     $view = intval($row['view']);
  34.     if (($mod_active == 1) OR ($mod_active == 0 AND is_admin($admin))) {
  35.         if (!isset($mop)) { $mop="modload"; }
  36.         if (!isset($file)) { $file="index"; }
  37.         if (ereg("\.\.",$name) || ereg("\.\.",$file) || ereg("\.\.",$mop)) {
  38.             echo "You are so cool...";
  39.         } else {
  40.             $ThemeSel = get_theme();
  41.         if (file_exists("themes/$ThemeSel/modules/$name/".$file.".php")) {
  42.                 $modpath = "themes/$ThemeSel/";
  43.             } else {
  44.                 $modpath = "";
  45.             }
  46.             if ($view == 0) {
  47.         $modpath .= "modules/$name/".$file.".php";
  48.                 if (file_exists($modpath)) {
  49.                     include($modpath);
  50.                 } else {
  51.                     die ("Sorry, such file doesn't exist...");
  52.             }
  53.             } else if ($view == 1 AND (is_user($user) OR is_group($user, $name)) OR is_admin($admin)) { 
  54.         $modpath .= "modules/$name/".$file.".php";
  55.                 if (file_exists($modpath)) {
  56.                     include($modpath);
  57.                 } else {
  58.                     die ("Sorry, such file doesn't exist...");
  59.                 }
  60.             } elseif ($view == 1 AND !is_user($user) AND !is_admin($admin)) {
  61.                 $pagetitle = "- "._ACCESSDENIED."";
  62.                 include("header.php");
  63.                 title("$sitename: "._ACCESSDENIED."");
  64.                 OpenTable();
  65.                 echo "<center><b>"._RESTRICTEDAREA."</b><br><br>"
  66.                     .""._MODULEUSERS."";
  67.         $result2 = $db->sql_query("SELECT mod_group FROM ".$prefix."_modules WHERE title='$name'"); 
  68.         $row2 = $db->sql_fetchrow($result2); 
  69.         if ($row2[mod_group] != 0) { 
  70.         $result3 = $db->sql_query("SELECT name FROM ".$prefix."_groups WHERE id='$row2[mod_group]'"); 
  71.         $row3 = $db->sql_fetchrow($result3); 
  72.         echo ""._ADDITIONALYGRP.": <b>$row3[name]</b><br><br>";
  73.                 }
  74.                 echo ""._GOBACK."";
  75.                 CloseTable();
  76.                 include("footer.php");
  77.                 die();
  78.             } else if ($view == 2 AND is_admin($admin)) { 
  79.         $modpath .= "modules/$name/".$file.".php";
  80.                 if (file_exists($modpath)) {
  81.                     include($modpath);
  82.                 } else {
  83.                     die ("Sorry, such file doesn't exist...");
  84.                 }
  85.             } elseif ($view == 2 AND !is_admin($admin)) {
  86.                 $pagetitle = "- "._ACCESSDENIED."";
  87.                 include("header.php");
  88.                 title("$sitename: "._ACCESSDENIED."");
  89.                 OpenTable();
  90.                 echo "<center><b>"._RESTRICTEDAREA."</b><br><br>"
  91.                     .""._MODULESADMINS.""
  92.                     .""._GOBACK."";
  93.                 CloseTable();
  94.                 include("footer.php");
  95.                 die();
  96.             } else if ($view == 3 AND paid()) { 
  97.                 $modpath .= "modules/$name/$file.php";
  98.                 if (file_exists($modpath)) {
  99.                     include($modpath);
  100.                 } else {
  101.                     die ("Sorry, such file doesn't exist...");
  102.                 }
  103.             } else {
  104.                 $pagetitle = "- "._ACCESSDENIED."";
  105.                 include("header.php");
  106.                 title("$sitename: "._ACCESSDENIED."");
  107.                 OpenTable();
  108.                 echo "<center><b>"._RESTRICTEDAREA."</b><br><br>"
  109.                     .""._MODULESSUBSCRIBER."";
  110.                 if ($subscription_url != "") {
  111.                     echo "<br>"._SUBHERE."";
  112.                 }
  113.                 echo "<br><br>"._GOBACK."";
  114.                 CloseTable();
  115.                 include("footer.php");
  116.                 die();
  117.             }
  118.         }
  119.     } else {
  120.         include("header.php");
  121.         OpenTable();
  122.         echo "<center>"._MODULENOTACTIVE."<br><br>"
  123.             .""._GOBACK."</center>";
  124.         CloseTable();
  125.         include("footer.php");
  126.     }
  127. } else {
  128.     die ("Sorry, you can't access this file directly...");
  129. }
  130.  
  131. ?>
  132.