Пример #1
0
 /**
  * Function to start the module
  * 
  * @access public
  * @return void
  */
 public function Start()
 {
     if (file_exists($this->sModuleDiretory . SP . "status.txt")) {
         $iStatus = intval(file_get_contents($this->sModuleDiretory . SP . "status.txt"));
         $bStatus = $iStatus == 1;
         Storage::Set("app." . $this->sModuleName . ".enabled", $bStatus);
     } else {
         $bStatus = true;
         file_put_contents($this->sModuleDiretory . SP . "status.txt", "1");
         Storage::Set("app." . $this->sModuleName . ".enabled", true);
     }
     if ($bStatus) {
         Storage::SetArray("class.list", "module." . $this->sModuleName, $this->sModuleDiretory . "core" . SP);
         //Diretory Paths
         Storage::Set("app." . $this->sModuleName, $this->sModuleDiretory);
         Storage::Set("app." . $this->sModuleName . ".shell.css", $this->sModuleDiretory . "shell" . SP . "css" . SP);
         Storage::Set("app." . $this->sModuleName . ".shell.tpl", $this->sModuleDiretory . "shell" . SP . "tpl" . SP);
         Storage::Set("app." . $this->sModuleName . ".shell.js", $this->sModuleDiretory . "shell" . SP . "js" . SP);
         Storage::Set("app." . $this->sModuleName . ".shell.img", $this->sModuleDiretory . "shell" . SP . "img" . SP);
         //Web Paths
         Storage::Set("virtual." . $this->sModuleName . ".shell.img", Storage::Join("route.root", "app/" . $this->sModuleName . "/shell/img/"));
         Storage::Set("virtual." . $this->sModuleName . ".shell.tpl", Storage::Join("route.root", "app/" . $this->sModuleName . "/shell/tpl/"));
         Storage::Set("virtual." . $this->sModuleName . ".shell.js", Storage::Join("route.root", "app/" . $this->sModuleName . "/shell/js/"));
         Storage::Set("virtual." . $this->sModuleName . ".shell.css", Storage::Join("route.root", "app/" . $this->sModuleName . "/shell/css/"));
         //Loading submodules
         if (is_dir($this->sModuleDiretory . "modules")) {
             $aModulesDirectories = glob($this->sModuleDiretory . "modules" . SP . "*", GLOB_ONLYDIR);
             foreach ($aModulesDirectories as $sModuleDiretory) {
                 if (file_exists($sModuleDiretory . SP . "status.txt")) {
                     $bStatus = intval(file_get_contents($sModuleDiretory . SP . "status.txt")) == 1;
                 } else {
                     $bStatus = false;
                 }
                 if ($bStatus) {
                     if (file_exists($sModuleDiretory . SP . "settings.php") && $bStatus) {
                         require_once $sModuleDiretory . SP . "settings.php";
                     }
                     if (file_exists($sModuleDiretory . SP . "include.php") && $bStatus) {
                         require_once $sModuleDiretory . SP . "include.php";
                     }
                     if (file_exists($sModuleDiretory . SP . "routes.php") && $bStatus) {
                         require_once $sModuleDiretory . SP . "routes.php";
                     }
                     if (file_exists($sModuleDiretory . SP . "events.php") && $bStatus) {
                         require_once $sModuleDiretory . SP . "events.php";
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 /**
  * Function to create connections
  * 
  * @static
  * @access public
  * @param string $sName Connection name
  * @param string $sDrive Drive database to be used (mysql, postgresql, sqlite, mongodb)
  * @param string $sHostname Hostname or path to the database
  * @param string $sUsername User access to the database
  * @param string $sPassword Password to access the database
  * @param string $sSchema Schema to be used (for MySQL, PostgreSQL and MongoDB)
  * @param integer $iPort Door access to the database (for MySQL, PostgreSQL and MongoDB) 
  * @return void
  */
 public static function CreateConnection($sName, $sDrive = "mysql", $sHostname, $sUsername = null, $sPassword = null, $sSchema = null, $iPort = 3306)
 {
     $oThis = self::CreateInstanceIfNotExists();
     Storage::SetArray("class.list", "db", Storage::Join("dir.core", "db" . SP));
     $oThis->aConnections[$sName] = array("drive" => $sDrive);
     switch (strtolower($sDrive)) {
         case "mysql":
             $oThis->aConnections[$sName]["resource"] = new MySQLCache($sHostname, $sUsername, $sPassword, $sSchema, $iPort);
             break;
         default:
             unset($oThis->aConnections[$sName]);
             break;
     }
 }
Пример #3
0
 /**
  * Function to load modules
  * 
  * @static
  * @access public
  * @return void
  */
 public static function LoadApp()
 {
     //If the module exists Express should be loaded first
     if (is_dir(Storage::Join("dir.app", "express"))) {
         if (file_exists(Storage::Join("dir.app", "express" . SP . "settings.php"))) {
             require_once Storage::Join("dir.app", "express" . SP . "settings.php");
         }
         if (file_exists(Storage::Join("dir.app", "express" . SP . "include.php"))) {
             require_once Storage::Join("dir.app", "express" . SP . "include.php");
         }
         if (file_exists(Storage::Join("dir.app", "express" . SP . "routes.php"))) {
             require_once Storage::Join("dir.app", "express" . SP . "routes.php");
         }
         if (file_exists(Storage::Join("dir.app", "express" . SP . "events.php"))) {
             require_once Storage::Join("dir.app", "express" . SP . "events.php");
         }
     }
     //Load Modules
     $aModulesDirectories = glob(Storage::Get("dir.app") . "*", GLOB_ONLYDIR);
     foreach ($aModulesDirectories as $sModuleDiretory) {
         $bStatus = file_exists($sModuleDiretory . SP . "status.txt") ? intval(file_get_contents($sModuleDiretory . SP . "status.txt")) == 1 : false;
         $bInstaled = file_exists($sModuleDiretory . SP . "settings.php");
         if ($bStatus && $bInstaled && basename($sModuleDiretory) != "express") {
             if (file_exists($sModuleDiretory . SP . "settings.php") && $bStatus) {
                 require_once $sModuleDiretory . SP . "settings.php";
             }
             if (file_exists($sModuleDiretory . SP . "include.php") && $bStatus) {
                 require_once $sModuleDiretory . SP . "include.php";
             }
             if (file_exists($sModuleDiretory . SP . "routes.php") && $bStatus) {
                 require_once $sModuleDiretory . SP . "routes.php";
             }
             if (file_exists($sModuleDiretory . SP . "events.php") && $bStatus) {
                 require_once $sModuleDiretory . SP . "events.php";
             }
         }
     }
 }
Пример #4
0
 /**
  * Function to create the Javascript file cache
  *
  * @access public
  * @param boolean $bForce Forcing creation
  * @return void
  */
 public static function CreateCacheJS()
 {
     $oThis = self::CreateInstanceIfNotExists();
     if (count($oThis->aJS) > 0) {
         $sCacheFilename = Storage::Join("dir.public.assets", strtolower($oThis->sNamespace) . ".js");
         Storage::Set("assets.js", Storage::Join("route.root", "public/assets/" . strtolower($oThis->sNamespace) . ".js"));
         if (!file_exists($sCacheFilename) || Storage::Get("debug", false)) {
             $sBuffer = "";
             foreach ($oThis->aJS as $sAppendBuffer) {
                 $sBuffer .= $sAppendBuffer;
             }
             file_put_contents($sCacheFilename, $sBuffer);
         }
     }
 }