示例#1
0
 public function createGuestSession()
 {
     if (config::item('devmode', 'system') || !session::permission('group_id', 'system')) {
         $permissions = $this->getPermissions(config::item('group_guests_id', 'users'));
         $permissions['system']['group_id'] = config::item('group_guests_id', 'users');
         foreach ($permissions as $plugin => $permission) {
             session::set($permission, '', 'permissions_' . $plugin);
         }
     }
     if (!config::item('template_override', 'system') && (input::get('template') && ($templateID = array_search(input::get('template'), config::item('templates', 'core', 'keywords'))) !== false || session::item('template_custom'))) {
         if (input::get('template')) {
             session::set('template_custom', input::get('template'));
             $template = config::item('templates', 'core', 'keywords', $templateID);
         } else {
             $template = session::item('template_custom');
         }
     } else {
         $template = config::item('templates', 'core', 'keywords', config::item('template_id', 'system'));
     }
     if (!config::item('language_override', 'system') && (input::get('language') && ($languageID = array_search(input::get('language'), config::item('languages', 'core', 'keywords'))) !== false || session::item('language_custom'))) {
         if (input::get('language')) {
             session::set('language_custom', input::get('language'));
             $language = config::item('languages', 'core', 'keywords', $languageID);
         } else {
             $language = session::item('language_custom');
         }
     } else {
         $language = config::item('languages', 'core', 'keywords', config::item('language_id', 'system'));
     }
     session::set('language', $language);
     session::set('template', $template);
     language::setLanguage($language);
     session::set('time_zone', config::item('time_zone', 'system'));
     $this->bootstrap->update();
     return true;
 }