Exemple #1
0
 /**
  * Page not found
  */
 public function errorBanned(Request $request, $matches = null)
 {
     $reason = $this->user->ban_reason;
     if (!$reason) {
         $reason = $this->lang->translate('user.ban.reason_unknown');
     }
     Env::$response->setStatusCode(403, 'Permission denied');
     return $this->view->twig->render('@assets/banned.twig', ['reason' => $reason, 'ban' => $this->user->ban_user->to_array()]);
 }
Exemple #2
0
 /**
  * @param Translate $lang
  * @return array
  */
 static function rebuild_menu(Translate $lang)
 {
     $groups = [];
     # Get all modules and make Admin first item
     $modules = static::dirs(ROOT . S . 'engine' . S . 'Module', ['Admin']);
     $modules[] = 'Admin';
     $modules = array_reverse($modules);
     # Obtain modules information
     foreach ($modules as $module) {
         // Control class
         $admin_class = '\\Module\\' . $module . '\\Control';
         if (!class_exists($admin_class)) {
             continue;
         }
         // Translate module name ( $module_name.module )
         $group_name = strtolower($module) . '.title';
         if ($lang->translate($group_name) != $group_name) {
             $group_name = $lang->translate($group_name);
         } else {
             $group_name = ucfirst($module);
         }
         // Translate menu
         $menu = [];
         foreach ($admin_class::$menu as $item) {
             $menu[] = ['title' => $lang->translate($item['title']), 'href' => $item['href'], 'show_counter' => isset($item['counter']), 'count' => isset($item['counter']) ? $admin_class::{$item['counter']}() : 0];
         }
         // Build group
         $groups[] = ['title' => $group_name, 'icon' => $admin_class::$fa_icon, 'items' => $menu];
     }
     return $groups;
 }