summaryrefslogtreecommitdiff
path: root/plugins/mime.pbase.php
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2025-08-27 15:18:16 +0100
committerlsces <lester@lsces.co.uk>2025-08-27 15:18:16 +0100
commit2986e32b3c805ed3fd6ad012e01a58c0fd3bb25e (patch)
treea2918e9bbdbb7262be50d4dcd0fb64d1cb4b4519 /plugins/mime.pbase.php
parentbb4eefff349d22c863d74dd50e017591c9d6a83a (diff)
downloadliberty-2986e32b3c805ed3fd6ad012e01a58c0fd3bb25e.tar.gz
liberty-2986e32b3c805ed3fd6ad012e01a58c0fd3bb25e.tar.bz2
liberty-2986e32b3c805ed3fd6ad012e01a58c0fd3bb25e.zip
plugin changes to cover namespace and style changes for PHP8.4
Diffstat (limited to 'plugins/mime.pbase.php')
-rwxr-xr-x[-rw-r--r--]plugins/mime.pbase.php49
1 files changed, 26 insertions, 23 deletions
diff --git a/plugins/mime.pbase.php b/plugins/mime.pbase.php
index d1f3836..8b75b8e 100644..100755
--- a/plugins/mime.pbase.php
+++ b/plugins/mime.pbase.php
@@ -1,4 +1,8 @@
<?php
+
+namespace Bitweaver\Liberty;
+use Bitweaver\BitBase;
+
/**
* @version $Header$
*
@@ -21,7 +25,7 @@ global $gLibertySystem;
*/
define( 'PLUGIN_MIME_GUID_PBASE', 'mimepbase' );
-$pluginParams = array (
+$pluginParams = [
// Set of functions and what they are called in this paricular plugin
// Use the GUID as your namespace
'verify_function' => 'mime_pbase_verify',
@@ -39,20 +43,20 @@ $pluginParams = array (
//'plugin_settings_url' => LIBERTY_PKG_URL.'admin/mime_pbase.php',
// This should be the same for all mime plugins
'plugin_type' => MIME_PLUGIN,
- // Set this to TRUE if you want the plugin active right after installation
- 'auto_activate' => FALSE,
+ // Set this to true if you want the plugin active right after installation
+ 'auto_activate' => false,
// Help page on bitweaver.org
//'help_page' => 'LibertyMime+PBase+Plugin',
-);
+];
$gLibertySystem->registerPlugin( PLUGIN_MIME_GUID_PBASE, $pluginParams );
function mime_pbase_verify( &$pStoreRow ) {
global $gBitSystem, $gBitUser;
- $ret = FALSE;
- if( @BitBase::verifyId( $pStoreRow['pbase_id'] )) {
- $pStoreRow['user_id'] = @BitBase::verifyId( $gBitUser->mUserId ) ? $gBitUser->mUserId : ROOT_USER_ID;
+ $ret = false;
+ if( BitBase::verifyId( $pStoreRow['pbase_id'] )) {
+ $pStoreRow['user_id'] = BitBase::verifyId( $gBitUser->mUserId ) ? $gBitUser->mUserId : ROOT_USER_ID;
$pStoreRow['attachment_id'] = $gBitSystem->mDb->GenID( 'liberty_attachments_id_seq' );
- $ret = TRUE;
+ $ret = true;
} else {
$pStoreRow['errors']['pbase_id'] = "No valid PBase ID given.";
}
@@ -64,22 +68,22 @@ function mime_pbase_verify( &$pStoreRow ) {
*
* @param array $pStoreRow File data needed to store details in the database - sanitised and generated in the verify function
* @access public
- * @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
+ * @return bool true on success, false on failure - $pStoreRow[errors] will contain reason
*/
function mime_pbase_store( &$pStoreRow ) {
global $gBitSystem;
- $ret = FALSE;
- if( @BitBase::verifyId( $pStoreRow['pbase_id'] )) {
+ $ret = false;
+ if( BitBase::verifyId( $pStoreRow['pbase_id'] )) {
// add the data into liberty_attachments to make this file available as attachment
- $storeHash = array(
+ $storeHash = [
"attachment_id" => $pStoreRow['attachment_id'],
"content_id" => $pStoreRow['content_id'],
"attachment_plugin_guid" => PLUGIN_MIME_GUID_PBASE,
"foreign_id" => $pStoreRow['pbase_id'],
"user_id" => $pStoreRow['user_id'],
- );
+ ];
$gBitSystem->mDb->associateInsert( BIT_DB_PREFIX."liberty_attachments", $storeHash );
- $ret = TRUE;
+ $ret = true;
} else {
$pStoreRow['errors']['pbase_id'] = "No valid PBase ID given.";
}
@@ -91,9 +95,9 @@ function mime_pbase_store( &$pStoreRow ) {
*
* @param array $pStoreRow File data needed to update details in the database
* @access public
- * @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
+ * @return void
*/
-function mime_pbase_update( &$pStoreRow, $pParams = NULL ) {
+function mime_pbase_update( &$pStoreRow, $pParams = null ) {
}
/**
@@ -103,17 +107,16 @@ function mime_pbase_update( &$pStoreRow, $pParams = NULL ) {
* @param array $pPrefs Attachment preferences taken liberty_attachment_prefs
* @param array $pParams Parameters for loading the plugin - e.g.: might contain values such as thumbnail size from the view page
* @access public
- * @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
+ * @return bool true on success, false on failure - $pStoreRow[errors] will contain reason
*/
-function mime_pbase_load( &$pFileHash, &$pPrefs, $pParams = NULL ) {
- $ret = array();
- if( $ret = mime_default_load( $pFileHash, $pPrefs, $pParams )) {
+function mime_pbase_load( &$pFileHash, &$pPrefs, $pParams = null ) {
+ $ret = [];
+ if( $ret = mime_default_load( $pFileHash, $pPrefs )) {
$ret['display_url'] = 'http://www.pbase.com/image/'.$pFileHash['foreign_id'];
$ret['thumbnail_url']['small'] = 'http://www.pbase.com/image/'.$pFileHash['foreign_id'].'/small.jpg';
$ret['thumbnail_url']['medium'] = 'http://www.pbase.com/image/'.$pFileHash['foreign_id'].'/medium.jpg';
$ret['thumbnail_url']['large'] = 'http://www.pbase.com/image/'.$pFileHash['foreign_id'].'/large.jpg';
- $ret['is_mime'] = TRUE;
+ $ret['is_mime'] = true;
}
return $ret;
-}
-?>
+} \ No newline at end of file