Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Stream/CHANGEDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@
++$count;
$sql[$count][0] = '1.2.00';
$sql[$count][1] = "";

//v1.2.01
++$count;
$sql[$count][0] = '1.2.01';
$sql[$count][1] = "";
5 changes: 5 additions & 0 deletions Stream/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
CHANGELOG
=========

v1.2.01
-------
Added comprehensive file upload tracking system to monitor and manage all file uploads across the system

v1.2.00
-------
Gibbon v28 compatibility
Expand Down
2 changes: 1 addition & 1 deletion Stream/manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
$entryURL = 'stream.php';
$type = 'Additional';
$category = 'Other';
$version = '1.2.00';
$version = '1.2.01';
$author = "Gibbon Foundation";
$url = "https://gibbonedu.org";

Expand Down
15 changes: 13 additions & 2 deletions Stream/posts_manage_addProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/

use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Domain\System\SettingGateway;
use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Module\Stream\Domain\PostGateway;
use Gibbon\Module\Stream\Domain\PostTagGateway;
use Gibbon\Module\Stream\Domain\PostAttachmentGateway;
Expand Down Expand Up @@ -101,6 +101,8 @@
$attachment = $fileUploader->uploadAndResizeImage($file, 'streamPhoto', $maxImageSize, 90);

if (!empty($attachment)) {
$fileMetaData = $fileUploader->getFileMetaData($attachment);

$thumbPath = $absolutePath.'/'.str_replace('streamPhoto', 'streamThumb', $attachment);
$thumbnail = $fileUploader->resizeImage($absolutePath.'/'.$attachment, $thumbPath, 650);

Expand All @@ -111,7 +113,16 @@
'type' => 'Image',
];

$postAttachmentGateway->insert($data);
$streamPostAttachmentID = $postAttachmentGateway->insert($data);

// Record file tracking
if (!empty($fileMetaData) && !empty($streamPostAttachmentID)) {
$gibbonFileID = $container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment');

if (empty($gibbonFileID)) {
$partialFail = true;
}
}
} else {
$partialFail = true;
}
Expand Down
16 changes: 14 additions & 2 deletions Stream/posts_manage_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Gibbon\Module\Stream\Domain\PostTagGateway;
use Gibbon\Module\Stream\Domain\PostAttachmentGateway;
use Gibbon\Domain\System\SettingGateway;
use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Data\Validator;

require_once '../../gibbon.php';
Expand All @@ -49,7 +50,7 @@

$data = [
'post' => $_POST['post'] ?? '',
'streamCategoryIDList' => (!empty($_POST['streamCategoryIDList']) &&(is_array($_POST['streamCategoryIDList'])) ? implode(",", $_POST['streamCategoryIDList']) : null)
'streamCategoryIDList' => (!empty($_POST['streamCategoryIDList']) && (is_array($_POST['streamCategoryIDList'])) ? implode(",", $_POST['streamCategoryIDList']) : null)
];

// Validate the required values are present
Expand Down Expand Up @@ -95,6 +96,8 @@
$attachment = $fileUploader->uploadAndResizeImage($file, 'streamPhoto', $maxImageSize, 90);

if (!empty($attachment)) {
$fileMetaData = $fileUploader->getFileMetaData($attachment);

$thumbPath = $absolutePath.'/'.str_replace('streamPhoto', 'streamThumb', $attachment);
$thumbnail = $fileUploader->resizeImage($absolutePath.'/'.$attachment, $thumbPath, 650);

Expand All @@ -105,7 +108,16 @@
'type' => 'Image',
];

$postAttachmentGateway->insert($data);
$streamPostAttachmentID = $postAttachmentGateway->insert($data);

// Record file tracking
if (!empty($fileMetaData) && !empty($streamPostAttachmentID)) {
$gibbonFileID = $container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment');

if (empty($gibbonFileID)) {
$partialFail = true;
}
}
} else {
$partialFail = true;
}
Expand Down
2 changes: 1 addition & 1 deletion Stream/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
/**
* Sets version information.
*/
$moduleVersion = '1.2.00';
$moduleVersion = '1.2.01';