Skip to content

Commit

Permalink
HTML injection fixed. IE6 CSS bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Aug 29, 2009
1 parent 9c508bf commit 2037851
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
5 changes: 4 additions & 1 deletion app/controllers/people_controller.php
Expand Up @@ -28,7 +28,10 @@ function index() {
//edit action for forumuser (uses guest account)
function edit() {
if(!empty($this->data)) {
$this->Person->read(null, $this->Session->read('person'));
//prevent from html-injection
//$this->data['Person']['description'] = strip_tags($this->data['Person']['description'], '<a><b>');

$this->Person->read(null, $this->Session->read('person'));
$this->Person->saveField('description', $this->data['Person']['description']);
$this->redirect(array('controller' => 'people', 'action' => 'view', 'id' => $this->Session->read('person')));
} else {
Expand Down
5 changes: 5 additions & 0 deletions app/views/elements/person/form.ctp
Expand Up @@ -18,10 +18,15 @@
} elseif(strstr($this->params['action'], 'edit')) {
$parent = $this->data['Person']['parent_id'];
}

//fields only for admin
if (!empty($authUser) && $authUser['User']['username'] == 'admin') {
echo $form->input('name', array('label' => 'Naam')).'<br />';
}

echo $form->input('description', array('label' => 'Beschrijving')).'<br />';

//fields only for admin
if (!empty($authUser) && $authUser['User']['username'] == 'admin') {
if (!empty($this->params['named']['parent_id'])) {
echo $form->hidden('parent_id', array('value' => $parent));
Expand Down
4 changes: 3 additions & 1 deletion app/views/elements/person/tree.ctp
Expand Up @@ -26,7 +26,9 @@
array('class' => 'modalbox_link')).'</div>';
}

echo '<div class="description">'.$data['Person']['description'].'</div>';
if (!empty($data['Person']['description'])) {
echo '<div class="description">'.nl2br($data['Person']['description']).'</div>';
}
echo '</div>';

//set links for admin
Expand Down
2 changes: 1 addition & 1 deletion app/views/elements/person/view.ctp
Expand Up @@ -15,7 +15,7 @@
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Beschrijving'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $person['Person']['description']; ?>
<?php echo nl2br($person['Person']['description']); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Status'); ?></dt>
Expand Down
12 changes: 3 additions & 9 deletions app/webroot/css/liber.css
Expand Up @@ -41,26 +41,20 @@ div#logo, h2 {
text-align: center;
}

div.link, dt, label {
float: left;
}

div.description {
display: inline-block;
}

/**
* Modalbox & forms
**/
label {
margin: 0 1em;
width: 8em;
display: inline-block;
}
dd, input[type="text"], input[type="password"], textarea {
font-weight: normal;
}

dd {
margin: 0 0 0 8em;
margin: 0 0 1em 3em;
}

/**
Expand Down

0 comments on commit 2037851

Please sign in to comment.