Skip to content

Commit

Permalink
fix: Added missing things for the new org image loader
Browse files Browse the repository at this point in the history
  • Loading branch information
iglocska committed Jan 19, 2018
1 parent ff6a36f commit 5a1abae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/Controller/OrganisationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function admin_edit($id) {
$this->request->data['Organisation']['id'] = $id;
if ($this->Organisation->save($this->request->data)) {
if (isset($this->request->data['Organisation']['logo']['size']) && $this->request->data['Organisation']['logo']['size'] > 0 && $this->request->data['Organisation']['logo']['error'] == 0) {
$filename = basename($this->request->data['Organisation']['name'] . '.png');
$filename = basename($this->request->data['Organisation']['id'] . '.png');
if (preg_match("/^[0-9a-z\-\_\.]*\.(png)$/i", $filename)) {
if (!empty($this->request->data['Organisation']['logo']['tmp_name']) && is_uploaded_file($this->request->data['Organisation']['logo']['tmp_name'])) {
$result = move_uploaded_file($this->request->data['Organisation']['logo']['tmp_name'], APP . 'webroot/img/orgs/' . $filename);
Expand Down
8 changes: 5 additions & 3 deletions app/View/Events/view.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
?>
<div class="events view">
<?php
if (Configure::read('MISP.showorg') || $isAdmin) {
echo $this->element('img', array('id' => $event['Orgc']['name'], 'imgSize' => 48));
}
if (Configure::read('MISP.showorg') || $isAdmin):
?>
<div style="float:right;"><?php echo $this->OrgImg->getOrgImg(array('name' => $event['Orgc']['name'], 'id' => $event['Orgc']['id'], 'size' => 48)); ?></div>
<?php
endif;
$title = h($event['Event']['info']);
if (strlen($title) > 58) $title = substr($title, 0, 55) . '...';
?>
Expand Down
2 changes: 1 addition & 1 deletion app/View/Organisations/view.ctp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="organisations view">
<div class="row-fluid">
<div class="span10"><h2><?php echo __('Organisation ') . h($org['Organisation']['name']);?></h2></div>
<div class="span2"><?php echo $this->element('img', array('id' => $org['Organisation']['name'])); ?></div>
<div class="span2"><div style="float:right;"><?php echo $this->OrgImg->getOrgImg(array('name' => $org['Organisation']['name'], 'id' => $org['Organisation']['id'], 'size' => 48)); ?></div></div>
</div>
<dl style="width:600px;">
<dt><?php echo __('Id'); ?></dt>
Expand Down

0 comments on commit 5a1abae

Please sign in to comment.