Пример #1
0
 /** ----------------------------------------
 	/**  Localization Edit Form
 	/** ----------------------------------------*/
 function edit_localization()
 {
     // Are localizations enabled?
     if (ee()->config->item('allow_member_localization') == 'n' and ee()->session->userdata('group_id') != 1) {
         return ee()->output->show_user_error('general', array(ee()->lang->line('localization_disallowed')));
     }
     // Fetch the admin config values in order to populate the form with
     // the same options
     ee()->load->model('admin_model');
     ee()->load->helper('form');
     $defaults = array('date_format' => ee()->session->userdata('date_format'), 'time_format' => ee()->session->userdata('time_format'), 'include_seconds' => ee()->session->userdata('include_seconds'));
     $config_fields = ee()->config->prep_view_vars('localization_cfg', $defaults);
     return $this->_var_swap($this->_load_element('localization_form'), array('form_declaration' => ee()->functions->form_declaration(array('action' => $this->_member_path('update_localization'))), 'path:update_localization' => $this->_member_path('update_localization'), 'form:localization' => ee()->localize->timezone_menu(ee()->session->userdata('timezone') == '' ? 'UTC' : ee()->session->userdata('timezone'), 'timezone'), 'form:date_format' => form_preference('date_format', $config_fields['fields']['date_format']), 'form:time_format' => form_preference('time_format', $config_fields['fields']['time_format']), 'form:include_seconds' => form_preference('include_seconds', $config_fields['fields']['include_seconds']), 'form:language' => ee()->functions->language_pack_names(ee()->session->userdata('language') == '' ? 'english' : ee()->session->userdata('language'))));
 }
Пример #2
0
<?php

extend_template('default');
?>

<?php 
echo form_open($form_action);
?>
	<?php 
if (isset($return_loc)) {
    echo form_hidden(array('return_location' => $return_loc));
}
?>
	<?php 
$this->table->set_template($cp_pad_table_template);
$this->table->set_heading(array('data' => lang('preference'), 'style' => 'width:50%;'), lang('setting'));
foreach ($fields as $name => $details) {
    $this->table->add_row("<strong>" . lang($name, $name) . "</strong>" . ($details['subtext'] != '' ? "<div class='subtext'>{$details['subtext']}</div>" : ''), form_preference($name, $details));
}
echo $this->table->generate();
?>
	<?php 
echo form_submit(array('name' => 'submit', 'value' => lang('submit'), 'class' => 'submit'));
echo form_close();
Пример #3
0
			<td><?php 
echo lang('time_format', 'time_format');
?>
</td>
			<td><?php 
echo form_preference('time_format', $time_format);
?>
</td>
		</tr>
		<tr class="odd">
			<td><?php 
echo lang('include_seconds', 'include_seconds');
?>
</td>
			<td><?php 
echo form_preference('include_seconds', $include_seconds);
?>
</td>
		</tr>
		<tr class="even">
			<td><?php 
echo lang('auto_custom_field', 'auto_custom_field');
?>
</td>
			<td><?php 
echo lang('auto_custom_field_blurb');
?>
<br />
			<label for="auto_custom_field"><input type="checkbox" name="auto_custom_field" value="y" <?php 
