aboutsummaryrefslogtreecommitdiff
path: root/views/installation/input
diff options
context:
space:
mode:
Diffstat (limited to 'views/installation/input')
-rw-r--r--views/installation/input/access.php19
-rw-r--r--views/installation/input/button.php37
-rw-r--r--views/installation/input/checkbox.php24
-rw-r--r--views/installation/input/checkboxes.php48
-rw-r--r--views/installation/input/combo.php19
-rw-r--r--views/installation/input/dropdown.php (renamed from views/installation/input/pulldown.php)27
-rw-r--r--views/installation/input/form.php35
-rw-r--r--views/installation/input/hidden.php16
-rw-r--r--views/installation/input/longtext.php22
-rw-r--r--views/installation/input/password.php16
-rw-r--r--views/installation/input/reset.php24
-rw-r--r--views/installation/input/securitytoken.php15
-rw-r--r--views/installation/input/submit.php15
-rw-r--r--views/installation/input/text.php22
14 files changed, 94 insertions, 245 deletions
diff --git a/views/installation/input/access.php b/views/installation/input/access.php
index 01ce69b80..c3d4713bc 100644
--- a/views/installation/input/access.php
+++ b/views/installation/input/access.php
@@ -1,23 +1,14 @@
<?php
/**
* Elgg access level input
- * Displays a pulldown input field
- *
- * @package Elgg
- * @subpackage Core
+ * Displays a dropdown input field
*
* @uses $vars['value'] The current value, if any
- * @uses $vars['js'] Any Javascript to enter into the input tag
- * @uses $vars['internalname'] The name of the input field
+ * @uses $vars['name'] The name of the input field
*
*/
-if (isset($vars['class'])) {
- $class = $vars['class'];
-}
-if (!$class) {
- $class = "input_access";
-}
+$class = "elgg-input-access";
if ((!isset($vars['options'])) || (!is_array($vars['options']))) {
$vars['options'] = array();
@@ -28,7 +19,7 @@ if (is_array($vars['options']) && sizeof($vars['options']) > 0) {
?>
- <select name="<?php echo $vars['internalname']; ?>" <?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']; ?>" class="<?php echo $class; ?>">
<?php
foreach($vars['options'] as $key => $option) {
@@ -44,4 +35,4 @@ if (is_array($vars['options']) && sizeof($vars['options']) > 0) {
<?php
-} \ No newline at end of file
+}
diff --git a/views/installation/input/button.php b/views/installation/input/button.php
index 1b70800e9..ec90fed9d 100644
--- a/views/installation/input/button.php
+++ b/views/installation/input/button.php
@@ -1,25 +1,22 @@
<?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['internalname'] The name of the input field
- * @uses $vars['type'] Submit or reset, defaults to submit.
- * @uses $vars['src'] Src of an image
- *
+ * @uses $vars['name'] The name of the input field
+ * @uses $vars['type'] submit or button.
*/
-global $CONFIG;
+if (isset($vars['class'])) {
+ $class = $vars['class'];
+} else {
+ $class = "elgg-button-submit";
+}
-$class = $vars['class'];
-if (!$class) {
- $class = "submit_button";
+if (isset($vars['name'])) {
+ $name = $vars['name'];
+} else {
+ $name = '';
}
if (isset($vars['type'])) {
@@ -32,20 +29,12 @@ switch ($type) {
case 'button' :
$type='button';
break;
- case 'reset' :
- $type='reset';
- break;
case 'submit':
default:
$type = 'submit';
}
$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8');
-$name = $vars['internalname'];
-$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['internalid'])) echo "id=\"{$vars['internalid']}\"";?> <?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; ?>" value="<?php echo $value; ?>" class="<?php echo $class; ?>" /> \ No newline at end of file
diff --git a/views/installation/input/checkbox.php b/views/installation/input/checkbox.php
new file mode 100644
index 000000000..6fbe25169
--- /dev/null
+++ b/views/installation/input/checkbox.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Elgg checkbox input
+ * Displays a checkbox input tag
+ *
+ * @uses $var['name']
+ * @uses $vars['value']
+ * @uses $vars['class']
+ */
+
+
+if (isset($vars['class'])) {
+ $id = "class=\"{$vars['class']}\"";
+} else {
+ $id = '';
+}
+
+if (!isset($vars['value'])) {
+ $vars['value'] = $vars['name'];
+}
+
+?>
+
+<input type="checkbox" <?php echo $class; ?> name="<?php echo $vars['name']; ?>" value="<?php echo $vars['value']; ?>" /> \ No newline at end of file
diff --git a/views/installation/input/checkboxes.php b/views/installation/input/checkboxes.php
deleted file mode 100644
index d4e1b494d..000000000
--- a/views/installation/input/checkboxes.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Elgg checkbox input
- * Displays a checkbox 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['internalname'] The name of the input field
- * @uses $vars['options'] An array of strings representing the options for the checkbox field
- *
- */
-
-$class = $vars['class'];
-if (!$class) {
- $class = "input-checkboxes";
-}
-
-foreach($vars['options'] as $label => $option) {
- //if (!in_array($option,$vars['value'])) {
- if (is_array($vars['value'])) {
- if (!in_array($option,$vars['value'])) {
- $selected = "";
- } else {
- $selected = "checked = \"checked\"";
- }
- } else {
- if ($option != $vars['value']) {
- $selected = "";
- } else {
- $selected = "checked = \"checked\"";
- }
- }
-
- // handle indexed array where label is not specified
- // @todo deprecate in Elgg 1.8
- if (is_integer($label)) {
- $label = $option;
- }
-
- $disabled = "";
- if ($vars['disabled']) {
- $disabled = ' disabled="yes" ';
- }
- echo "<label><input type=\"checkbox\" $disabled {$vars['js']} name=\"{$vars['internalname']}[]\" {$selected} value=\"".htmlentities($option, ENT_QUOTES, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />";
-} \ No newline at end of file
diff --git a/views/installation/input/combo.php b/views/installation/input/combo.php
new file mode 100644
index 000000000..508dbcd01
--- /dev/null
+++ b/views/installation/input/combo.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Combination of text box and check box. When the checkbox is checked, the
+ * text field is cleared and disabled.
+ *
+ */
+
+$label = elgg_echo('install:label:combo:' . $vars['name']);
+
+$vars['class'] = "elgg-combo-text";
+echo elgg_view('input/text', $vars);
+
+$vars['class'] = "elgg-combo-checkbox";
+$vars['value'] = "{$vars['name']}-checkbox";
+echo elgg_view('input/checkbox', $vars);
+
+echo "<label class=\"elgg-combo-label\">$label</label>";
+
+echo '<div class="clearfloat"></div>'; \ No newline at end of file
diff --git a/views/installation/input/pulldown.php b/views/installation/input/dropdown.php
index 70e961c4d..cf875492e 100644
--- a/views/installation/input/pulldown.php
+++ b/views/installation/input/dropdown.php
@@ -1,29 +1,22 @@
<?php
/**
- * Elgg pulldown input
- * Displays a pulldown input field
- *
- * @package Elgg
- * @subpackage Core
+ * Elgg dropdown input
+ * Displays a dropdown input field
*
* @uses $vars['value'] The current value, if any
- * @uses $vars['js'] Any Javascript to enter into the input tag
- * @uses $vars['internalname'] The name of the input field
- * @uses $vars['options'] An array of strings representing the options for the pulldown field
+ * @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
* the value displayed on the button. Replaces $vars['options'] when defined.
*/
+$class = "elgg-input-dropdown";
-$class = $vars['class'];
-if (!$class) {
- $class = "input-pulldown";
-}
?>
-<select name="<?php echo $vars['internalname']; ?>" <?php echo $vars['js']; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>">
+<select name="<?php echo $vars['name']; ?>" class="<?php echo $class; ?>">
<?php
-if ($vars['options_values']) {
- foreach($vars['options_values'] as $value => $option) {
+if (isset($vars['options_values'])) {
+ foreach ($vars['options_values'] as $value => $option) {
if ($value != $vars['value']) {
echo "<option value=\"$value\">{$option}</option>";
} else {
@@ -31,7 +24,7 @@ if ($vars['options_values']) {
}
}
} else {
- foreach($vars['options'] as $option) {
+ foreach ($vars['options'] as $option) {
if ($option != $vars['value']) {
echo "<option>{$option}</option>";
} else {
@@ -40,4 +33,4 @@ if ($vars['options_values']) {
}
}
?>
-</select> \ No newline at end of file
+</select>
diff --git a/views/installation/input/form.php b/views/installation/input/form.php
index a4707f257..3556413a8 100644
--- a/views/installation/input/form.php
+++ b/views/installation/input/form.php
@@ -1,36 +1,21 @@
<?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['name'] Form name
*/
-if (isset($vars['internalid'])) {
- $id = $vars['internalid'];
-} else {
- $id = '';
-}
-if (isset($vars['internalname'])) {
- $name = $vars['internalname'];
+if (isset($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 +24,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 $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
deleted file mode 100644
index 7a0798e48..000000000
--- a/views/installation/input/hidden.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?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['internalname'] The name of the input field
- *
- */
-?>
-<input type="hidden" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" 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 766cd68e4..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['internalname'] The name of the input field
- *
- */
-
-$class = $vars['class'];
-if (!$class) {
- $class = "input_textarea";
-}
-
-?>
-
-<textarea class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?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 34578a1e2..2265ab117 100644
--- a/views/installation/input/password.php
+++ b/views/installation/input/password.php
@@ -3,19 +3,15 @@
* 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['internalname'] The name of the input field
+ * @uses $vars['name'] The name of the input field
*
*/
-$class = $vars['class'];
-if (!$class) {
- $class = "input_password";
-}
+$class = "input-password";
+
+$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8');
+
?>
-<input type="password" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class; ?>" />
+<input type="password" name="<?php echo $vars['name']; ?>" value="<?php echo $value; ?>" class="<?php echo $class; ?>" />
diff --git a/views/installation/input/reset.php b/views/installation/input/reset.php
deleted file mode 100644
index 1d5e47ccb..000000000
--- a/views/installation/input/reset.php
+++ /dev/null
@@ -1,24 +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
- *
- * @uses $vars['value'] The current value, if any
- * @uses $vars['js'] Any Javascript to enter into the input tag
- * @uses $vars['internalname'] The name of the input field
- * @uses $vars['type'] Submit or reset, defaults to submit.
- *
- */
-
-$vars['type'] = 'reset';
-$class = $vars['class'];
-if (!$class) {
- $class = "submit_button";
-}
-$vars['class'] = $class;
-
-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 9a8cb1ebe..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('internalname' => '__elgg_token', 'value' => $token));
-echo elgg_view('input/hidden', array('internalname' => '__elgg_ts', 'value' => $ts));
diff --git a/views/installation/input/submit.php b/views/installation/input/submit.php
index 0a6d2a06d..5d891c380 100644
--- a/views/installation/input/submit.php
+++ b/views/installation/input/submit.php
@@ -1,24 +1,11 @@
<?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['js'] Any Javascript to enter into the input tag
- * @uses $vars['internalname'] The name of the input field
- * @uses $vars['type'] Submit or reset, defaults to submit.
- *
+ * @uses $vars['name'] The name of the input field
*/
$vars['type'] = 'submit';
-$class = $vars['class'];
-if (!$class) {
- $class = "submit_button";
-}
-$vars['class'] = $class;
echo elgg_view('input/button', $vars); \ No newline at end of file
diff --git a/views/installation/input/text.php b/views/installation/input/text.php
index c8ce7266e..375b91c44 100644
--- a/views/installation/input/text.php
+++ b/views/installation/input/text.php
@@ -3,22 +3,18 @@
* 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['internalname'] The name of the input field
- * @uses $vars['disabled'] If true then control is read-only
- * @uses $vars['class'] Class override
+ * @uses $vars['name'] The name of the input field
+ * @uses $vars['class'] CSS class
*/
-$class = $vars['class'];
-if (!$class) {
- $class = "input_text";
+if (isset($vars['class'])) {
+ $class = "class=\"{$vars['class']}\"";
+} else {
+ $class = "elgg-input-text";
}
+$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8');
+
?>
-<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" class="<?php echo $class ?>"/> \ No newline at end of file
+<input type="text" name="<?php echo $vars['name']; ?>" value="<?php echo $value; ?>" <?php echo $class; ?> /> \ No newline at end of file