home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  3.0 KB  |  91 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. require_once("mainfile.php");
  16. $module = 1;
  17.  
  18. if (isset($name)) {
  19.  
  20.     $result = sql_query("select active, view from ".$prefix."_modules where title='$name'", $dbi);
  21.     list($mod_active, $view) = sql_fetch_row($result, $dbi);
  22.     if (($mod_active == 1) OR ($mod_active == 0 AND is_admin($admin))) {
  23.     if (!isset($mop)) { $mop="modload"; }
  24.     if (!isset($file)) { $file="index"; }
  25.     if (ereg("\.\.",$name) || ereg("\.\.",$file)) {
  26.         echo "You are so cool...";
  27.     } else {
  28.         $ThemeSel = get_theme();
  29.         if (file_exists("themes/$ThemeSel/modules/$name/$file.php")) {
  30.         $modpath = "themes/$ThemeSel/";
  31.         }
  32.         if ($view == 0) {
  33.         $modpath .= "modules/$name/$file.php";
  34.             if (file_exists($modpath)) {
  35.             include($modpath);
  36.             } else {
  37.             die ("Sorry, such file doesn't exist...");
  38.         }
  39.         }
  40.         if ($view == 1 AND is_user($user) || is_admin($admin)) {
  41.         $modpath .= "modules/$name/$file.php";
  42.             if (file_exists($modpath)) {
  43.             include($modpath);
  44.             } else {
  45.             die ("Sorry, such file doesn't exist...");
  46.         }
  47.         } elseif ($view == 1 AND !is_user($user) || !is_admin($admin)) {
  48.         $pagetitle = "- "._ACCESSDENIED."";
  49.         include("header.php");
  50.         title("$sitename: "._ACCESSDENIED."");
  51.         OpenTable();
  52.         echo "<center><b>"._RESTRICTEDAREA."</b><br><br>"
  53.             .""._MODULEUSERS.""
  54.             .""._GOBACK."";
  55.         CloseTable();
  56.         include("footer.php");
  57.         die();
  58.         }
  59.         if ($view == 2 AND is_admin($admin)) {
  60.         $modpath .= "modules/$name/$file.php";
  61.             if (file_exists($modpath)) {
  62.             include($modpath);
  63.             } else {
  64.             die ("Sorry, such file doesn't exist...");
  65.         }    
  66.         } elseif ($view == 2 AND !is_admin($admin)) {
  67.         $pagetitle = "- "._ACCESSDENIED."";
  68.         include("header.php");
  69.         title("$sitename: "._ACCESSDENIED."");
  70.         OpenTable();
  71.         echo "<center><b>"._RESTRICTEDAREA."</b><br><br>"
  72.             .""._MODULESADMINS.""
  73.             .""._GOBACK."";
  74.         CloseTable();
  75.         include("footer.php");
  76.         die();
  77.         }
  78.     }
  79.     } else {
  80.     include("header.php");
  81.     OpenTable();
  82.     echo "<center>"._MODULENOTACTIVE."<br><br>"
  83.         .""._GOBACK."</center>";
  84.     CloseTable();
  85.     include("footer.php");
  86.     }
  87. } else {
  88.     die ("Sorry, you can't access this file directly...");
  89. }
  90.  
  91. ?>