Skip to main content Help Control Panel

Aubagne HipHop

Tout le Hip Hop d'Aubagne et des alentours

Home «   Server software «  

Documentation: files/files.php

ContentClick to slide

Class Files - The database abstraction layer for files

Files are saved into the file system of the web server. Each file also has a related record in the database.

This script is a reference file of this system.

Voir aussi:

Licence: GNU Lesser General Public License

Auteurs:

Testeurs:

Reste à faire:

delete() - Delete one file in the database and in the file system

function delete($id)

delete_for_anchor() - Delete all files for a given anchor

function delete_for_anchor($anchor)

get() - Get one file by id

function &get($id)

get_by_anchor_and_name() - Get one file by anchor and name

function &get_by_anchor_and_name($anchor, $name)

get_icon_url() - Get the url to the icon for this file

function get_icon_url($name)

get_mime_type() - Get the mime type for a file

function get_mime_type($name)

We don't use the internal function from PHP library, which has proven to be boggus.

get_mime_types() - Get supported MIME types

function &get_mime_types()



Voir aussi:

get_next_url() - Get url of next file

function get_next_url($item, $anchor, $order='date', $capability='?')

This function is used to build navigation bars.

Voir aussi:

get_previous_url() - Get url of previous file

function get_previous_url($item, $anchor, $order='date', $capability='?')

This function is used to build navigation bars.

Voir aussi:

get_url() - Get the url to view a file

function get_url($id, $action='view')

By default, a relative URL will be provided (e.g. 'files/view.php?id=512'), which may be not processed correctly by search engines. If the parameter 'with_friendly_urls' has been set to 'Y' in the configuration panel, this function will return an URL parsable by search engines (e.g. 'files/view.php/512').

Voir aussi:

increment_hits() - Set the hits counter - errors are not reported, if any

function increment_hits($id)

is_audio_stream() - Look for potential audio streams

function is_audio_stream($name)

Meta-data types are not matched (e.g., m3u).

This function returns TRUE for following file types:

is_authorized() - Check if a file type is authorized

function is_authorized($name)

This function is based on the growing list of extensions officially supported by YACS. It also considers additional extensions set in the configuration panel for files.

Voir aussi:

is_stream() - Should this file be streamed?

function is_stream($name)



is_video_stream() - Look for potential video streams

function is_video_stream($name)

Meta-data types are not matched (e.g., m3u).

This function returns TRUE for following file types:

list_by_date() - List newest files

function &list_by_date($offset=0, $count=10, $variant='dates')

To build a simple box of the newest files in your main index page, just use the following example:

// side bar with the list of most recent files
include_once 'files/files.php';
$local['title_en'] = 'Most recent Files';
$local['title_fr'] = 'Fichiers récents';
$title i18n::user('title');
$items Files::list_by_date(010);
$text Skin::build_list($items'compact');
$context['text'] .= Skin::build_box($title$text'navigation');


You can also display the newest file separately, using Files::get_newest() In this case, skip the very first file in the list by using Files::list_by_date(1, 10)

list_by_date_for_anchor() - List newest files for one anchor

function &list_by_date_for_anchor($anchor, $offset=0, $count=20, $variant='no_anchor', $capability='?')

Files are sorted according to creation date, therefore file replacement or update does not change the order.

Example: include_once 'files/files.php'; $items = Files::list_by_date_for_anchor('section:12', 0, 10); $context['text'] .= Skin::build_list($items, 'compact');

Voir aussi:

list_by_date_for_author() - List newest files for one author

function &list_by_date_for_author($author_id, $offset=0, $count=20, $variant='no_author')

Example: include_once 'files/files.php'; $items = Files::list_by_date_for_author(12, 0, 10); $context['text'] .= Skin::build_list($items, 'compact');

list_by_hits() - List most read files

function &list_by_hits($offset=0, $count=10, $variant='hits')

To build a simple box of the most read files in your main index page, just use Files::list_by_hits(0, 10)

Example: include_once '../files/files.php'; $context['text'] .= Skin::build_list(Files::list_by_hits(), 'compact');

You can also display the most read file separately, using Files::get_most_read() In this case, skip the very first file in the list by using Files::list_by_hits(1)

list_by_hits_for_author() - List newest files for one author

function &list_by_hits_for_author($author_id, $offset=0, $count=10, $variant='hits')

Example: include_once 'files/files.php'; $items = Files::list_by_hits_for_author(12, 0, 10); $context['text'] .= Skin::build_list($items, 'compact');

list_by_oldest_date() - List oldest files

function &list_by_oldest_date($offset=0, $count=10, $variant='full')

This function never lists inactive files. It is aiming to provide a simple list of the most old files to put in simple boxes.

list_by_size() - List biggest files

function &list_by_size($offset=0, $count=10, $variant='full')

list_by_title_for_anchor() - List files by title for one anchor

function &list_by_title_for_anchor($anchor, $offset=0, $count=10, $variant='no_anchor', $capability='?')

Example: include_once '../files/files.php'; $items = Files::list_by_title_for_anchor('article:12'); $context['text'] .= Skin::build_list($items, 'decorated');

Voir aussi:

list_selected() - List selected files

function &list_selected(&$result, $layout='compact', $capability='?')

Accept following variants:

Voir aussi:

list_unused() - List less downloaded files

function &list_unused($offset=0, $count=10, $variant='full')

post() - Post a new file or an updated file

function post($fields, $capability='?')



Voir aussi:

search() - Search for some keywords in all files

function &search($pattern, $offset=0, $count=10, $variant='search')

Only files matching following criteria are returned:

setup() - Create tables for files

function setup()

stat() - Get some statistics for all files

function &stat()



Voir aussi:

stat_for_anchor() - Get some statistics for one anchor

function &stat_for_anchor($anchor, $capability='?')

Tools
Browse the source of this script
Server software