Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refs #1459: Added missing security tokens for failsafe (installation)…

… view.

git-svn-id: http://code.elgg.org/elgg/trunk@3835 36083f99-b078-4883-b0ff-0f9b5a30f544
  • Loading branch information...
commit 728ac2daaeaa95098aa189c03dd908eaa674a3c7 1 parent 6526a83
@brettp brettp authored
View
6 views/failsafe/input/form.php
@@ -41,7 +41,13 @@
$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 $security_header; ?>
<?php echo $body; ?>
</form>
View
17 views/failsafe/input/securitytoken.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * CSRF security token view for use with secure forms.
+ *
+ * It is still recommended that you use input/form.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+
+$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));
Please sign in to comment.
Something went wrong with that request. Please try again.