diff options
| -rwxr-xr-x | icons/pbase.gif | bin | 99 -> 0 bytes | |||
| -rwxr-xr-x | plugins/mime.pbase.php | 123 | ||||
| -rwxr-xr-x | templates/mime/pbase/upload.tpl | 11 |
3 files changed, 0 insertions, 134 deletions
diff --git a/icons/pbase.gif b/icons/pbase.gif Binary files differdeleted file mode 100755 index c3566f8..0000000 --- a/icons/pbase.gif +++ /dev/null diff --git a/plugins/mime.pbase.php b/plugins/mime.pbase.php deleted file mode 100755 index 388d25c..0000000 --- a/plugins/mime.pbase.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -namespace Bitweaver\Liberty; - -use Bitweaver\BitBase; - -/** - * @version $Header$ - * - * @author xing <xing@synapse.plus.com> - * @version $Revision$ - * created Thursday May 08, 2008 - * @package liberty - * @subpackage liberty_mime_handler - **/ - -/** - * setup - */ -global $gLibertySystem; - -/** - * This is the name of the plugin - max char length is 16 - * As a naming convention, the liberty mime handler definition should start with: - * PLUGIN_MIME_GUID_ - */ -define( 'PLUGIN_MIME_GUID_PBASE', 'mimepbase' ); - -$pluginParams = [ - // 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 - 'plugin_type' => MIME_PLUGIN, - // 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; - $pStoreRow['attachment_id'] = $gBitSystem->mDb->GenID( 'liberty_attachments_id_seq' ); - $ret = true; - } else { - $pStoreRow['errors']['pbase_id'] = "No valid PBase ID given."; - } - return $ret; -} - -/** - * 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 - * @access public - * @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'] )) { - // add the data into liberty_attachments to make this file available as attachment - $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; - } else { - $pStoreRow['errors']['pbase_id'] = "No valid PBase ID given."; - } - return $ret; -} - -/** - * 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 - * @access public - * @return void - */ -function mime_pbase_update( &$pStoreRow, $pParams = null ) { -} - -/** - * 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 - * @access public - * @return bool true on success, false on failure - $pStoreRow[errors] will contain reason - */ -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; - } - return $ret; -}
\ No newline at end of file diff --git a/templates/mime/pbase/upload.tpl b/templates/mime/pbase/upload.tpl deleted file mode 100755 index 25358eb..0000000 --- a/templates/mime/pbase/upload.tpl +++ /dev/null @@ -1,11 +0,0 @@ -{strip} -{if $gBitUser->hasPermission('p_liberty_attach_attachments') } - <div class="form-group"> - {formlabel label="PBase image ID"} - {forminput} - <input type="input" name="mimeplugin[{$smarty.const.PLUGIN_MIME_GUID_PBASE}][pbase_id]" size="10" /> - {formhelp note='Use the ID number in the URL of the image on <a href="http://www.pbase.com/">PBase</a>.'} - {/forminput} - </div> -{/if} -{/strip} |
