Пример #1
0
 public function render_views($params)
 {
     $filename = isset($params['filename']) ? $params['filename'] : '';
     $vars = isset($params['vars']) ? $params['vars'] : '';
     //if (!isset($vars['fields']) || empty($vars['fields']) || !is_array($vars['fields']))
     //	return;
     $form_fields = '';
     die('<pre>' . print_r($vars['fields'], true));
     $this->ci->load->helper('form');
     foreach ($vars['fields'] as $name => $opts) {
         switch (strtolower($opts['field_type'])) {
             case 'checkbox':
                 $form_fields .= form_checkbox($name, 1);
                 break;
             case 'date':
                 $form_fields .= form_date(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
                 break;
             case 'datetime':
                 $form_fields .= form_datetime(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
                 break;
             case 'dropdown':
                 $options = isset($opts['options']) ? $opts['options'] : array();
                 $form_fields .= form_dropdown(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"), $options);
                 break;
             case 'email':
                 $form_fields .= form_email(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
                 break;
             case 'input':
                 $form_fields .= form_input(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
                 break;
             case 'month':
                 $form_fields .= form_month(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
                 break;
             case 'number':
                 $form_fields .= form_number(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
                 break;
             case 'range':
                 $form_fields .= form_range(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
                 break;
             case 'textarea':
                 $rows = 10;
                 $cols = 40;
                 $form_fields .= form_input(array('name' => $name, 'class' => 'input-xxlarge', 'value' => "<?php echo set_value('{$name}') ?>", 'rows' => $rows, 'cols' => $cols));
                 break;
             case 'url':
                 $form_fields .= form_url(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
                 break;
         }
     }
     //echo '<pre>';
     //die(print_r($params));
     $this->tpl = str_replace('{form_fields}', $form_fields, $this->tpl);
 }
Пример #2
0
<?php

echo form_open('auth/forgot', 'class="form-signin" autocomplete="off"');
?>

	<a href="/auth/login"><img src="/assets/img/logo.png" alt="Stockholm Makerspace" class="logo"></a>
	
	<p><strong>Forgot your password?</strong> No worries. Just enter your e-mail address below to initialize a password reset.</p>

	<br>
	
	<?php 
echo form_email('email', set_value('email'), 'class="input-block-level" placeholder="E-mail address" required');
?>

	<br><br>
	
	<button class="btn btn-medium btn-primary" type="submit">Send password reset</button>
	<a href="/auth/login" class="btn btn-medium pull-right">Return to login</a>
	
<?php 
echo form_close();
Пример #3
0
function guest_register()
{
    global $tshirt_sizes, $enable_tshirt_size, $default_theme;
    $msg = "";
    $nick = "";
    $lastname = "";
    $prename = "";
    $age = "";
    $tel = "";
    $dect = "";
    $mobile = "";
    $mail = "";
    $email_shiftinfo = false;
    $jabber = "";
    $hometown = "";
    $comment = "";
    $tshirt_size = '';
    $password_hash = "";
    $selected_angel_types = array();
    $planned_arrival_date = null;
    $angel_types_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
    $angel_types = array();
    foreach ($angel_types_source as $angel_type) {
        $angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? " (restricted)" : "");
        if (!$angel_type['restricted']) {
            $selected_angel_types[] = $angel_type['id'];
        }
    }
    if (isset($_REQUEST['submit'])) {
        $ok = true;
        if (isset($_REQUEST['nick']) && strlen(User_validate_Nick($_REQUEST['nick'])) > 1) {
            $nick = User_validate_Nick($_REQUEST['nick']);
            if (sql_num_query("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "' LIMIT 1") > 0) {
                $ok = false;
                $msg .= error(sprintf(_("Your nick &quot;%s&quot; already exists."), $nick), true);
            }
        } else {
            $ok = false;
            $msg .= error(sprintf(_("Your nick &quot;%s&quot; is too short (min. 2 characters)."), User_validate_Nick($_REQUEST['nick'])), true);
        }
        if (isset($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) {
            $mail = strip_request_item('mail');
            if (!check_email($mail)) {
                $ok = false;
                $msg .= error(_("E-mail address is not correct."), true);
            }
        } else {
            $ok = false;
            $msg .= error(_("Please enter your e-mail."), true);
        }
        if (isset($_REQUEST['email_shiftinfo'])) {
            $email_shiftinfo = true;
        }
        if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
            $jabber = strip_request_item('jabber');
            if (!check_email($jabber)) {
                $ok = false;
                $msg .= error(_("Please check your jabber account information."), true);
            }
        }
        if ($enable_tshirt_size) {
            if (isset($_REQUEST['tshirt_size']) && isset($tshirt_sizes[$_REQUEST['tshirt_size']]) && $_REQUEST['tshirt_size'] != '') {
                $tshirt_size = $_REQUEST['tshirt_size'];
            } else {
                $ok = false;
                $msg .= error(_("Please select your shirt size."), true);
            }
        }
        if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= MIN_PASSWORD_LENGTH) {
            if ($_REQUEST['password'] != $_REQUEST['password2']) {
                $ok = false;
                $msg .= error(_("Your passwords don't match."), true);
            }
        } else {
            $ok = false;
            $msg .= error(sprintf(_("Your password is too short (please use at least %s characters)."), MIN_PASSWORD_LENGTH), true);
        }
        if (isset($_REQUEST['planned_arrival_date']) && DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))) {
            $planned_arrival_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))->getTimestamp();
        } else {
            $ok = false;
            $msg .= error(_("Please enter your planned date of arrival."), true);
        }
        $selected_angel_types = array();
        foreach ($angel_types as $angel_type_id => $angel_type_name) {
            if (isset($_REQUEST['angel_types_' . $angel_type_id])) {
                $selected_angel_types[] = $angel_type_id;
            }
        }
        // Trivia
        if (isset($_REQUEST['lastname'])) {
            $lastname = strip_request_item('lastname');
        }
        if (isset($_REQUEST['prename'])) {
            $prename = strip_request_item('prename');
        }
        if (isset($_REQUEST['age']) && preg_match("/^[0-9]{0,4}\$/", $_REQUEST['age'])) {
            $age = strip_request_item('age');
        }
        if (isset($_REQUEST['tel'])) {
            $tel = strip_request_item('tel');
        }
        if (isset($_REQUEST['dect'])) {
            $dect = strip_request_item('dect');
        }
        if (isset($_REQUEST['mobile'])) {
            $mobile = strip_request_item('mobile');
        }
        if (isset($_REQUEST['hometown'])) {
            $hometown = strip_request_item('hometown');
        }
        if (isset($_REQUEST['comment'])) {
            $comment = strip_request_item_nl('comment');
        }
        if ($ok) {
            sql_query("\n          INSERT INTO `User` SET \n          `color`='" . sql_escape($default_theme) . "', \n          `Nick`='" . sql_escape($nick) . "', \n          `Vorname`='" . sql_escape($prename) . "', \n          `Name`='" . sql_escape($lastname) . "', \n          `Alter`='" . sql_escape($age) . "', \n          `Telefon`='" . sql_escape($tel) . "', \n          `DECT`='" . sql_escape($dect) . "', \n          `Handy`='" . sql_escape($mobile) . "', \n          `email`='" . sql_escape($mail) . "', \n          `email_shiftinfo`=" . sql_bool($email_shiftinfo) . ", \n          `jabber`='" . sql_escape($jabber) . "',\n          `Size`='" . sql_escape($tshirt_size) . "', \n          `Passwort`='" . sql_escape($password_hash) . "', \n          `kommentar`='" . sql_escape($comment) . "', \n          `Hometown`='" . sql_escape($hometown) . "', \n          `CreateDate`=NOW(), \n          `Sprache`='" . sql_escape($_SESSION["locale"]) . "',\n          `arrival_date`=NULL,\n          `planned_arrival_date`='" . sql_escape($planned_arrival_date) . "'");
            // Assign user-group and set password
            $user_id = sql_id();
            sql_query("INSERT INTO `UserGroups` SET `uid`='" . sql_escape($user_id) . "', `group_id`=-2");
            set_password($user_id, $_REQUEST['password']);
            // Assign angel-types
            $user_angel_types_info = array();
            foreach ($selected_angel_types as $selected_angel_type_id) {
                sql_query("INSERT INTO `UserAngelTypes` SET `user_id`='" . sql_escape($user_id) . "', `angeltype_id`='" . sql_escape($selected_angel_type_id) . "'");
                $user_angel_types_info[] = $angel_types[$selected_angel_type_id];
            }
            engelsystem_log("User " . $nick . " signed up as: " . join(", ", $user_angel_types_info));
            success(_("Angel registration successful!"));
            redirect('?');
        }
    }
    return page_with_title(register_title(), array(_("By completing this form you're registering as a Chaos-Angel. This script will create you an account in the angel task sheduler."), $msg, msg(), form(array(div('row', array(div('col-md-6', array(div('row', array(div('col-sm-4', array(form_text('nick', _("Nick") . ' ' . entry_required(), $nick))), div('col-sm-8', array(form_email('mail', _("E-Mail") . ' ' . entry_required(), $mail), form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $email_shiftinfo))))), div('row', array(div('col-sm-6', array(form_date('planned_arrival_date', _("Planned date of arrival") . ' ' . entry_required(), $planned_arrival_date, time()))), div('col-sm-6', array($enable_tshirt_size ? form_select('tshirt_size', _("Shirt size") . ' ' . entry_required(), $tshirt_sizes, $tshirt_size) : '')))), div('row', array(div('col-sm-6', array(form_password('password', _("Password") . ' ' . entry_required()))), div('col-sm-6', array(form_password('password2', _("Confirm password") . ' ' . entry_required()))))), form_checkboxes('angel_types', _("What do you want to do?") . sprintf(" (<a href=\"%s\">%s</a>)", page_link_to('angeltypes') . '&action=about', _("Description of job types")), $angel_types, $selected_angel_types), form_info("", _("Restricted angel types need will be confirmed later by an archangel. You can change your selection in the options section.")))), div('col-md-6', array(div('row', array(div('col-sm-4', array(form_text('dect', _("DECT"), $dect))), div('col-sm-4', array(form_text('mobile', _("Mobile"), $mobile))), div('col-sm-4', array(form_text('tel', _("Phone"), $tel))))), form_text('jabber', _("Jabber"), $jabber), div('row', array(div('col-sm-6', array(form_text('prename', _("First name"), $prename))), div('col-sm-6', array(form_text('lastname', _("Last name"), $lastname))))), div('row', array(div('col-sm-3', array(form_text('age', _("Age"), $age))), div('col-sm-9', array(form_text('hometown', _("Hometown"), $hometown))))), form_info(entry_required() . ' = ' . _("Entry required!")))))), form_submit('submit', _("Register"))))));
}
Пример #4
0
function guest_register()
{
    global $default_theme, $genders;
    $msg = "";
    $nick = "";
    $lastname = "";
    $prename = "";
    $age = "";
    $tel = "";
    $mobile = "";
    $mail = "";
    $email_shiftinfo = false;
    $hometown = "";
    $comment = "";
    $password_hash = "";
    $selected_angel_types = array();
    $gender = "none";
    $angel_types_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
    $angel_types = array();
    foreach ($angel_types_source as $angel_type) {
        $angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? " (restricted)" : "");
        if (!$angel_type['restricted']) {
            $selected_angel_types[] = $angel_type['id'];
        }
    }
    if (isset($_REQUEST['submit'])) {
        $ok = true;
        if (isset($_REQUEST['nick']) && strlen(User_validate_Nick($_REQUEST['nick'])) > 1) {
            $nick = User_validate_Nick($_REQUEST['nick']);
            if (sql_num_query("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "' LIMIT 1") > 0) {
                $ok = false;
                $msg .= error(sprintf(_("Your nick &quot;%s&quot; already exists."), $nick), true);
            }
        } else {
            $ok = false;
            $msg .= error(sprintf(_("Your nick &quot;%s&quot; is too short (min. 2 characters)."), User_validate_Nick($_REQUEST['nick'])), true);
        }
        if (isset($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) {
            $mail = strip_request_item('mail');
            if (!check_email($mail)) {
                $ok = false;
                $msg .= error(_("E-mail address is not correct."), true);
            }
        } else {
            $ok = false;
            $msg .= error(_("Please enter your e-mail."), true);
        }
        if (isset($_REQUEST['email_shiftinfo'])) {
            $email_shiftinfo = true;
        }
        if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= MIN_PASSWORD_LENGTH) {
            if ($_REQUEST['password'] != $_REQUEST['password2']) {
                $ok = false;
                $msg .= error(_("Your passwords don't match."), true);
            }
        } else {
            $ok = false;
            $msg .= error(sprintf(_("Your password is too short (please use at least %s characters)."), MIN_PASSWORD_LENGTH), true);
        }
        $selected_angel_types = array();
        foreach ($angel_types as $angel_type_id => $angel_type_name) {
            if (isset($_REQUEST['angel_types_' . $angel_type_id])) {
                $selected_angel_types[] = $angel_type_id;
            }
        }
        // Trivia
        if (isset($_REQUEST['lastname'])) {
            $lastname = strip_request_item('lastname');
        }
        if (isset($_REQUEST['prename'])) {
            $prename = strip_request_item('prename');
        }
        if (isset($_REQUEST['age']) && preg_match("/^[0-9]{0,4}\$/", $_REQUEST['age'])) {
            $age = strip_request_item('age');
        }
        if (isset($_REQUEST['tel'])) {
            $tel = strip_request_item('tel');
        }
        if (isset($_REQUEST['mobile'])) {
            $mobile = strip_request_item('mobile');
        }
        if (isset($_REQUEST['hometown'])) {
            $hometown = strip_request_item('hometown');
        }
        if (isset($_REQUEST['comment'])) {
            $comment = strip_request_item_nl('comment');
        }
        if (isset($_REQUEST['gender']) && array_key_exists($_REQUEST['gender'], $genders)) {
            $gender = $_REQUEST['gender'];
        }
        if ($ok) {
            $confirmationToken = bin2hex(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM));
            $confirmationTokenUrl = page_link_to_absolute('user_activate_account') . '&token=' . $confirmationToken;
            sql_query("\n          INSERT INTO `User` SET \n          `color`='" . sql_escape($default_theme) . "', \n          `Nick`='" . sql_escape($nick) . "', \n          `Vorname`='" . sql_escape($prename) . "', \n          `Name`='" . sql_escape($lastname) . "', \n          `Alter`='" . sql_escape($age) . "', \n          `gender`='" . sql_escape($gender) . "',\n          `Telefon`='" . sql_escape($tel) . "', \n          `Handy`='" . sql_escape($mobile) . "', \n          `email`='" . sql_escape($mail) . "', \n          `email_shiftinfo`=" . sql_bool($email_shiftinfo) . ", \n          `Passwort`='" . sql_escape($password_hash) . "', \n          `kommentar`='" . sql_escape($comment) . "', \n          `Hometown`='" . sql_escape($hometown) . "', \n          `CreateDate`=NOW(), \n          `Sprache`='" . sql_escape($_SESSION["locale"]) . "',\n          `arrival_date`=NULL,\n          `planned_arrival_date`= 0,\n          `mailaddress_verification_token` = '" . sql_escape($confirmationToken) . "',\n          `user_account_approved` = 0");
            // Assign user-group and set password
            $user_id = sql_id();
            sql_query("INSERT INTO `UserGroups` SET `uid`='" . sql_escape($user_id) . "', `group_id`=-2");
            set_password($user_id, $_REQUEST['password']);
            // Assign angel-types
            $user_angel_types_info = array();
            foreach ($selected_angel_types as $selected_angel_type_id) {
                sql_query("INSERT INTO `UserAngelTypes` SET `user_id`='" . sql_escape($user_id) . "', `angeltype_id`='" . sql_escape($selected_angel_type_id) . "'");
                $user_angel_types_info[] = $angel_types[$selected_angel_type_id];
            }
            engelsystem_log("User " . $nick . " signed up as: " . join(", ", $user_angel_types_info));
            engelsystem_email($mail, _('Please confirm your eMail-address'), sprintf(_('Hello %1$s! Thanks for signing up at Engelsystem. Please confirm your eMail-address by clicking the following link: %2$s'), $mail, $confirmationTokenUrl));
            success(_("Angel registration successful! Please click the confirmation link in the eMail we sent you to activate your account."));
            redirect('?');
        }
    }
    return page_with_title(register_title(), array(_("By completing this form you're registering as an helper. Please enter a username/nick of your choice, your e-mail adress and your full name. Only your nick will be shown to other users."), $msg, msg(), form(array(div('row', array(div('col-md-6', array(div('row', array(div('col-sm-4', array(form_text('nick', _("Nick") . ' ' . entry_required(), $nick))), div('col-sm-8', array(form_email('mail', _("E-Mail") . ' ' . entry_required(), $mail), form_checkbox('email_shiftinfo', _("Please keep me informed by e-mail, e.g. if my shifts change"), $email_shiftinfo))), div('col-sm-4', array(form_text('prename', _("First name") . ' ' . entry_required(), $prename))), div('col-sm-4', array(form_text('lastname', _("Last name") . ' ' . entry_required(), $lastname))))), div('row', array(div('col-sm-6', array()), div('col-sm-6', array()))), div('row', array(div('col-sm-6', array(form_password('password', _("Password") . ' ' . entry_required()))), div('col-sm-6', array(form_password('password2', _("Confirm password") . ' ' . entry_required()))))))), div('col-md-6', array(div('row', array(div('col-sm-4', array(form_text('mobile', _("Mobile"), $mobile))), div('col-sm-4', array(form_text('tel', _("Phone"), $tel))))), div('row', array(div('col-sm-3', array(form_text('age', _("Age"), $age))), div('col-sm-6', array(form_text('comment', _("Additional Information(Language / Profession)"), $comment))))), form_info(entry_required() . ' = ' . _("Entry required!")))))), form_submit('submit', _("Register"))))));
}
Пример #5
0
<div class="row">
	<?php 
echo form_open('members/add', 'class="form-horizontal" autocomplete="off"');
?>

	<div class="span6 pull-left">
		<?php 
echo form_fieldset('Member Information');
?>
			<div class="control-group">
				<?php 
echo form_label('E-mail address', 'email', array('class' => 'control-label'));
?>
				<div class="controls">
					<?php 
echo form_email('email', set_value('email'), 'id="email" required placeholder="*****@*****.**"');
?>
				</div>
			</div>
			
			<div class="control-group">
				<?php 
echo form_label('Password', 'password', array('class' => 'control-label'));
?>
				<div class="controls">
					<?php 
echo form_password('password', '', 'id="password"');
?>
					<span class="help-block">Leave empty to generate a random password.</span>
				</div>
			</div>
Пример #6
0
					<label class="<?php 
    echo BS_COL_SM_3;
    ?>
 control-label" for="input-<?php 
    echo $_field;
    ?>
"><?php 
    echo $_label;
    ?>
</label>
					<div class="<?php 
    echo BS_COL_SM_9;
    ?>
">
						<?php 
    echo form_email($_field, set_value($_field), 'id="input-<?=$_field?>" placeholder="' . $_placeholder . '" class="form-control "');
    ?>
						<?php 
    echo form_error($_field, '<p class="help-block">', '</p>');
    ?>
					</div>
				</div>
				<?php 
}
if (APP_NATIVE_LOGIN_USING == 'USERNAME' || APP_NATIVE_LOGIN_USING == 'BOTH') {
    $_field = 'username';
    $_label = lang('form_label_username');
    $_placeholder = lang('auth_register_username_placeholder');
    ?>
				<div class="form-group <?php 
    echo form_error($_field) ? 'has-error' : '';