Develdoc:Structure

From PMWH2 - PHPMyWebHosting's official wiki
Jump to: navigation, search
up

The directory structure of PHPMyWebHosting is the most important thing you have to remember. The following directories are underlying this structure:

  • includes/modules/
  • templates/<template name>/
  • help/

Lets take a look at includes/switch.php to understand that structure:

...
09   $act = addslashes($act);
10   if ($what == "") {
11       $what = "overview";
12   }
13   if (is_readable("includes/modules/$act/$what.php")) {
14       include("includes/modules/$act/$what.php");
15   } else {
16       $s = new Smarty();
17       $s->assign("HEADING",_PHPMYWEBHOSTING);
18       $main .= $s->fetch("modules/heading.tpl");
19       if (VAR_GROUP == "0") {
20           include("includes/admin_check.php");
21       }
22   }
...

Description:

  • Line 9: We escape the variable $act to avoid "../.."
  • Line 10-12: If you don't set the $what variable it is filled with the standard "overview".
  • Line 13: PHPMyWebHosting tests if a file named "includes/modules/$act/$what.php" exists and is readable. If yes it is included. If not, see lines 15-22. If $what is not set via your GET-url, it was filled with "overview". So minimum "includes/modules/$act/overview.php" is called.
  • Line 15-22: This should only happen after login.
    • Line 16: We create a new Smarty object
    • Line 17: Assign the heading to the template called in line 18
    • Line 18: Add the template to $main, which will be assigned to the template called in "index.php"
    • Line 19-21: We include some admin checks if the user group is 0 (pmwh_admin).