Esempio n. 1
0
 /**
  * Inits all loaded apps, calls core specific actions and maps
  */
 private function initApps()
 {
     // Run app specfic functions
     /* @var $app \Core\Amvc\App\Abstractapp */
     foreach ($this->apps as $app) {
         // Call additional Init() methods in apps
         if (method_exists($app, 'Init')) {
             $app->Init();
         }
         switch ($app->getName()) {
             case 'Core':
                 $config = $this->config->getStorage('Core');
                 // Create home url
                 $type = $this->user->isGuest() ? 'guest' : 'user';
                 $route = $config->get('home.' . $type . '.route');
                 $params = parse_ini_string($config->get('home.' . $type . '.params'));
                 $config->set('url.home', $app->url($route, $params));
                 break;
         }
     }
 }
Esempio n. 2
0
 /**
  * Deletes a user
  *
  * @param User $user
  */
 public function deleteUser(User $user)
 {
     if ($user->isGuest()) {
         throw new UserException('Cannot delete a guest user.');
     }
     // Check the old password
     $this->db->delete($this->table, 'id_user=:id_user', [':id_user' => $user->getId()]);
 }