]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
clean up installation input views
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 14 May 2011 23:24:42 +0000 (23:24 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 14 May 2011 23:24:42 +0000 (23:24 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@9087 36083f99-b078-4883-b0ff-0f9b5a30f544

12 files changed:
views/installation/input/access.php
views/installation/input/button.php
views/installation/input/checkboxes.php
views/installation/input/dropdown.php
views/installation/input/form.php
views/installation/input/hidden.php
views/installation/input/longtext.php [deleted file]
views/installation/input/password.php
views/installation/input/reset.php [deleted file]
views/installation/input/securitytoken.php [deleted file]
views/installation/input/submit.php
views/installation/input/text.php

index 3fde7295fccf4fa4a6438bd18002818cd93483b7..7665d8bca81a782d97c21e053137622cac5035a9 100644 (file)
@@ -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) {
index a69f7dbfaad309c6b9af3dd6a0e1baccbe26df58..29a37dd553d2c777b9eaba1bd47eaa5e822dbc43 100644 (file)
@@ -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
index c78fe4db08ba32211a3787e87df967f3e7c39f2d..026ff04baba00bc75902d2b910ed7b0637c63bcc 100644 (file)
@@ -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 &#0049;
- *
- * @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,
                );
 
index 141ff65b0adcc6dfba571359c75644a4736ba983..46e15c657945ab506ee491ba08ec1634e94c8794 100644 (file)
@@ -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) {
index b131c9d1029381d4d9fcbb8e4ad7a912f8a5311f..d48d5fed87ed4eedd8b0689d4093529037a10026 100644 (file)
@@ -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
index c9800ebbb6caa6fbf9d86d96d326df9b80a6b12f..139ff03d782ff0de7fb9fe173dcd4874b3c5397d 100644 (file)
@@ -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 (file)
index 820a51d..0000000
+++ /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
index 8ba79228da68556a0d037627c3a18014a90ac144..18811109b22f029861382d559040adfaab828daf 100644 (file)
@@ -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 (file)
index 0c83a92..0000000
+++ /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 (file)
index 7541084..0000000
+++ /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));
index aefb2ada6a012c0fc803a7eb718b42081a5d936e..5d891c3806d80c7098745b6a07b1839bb7ac83dc 100644 (file)
@@ -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';
index c59278b401fd66abce1979338993e16f9d918a96..2caf547b6c957fc0e96c7d73a67334fb0eac970e 100644 (file)
@@ -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