Esempio n. 1
0
 public function display()
 {
     if (!$this->user->is_guest) {
         header('Location: ' . Url::base());
         exit;
     }
     // Antispam feature
     require $this->feather->forum_env['FEATHER_ROOT'] . 'featherbb/lang/' . $this->user->language . '/antispam.php';
     $index_questions = rand(0, count($lang_antispam_questions) - 1);
     // Display an error message if new registrations are disabled
     // If $_REQUEST['username'] or $_REQUEST['password'] are filled, we are facing a bot
     if ($this->config['o_regs_allow'] == '0' || $this->request->post('username') || $this->request->post('password')) {
         throw new Error(__('No new regs'), 403);
     }
     $user['timezone'] = isset($user['timezone']) ? $user['timezone'] : $this->config['o_default_timezone'];
     $user['dst'] = isset($user['dst']) ? $user['dst'] : $this->config['o_default_dst'];
     $user['email_setting'] = isset($user['email_setting']) ? $user['email_setting'] : $this->config['o_default_email_setting'];
     $user['errors'] = '';
     if ($this->feather->request()->isPost()) {
         $user = $this->model->check_for_errors();
         // Did everything go according to plan? Insert the user
         if (empty($user['errors'])) {
             $this->model->insert_user($user);
         }
     }
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Register')), 'focus_element' => array('register', 'req_user'), 'required_fields' => array('req_user' => __('Username'), 'req_password1' => __('Password'), 'req_password2' => __('Confirm pass'), 'req_email1' => __('Email'), 'req_email2' => __('Email') . ' 2', 'captcha' => __('Robot title')), 'active_page' => 'register', 'is_indexed' => true, 'errors' => $user['errors'], 'index_questions' => $index_questions, 'languages' => \FeatherBB\Core\Lister::getLangs(), 'question' => array_keys($lang_antispam_questions), 'qencoded' => md5(array_keys($lang_antispam_questions)[$index_questions])))->addTemplate('register/form.php')->display();
 }
Esempio n. 2
0
 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.register.display');
     if (!User::get()->is_guest) {
         return Router::redirect(Router::pathFor('home'));
     }
     // Antispam feature
     $lang_antispam_questions = (require ForumEnv::get('FEATHER_ROOT') . 'featherbb/lang/' . User::get()->language . '/antispam.php');
     $index_questions = rand(0, count($lang_antispam_questions) - 1);
     // Display an error message if new registrations are disabled
     // If $_REQUEST['username'] or $_REQUEST['password'] are filled, we are facing a bot
     if (ForumSettings::get('o_regs_allow') == '0' || Input::post('username') || Input::post('password')) {
         throw new Error(__('No new regs'), 403);
     }
     $user['timezone'] = isset($user['timezone']) ? $user['timezone'] : ForumSettings::get('o_default_timezone');
     $user['dst'] = isset($user['dst']) ? $user['dst'] : ForumSettings::get('o_default_dst');
     $user['email_setting'] = isset($user['email_setting']) ? $user['email_setting'] : ForumSettings::get('o_default_email_setting');
     $user['errors'] = '';
     if (Request::isPost()) {
         $user = $this->model->check_for_errors();
         // Did everything go according to plan? Insert the user
         if (empty($user['errors'])) {
             return $this->model->insert_user($user);
         }
     }
     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Register')), 'focus_element' => array('register', 'req_user'), 'required_fields' => array('req_user' => __('Username'), 'req_password1' => __('Password'), 'req_password2' => __('Confirm pass'), 'req_email1' => __('Email'), 'req_email2' => __('Email') . ' 2', 'captcha' => __('Robot title')), 'active_page' => 'register', 'is_indexed' => true, 'errors' => $user['errors'], 'index_questions' => $index_questions, 'languages' => \FeatherBB\Core\Lister::getLangs(), 'question' => array_keys($lang_antispam_questions), 'qencoded' => md5(array_keys($lang_antispam_questions)[$index_questions])))->addTemplate('register/form.php')->display();
 }
Esempio n. 3
0
 public function index($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.plugins.index');
     View::addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript'));
     $availablePlugins = Lister::getPlugins();
     $activePlugins = Container::get('cache')->isCached('activePlugins') ? Container::get('cache')->retrieve('activePlugins') : array();
     $officialPlugins = Lister::getOfficialPlugins();
     AdminUtils::generateAdminMenu('plugins');
     View::setPageInfo(array('admin_console' => true, 'active_page' => 'admin', 'availablePlugins' => $availablePlugins, 'activePlugins' => $activePlugins, 'officialPlugins' => $officialPlugins, 'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Extension'))))->addTemplate('admin/plugins.php')->display();
 }
