contenido\includes\functions.file.php

Show: PublicProtectedPrivateinherited
    Table of Contents
    Project: Contenido Content Management System

    Description: Functions to edit files. Included in Area style, js, htmltpl in Frame right_bottom.

    Requirements:

    Author
    Willi Man  
    Con_php_req
    5.0  
    Copyright
    four for business AG  
    License
    http://www.contenido.org/license/LIZENZ.txt  
    Link
    http://www.4fb.de  
    Link
    http://www.contenido.org  
    Package
    Contenido Backend includes  
    Since
    file available since contenido release >= 4.6 {@internal created 2004-07-13 modified 2008-06-26, Frederic Schneider, add security fix modified 2008-08-14, Timo.Trautmann added file_information functions for storing file meta indormations modified 2009-10-23, Murat Purc, removed deprecated function (PHP 5.3 ready), added new function fileValidateFilename() and commented code $Id: functions.file.php 1085 2009-10-24 02:01:34Z xmurrix $: }}  
    Version
    1.0.3  

    Functions

    functioncreateFile(string $filename, string $path) : \(void | \bool)

    Creates a file.

    Exits the script, if filename is not valid or creation (touch or chmod) fails!

    Parameters
    NameTypeDescription
    $filenamestring

    The file to create

    $pathstring

    Path to the file

    Returns
    TypeDescription
    \(void | \bool)Either true on success or nothing
    functionfileEdit(string $filename, string $sCode, string $path) : \(string | \void)

    Writes passed data into a file using binary mode.

    Exits the script, if file could not opened!

    Parameters
    NameTypeDescription
    $filenamestring

    The file to write the content

    $sCodestring

    File content to write

    $pathstring

    Path to the file

    Returns
    TypeDescription
    \(string | \void)Either content of file o nothing
    functionfileValidateFilename(string $filename, bool $notifyAndExitOnFailure = true) : \(void | \bool)

    Validates passed filename.

    Filename can contain alphanumeric characters, dot, underscore or a hyphen.

    Exits the script, if second parameter is set to true and validation fails!

    Parameters
    NameTypeDescription
    $filenamestring

    The filename to validate

    $notifyAndExitOnFailurebool

    Flag to display notification and to exit further script execution, ifd validation fails

    Returns
    TypeDescription
    \(void | \bool)Either validation result or nothing (depends on second parameter)
    functiongetFileContent(string $filename, string $path) : \(string | \void)

    Reads content of file into memory using binary mode and returns it back.

    Exits the script, if file could not opened!

    Parameters
    NameTypeDescription
    $filenamestring

    The file to get the content

    $pathstring

    Path to the file

    Returns
    TypeDescription
    \(string | \void)Either content of file o nothing
    functiongetFileInformation(integer $iIdClient, string $sFilename, string $sType, object $oDb) : array

    Function returns file meta information from database (used when files were versionned or description is displayed)

    Parameters
    NameTypeDescription
    $iIdClientinteger
    • id of client which contains this file
    $sFilenamestring
    • name of corresponding file
    $sTypestring
    • type of file (css, js or templates)
    $oDbobject
    • contenido database object
    Returns
    TypeDescription
    arrayIndexes: idsfi - Primary key of database record created - Datetime when file was created lastmodified - Datetime when file was last modified author - Author of file (Contenido Backend User) modifiedby - Last modifier of file (Contenido Backend User) description - Description which was inserted for this file
    Details
    Author
    Timo Trautmann  
    functiongetFileType(string $filename) : string

    Returns the filetype (extension).

    Parameters
    NameTypeDescription
    $filenamestring

    The file to get the type

    Returns
    TypeDescription
    stringFiletype
    functionremoveFileInformation(integer $iIdClient, string $sFilename, string $sType, object $oDb) : void

    Function removes file meta information from database (used when a file is deleted)

    Parameters
    NameTypeDescription
    $iIdClientinteger
    • id of client which contains this file
    $sFilenamestring
    • name of corresponding file
    $sTypestring
    • type of file (css, js or templates)
    $oDbobject
    • contenido database object
    Details
    Author
    Timo Trautmann  
    functionrenameFile(string $sOldFile, string $sNewFile, string $path) : \(void | \string)

    Renames a existing file.

    Exits the script, if new filename is not valid or renaming fails!

    Parameters
    NameTypeDescription
    $sOldFilestring

    Old filename

    $sNewFilestring

    New filename

    $pathstring

    Path to the file

    Returns
    TypeDescription
    \(void | \string)Either new filename or nothing
    functionupdateFileInformation(integer $iIdClient, string $sFilename, string $sType, string $sAuthor, string $sDescription, object $oDb, string $sFilenameNew = '') : void

    Function updates file meta information (used when files were created or edited).

    It creates new database record for file meta informations if database record does not exist. Otherwise, existing record will be updated

    Parameters
    NameTypeDescription
    $iIdClientinteger
    • id of client which contains this file
    $sFilenamestring
    • name of corresponding file
    $sTypestring
    • type of file (css, js or templates)
    $sAuthorstring
    • author of file
    $sDescriptionstring
    • description of file
    $oDbobject
    • contenido database object
    $sFilenameNewstring
    • new filename if filename was changed (optional)
    Details
    Author
    Timo Trautmann  
    Documentation was generated by phpDocumentor 2.0.0a12.