diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-05-14 23:24:42 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-05-14 23:24:42 +0000 |
commit | b7ea2e2e377568a3730ed46b8df1751cc747323f (patch) | |
tree | 737a894cbbf111fdc205d2f015b25e728b337da3 /views | |
parent | 0212a359267ab5e109a80d14f8c069225202ac3b (diff) | |
download | elgg-b7ea2e2e377568a3730ed46b8df1751cc747323f.tar.gz elgg-b7ea2e2e377568a3730ed46b8df1751cc747323f.tar.bz2 |
clean up installation input views
git-svn-id: http://code.elgg.org/elgg/trunk@9087 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views')
-rw-r--r-- | views/installation/input/access.php | 6 | ||||
-rw-r--r-- | views/installation/input/button.php | 20 | ||||
-rw-r--r-- | views/installation/input/checkboxes.php | 18 | ||||
-rw-r--r-- | views/installation/input/dropdown.php | 6 | ||||
-rw-r--r-- | views/installation/input/form.php | 30 | ||||
-rw-r--r-- | views/installation/input/hidden.php | 8 | ||||
-rw-r--r-- | views/installation/input/longtext.php | 22 | ||||
-rw-r--r-- | views/installation/input/password.php | 6 | ||||
-rw-r--r-- | views/installation/input/reset.php | 13 | ||||
-rw-r--r-- | views/installation/input/securitytoken.php | 15 | ||||
-rw-r--r-- | views/installation/input/submit.php | 6 | ||||
-rw-r--r-- | views/installation/input/text.php | 7 |
12 files changed, 16 insertions, 141 deletions
diff --git a/views/installation/input/access.php b/views/installation/input/access.php index 3fde7295f..7665d8bca 100644 --- a/views/installation/input/access.php +++ b/views/installation/input/access.php @@ -3,11 +3,7 @@ * Elgg access level input * Displays a dropdown input field * - * @package Elgg - * @subpackage Core - * * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag * @uses $vars['name'] The name of the input field * */ @@ -28,7 +24,7 @@ if (is_array($vars['options']) && sizeof($vars['options']) > 0) { ?> - <select name="<?php echo $vars['name']; ?>" <?php if (isset($vars['js'])) echo $vars['js']; ?> <?php if ((isset($vars['disabled'])) && ($vars['disabled'])) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>"> + <select name="<?php echo $vars['name']; ?>" <?php if ((isset($vars['disabled'])) && ($vars['disabled'])) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>"> <?php foreach($vars['options'] as $key => $option) { diff --git a/views/installation/input/button.php b/views/installation/input/button.php index a69f7dbfa..29a37dd55 100644 --- a/views/installation/input/button.php +++ b/views/installation/input/button.php @@ -1,18 +1,10 @@ <?php /** * Create a input button - * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides - * extra security which help prevent CSRF attacks. - * - * @package Elgg - * @subpackage Core * * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag * @uses $vars['name'] The name of the input field - * @uses $vars['type'] Submit or reset, defaults to submit. - * @uses $vars['src'] Src of an image - * + * @uses $vars['type'] submit or button. */ $class = $vars['class']; @@ -30,9 +22,6 @@ switch ($type) { case 'button' : $type='button'; break; - case 'reset' : - $type='reset'; - break; case 'submit': default: $type = 'submit'; @@ -40,10 +29,5 @@ switch ($type) { $value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); $name = $vars['name']; -$src = $vars['src']; -// blank src if trying to access an offsite image. -if (strpos($src, elgg_get_site_url()) === false) { - $src = ""; -} ?> -<input type="<?php echo $type; ?>" <?php if (isset($vars['id'])) echo "id=\"{$vars['id']}\"";?> <?php echo $vars['js']; ?> value="<?php echo $value; ?>" src="<?php echo $src; ?>" class="<?php echo $class; ?>" />
\ No newline at end of file +<input type="<?php echo $type; ?>" <?php if (isset($vars['id'])) echo "id=\"{$vars['id']}\"";?> value="<?php echo $value; ?>" class="<?php echo $class; ?>" />
\ No newline at end of file diff --git a/views/installation/input/checkboxes.php b/views/installation/input/checkboxes.php index c78fe4db0..026ff04ba 100644 --- a/views/installation/input/checkboxes.php +++ b/views/installation/input/checkboxes.php @@ -3,17 +3,6 @@ * Elgg checkbox input * Displays a checkbox input field * - * @note This also includes a hidden input with the same name as the checkboxes - * to make sure something is sent to the server. The default value is 0. - * If using JS, be specific to avoid selecting the hidden default value: - * $('input[type=checkbox][name=name]') - * - * @warning Passing integers as labels does not currently work due to a - * deprecated hack that will be removed in Elgg 1.9. To use integer labels, - * the labels must be character codes: 1 would be 1 - * - * @package Elgg - * @subpackage Core * * @uses string $vars['name'] The name of the input fields * (Forced to an array by appending []) @@ -40,7 +29,6 @@ $default = (isset($vars['default'])) ? $vars['default'] : 0; $id = (isset($vars['id'])) ? $vars['id'] : ''; $disabled = (isset($vars['disabled'])) ? $vars['disabled'] : FALSE; -$js = (isset($vars['js'])) ? $vars['js'] : ''; $class = "elgg-input-checkboxes elgg-$align"; if ($additional_class) { @@ -55,18 +43,12 @@ if ($options && count($options) > 0) { echo "<ul class=\"$class\">"; foreach ($options as $label => $option) { - // @deprecated 1.8 Remove in 1.9 - if (is_integer($label)) { - elgg_deprecated_notice('$vars[\'options\'] must be an associative array in input/checkboxes', 1.8); - $label = $option; - } $input_vars = array( 'checked' => in_array(elgg_strtolower($option), $value_array), 'value' => $option, 'disabled' => $disabled, 'id' => $id, - 'js' => $js, 'default' => false, ); diff --git a/views/installation/input/dropdown.php b/views/installation/input/dropdown.php index 141ff65b0..46e15c657 100644 --- a/views/installation/input/dropdown.php +++ b/views/installation/input/dropdown.php @@ -3,11 +3,7 @@ * Elgg dropdown input * Displays a dropdown input field * - * @package Elgg - * @subpackage Core - * * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag * @uses $vars['name'] The name of the input field * @uses $vars['options'] An array of strings representing the options for the dropdown field * @uses $vars['options_values'] An associative array of "value" => "option" where "value" is an internal name and "option" is @@ -20,7 +16,7 @@ if (!$class) { $class = "elgg-input-dropdown"; } ?> -<select name="<?php echo $vars['name']; ?>" <?php echo $vars['js']; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>"> +<select name="<?php echo $vars['name']; ?>" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>"> <?php if ($vars['options_values']) { foreach($vars['options_values'] as $value => $option) { diff --git a/views/installation/input/form.php b/views/installation/input/form.php index b131c9d10..d48d5fed8 100644 --- a/views/installation/input/form.php +++ b/views/installation/input/form.php @@ -1,36 +1,26 @@ <?php /** * Create a form for data submission. - * Use this view for forms rather than creating a form tag in the wild as it provides - * extra security which help prevent CSRF attacks. * - * @package Elgg - * @subpackage Core - * - * @uses $vars['body'] The body of the form (made up of other input/xxx views and html - * @uses $vars['method'] Method (default POST) - * @uses $vars['enctype'] How the form is encoded, default blank + * @uses $vars['body'] The body of the form (made up of other input/xxx views and html * @uses $vars['action'] URL of the action being called - * + * @uses $vars['method'] Method (default POST) + * @uses $vars['id'] Form id + * @uses $vars['name'] Form name */ if (isset($vars['id'])) { - $id = $vars['id']; + $id = "id = \"{$vars['id']}\""; } else { $id = ''; } if (isset($vars['name'])) { - $name = $vars['name']; + $name = "name = \"{$vars['name']}\""; } else { $name = ''; } $body = $vars['body']; $action = $vars['action']; -if (isset($vars['enctype'])) { - $enctype = $vars['enctype']; -} else { - $enctype = ''; -} if (isset($vars['method'])) { $method = $vars['method']; } else { @@ -39,13 +29,7 @@ if (isset($vars['method'])) { $method = strtolower($method); -// Generate a security header -$security_header = ""; -if (!isset($vars['disable_security']) || $vars['disable_security'] != true) { - $security_header = elgg_view('input/securitytoken'); -} ?> -<form <?php if ($id) { ?>id="<?php echo $id; ?>" <?php } ?> <?php if ($name) { ?>name="<?php echo $name; ?>" <?php } ?> action="<?php echo $action; ?>" method="<?php echo $method; ?>" <?php if ($enctype!="") echo "enctype=\"$enctype\""; ?> <?php echo $vars['js']; ?>> -<?php echo $security_header; ?> +<form <?php echo "$id $name"; ?> action="<?php echo $action; ?>" method="<?php echo $method; ?>"> <?php echo $body; ?> </form>
\ No newline at end of file diff --git a/views/installation/input/hidden.php b/views/installation/input/hidden.php index c9800ebbb..139ff03d7 100644 --- a/views/installation/input/hidden.php +++ b/views/installation/input/hidden.php @@ -1,16 +1,10 @@ <?php /** * Create a hidden data field - * Use this view for forms rather than creating a hidden tag in the wild as it provides - * extra security which help prevent CSRF attacks. - * - * @package Elgg - * @subpackage Core * * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag * @uses $vars['name'] The name of the input field * */ ?> -<input type="hidden" <?php echo $vars['js']; ?> name="<?php echo $vars['name']; ?>" value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" />
\ No newline at end of file +<input type="hidden" name="<?php echo $vars['name']; ?>" value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" />
\ No newline at end of file diff --git a/views/installation/input/longtext.php b/views/installation/input/longtext.php deleted file mode 100644 index 820a51da4..000000000 --- a/views/installation/input/longtext.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * Elgg long text input - * Displays a long text input field - * - * @package Elgg - * @subpackage Core - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['name'] The name of the input field - * - */ - -$class = $vars['class']; -if (!$class) { - $class = "elgg-input-textarea"; -} - -?> - -<textarea class="<?php echo $class; ?>" name="<?php echo $vars['name']; ?>" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo $vars['value']; ?></textarea>
\ No newline at end of file diff --git a/views/installation/input/password.php b/views/installation/input/password.php index 8ba79228d..18811109b 100644 --- a/views/installation/input/password.php +++ b/views/installation/input/password.php @@ -3,11 +3,7 @@ * Elgg password input * Displays a password input field * - * @package Elgg - * @subpackage Core - * * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag * @uses $vars['name'] The name of the input field * */ @@ -18,4 +14,4 @@ if (!$class) { } ?> -<input type="password" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['name']; ?>" <?php if (isset($vars['id'])) echo "id=\"{$vars['id']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>" /> +<input type="password" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> name="<?php echo $vars['name']; ?>" <?php if (isset($vars['id'])) echo "id=\"{$vars['id']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>" /> diff --git a/views/installation/input/reset.php b/views/installation/input/reset.php deleted file mode 100644 index 0c83a92ca..000000000 --- a/views/installation/input/reset.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -/** - * Create a reset input button - * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides - * extra security which help prevent CSRF attacks. - * - * @package Elgg - * @subpackage Core - */ - -$vars['type'] = 'reset'; - -echo elgg_view('input/button', $vars);
\ No newline at end of file diff --git a/views/installation/input/securitytoken.php b/views/installation/input/securitytoken.php deleted file mode 100644 index 75410848a..000000000 --- a/views/installation/input/securitytoken.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * CSRF security token view for use with secure forms. - * - * It is still recommended that you use input/form. - * - * @package Elgg - * @subpackage Core - */ - -$ts = time(); -$token = generate_action_token($ts); - -echo elgg_view('input/hidden', array('name' => '__elgg_token', 'value' => $token)); -echo elgg_view('input/hidden', array('name' => '__elgg_ts', 'value' => $ts)); diff --git a/views/installation/input/submit.php b/views/installation/input/submit.php index aefb2ada6..5d891c380 100644 --- a/views/installation/input/submit.php +++ b/views/installation/input/submit.php @@ -1,11 +1,9 @@ <?php /** * Create a submit input button - * Use this view for forms rather than creating a submit/reset button tag in the wild as it provides - * extra security which help prevent CSRF attacks. * - * @package Elgg - * @subpackage Core + * @uses $vars['value'] The current value, if any + * @uses $vars['name'] The name of the input field */ $vars['type'] = 'submit'; diff --git a/views/installation/input/text.php b/views/installation/input/text.php index c59278b40..2caf547b6 100644 --- a/views/installation/input/text.php +++ b/views/installation/input/text.php @@ -3,13 +3,8 @@ * Elgg text input * Displays a text input field * - * @package Elgg - * @subpackage Core - - * * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag * @uses $vars['name'] The name of the input field * @uses $vars['disabled'] If true then control is read-only * @uses $vars['class'] Class override @@ -21,4 +16,4 @@ if (!$class) { } ?> -<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['name']; ?>" value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class ?>"/>
\ No newline at end of file +<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> name="<?php echo $vars['name']; ?>" value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class ?>"/>
\ No newline at end of file |