Esempio n. 4
0
 public function index()
 {
     // AdminUtils::generateAdminMenu('plugins');
     $this->feather->template->addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript'));
     $availablePlugins = Lister::getPlugins();
     // var_dump($availablePlugins);
     $activePlugins = $this->feather->cache->isCached('active_plugins') ? $this->feather->cache->retrieve('active_plugins') : array();
     // var_dump($activePlugins);
     // $this->feather->cache->delete('active_plugins');
     AdminUtils::generateAdminMenu('plugins');
     $this->feather->template->setPageInfo(array('admin_console' => true, 'active_page' => 'admin', 'availablePlugins' => $availablePlugins, 'activePlugins' => $activePlugins, 'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Extension'))))->addTemplate('admin/plugins.php')->display();
 }
Esempio n. 5
0
    echo "\t\t\t\t\t\t\t\t" . '<option value="' . $key . '"';
    if ($user['date_format'] == $key) {
        echo ' selected="selected"';
    }
    echo '>' . Utils::format_time(time(), true, $date_format, null, false, true);
    if ($key == 0) {
        echo ' (' . __('Default') . ')';
    }
    echo "</option>\n";
}
?>
                        </select>
                        <br /></label>

<?php 
$languages = \FeatherBB\Core\Lister::getLangs();
// Only display the language selection box if there's more than one language available
if (count($languages) > 1) {
    ?>
                        <label><?php 
    _e('Language');
    ?>
                        <br /><select name="form_language">
<?php 
    foreach ($languages as $temp) {
        if ($user['language'] == $temp) {
            echo "\t\t\t\t\t\t\t\t" . '<option value="' . $temp . '" selected="selected">' . $temp . '</option>';
        } else {
            echo "\t\t\t\t\t\t\t\t" . '<option value="' . $temp . '">' . $temp . '</option>';
        }
    }
Esempio n. 6
0
 public function update_profile($id, $info, $section)
 {
     $info = Container::get('hooks')->fire('model.profile.update_profile_start', $info, $id, $section);
     $username_updated = false;
     $section = Container::get('hooks')->fire('model.profile.update_profile_section', $section, $id, $info);
     // Validate input depending on section
     switch ($section) {
         case 'essentials':
             $form = array('timezone' => floatval(Input::post('form_timezone')), 'dst' => Input::post('form_dst') ? '1' : '0', 'time_format' => intval(Input::post('form_time_format')), 'date_format' => intval(Input::post('form_date_format')));
             // Make sure we got a valid language string
             if (Input::post('form_language')) {
                 $languages = \FeatherBB\Core\Lister::getLangs();
                 $form['language'] = Utils::trim(Input::post('form_language'));
                 if (!in_array($form['language'], $languages)) {
                     throw new Error(__('Bad request'), 404);
                 }
             }
             if (User::get()->is_admmod) {
                 $form['admin_note'] = Utils::trim(Input::post('admin_note'));
                 // Are we allowed to change usernames?
                 if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || User::get()->g_moderator == '1' && User::get()->g_mod_rename_users == '1') {
                     $form['username'] = Utils::trim(Input::post('req_username'));
                     if ($form['username'] != $info['old_username']) {
                         $errors = '';
                         $errors = $this->check_username($form['username'], $errors, $id);
                         if (!empty($errors)) {
                             throw new Error($errors[0]);
                         }
                         $username_updated = true;
                     }
                 }
                 // We only allow administrators to update the post count
                 if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN')) {
                     $form['num_posts'] = intval(Input::post('num_posts'));
                 }
             }
             if (ForumSettings::get('o_regs_verify') == '0' || User::get()->is_admmod) {
                 // Validate the email address
                 $form['email'] = strtolower(Utils::trim(Input::post('req_email')));
                 if (!Container::get('email')->is_valid_email($form['email'])) {
                     throw new Error(__('Invalid email'));
                 }
             }
             break;
         case 'personal':
             $form = array('realname' => Input::post('form_realname') ? Utils::trim(Input::post('form_realname')) : '', 'url' => Input::post('form_url') ? Utils::trim(Input::post('form_url')) : '', 'location' => Input::post('form_location') ? Utils::trim(Input::post('form_location')) : '');
             // Add http:// if the URL doesn't contain it already (while allowing https://, too)
             if (User::get()->g_post_links == '1') {
                 if ($form['url'] != '') {
                     $url = Url::is_valid($form['url']);
                     if ($url === false) {
                         throw new Error(__('Invalid website URL'));
                     }
                     $form['url'] = $url['url'];
                 }
             } else {
                 if (!empty($form['url'])) {
                     throw new Error(__('Website not allowed'));
                 }
                 $form['url'] = '';
             }
             if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN')) {
                 $form['title'] = Utils::trim(Input::post('title'));
             } elseif (User::get()->g_set_title == '1') {
                 $form['title'] = Utils::trim(Input::post('title'));
                 if ($form['title'] != '') {
                     // A list of words that the title may not contain
                     // If the language is English, there will be some duplicates, but it's not the end of the world
                     $forbidden = array('member', 'moderator', 'administrator', 'banned', 'guest', utf8_strtolower(__('Member')), utf8_strtolower(__('Moderator')), utf8_strtolower(__('Administrator')), utf8_strtolower(__('Banned')), utf8_strtolower(__('Guest')));
                     if (in_array(utf8_strtolower($form['title']), $forbidden)) {
                         throw new Error(__('Forbidden title'));
                     }
                 }
             }
             break;
         case 'messaging':
             $form = array('jabber' => Utils::trim(Input::post('form_jabber')), 'icq' => Utils::trim(Input::post('form_icq')), 'msn' => Utils::trim(Input::post('form_msn')), 'aim' => Utils::trim(Input::post('form_aim')), 'yahoo' => Utils::trim(Input::post('form_yahoo')));
             // If the ICQ UIN contains anything other than digits it's invalid
             if (preg_match('%[^0-9]%', $form['icq'])) {
                 throw new Error(__('Bad ICQ'));
             }
             break;
         case 'personality':
             $form = array();
             // Clean up signature from POST
             if (ForumSettings::get('o_signatures') == '1') {
                 $form['signature'] = Utils::linebreaks(Utils::trim(Input::post('signature')));
                 // Validate signature
                 if (Utils::strlen($form['signature']) > ForumSettings::get('p_sig_length')) {
                     throw new Error(sprintf(__('Sig too long'), ForumSettings::get('p_sig_length'), Utils::strlen($form['signature']) - ForumSettings::get('p_sig_length')));
                 } elseif (substr_count($form['signature'], "\n") > ForumSettings::get('p_sig_lines') - 1) {
                     throw new Error(sprintf(__('Sig too many lines'), ForumSettings::get('p_sig_lines')));
                 } elseif ($form['signature'] && ForumSettings::get('p_sig_all_caps') == '0' && Utils::is_all_uppercase($form['signature']) && !User::get()->is_admmod) {
                     $form['signature'] = utf8_ucwords(utf8_strtolower($form['signature']));
                 }
                 // Validate BBCode syntax
                 if (ForumSettings::get('p_sig_bbcode') == '1') {
                     $errors = array();
                     $form['signature'] = Container::get('parser')->preparse_bbcode($form['signature'], $errors, true);
                     if (count($errors) > 0) {
                         throw new Error('<ul><li>' . implode('</li><li>', $errors) . '</li></ul>');
                     }
                 }
             }
             break;
         case 'display':
             $form = array('disp_topics' => Utils::trim(Input::post('form_disp_topics')), 'disp_posts' => Utils::trim(Input::post('form_disp_posts')), 'show_smilies' => Input::post('form_show_smilies') ? '1' : '0', 'show_img' => Input::post('form_show_img') ? '1' : '0', 'show_img_sig' => Input::post('form_show_img_sig') ? '1' : '0', 'show_avatars' => Input::post('form_show_avatars') ? '1' : '0', 'show_sig' => Input::post('form_show_sig') ? '1' : '0');
             if ($form['disp_topics'] != '') {
                 $form['disp_topics'] = intval($form['disp_topics']);
                 if ($form['disp_topics'] < 3) {
                     $form['disp_topics'] = 3;
                 } elseif ($form['disp_topics'] > 75) {
                     $form['disp_topics'] = 75;
                 }
             }
             if ($form['disp_posts'] != '') {
                 $form['disp_posts'] = intval($form['disp_posts']);
                 if ($form['disp_posts'] < 3) {
                     $form['disp_posts'] = 3;
                 } elseif ($form['disp_posts'] > 75) {
                     $form['disp_posts'] = 75;
                 }
             }
             // Make sure we got a valid style string
             if (Input::post('form_style')) {
                 $styles = \FeatherBB\Core\Lister::getStyles();
                 $form['style'] = Utils::trim(Input::post('form_style'));
                 if (!in_array($form['style'], $styles)) {
                     throw new Error(__('Bad request'), 404);
                 }
             }
             break;
         case 'privacy':
             $form = array('email_setting' => intval(Input::post('form_email_setting')), 'notify_with_post' => Input::post('form_notify_with_post') ? '1' : '0', 'auto_notify' => Input::post('form_auto_notify') ? '1' : '0');
             if ($form['email_setting'] < 0 || $form['email_setting'] > 2) {
                 $form['email_setting'] = ForumSettings::get('o_default_email_setting');
             }
             break;
         default:
             throw new Error(__('Bad request'), 404);
     }
     $form = Container::get('hooks')->fire('model.profile.update_profile_form', $form, $section, $id, $info);
     // Single quotes around non-empty values and nothing for empty values
     $temp = array();
     foreach ($form as $key => $input) {
         $temp[$key] = $input;
     }
     if (empty($temp)) {
         throw new Error(__('Bad request'), 404);
     }
     $update_user = DB::for_table('users')->where('id', $id)->find_one()->set($temp);
     $update_user = Container::get('hooks')->fireDB('model.profile.update_profile_query', $update_user);
     $update_user = $update_user->save();
     // If we changed the username we have to update some stuff
     if ($username_updated) {
         $bans_updated = DB::for_table('bans')->where('username', $info['old_username']);
         $bans_updated = Container::get('hooks')->fireDB('model.profile.update_profile_bans_updated', $bans_updated);
         $bans_updated = $bans_updated->update_many('username', $form['username']);
         $update_poster_id = DB::for_table('posts')->where('poster_id', $id);
         $update_poster_id = Container::get('hooks')->fireDB('model.profile.update_profile_poster_id', $update_poster_id);
         $update_poster_id = $update_poster_id->update_many('poster', $form['username']);
         $update_posts = DB::for_table('posts')->where('edited_by', $info['old_username']);
         $update_posts = Container::get('hooks')->fireDB('model.profile.update_profile_posts', $update_posts);
         $update_posts = $update_posts->update_many('edited_by', $form['username']);
         $update_topics_poster = DB::for_table('topics')->where('poster', $info['old_username']);
         $update_topics_poster = Container::get('hooks')->fireDB('model.profile.update_profile_topics_poster', $update_topics_poster);
         $update_topics_poster = $update_topics_poster->update_many('poster', $form['username']);
         $update_topics_last_poster = DB::for_table('topics')->where('last_poster', $info['old_username']);
         $update_topics_last_poster = Container::get('hooks')->fireDB('model.profile.update_profile_topics_last_poster', $update_topics_last_poster);
         $update_topics_last_poster = $update_topics_last_poster->update_many('last_poster', $form['username']);
         $update_forums = DB::for_table('forums')->where('last_poster', $info['old_username']);
         $update_forums = Container::get('hooks')->fireDB('model.profile.update_profile_forums', $update_forums);
         $update_forums = $update_forums->update_many('last_poster', $form['username']);
         $update_online = DB::for_table('online')->where('ident', $info['old_username']);
         $update_online = Container::get('hooks')->fireDB('model.profile.update_profile_online', $update_online);
         $update_online = $update_online->update_many('ident', $form['username']);
         // If the user is a moderator or an administrator we have to update the moderator lists
         $group_id = DB::for_table('users')->where('id', $id);
         // TODO: restore hook
         // $group_id = Container::get('hooks')->fireDB('model.profile.update_profile_group_id', $update_online);
         $group_id = $group_id->find_one_col('group_id');
         $group_mod = DB::for_table('groups')->where('g_id', $group_id);
         $group_mod = Container::get('hooks')->fireDB('model.profile.update_profile_group_mod', $group_mod);
         $group_mod = $group_mod->find_one_col('g_moderator');
         if ($group_id == ForumEnv::get('FEATHER_ADMIN') || $group_mod == '1') {
             // Loop through all forums
             $result = $this->loop_mod_forums();
             foreach ($result as $cur_forum) {
                 $cur_moderators = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
                 if (in_array($id, $cur_moderators)) {
                     unset($cur_moderators[$info['old_username']]);
                     $cur_moderators[$form['username']] = $id;
                     uksort($cur_moderators, 'utf8_strcasecmp');
                     $update_mods = DB::for_table('forums')->where('id', $cur_forum['id'])->find_one()->set('moderators', serialize($cur_moderators));
                     $update_mods = Container::get('hooks')->fireDB('model.profile.update_profile_mods', $update_mods);
                     $update_mods = $update_mods->save();
                 }
             }
         }
         // Regenerate the users info cache
         if (!Container::get('cache')->isCached('users_info')) {
             Container::get('cache')->store('users_info', Cache::get_users_info());
         }
         $stats = Container::get('cache')->retrieve('users_info');
         // Check if the bans table was updated and regenerate the bans cache when needed
         if ($bans_updated) {
             Container::get('cache')->store('bans', Cache::get_bans());
         }
     }
     $section = Container::get('hooks')->fireDB('model.profile.update_profile', $section, $id);
     return Router::redirect(Router::pathFor('profileSection', array('id' => $id, 'section' => $section)), __('Profile redirect'));
 }
