Merge remote-tracking branch 'origin/develop' into notes
|
@ -82,6 +82,14 @@ app/Lib/EventWarning/Custom/*
|
|||
!/app/webroot/img/orgs/MISP.png
|
||||
!/app/webroot/img/orgs/NATO.png
|
||||
!/app/webroot/img/orgs/NCIRC.png
|
||||
/app/files/img/custom/*
|
||||
!/app/files/img/custom/empty
|
||||
/app/files/img/orgs/*
|
||||
!/app/files/img/orgs/ADMIN.png
|
||||
!/app/files/img/orgs/MIL.be.png
|
||||
!/app/files/img/orgs/MISP.png
|
||||
!/app/files/img/orgs/NATO.png
|
||||
!/app/files/img/orgs/NCIRC.png
|
||||
/app/Config/bootstrap.php
|
||||
/app/Config/database.php
|
||||
/app/Config/core.php
|
||||
|
|
|
@ -506,7 +506,7 @@ class OrganisationsController extends AppController
|
|||
}
|
||||
|
||||
if (!empty($logo['tmp_name']) && is_uploaded_file($logo['tmp_name'])) {
|
||||
return move_uploaded_file($logo['tmp_name'], APP . 'webroot/img/orgs/' . $filename);
|
||||
return move_uploaded_file($logo['tmp_name'], APP . 'files/img/orgs/' . $filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ App::uses('FileAccessTool', 'Tools');
|
|||
App::uses('JsonTool', 'Tools');
|
||||
App::uses('RedisTool', 'Tools');
|
||||
App::uses('BetterCakeEventManager', 'Tools');
|
||||
App::uses('Folder', 'Utility');
|
||||
|
||||
class AppModel extends Model
|
||||
{
|
||||
|
@ -275,6 +276,9 @@ class AppModel extends Model
|
|||
$this->removeDuplicatedUUIDs();
|
||||
$dbUpdateSuccess = $this->updateDatabase('createUUIDsConstraints');
|
||||
break;
|
||||
case 120:
|
||||
$dbUpdateSuccess = $this->moveImages();
|
||||
break;
|
||||
default:
|
||||
$dbUpdateSuccess = $this->updateDatabase($command);
|
||||
break;
|
||||
|
@ -4227,4 +4231,32 @@ class AppModel extends Model
|
|||
{
|
||||
return preg_match('/^[\w\_\-\. ]+$/', $param);
|
||||
}
|
||||
|
||||
public function moveImages()
|
||||
{
|
||||
$oldImageDir = APP . 'webroot/img';
|
||||
$newImageDir = APP . 'files/img';
|
||||
$oldOrgDir = new Folder($oldImageDir . '/orgs');
|
||||
$oldCustomDir = new Folder($oldImageDir . '/custom');
|
||||
$result = false;
|
||||
$result = $oldOrgDir->copy([
|
||||
'from' => $oldImageDir . '/orgs',
|
||||
'to' => $newImageDir . '/orgs',
|
||||
'scheme' => Folder::OVERWRITE,
|
||||
'recursive' => true
|
||||
]);
|
||||
if ($result) {
|
||||
$oldOrgDir->delete();
|
||||
}
|
||||
$result = $oldCustomDir->copy([
|
||||
'from' => $oldImageDir . '/custom',
|
||||
'to' => $newImageDir . '/custom',
|
||||
'scheme' => Folder::OVERWRITE,
|
||||
'recursive' => true
|
||||
]);
|
||||
if ($result) {
|
||||
$oldCustomDir->delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2429,7 +2429,7 @@ class Attribute extends AppModel
|
|||
$conditions['AND'][] = array($scope . ' <=' => $timestamp[1]);
|
||||
} else {
|
||||
$timestamp = intval($this->resolveTimeDelta($timestamp)) * 1000000; // seen in stored in micro-seconds in the DB
|
||||
if ($scope == 'Attribute.first_seen') {
|
||||
if ($scope == 'Attribute.first_seen' || $scope == 'Object.first_seen') {
|
||||
$conditions['AND'][] = array($scope . ' >=' => $timestamp);
|
||||
} else {
|
||||
$conditions['AND'][] = array($scope . ' <=' => $timestamp);
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?php
|
||||
App::uses('AppHelper', 'View/Helper');
|
||||
App::uses('FileAccessTool', 'Lib/Tools');
|
||||
|
||||
// Helper to retrieve org images with the given parameters
|
||||
class OrgImgHelper extends AppHelper
|
||||
{
|
||||
const IMG_PATH = APP . WEBROOT_DIR . DS . 'img' . DS . 'orgs' . DS;
|
||||
const IMG_PATH = APP . 'files' . DS . 'img' . DS . 'orgs' . DS;
|
||||
|
||||
/** @var array */
|
||||
private $imageCache = [];
|
||||
|
@ -55,9 +56,9 @@ class OrgImgHelper extends AppHelper
|
|||
if ($orgImgName) {
|
||||
$size = !empty($options['size']) ? $options['size'] : 48;
|
||||
$result = sprintf(
|
||||
'<img src="%s/img/orgs/%s" title="%s" width="%s" height="%s">',
|
||||
$baseurl,
|
||||
$orgImgName,
|
||||
'<img src="data:image/%s;base64,%s" title="%s" width="%s" height="%s">',
|
||||
'png',
|
||||
base64_encode(FileAccessTool::readFromFile(self::IMG_PATH . $orgImgName)),
|
||||
isset($options['name']) ? h($options['name']) : h($options['id']),
|
||||
(int)$size,
|
||||
(int)$size
|
||||
|
|
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 842 B |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 6.1 KiB |