diff options
Diffstat (limited to 'views/failsafe')
-rw-r--r-- | views/failsafe/canvas/default.php | 21 | ||||
-rw-r--r-- | views/failsafe/input/button.php | 41 | ||||
-rw-r--r-- | views/failsafe/input/checkboxes.php | 49 | ||||
-rw-r--r-- | views/failsafe/input/form.php | 31 | ||||
-rw-r--r-- | views/failsafe/input/hidden.php | 20 | ||||
-rw-r--r-- | views/failsafe/input/longtext.php | 25 | ||||
-rw-r--r-- | views/failsafe/input/pulldown.php | 52 | ||||
-rw-r--r-- | views/failsafe/input/reset.php | 27 | ||||
-rw-r--r-- | views/failsafe/input/submit.php | 27 | ||||
-rw-r--r-- | views/failsafe/input/text.php | 27 | ||||
-rw-r--r-- | views/failsafe/messages/messages/list.php | 38 | ||||
-rw-r--r-- | views/failsafe/messages/messages/message.php | 20 | ||||
-rw-r--r-- | views/failsafe/pageshells/pageshell.php | 14 | ||||
-rw-r--r-- | views/failsafe/settings/install.php | 19 | ||||
-rw-r--r-- | views/failsafe/settings/system.php | 51 |
15 files changed, 462 insertions, 0 deletions
diff --git a/views/failsafe/canvas/default.php b/views/failsafe/canvas/default.php new file mode 100644 index 000000000..2d2707918 --- /dev/null +++ b/views/failsafe/canvas/default.php @@ -0,0 +1,21 @@ +<?php
+
+ /**
+ * Elgg default layout
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ for ($i = 1; $i < 8; $i++) {
+
+ if (isset($vars["area{$i}"]))
+ echo $vars["area{$i}"];
+
+ }
+
+?>
\ No newline at end of file diff --git a/views/failsafe/input/button.php b/views/failsafe/input/button.php new file mode 100644 index 000000000..9a72f38b0 --- /dev/null +++ b/views/failsafe/input/button.php @@ -0,0 +1,41 @@ +<?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 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * @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 + * + */ + + global $CONFIG; + + $class = $vars['class']; + if (!$class) $class = "submit_button"; + + if (isset($vars['type'])) { $type = strtolower($vars['type']); } else { $type = 'submit'; } + switch ($type) + { + case 'button' : $type='button'; break; + case 'reset' : $type='reset'; break; + case 'submit': + default: $type = 'submit'; + } + + $value = htmlentities($vars['value'], null, 'UTF-8'); + $name = $vars['internalname']; + $src = $vars['src']; + if (strpos($src,$CONFIG->wwwroot)===false) $src = ""; // blank src if trying to access an offsite image. +?> +<input type="<?php echo $type; ?>" class="<?php echo $type; ?>_button" <?php echo $vars['js']; ?> value="<?php echo $value; ?>" src="<?php echo $src; ?>" class="<?php echo $class; ?>" />
\ No newline at end of file diff --git a/views/failsafe/input/checkboxes.php b/views/failsafe/input/checkboxes.php new file mode 100644 index 000000000..ff3ab8523 --- /dev/null +++ b/views/failsafe/input/checkboxes.php @@ -0,0 +1,49 @@ +<?php
+
+ /**
+ * Elgg checkbox input
+ * Displays a checkbox input field
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @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\"";
+ }
+ }
+ $labelint = (int) $label;
+ if ("{$label}" == "{$labelint}") {
+ $label = $option;
+ } + + $disabled = ""; + if ($vars['disabled']) $disabled = ' disabled="yes" ';
+ echo "<label><input type=\"checkbox\" $disabled {$vars['js']} name=\"{$vars['internalname']}[]\" {$selected} value=\"".htmlentities($option, null, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />";
+ }
+
+?>
\ No newline at end of file diff --git a/views/failsafe/input/form.php b/views/failsafe/input/form.php new file mode 100644 index 000000000..a640619bb --- /dev/null +++ b/views/failsafe/input/form.php @@ -0,0 +1,31 @@ +<?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 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * @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['action'] URL of the action being called + * + */ + + if (isset($vars['internalid'])) { $id = $vars['internalid']; } else { $id = ''; } + if (isset($vars['internalname'])) { $name = $vars['internalname']; } 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 { $method = 'POST'; } + +?> +<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 $body; ?> +</form>
\ No newline at end of file diff --git a/views/failsafe/input/hidden.php b/views/failsafe/input/hidden.php new file mode 100644 index 000000000..4ff9f31da --- /dev/null +++ b/views/failsafe/input/hidden.php @@ -0,0 +1,20 @@ +<?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 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * @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'], null, 'UTF-8'); ?>" />
\ No newline at end of file diff --git a/views/failsafe/input/longtext.php b/views/failsafe/input/longtext.php new file mode 100644 index 000000000..85c3f8186 --- /dev/null +++ b/views/failsafe/input/longtext.php @@ -0,0 +1,25 @@ +<?php
+
+ /**
+ * Elgg long text input
+ * Displays a long text input field
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @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/failsafe/input/pulldown.php b/views/failsafe/input/pulldown.php new file mode 100644 index 000000000..96b4d19aa --- /dev/null +++ b/views/failsafe/input/pulldown.php @@ -0,0 +1,52 @@ +<?php
+
+ /**
+ * Elgg pulldown input
+ * Displays a pulldown input field
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @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['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 = $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; ?>">
+<?php
+ if ($vars['options_values']) + { + foreach($vars['options_values'] as $value => $option) { + if ($value != $vars['value']) { + echo "<option value=\"$value\">{$option}</option>"; + } else { + echo "<option value=\"$value\" selected=\"selected\">{$option}</option>"; + } + } + } + else + {
+ foreach($vars['options'] as $option) {
+ if ($option != $vars['value']) {
+ echo "<option>{$option}</option>";
+ } else {
+ echo "<option selected=\"selected\">{$option}</option>";
+ }
+ }
+ }
+?>
+</select>
\ No newline at end of file diff --git a/views/failsafe/input/reset.php b/views/failsafe/input/reset.php new file mode 100644 index 000000000..6aa9d1c82 --- /dev/null +++ b/views/failsafe/input/reset.php @@ -0,0 +1,27 @@ +<?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 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * @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/failsafe/input/submit.php b/views/failsafe/input/submit.php new file mode 100644 index 000000000..591a43998 --- /dev/null +++ b/views/failsafe/input/submit.php @@ -0,0 +1,27 @@ +<?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 + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * @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'] = '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/failsafe/input/text.php b/views/failsafe/input/text.php new file mode 100644 index 000000000..a6045cf4c --- /dev/null +++ b/views/failsafe/input/text.php @@ -0,0 +1,27 @@ +<?php
+
+ /**
+ * Elgg text input
+ * Displays a text input field
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @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
+ */
+ + + $class = $vars['class']; + if (!$class) $class = "input-text"; +
+?>
+
+<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'], null, 'UTF-8'); ?>" class="<?php echo $class ?>"/>
\ No newline at end of file diff --git a/views/failsafe/messages/messages/list.php b/views/failsafe/messages/messages/list.php new file mode 100644 index 000000000..5387fc384 --- /dev/null +++ b/views/failsafe/messages/messages/list.php @@ -0,0 +1,38 @@ +<?php
+
+ /**
+ * Elgg list system messages
+ * Lists system messages
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @uses $vars['object'] An array of system messages
+ */
+
+ if (!empty($vars['object']) && is_array($vars['object'])) {
+
+?>
+
+ <div class="messages">
+
+<?php
+
+
+ foreach($vars['object'] as $message) {
+ echo elgg_view('messages/messages/message',array('object' => $message));
+ }
+
+?>
+
+ </div>
+
+<?php
+
+ }
+
+?>
\ No newline at end of file diff --git a/views/failsafe/messages/messages/message.php b/views/failsafe/messages/messages/message.php new file mode 100644 index 000000000..1622c29e8 --- /dev/null +++ b/views/failsafe/messages/messages/message.php @@ -0,0 +1,20 @@ +<?php
+
+ /**
+ * Elgg standard message
+ * Displays a single Elgg system message
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @uses $vars['object'] A system message (string)
+ */
+?>
+
+ <p>
+ <?php echo nl2br($vars['object']); ?>
+ </p>
\ No newline at end of file diff --git a/views/failsafe/pageshells/pageshell.php b/views/failsafe/pageshells/pageshell.php index d5f9dc81a..24f5ccdf7 100644 --- a/views/failsafe/pageshells/pageshell.php +++ b/views/failsafe/pageshells/pageshell.php @@ -113,6 +113,20 @@ text-align: left; vertical-align: middle; } + + .messages { + border:1px solid #00cc00; + background:#ccffcc; + color:#000000; + padding:3px 10px 3px 10px; + } + .messages_error { + border:1px solid #D3322A; + background:#F7DAD8; + color:#000000; + padding:3px 10px 3px 10px; + + } </style> diff --git a/views/failsafe/settings/install.php b/views/failsafe/settings/install.php new file mode 100644 index 000000000..17d263349 --- /dev/null +++ b/views/failsafe/settings/install.php @@ -0,0 +1,19 @@ +<?php
+
+ /**
+ * Elgg system settings on initial installation
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ */
+
+ echo "<p>" . autop(elgg_echo("installation:settings:description")) . "</p>";
+
+ echo elgg_view("settings/system",array("action" => "action/systemsettings/install"));
+
+?>
\ No newline at end of file diff --git a/views/failsafe/settings/system.php b/views/failsafe/settings/system.php new file mode 100644 index 000000000..55a515700 --- /dev/null +++ b/views/failsafe/settings/system.php @@ -0,0 +1,51 @@ +<?php
+
+ /**
+ * Elgg system settings form
+ * The form to change system settings
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ *
+ * @uses $vars['action'] If set, the place to forward the form to (usually action/systemsettings/save)
+ */
+
+ // Set action appropriately
+ if (!isset($vars['action'])) {
+ $action = $vars['url'] . "action/systemsettings/save";
+ } else {
+ $action = $vars['action'];
+ }
+
+ $form_body = "";
+ foreach(array('sitename','sitedescription', 'wwwroot','path','dataroot', 'view') as $field) {
+ $form_body .= "<p>";
+ $form_body .= elgg_echo($field) . "<br />";
+ $form_body .= elgg_view("input/text",array('internalname' => $field, 'value' => $vars['config']->$field));
+ $form_body .= "</p>";
+ }
+
+ $languages = get_installed_translations();
+ $form_body .= "<p>" . elgg_echo('language') . elgg_view("input/pulldown", array('internalname' => 'language', 'value' => $vars['config']->language, 'options_values' => $languages)) . "</p>";
+
+ $form_body .= "<p class=\"admin_debug\">" . elgg_echo('debug') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('debug:label') : "") )) . "</p>";
+
+ $form_body .= "<p class=\"admin_usage\">" . elgg_echo('usage') . "<br />";
+ $on = elgg_echo('usage:label');
+
+ if (isset($CONFIG->ping_home))
+ $on = ($vars['config']->ping_home!='disabled' ? elgg_echo('usage:label') : "");
+ $form_body .= elgg_view("input/checkboxes", array('options' => array(elgg_echo('usage:label')), 'internalname' => 'usage', 'value' => $on ));
+ $form_body .= "</p>";
+
+ $form_body .= elgg_view('input/hidden', array('internalname' => 'settings', 'value' => 'go'));
+
+ $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));
+
+ echo elgg_view('input/form', array('action' => $action, 'body' => $form_body));
+
+?>
\ No newline at end of file |