Esempio n. 7
0
 public function run()
 {
     Container::get('hooks')->fire('controller.install.run_install');
     if (Input::getParsedBodyParam('choose_lang')) {
         if (in_array(Utils::trim(Input::getParsedBodyParam('install_lang')), $this->available_langs)) {
             $this->install_lang = Input::getParsedBodyParam('install_lang');
         }
     }
     $csrf = new \FeatherBB\Middleware\Csrf();
     $csrf->generateNewToken(Container::get('request'));
     translate('install', 'featherbb', $this->install_lang);
     if (Request::isPost() && empty(Input::getParsedBodyParam('choose_lang'))) {
         $missing_fields = array();
         $data = array_map(function ($item) {
             return Utils::escape(Utils::trim($item));
         }, Input::getParsedBodyParam('install'));
         foreach ($data as $field => $value) {
             // Handle empty fields
             if (empty($value)) {
                 // If the field is required, or if user and pass are missing even though mysql or pgsql are selected as DB
                 if (!in_array($field, $this->optional_fields) || in_array($field, array('db_user')) && in_array($data['db_type'], array('mysql', 'pgsql'))) {
                     $missing_fields[] = $field;
                 }
             }
         }
         if (!empty($missing_fields)) {
             $this->errors = 'The following fields are required but are missing : ' . implode(', ', $missing_fields);
         } else {
             // Missing fields, so we don't need to validate the others
             // VALIDATION
             // Make sure base_url doesn't end with a slash
             if (substr($data['base_url'], -1) == '/') {
                 $data['base_url'] = substr($data['base_url'], 0, -1);
             }
             // Validate username and passwords
             if (Utils::strlen($data['username']) < 2) {
                 $this->errors[] = __('Username 1');
             } elseif (Utils::strlen($data['username']) > 25) {
                 // This usually doesn't happen since the form element only accepts 25 characters
                 $this->errors[] = __('Username 2');
             } elseif (!strcasecmp($data['username'], 'Guest')) {
                 $this->errors[] = __('Username 3');
             } elseif (preg_match('%[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}%', $data['username']) || preg_match('%((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))%', $data['username'])) {
                 $this->errors[] = __('Username 4');
             } elseif ((strpos($data['username'], '[') !== false || strpos($data['username'], ']') !== false) && strpos($data['username'], '\'') !== false && strpos($data['username'], '"') !== false) {
                 $this->errors[] = __('Username 5');
             } elseif (preg_match('%(?:\\[/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\\]|\\[(?:code|quote|list)=)%i', $data['username'])) {
                 $this->errors[] = __('Username 6');
             }
             if (Utils::strlen($data['password']) < 6) {
                 $this->errors[] = __('Short password');
             } elseif ($data['password'] != $data['password_conf']) {
                 $this->errors[] = __('Passwords not match');
             }
             // Validate email
             if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
                 $this->errors[] = __('Wrong email');
             }
             // Validate language
             if (!in_array($data['default_lang'], Lister::getLangs())) {
                 $this->errors[] = __('Error default language');
             }
             // Check if the cache directory is writable
             if (!is_writable(ForumEnv::get('FORUM_CACHE_DIR'))) {
                 $this->errors[] = sprintf(__('Alert cache'), ForumEnv::get('FORUM_CACHE_DIR'));
             }
             // Check if default avatar directory is writable
             if (!is_writable(ForumEnv::get('FEATHER_ROOT') . 'style/img/avatars/')) {
                 $this->errors[] = sprintf(__('Alert avatar'), ForumEnv::get('FEATHER_ROOT') . 'style/img/avatars/');
             }
             // Validate db_prefix if existing
             if (!empty($data['db_prefix']) && (strlen($data['db_prefix']) > 0 && (!preg_match('%^[a-zA-Z_][a-zA-Z0-9_]*$%', $data['db_prefix']) || strlen($data['db_prefix']) > 40))) {
                 $this->errors[] = sprintf(__('Table prefix error'), $data['db_prefix']);
             }
         }
         // End validation and check errors
         if (!empty($this->errors)) {
             return View::setPageInfo(array('languages' => $this->available_langs, 'supported_dbs' => $this->supported_dbs, 'data' => $data, 'errors' => $this->errors))->addTemplate('install.php')->display(false);
         } else {
             $data['default_style'] = $this->default_style;
             $data['avatars'] = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0;
             return $this->create_config($data);
         }
     } else {
         $base_url = str_replace('index.php', '', Url::base());
         $data = array('title' => __('My FeatherBB Forum'), 'description' => __('Description'), 'base_url' => $base_url, 'default_lang' => $this->install_lang);
         return View::setPageInfo(array('languages' => $this->available_langs, 'supported_dbs' => $this->supported_dbs, 'data' => $data, 'alerts' => array()))->addTemplate('install.php')->display(false);
     }
 }
