function read($onlyActive = true)
 {
     if ($onlyActive) {
         $this->mDB->q("SELECT * FROM `@P@modules` WHERE `active`='1' ORDER BY `loadweight` ASC");
     } else {
         $this->mDB->q("SELECT * FROM `@P@modules`");
     }
     $result = 0;
     global $WT;
     while ($mod = $this->mDB->fetch()) {
         if (!$this->isCoreModule($mod['mid'])) {
             $dir = wtDir($WT->ModuleDir . $mod['mid'] . "/");
             $url = wtDir($WT->ModuleUrl . $mod['mid'] . "/");
         } else {
             $dir = wtDir($WT->CoreDir . "modules/" . $mod['mid'] . "/");
             $url = wtDir($WT->CoreUrl . "modules/" . $mod['mid'] . "/");
         }
         include $dir . "Module.php";
         eval("\$this->mModules['" . $mod['mid'] . "']=new " . $mod['mid'] . ";");
         if ($mod['active']) {
             $result++;
             $this->mModules[$mod['mid']]->Dir = $dir;
             $this->mModules[$mod['mid']]->Url = $url;
             $this->mModules[$mod['mid']]->Id = $mod['mid'];
             $this->mActiveModules[$mod['mid']] =& $this->mModules[$mod['mid']];
         }
         $this->mModules[$mod['mid']]->Installed = $mod['installed'];
     }
     return $result;
 }
 * @file
 * Watchtower main script
 * 
 * This script is called by wtInit().
 * All necessary initialisation processes are performed here. 
 * 
 * @see 
 *  wtInit()   
 */
// This has to be included first, because we need wtDir()
include dirname(__FILE__) . "/wtUtil.php";
// Include the core
include dirname(__FILE__) . "/wtCore.php";
$WT = new wtCore();
// Setup the core
$WT->CoreDir = wtDir(dirname(__FILE__) . "/../");
$WT->CoreUrl = "";
$WT->RootDir = $rootDir . "/";
$WT->RootUrl = $rootUrl . "/";
$WT->ModuleDir = $rootDir . "/modules/";
$WT->ModuleUrl = $rootUrl . "/modules/";
unset($WTRootDir);
// Include all files
include $WT->CoreDir . "include/wtModule.php";
include $WT->CoreDir . "include/wtModuleManager.php";
include $WT->CoreDir . "include/wtDB.php";
include $WT->CoreDir . "include/wtRegistry.php";
include $WT->CoreDir . "include/wtUser.php";
include $WT->CoreDir . "include/wtDBUtil.php";
include $WT->CoreDir . "include/wtHook.php";
include $WT->CoreDir . "include/wtTheme.php";