liberty
[ class tree: liberty ] [ index: liberty ] [ all elements ]

Procedural File: mime.flatdefault.php

Source Location: /protector/liberty_plugins/mime.flatdefault.php



Page Details:

Mime handler - flat attachments model default

As an alternative to storing file attachments in a user based storage tree, this version of mime.default.php provides for a flat filing system based on id. A two level tree is currently provided bassed on a Mod 1000 trimming of the id number for the first level directories. This limits each branch to a maximum of 1000 sub directories but a change the mime_default_branch setting will allow other trimmimg to be implemented.

Include define( 'LIBERTY_DEFAULT_MIME_HANDLER', 'mimeflatdefault' ); in config_inc.php to activate




Tags:

filesource:  Source Code for this file







FLAT_STORAGE_NAME [line 29]

FLAT_STORAGE_NAME = 'attachments'

[ Top ]



PLUGIN_MIME_GUID_FLATDEFAULT [line 28]

PLUGIN_MIME_GUID_FLATDEFAULT = 'mimeflatdefault'
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_



[ Top ]




liberty_mime_get_source_file [line 470]

void liberty_mime_get_source_file( $pParamHash)



Parameters

   $pParamHash  
[ Top ]



liberty_mime_get_source_url [line 458]

void liberty_mime_get_source_url( $pParamHash)



Parameters

   $pParamHash  
[ Top ]



liberty_mime_get_storage_branch [line 429]

string liberty_mime_get_storage_branch( $pParamHash $pParamHash)

liberty_mime_get_storage_branch - get url to store files for the feature site_upload_dir. It creates a calculable hierarchy of directories



Tags:

return:  full path on local filsystem to store files.
author:  Lester Caine<lester@lsces.co.uk>
access:  public


Parameters

$pParamHash   $pParamHash   key=>value pairs to determine path. Possible keys in descending directory depth are: use the 'common' branch if null, 'package' - any desired directory below the StoragePath. this will be created if it doesn't exist, 'sub_dir' - the sub-directory in the package organization directory, this is often a primary id such as attachment_id
[ Top ]



mime_default_branch [line 411]

string mime_default_branch( integer $pAttachmentId)

Generate branch from Id



Tags:

return:  containing path to storage location for attachment
access:  public


Parameters

integer   $pAttachmentId   The id of the attachment to access
[ Top ]



mime_default_download [line 321]

TRUE mime_default_download( &$pFileHash, array $pFileHash)

Takes care of the entire download process. Make sure it doesn't die at the end.

in this functioin it would be possible to add download resume possibilites and the like




Tags:

return:  on success, FALSE on failure - $pParamHash['errors'] will contain reason for failure
access:  public


Parameters

array   $pFileHash   Basically the same has as returned by the load function
   &$pFileHash  
[ Top ]



mime_default_expunge [line 383]

TRUE mime_default_expunge( integer $pAttachmentId)

Nuke data in tables when content is removed



Tags:

return:  on success, FALSE on failure
access:  public


Parameters

integer   $pAttachmentId   The id of the attachment to delete
[ Top ]



mime_default_load [line 244]

TRUE mime_default_load( array $pFileHash, &$pPrefs)

Load file data from the database



Tags:

return:  on success, FALSE on failure - ['errors'] will contain reason for failure
access:  public


Parameters

array   $pFileHash   contains all file information
   &$pPrefs  
[ Top ]



mime_default_store [line 201]

TRUE mime_default_store( &$pStoreRow, array $pStoreRow)

Store the data in the database



Tags:

return:  on success, FALSE on failure - $pStoreRow['errors'] will contain reason
access:  public


Parameters

array   $pStoreRow   File data needed to store details in the database - sanitised and generated in the verify function
   &$pStoreRow  
[ Top ]



mime_default_update [line 140]

TRUE mime_default_update( &$pStoreRow, array $pStoreRow)

When a file is edited



Tags:

return:  on success, FALSE on failure - $pStoreRow['errors'] will contain reason
access:  public


Parameters

array   $pStoreRow   File data needed to store details in the database - sanitised and generated in the verify function
   &$pStoreRow  
[ Top ]



mime_default_verify [line 76]

TRUE mime_default_verify( &$pStoreRow, array $pStoreRow, array $pStoreRow['upload'])

Sanitise and validate data before it's stored



Tags:

return:  on success, FALSE on failure - $pStoreRow['errors'] will contain reason
access:  public


Parameters

array   $pStoreRow   Hash of data that needs to be stored
array   $pStoreRow['upload']   Hash passed in by $_FILES upload
   &$pStoreRow  
[ Top ]



Documentation generated on Wed, 29 Jul 2015 13:57:06 +0000 by phpDocumentor 1.5.0-lsces