Esempio n. 8
0
 public function get_langs()
 {
     $langs = \FeatherBB\Core\Lister::getLangs();
     $langs = $this->hook->fire('options.get_langs.langs', $langs);
     $output = '';
     foreach ($langs as $temp) {
         if ($this->config['o_default_lang'] == $temp) {
             $output .= "\t\t\t\t\t\t\t\t\t\t\t" . '<option value="' . $temp . '" selected="selected">' . str_replace('_', ' ', $temp) . '</option>' . "\n";
         } else {
             $output .= "\t\t\t\t\t\t\t\t\t\t\t" . '<option value="' . $temp . '">' . str_replace('_', ' ', $temp) . '</option>' . "\n";
         }
     }
     $output = $this->hook->fire('options.get_langs.output', $output);
     return $output;
 }
Esempio n. 9
0
</span></h2>
    <div class="box">
        <form id="profile5" method="post" action="<?php 
echo Router::pathFor('profileSection', ['id' => $id, 'section' => 'display']);
?>
">
            <input type="hidden" name="csrf_name" value="<?php 
echo $csrf_name;
?>
"><input type="hidden" name="csrf_value" value="<?php 
echo $csrf_value;
?>
">
            <div><input type="hidden" name="form_sent" value="1" /></div>
<?php 
$styles = \FeatherBB\Core\Lister::getStyles();
// Only display the style selection box if there's more than one style available
if (count($styles) == 1) {
    echo "\t\t\t" . '<div><input type="hidden" name="form_style" value="' . $styles[0] . '" /></div>' . "\n";
} elseif (count($styles) > 1) {
    ?>
            <div class="inform">
                <fieldset>
                    <legend><?php 
    _e('Style legend');
    ?>
</legend>
                    <div class="infldset">
                        <label><?php 
    _e('Styles');
    ?>
Esempio n. 10
0
 public function get_langs()
 {
     $langs = \FeatherBB\Core\Lister::getLangs();
     $langs = Container::get('hooks')->fire('model.admin.options.get_langs.langs', $langs);
     $output = '';
     foreach ($langs as $temp) {
         if (ForumSettings::get('o_default_lang') == $temp) {
             $output .= "\t\t\t\t\t\t\t\t\t\t\t" . '<option value="' . $temp . '" selected="selected">' . str_replace('_', ' ', $temp) . '</option>' . "\n";
         } else {
             $output .= "\t\t\t\t\t\t\t\t\t\t\t" . '<option value="' . $temp . '">' . str_replace('_', ' ', $temp) . '</option>' . "\n";
         }
     }
     $output = Container::get('hooks')->fire('model.admin.options.get_langs.output', $output);
     return $output;
 }