|
HistView Api Doc | |||||
PREV NEXT | Frames No Frame | |||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
![]() | hvconfig |
![]() |
Scanning a directory and checking for download files
Constructor Summary | ||
void | download([string $basedir], [string $icondir]) Initial setup of default filetypes and date format |
Method Summary | ||
protected void | add_bot(mixed $bot, string $cat) Setup bots to be ignored/rejected | |
void | add_details([string $descdir], [boolean $descreplace]) Add details to the filelist (fields "size" and "date") | |
protected void | ar_sort_by(array $arr, string $orderby, [boolean $rev], [integer $method]) Sort array by given key | |
void | blacklistCheck() Handle IP blacklist | |
void | crawler_net(mixed $name) Add name to crawler list | |
protected object& | db_init() Initialize DB and hand-out a handle to it | |
void | db_setup(string $host, string $database, string $user, string $passwd, string $table, string $limitTable) Setup database connection | |
void | dbcounter(string $filename) Increase download counter in the database (if statisticsmode is enabled and the Remote UA is not in the ignore list) | |
array | get_filelist() Get full (interpreted) filelist | |
array | get_filenames() Get the list of files | |
protected string | getProgName(string $file) Get the prog name from the file name | |
void | ignore_bot(mixed $bot) Add bots to ignore list | |
protected void | interprete_filelist([integer $dirnum]) Generate list of all files incl. | |
boolean | is_crawler_net() Network check (where does the request come from) | |
void | limit_check(string $file) Check for download limits and reject the request if they are exceeded | |
void | limit_purge() Purge the limits table | |
void | refererCheck() Handle request w/o referer | |
void | reject() Reject a client and quit | |
void | reject_bot(mixed $bot) Add bots to reject list | |
void | scan_dir(string $dir, [integer $dirnum]) Scan another directory Switches to another directory. | |
boolean | send_latest(string $prog, string $type, [string $directory]) Send latest version | |
boolean | sendfile(string $filename, [string $directory]) Download a file (if the remote UA is not in the reject list) | |
void | set_argsep(string $separator) Set the argument separator This is how to separate arguments in the URL. | |
void | set_bots(string $type, string $filename) Setup bots to ignore / reject | |
void | set_dateformat(string $format) Set the date format to use | |
void | set_dllinktype(string $type) Set download linktype | |
void | set_excludes(array $excludes, [boolean $replace]) Setup exclude list | |
void | set_filetype(string $type, string $mask, string $extension, [string $icon]) Setup file types | |
void | set_icondir(string $dir) Set the directory (URL) where your icons reside | |
boolean | set_statisticsmode(integer $mode) Set the statisticsmode Use this to turn on (1)/Off (0) statistic functions (database related stuff like download counters) at runtime | |
void | sort_by_filename([boolean $rev]) Sort by filename | |
void | sort_by_version([boolean $rev]) Sort filelist by version | |
array | whois(string $host, [boolean $raw], [string $server], [integer $port]) Query the whois database |
Constructor Detail |
void download([string $basedir], [string $icondir])
Initial setup of default filetypes and date format
basedir
- What to cut off to generate a download link.
This is usually your web servers document root. This parameter is
not needed when using the internal download method (default).icondir
- URL of the directory where the icons resideMethod Detail |
protected void add_bot(mixed $bot, string $cat)
Setup bots to be ignored/rejected
bot
- string or array of strings (substr of botnames)cat
- category to add the bot to (ignore,reject)void add_details([string $descdir], [boolean $descreplace])
Add details to the filelist (fields "size" and "date")
descdir
- Directory where the description files reside.
Name of a description file must be either <name>.desc (for a
general, version independent description) or
<name>_<version>.desc (description bound to a specific
version). The latter one is used (if found), the first one otherwise
(if found). Descriptions will be preceded by "<name> v<version>".
If a description file is found, it then will be added after an additional
line break (<BR>).descreplace
- Replace the short desc (TRUE, default)
or append to it (FALSE)protected void ar_sort_by(array $arr, string $orderby, [boolean $rev], [integer $method])
Sort array by given key
arr
- Array to sortorderby
- Field to order byrev
- Reverse order (default:false)method
- One of the constants SORT_REGULAR,
SORT_NUMERIC, SORT_STRING, SORT_LOCALE_STRINGvoid blacklistCheck()
Handle IP blacklist
void crawler_net(mixed $name)
Add name to crawler list
name
- string or array of strings (substr of botnames)protected object& db_init()
Initialize DB and hand-out a handle to it
void db_setup(string $host, string $database, string $user, string $passwd, string $table, string $limitTable)
Setup database connection
host
- hostname the DB is running ondatabase
- Name of the database to useuser
- DB User to connect withpasswd
- Password to usetable
- Name of the download tablelimitTable
- Name of the download limits tablevoid dbcounter(string $filename)
Increase download counter in the database (if statisticsmode is enabled and the Remote UA is not in the ignore list)
filename
- Filename to processarray get_filelist()
Get full (interpreted) filelist
array get_filenames()
Get the list of files
protected string getProgName(string $file)
Get the prog name from the file name
file
- name of the filevoid ignore_bot(mixed $bot)
Add bots to ignore list
bot
- string or array of strings (substr of botnames)protected void interprete_filelist([integer $dirnum])
Generate list of all files incl. basic information Is called from method scan_dir
dirnum
- If you run multiple directories via an array, you can store the index here. Will be added to the DL URL, when internal DL method is used.boolean is_crawler_net()
Network check (where does the request come from)
void limit_check(string $file)
Check for download limits and reject the request if they are exceeded
file
- name of the downloaded filevoid limit_purge()
Purge the limits table
void refererCheck()
Handle request w/o referer
void reject()
Reject a client and quit
void reject_bot(mixed $bot)
Add bots to reject list
bot
- string or array of strings (substr of botnames)void scan_dir(string $dir, [integer $dirnum])
Scan another directory Switches to another directory. This resets the internal file array and starts over. The filelist array will not be reset, so entries are added to it.
dir
- Directory to scandirnum
- If you run multiple directories via an array, you can store the index here. Will be added to the DL URL, when internal DL method is used.boolean send_latest(string $prog, string $type, [string $directory])
Send latest version
prog
- Which program is requestedtype
- What type of archive (first parameter of set_filetype)directory
- Directory where the file resides (if it was not scanned yet)boolean sendfile(string $filename, [string $directory])
Download a file (if the remote UA is not in the reject list)
filename
- File to downloaddirectory
- Directory where the file resides (if other than the recent one)void set_argsep(string $separator)
Set the argument separator This is how to separate arguments in the URL. Default is ";" - you may want to set this to "&"
separator
- void set_bots(string $type, string $filename)
Setup bots to ignore / reject
type
- "ignore" or "reject"filename
- file to read the bots fromvoid set_dateformat(string $format)
Set the date format to use
format
- Date format to use (refer to the PHP manual of date)void set_dllinktype(string $type)
Set download linktype
type
- type of the linkvoid set_excludes(array $excludes, [boolean $replace])
Setup exclude list
excludes
- Array of files to exclude from listingsreplace
- Replace the preset list (TRUE) or append to it (FALSE)? Default is to append.void set_filetype(string $type, string $mask, string $extension, [string $icon])
Setup file types
type
- Short name for the type, e.g. "rpm", "deb", "tar"mask
- Corresponding regexp mask. The back references should be
set such that extension
- File extension to identify this type - e.g. "deb" or "tar.gz"icon
- Complete img tag to display for this typevoid set_icondir(string $dir)
Set the directory (URL) where your icons reside
dir
- URL of the directory where the icons resideboolean set_statisticsmode(integer $mode)
Set the statisticsmode Use this to turn on (1)/Off (0) statistic functions (database related stuff like download counters) at runtime
mode
- 0 (to turn off stats) or 1 (to turn them on)void sort_by_filename([boolean $rev])
Sort by filename
rev
- Reverse order? Default: Falsevoid sort_by_version([boolean $rev])
Sort filelist by version
rev
- Reverse order? Default: Falsearray whois(string $host, [boolean $raw], [string $server], [integer $port])
Query the whois database
host
- IP/hostnameraw
- whether to include the raw whois information (default: FALSE)server
- whois server to use (default: "whois.arin.net")port
- (default: 43)
|
HistView Api Doc | |||||
PREV NEXT | Frames No Frame | |||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This document was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)