Source for file mime.pbase.php
Documentation is available at mime.pbase.php
* @author xing <xing@synapse.plus.com>
* created Thursday May 08, 2008
* @subpackage liberty_mime_handler
* This is the name of the plugin - max char length is 16
* As a naming convention, the liberty mime handler definition should start with:
define( 'PLUGIN_MIME_GUID_PBASE', 'mimepbase' );
// Set of functions and what they are called in this paricular plugin
// Use the GUID as your namespace
'verify_function' => 'mime_pbase_verify',
'store_function' => 'mime_pbase_store',
//'update_function' => 'mime_pbase_update',
'load_function' => 'mime_pbase_load',
//'download_function' => 'mime_pbase_download',
//'expunge_function' => 'mime_pbase_expunge',
// Brief description of what the plugin does
'title' => 'Display image from PBase',
'description' => 'Use a PBase image ID to display it on your website.',
// Templates to display the files
'upload_tpl' => 'bitpackage:liberty/mime/pbase/upload.tpl',
// url to page with options for this plugin
//'plugin_settings_url' => LIBERTY_PKG_URL.'admin/mime_pbase.php',
// This should be the same for all mime plugins
// 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',
global $gBitSystem, $gBitUser;
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' );
$pStoreRow['errors']['pbase_id'] = "No valid PBase ID given.";
* Store the data in the database
* @param array $pStoreRow File data needed to store details in the database - sanitised and generated in the verify function
* @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
if( @BitBase::verifyId( $pStoreRow['pbase_id'] )) {
// add the data into liberty_attachments to make this file available as attachment
"attachment_id" => $pStoreRow['attachment_id'],
"content_id" => $pStoreRow['content_id'],
"foreign_id" => $pStoreRow['pbase_id'],
"user_id" => $pStoreRow['user_id'],
$gBitSystem->mDb->associateInsert( BIT_DB_PREFIX. "liberty_attachments", $storeHash );
$pStoreRow['errors']['pbase_id'] = "No valid PBase ID given.";
* mime_pbase_update update file information in the database if there were changes.
* @param array $pStoreRow File data needed to update details in the database
* @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
* Load file data from the database
* @param array $pFileHash Contains all file information
* @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
* @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
$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';
|