echo set_checkbox('auto_custom_field', 'y');
?>
Пример #4
0
 /**
  * Member Registration Form
  */
 public function registration_form()
 {
     // Do we allow new member registrations?
     if (ee()->config->item('allow_member_registration') == 'n') {
         $data = array('title' => lang('member_registration'), 'heading' => lang('notice'), 'content' => lang('mbr_registration_not_allowed'), 'link' => array(ee()->functions->fetch_site_index(), stripslashes(ee()->config->item('site_name'))));
         ee()->output->show_message($data);
     }
     // Is the current user logged in?
     if (ee()->session->userdata('member_id') != 0) {
         return ee()->output->show_user_error('general', array(lang('mbr_you_are_registered')));
     }
     // Fetch the registration form
     $reg_form = $this->_load_element('registration_form');
     // Do we have custom fields to show?
     $query = ee()->db->where('m_field_reg', 'y')->order_by('m_field_order')->get('member_fields');
     // If not, we'll kill the custom field variables from the template
     if ($query->num_rows() == 0) {
         $reg_form = preg_replace("/{custom_fields}.*?{\\/custom_fields}/s", "", $reg_form);
     } else {
         // Parse custom field data
         // First separate the chunk between the {custom_fields} variable pairs.
         $field_chunk = preg_match("/{custom_fields}(.*?){\\/custom_fields}/s", $reg_form, $match) ? $match['1'] : '';
         // Next, separate the chunck between the {required} variable pairs
         $req_chunk = preg_match("/{required}(.*?){\\/required}/s", $field_chunk, $match) ? $match['1'] : '';
         // Loop through the query result
         $str = '';
         foreach ($query->result_array() as $row) {
             $field = '';
             $temp = $field_chunk;
             // Replace {field_name}
             $temp = str_replace("{field_name}", $row['m_field_label'], $temp);
             if ($row['m_field_description'] == '') {
                 $temp = preg_replace("/{if field_description}.+?{\\/if}/s", "", $temp);
             } else {
                 $temp = preg_replace("/{if field_description}(.+?){\\/if}/s", "\\1", $temp);
             }
             $temp = str_replace("{field_description}", $row['m_field_description'], $temp);
             // Replace {required} pair
             if ($row['m_field_required'] == 'y') {
                 $temp = preg_replace("/" . LD . "required" . RD . ".*?" . LD . "\\/required" . RD . "/s", $req_chunk, $temp);
             } else {
                 $temp = preg_replace("/" . LD . "required" . RD . ".*?" . LD . "\\/required" . RD . "/s", '', $temp);
             }
             // Parse input fields
             // Set field width
             if (strpos($row['m_field_width'], 'px') === FALSE && strpos($row['m_field_width'], '%') === FALSE) {
                 $width = $row['m_field_width'] . 'px';
             } else {
                 $width = $row['m_field_width'];
             }
             //  Textarea fields
             if ($row['m_field_type'] == 'textarea') {
                 $rows = !isset($row['m_field_ta_rows']) ? '10' : $row['m_field_ta_rows'];
                 $field = "<textarea style=\"width:{$width};\" name=\"m_field_id_" . $row['m_field_id'] . "\"  cols='50' rows='{$rows}' class=\"textarea\" ></textarea>";
             } else {
                 //  Text fields
                 if ($row['m_field_type'] == 'text') {
                     $maxlength = $row['m_field_maxl'] == 0 ? '100' : $row['m_field_maxl'];
                     $field = "<input type=\"text\" name=\"m_field_id_" . $row['m_field_id'] . "\" value=\"\" class=\"input\" maxlength=\"{$maxlength}\" size=\"40\" style=\"width:{$width};\" />";
                 } elseif ($row['m_field_type'] == 'select') {
                     //  Drop-down fields
                     $select_list = trim($row['m_field_list_items']);
                     if ($select_list != '') {
                         $field = "<select name=\"m_field_id_" . $row['m_field_id'] . "\" class=\"select\">";
                         foreach (explode("\n", $select_list) as $v) {
                             $v = trim($v);
                             $field .= "<option value=\"{$v}\">{$v}</option>";
                         }
                         $field .= "</select>";
                     }
                 }
             }
             $temp = str_replace("{field}", $field, $temp);
             $str .= $temp;
         }
         // since $str may have sequences that look like PCRE backreferences,
         // the two choices are to escape them and use preg_replace() or to
         // match the pattern and use str_replace().  This way happens
         // to be faster in this case.
         if (preg_match("/" . LD . "custom_fields" . RD . ".*?" . LD . "\\/custom_fields" . RD . "/s", $reg_form, $match)) {
             $reg_form = str_replace($match[0], $str, $reg_form);
         }
     }
     // {if captcha}
     if (preg_match("/{if captcha}(.+?){\\/if}/s", $reg_form, $match)) {
         if (ee()->config->item('use_membership_captcha') == 'y') {
             $reg_form = preg_replace("/{if captcha}.+?{\\/if}/s", $match['1'], $reg_form);
             // Bug fix.  Deprecate this later..
             $reg_form = str_replace('{captcha_word}', '', $reg_form);
             if (!class_exists('Template')) {
                 $reg_form = preg_replace("/{captcha}/", ee()->functions->create_captcha(), $reg_form);
             }
         } else {
             $reg_form = preg_replace("/{if captcha}.+?{\\/if}/s", "", $reg_form);
         }
     }
     $un_min_len = str_replace("%x", ee()->config->item('un_min_len'), lang('mbr_username_length'));
     $pw_min_len = str_replace("%x", ee()->config->item('pw_min_len'), lang('mbr_password_length'));
     // Fetch the admin config values in order to populate the form with
     // the same options
     ee()->load->model('admin_model');
     ee()->load->helper('form');
     $config_fields = ee()->config->prep_view_vars('localization_cfg');
     // Parse languge lines
     $reg_form = $this->_var_swap($reg_form, array('lang:username_length' => $un_min_len, 'lang:password_length' => $pw_min_len, 'form:localization' => ee()->localize->timezone_menu(), 'form:date_format' => form_preference('date_format', $config_fields['fields']['date_format']), 'form:time_format' => form_preference('time_format', $config_fields['fields']['time_format']), 'form:include_seconds' => form_preference('include_seconds', $config_fields['fields']['include_seconds']), 'form:language' => ee()->functions->language_pack_names('english')));
     // Generate Form declaration
     $data['hidden_fields'] = array('ACT' => ee()->functions->fetch_action_id('Member', 'register_member'), 'RET' => ee()->functions->fetch_site_index(), 'FROM' => $this->in_forum == TRUE ? 'forum' : '');
     if ($this->in_forum === TRUE) {
         $data['hidden_fields']['board_id'] = $this->board_id;
     }
     $data['id'] = 'register_member_form';
     // Return the final rendered form
     return ee()->functions->form_declaration($data) . $reg_form . "\n" . "</form>";
 }
Пример #5
0
?>

	<p class="cf">
		<?php 
echo form_label(lang('timezone'), 'timezone');
?>
		<span class="timezone">
			<?php 
echo $timezone;
?>
		</span>
	</p>

	<?php 
foreach ($fields as $name => $details) {
    echo "<p>" . lang($name, $name) . form_preference($name, $details) . "</p>";
}
?>

	<p>
		<?php 
echo form_label(lang('language'), 'language');
?>
		<?php 
echo form_dropdown('language', $language_options, $language, 'id="language"');
?>
	</p>

	<p class="submit"><?php 
echo form_submit('localization_update', lang('update'), 'class="submit"');
?>