public function __destruct()
 {
     parent::__destruct();
     mysql_close($this->dbLink);
     $connection = false;
     unset($this);
 }
示例#2
0
 public function __defaultController()
 {
     // Include only the Class needed
     $app = $this->app;
     $bind = $this->bind;
     $action = $this->action;
     $view_display = $this->view_display;
     $classFile = MVC_BASE_PATH . '/apps/greystone/models/' . $bind . '.php';
     $classView = MVC_BASE_PATH . '/apps/greystone/views/' . $view_display . '.php';
     $classAction = MVC_BASE_PATH . '/' . $bind . '.php?action=' . $action;
     // Load and verify Class
     require_once $classFile;
     if (class_exists($bind)) {
         try {
             $instance = new $bind();
             if (!MVC_App::isValid($instance)) {
                 die('Not the object I am looking for.');
             }
         } catch (Exeception $e) {
             echo 'Message: ' . $e->getMessage();
             die("The requested class does not exists!");
         }
     } else {
         echo 'Message: Danger, Danger, Will Robinson!';
         die("The requested class does not exists!");
     }
     $instance->appName = $app;
     $result = array();
     // Execute and verify Class Action
     try {
         $result = $instance->{$action}();
     } catch (Exeception $e) {
         echo 'Message: ' . $e->getMessage();
         die("No action found.");
     }
     //Send the model results to view
     $view = MVC_View::factory($instance->view, $instance);
     $view->app = $app;
     $view->bind = $bind;
     $view->action = $action;
     $view->view_display = $view_display;
     $view->display();
 }
 public function __destruct()
 {
     parent::__destruct();
     unset($this);
 }