mirror of https://github.com/MISP/MISP
More changes to the discussion boards
- quote / event tags - anonymised e-mail addressespull/217/head
parent
6895548877
commit
b2b76779b9
|
@ -111,7 +111,6 @@ class PostsController extends AppController {
|
||||||
// We have a post that was posted in a new thread. This could also mean that someone created the first post related to an event!
|
// We have a post that was posted in a new thread. This could also mean that someone created the first post related to an event!
|
||||||
$this->Thread->create();
|
$this->Thread->create();
|
||||||
// Take the title from above and the id of the event as event_id if we are adding a post to an event.
|
// Take the title from above and the id of the event as event_id if we are adding a post to an event.
|
||||||
debug($this->request->data);
|
|
||||||
if ($target_type === 'event') {
|
if ($target_type === 'event') {
|
||||||
$title = $eventDiscussionTitle;
|
$title = $eventDiscussionTitle;
|
||||||
$event_id = $this->Event->data['Event']['id'];
|
$event_id = $this->Event->data['Event']['id'];
|
||||||
|
|
|
@ -58,6 +58,13 @@ class ThreadsController extends AppController {
|
||||||
'contain' => 'User'
|
'contain' => 'User'
|
||||||
);
|
);
|
||||||
$posts = $this->paginate('Post');
|
$posts = $this->paginate('Post');
|
||||||
|
if (!$this->_isSiteAdmin()) {
|
||||||
|
foreach ($posts as &$post) {
|
||||||
|
if ($post['User']['org'] != $this->Auth->user('org')) {
|
||||||
|
$post['User']['email'] = 'User ' . $post['User']['id'] . ' (' . $post['User']['org'] . ')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->set('posts', $posts);
|
$this->set('posts', $posts);
|
||||||
$this->set('thread_id', $thread_id);
|
$this->set('thread_id', $thread_id);
|
||||||
$this->set('myuserid', $this->Auth->user('id'));
|
$this->set('myuserid', $this->Auth->user('id'));
|
||||||
|
@ -69,6 +76,7 @@ class ThreadsController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
|
$this->loadModel('Posts');
|
||||||
$conditions = null;
|
$conditions = null;
|
||||||
$conditions['AND']['OR'] = array(
|
$conditions['AND']['OR'] = array(
|
||||||
'Thread.distribution >' => 0,
|
'Thread.distribution >' => 0,
|
||||||
|
@ -81,15 +89,23 @@ class ThreadsController extends AppController {
|
||||||
'contain' => array(
|
'contain' => array(
|
||||||
'Post' =>array(
|
'Post' =>array(
|
||||||
'fields' => array(),
|
'fields' => array(),
|
||||||
|
'limit' => 1,
|
||||||
|
'order' => 'Post.date_modified DESC',
|
||||||
'User' => array(
|
'User' => array(
|
||||||
'fields' => array('email', 'org')
|
'fields' => array('id','email', 'org'),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'order' => array('Thread.date_modified' => 'desc'),
|
'order' => array('Thread.date_modified' => 'desc'),
|
||||||
'recursive' => 1
|
'recursive' => 1
|
||||||
);
|
);
|
||||||
$this->set('threads', $this->paginate());
|
$threadsBeforeEmailRemoval = $this->paginate();
|
||||||
|
if (!$this->_isSiteAdmin()) {
|
||||||
|
foreach ($threadsBeforeEmailRemoval as &$thread) {
|
||||||
|
if ($thread['Post'][0]['User']['org'] != $this->Auth->user('org')) $thread['Post'][0]['User']['email'] = 'User ' . $thread['Post'][0]['User']['id'] . " (" . $thread['Post'][0]['User']['org'] . ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('threads', $threadsBeforeEmailRemoval);
|
||||||
$this->loadModel('Event');
|
$this->loadModel('Event');
|
||||||
$this->set('distributionLevels', $this->Event->distributionLevels);
|
$this->set('distributionLevels', $this->Event->distributionLevels);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Post extends AppModel {
|
||||||
public $belongsTo = array(
|
public $belongsTo = array(
|
||||||
'Thread',
|
'Thread',
|
||||||
'User' => array(
|
'User' => array(
|
||||||
'fields' => array('email', 'org'),
|
'fields' => array('email', 'org', 'id'),
|
||||||
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,7 +42,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td class="discussionBoxTD discussionBoxTDMid discussionBoxTDMidLeft">
|
<td class="discussionBoxTD discussionBoxTDMid discussionBoxTDMidLeft">
|
||||||
<?php
|
<?php
|
||||||
echo $this->Html->image('orgs/' . h($post['User']['org']) . '.png', array('alt' => h($post['User']['org']), 'title' => h($post['User']['org']), 'style' => 'width:48px; height:48px'));
|
$imgAbsolutePath = APP . WEBROOT_DIR . DS . 'img' . DS . 'orgs' . DS . h($post['User']['org']) . '.png';
|
||||||
|
if (file_exists($imgAbsolutePath)) echo $this->Html->image('orgs/' . h($post['User']['org']) . '.png', array('alt' => h($post['User']['org']), 'title' => h($post['User']['org']), 'style' => 'width:48px; height:48px'));
|
||||||
|
else echo $this->Html->tag('span', h($post['User']['org']), array('class' => 'welcome', 'style' => 'float:center;'));
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td class="discussionBoxTD discussionBoxTDMid discussionBoxTDMidRight">
|
<td class="discussionBoxTD discussionBoxTDMid discussionBoxTDMidRight">
|
||||||
|
@ -124,8 +126,14 @@
|
||||||
<div class="comment">
|
<div class="comment">
|
||||||
<?php echo $this->Form->create('Post');?>
|
<?php echo $this->Form->create('Post');?>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
<div class="input clear">
|
||||||
|
<button type="button" title="Insert a quote - just paste your quote between the [quote][/quote] tags." class="toggle-left btn btn-inverse qet" id = "quote" onclick="insertQuote()">Quote</button>
|
||||||
|
<button type="button" title="Insert a link to an event - just enter the event ID between the [event][/event] tags." class="toggle btn btn-inverse qet" id = "event" onclick="insertEvent()">Event</button>
|
||||||
|
<button type="button" title="Insert a link to a discussion thread - enter the thread's ID between the [thread][/thread] tags." class="toggle-right btn btn-inverse qet" id = "thread" onclick="insertThread()">Thread</button>
|
||||||
|
</div>
|
||||||
<?php
|
<?php
|
||||||
echo $this->Form->input('message', array(
|
echo $this->Form->input('message', array(
|
||||||
|
'label' => false,
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'div' => 'input clear',
|
'div' => 'input clear',
|
||||||
'class' => 'input-xxlarge',
|
'class' => 'input-xxlarge',
|
||||||
|
@ -144,4 +152,15 @@
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function insertQuote() {
|
||||||
|
document.getElementById("PostMessage").value+="[Quote][/Quote]";
|
||||||
|
}
|
||||||
|
function insertEvent() {
|
||||||
|
document.getElementById("PostMessage").value+="[Event][/Event]";
|
||||||
|
}
|
||||||
|
function insertThread() {
|
||||||
|
document.getElementById("PostMessage").value+="[Thread][/Thread]";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<?php echo $this->Js->writeBuffer();?>
|
<?php echo $this->Js->writeBuffer();?>
|
||||||
|
|
|
@ -36,8 +36,6 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
|
||||||
<?php if ($isAclAdd): ?>
|
<?php if ($isAclAdd): ?>
|
||||||
<li><a href="/events/add">Add Event</a></li>
|
<li><a href="/events/add">Add Event</a></li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<li class="divider"></li>
|
|
||||||
<li><a href="/posts/add/null/null/event/<?php echo $event['Event']['id'];?>">Leave comment</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -139,11 +137,29 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<h3><span id="pivots_active" class="icon-minus"></span><span id="pivots_inactive" class="icon-plus" style="display:none;"></span>Pivot Thread</h3>
|
<div>
|
||||||
|
<button class="btn btn-inverse toggle-left btn.active" id="pivots_active">
|
||||||
|
<span class="icon-minus icon-white" style="vertical-align:top;"></span>
|
||||||
|
Pivots
|
||||||
|
</button><button class="btn btn-inverse toggle-left" style="display:none;" id="pivots_inactive">
|
||||||
|
<span class="icon-plus icon-white" style="vertical-align:top;"></span>
|
||||||
|
Pivots
|
||||||
|
</button><button class="btn btn-inverse toggle" id="attributes_active">
|
||||||
|
<span class="icon-minus icon-white" style="vertical-align:top;"></span>
|
||||||
|
Attributes
|
||||||
|
</button><button class="btn btn-inverse toggle" id="attributes_inactive" style="display:none;">
|
||||||
|
<span class="icon-plus icon-white" style="vertical-align:top;"></span>
|
||||||
|
Attributes
|
||||||
|
</button><button class="btn btn-inverse toggle-right" id="discussions_active">
|
||||||
|
<span class="icon-minus icon-white" style="vertical-align:top;"></span>Discussion
|
||||||
|
</button><button class="btn btn-inverse toggle-right" id="discussions_inactive" style="display:none;">
|
||||||
|
<span class="icon-plus icon-white" style="vertical-align:top;"></span>Discussion
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
<div id="pivots_div">
|
<div id="pivots_div">
|
||||||
<?php if (sizeOf($allPivots) > 1) echo $this->element('pivot'); ?>
|
<?php if (sizeOf($allPivots) > 1) echo $this->element('pivot'); ?>
|
||||||
</div>
|
</div>
|
||||||
<h3><span id="attributes_active" class="icon-minus"></span><span id="attributes_inactive" class="icon-plus" style="display:none;"></span>Attributes</h3>
|
|
||||||
<div id="attributes_div">
|
<div id="attributes_div">
|
||||||
<?php
|
<?php
|
||||||
if (!empty($event['Attribute'])):?>
|
if (!empty($event['Attribute'])):?>
|
||||||
|
@ -403,7 +419,6 @@ if (!empty($event['Attribute'])):?>
|
||||||
<?php
|
<?php
|
||||||
endif; ?>
|
endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<h3><span id="discussions_active" class="icon-minus"></span><span id="discussions_inactive" class="icon-plus" style="display:none;"></span>Discussion</h3>
|
|
||||||
<div id="discussions_div">
|
<div id="discussions_div">
|
||||||
<?php
|
<?php
|
||||||
echo $this->element('eventdiscussion');
|
echo $this->element('eventdiscussion');
|
||||||
|
|
|
@ -31,4 +31,5 @@ You can for example ask: /events/index/limit:999.xml to get the 999 first record
|
||||||
|
|
||||||
|
|
||||||
To export all the events at once, with their attributes, use the export functionality.
|
To export all the events at once, with their attributes, use the export functionality.
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -7,6 +7,23 @@ App::uses('AppHelper', 'View/Helper');
|
||||||
public function convertQuotes($string){
|
public function convertQuotes($string){
|
||||||
$string = str_ireplace('[QUOTE]', '<div class="quote">', $string);
|
$string = str_ireplace('[QUOTE]', '<div class="quote">', $string);
|
||||||
$string = str_ireplace('[/QUOTE]', '</div>', $string);
|
$string = str_ireplace('[/QUOTE]', '</div>', $string);
|
||||||
|
$matches = array();
|
||||||
|
while (preg_match ('%\[event\](.*?)\[/event\]%is', $string, $matches)) {
|
||||||
|
if (!empty($matches) && is_numeric($matches[1])) {
|
||||||
|
$string = preg_replace('%\[event\]' . $matches[1] . '\[/event\]%i', '<a href=/events/view/' . $matches[1] . '> Event ' . $matches[1] . '</a>', $string);
|
||||||
|
} else {
|
||||||
|
$string = preg_replace('%\[event\]' . $matches[1] . '\[/event\]%i', '%Malformed_Event_Link%', $string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$matches = array();
|
||||||
|
while (preg_match ('%\[thread\](.*?)\[/thread\]%is', $string, $matches)) {
|
||||||
|
if (!empty($matches) && is_numeric($matches[1])) {
|
||||||
|
$string = preg_replace('%\[thread\]' . $matches[1] . '\[/thread\]%i', '<a href=/threads/view/' . $matches[1] . '> Thread ' . $matches[1] . '</a>', $string);
|
||||||
|
} else {
|
||||||
|
$string = preg_replace('%\[event\]' . $matches[1] . '\[/event\]%i', '%Malformed_Thread_Link%', $string);
|
||||||
|
}
|
||||||
|
$matches = array();
|
||||||
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<?php echo $this->Form->create('Post');?>
|
<?php echo $this->Form->create('Post');?>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Add Post</legend>
|
<legend>Add Post</legend>
|
||||||
<p>You can quote something in your message by enclosing the quote between [QUOTE] and [/QUOTE] tags.</p>
|
|
||||||
<?php
|
<?php
|
||||||
$quote = '';
|
$quote = '';
|
||||||
// If it is a new thread, let the user enter a subject
|
// If it is a new thread, let the user enter a subject
|
||||||
|
@ -30,7 +29,15 @@
|
||||||
));
|
));
|
||||||
$quote = '[QUOTE]' . $previous . '[/QUOTE]' . "\n";
|
$quote = '[QUOTE]' . $previous . '[/QUOTE]' . "\n";
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
<div class="input clear">
|
||||||
|
<button type="button" title="Insert a quote - just paste your quote between the [quote][/quote] tags." class="toggle-left btn btn-inverse qet" id = "quote" onclick="insertQuote()">Quote</button>
|
||||||
|
<button type="button" title="Insert a link to an event - just enter the event ID between the [event][/event] tags." class="toggle btn btn-inverse qet" id = "event" onclick="insertEvent()">Event</button>
|
||||||
|
<button type="button" title="Insert a link to a discussion thread - enter the thread's ID between the [thread][/thread] tags." class="toggle-right btn btn-inverse qet" id = "thread" onclick="insertThread()">Thread</button>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
echo $this->Form->input('message', array(
|
echo $this->Form->input('message', array(
|
||||||
|
'label' => false,
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'div' => 'input clear',
|
'div' => 'input clear',
|
||||||
'class' => 'input-xxlarge',
|
'class' => 'input-xxlarge',
|
||||||
|
@ -38,6 +45,17 @@
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function insertQuote() {
|
||||||
|
document.getElementById("PostMessage").value+="[Quote][/Quote]";
|
||||||
|
}
|
||||||
|
function insertEvent() {
|
||||||
|
document.getElementById("PostMessage").value+="[Event][/Event]";
|
||||||
|
}
|
||||||
|
function insertThread() {
|
||||||
|
document.getElementById("PostMessage").value+="[Thread][/Thread]";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<?php
|
<?php
|
||||||
echo $this->Form->button('Submit', array('class' => 'btn btn-primary'));
|
echo $this->Form->button('Submit', array('class' => 'btn btn-primary'));
|
||||||
echo $this->Form->end();
|
echo $this->Form->end();
|
||||||
|
|
|
@ -510,6 +510,29 @@ dd {
|
||||||
top: -45px;
|
top: -45px;
|
||||||
left: 13px;
|
left: 13px;
|
||||||
}
|
}
|
||||||
|
.toggle {
|
||||||
|
border-radius: 0px !important;
|
||||||
|
-webkit-border-radius: 0px !important;
|
||||||
|
-moz-border-radius: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-left {
|
||||||
|
border-bottom-right-radius: 0px !important;
|
||||||
|
-webkit-bottom-right-radius: 0px !important;
|
||||||
|
-moz-border-bottom-right-radius: 0px !important;
|
||||||
|
border-top-right-radius: 0px !important;
|
||||||
|
-webkit-top-right-radius: 0px !important;
|
||||||
|
-moz-border-top-right-radius: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-right {
|
||||||
|
border-bottom-left-radius: 0px !important;
|
||||||
|
-webkit-bottom-left-radius: 0px !important;
|
||||||
|
-moz-border-bottom-left-radius: 0px !important;
|
||||||
|
border-top-left-radius: 0px !important;
|
||||||
|
-webkit-top-left-radius: 0px !important;
|
||||||
|
-moz-border-top-left-radius: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.spinner {
|
.spinner {
|
||||||
height:60px;
|
height:60px;
|
||||||
|
@ -539,6 +562,12 @@ dd {
|
||||||
border-radius:100%;
|
border-radius:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.qet {
|
||||||
|
padding:1px 1px;
|
||||||
|
font-size:12px;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
@-webkit-keyframes rotation {
|
@-webkit-keyframes rotation {
|
||||||
from {-webkit-transform: rotate(0deg);}
|
from {-webkit-transform: rotate(0deg);}
|
||||||
to {-webkit-transform: rotate(359deg);}
|
to {-webkit-transform: rotate(359deg);}
|
||||||
|
@ -554,4 +583,3 @@ dd {
|
||||||
@keyframes rotation {
|
@keyframes rotation {
|
||||||
from {transform: rotate(0deg);}
|
from {transform: rotate(0deg);}
|
||||||
to {transform: rotate(359deg);}
|
to {transform: rotate(359deg);}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue