Class htaccessBlockMaker

Description

A simple class to generate simple .htaccess files

A simple class to generate very simple .htaccess files. It can take an list of IPs or UserAgents to block and create a .htaccess that blockes based on that.

Located in /htaccessblockmaker.lib.php (line 31)


	
			
Variable Summary
string $endl
int $error
string $filestring
Array(Array-serialized(string)) $list
Array(string) $listdef
Array(string) $listip
string $listipdef
Array(string) $listua
string $listuadef
bool $loaded
bool $update
Method Summary
htaccessBlockMaker __construct ([string $file = ''])
bool add_ip (string $ip)
Array(string) get_custom (int $n)
string get_customdef (int $n)
string get_ipdef ()
Array(string) get_iplist ()
string get_uadef ()
Array(string) get_ualist ()
bool loadfile ([string $string = 'by default reverts to filestring'])
bool load_file ([string $filename = 'by default reverts to filestring'])
bool process ()
void reset_error ()
string savefile ([bool $force = false])
void save_file ([ $force = false])
bool set_custom (int $n, Array(string) $v)
bool set_file (string $filename)
bool set_iplist (Array(string) $ipl)
bool set_ualist (Array(string) $li)
Variables
string $endl (line 111)

Newline (default to \n)

int $error (line 99)

The current error code

Error code:

  • 0 - NoError
  • 1 - FileNotFound
  • 2 - NoFileToSet
  • 3 - NoFileToProcess
  • 4 - InvalidInput
  • 5 - OutOfBounds
  • 6 - NotUpdated

string $filestring (line 37)

The name of the file to load

Array(Array-serialized(string)) $list (line 78)

List of Misc options to block

Array(string) $listdef (line 84)

List of Misc strings

Array(string) $listip (line 49)

List of IPs to block

string $listipdef (line 57)

String to use for IP blocking

The string to use to block an IP. Defaults to "deny from REPLACE".

Array(string) $listua (line 63)

List of User-Agents to block

string $listuadef (line 72)

String to use for User-Agent blocking

The string to use to block UserAgent. Defaults to "SetEnvIfNoCase REPLACE bad_item". Should not be changed.

bool $loaded (line 43)

Has the specified file been loaded?

bool $update (line 105)

Has definitions been updated?

Methods
Constructor __construct (line 122)

Creates a new htaccessBlockMaker

Creates a new htaccessBlockMaker. No need to call this manually - it is called when you make it.

  • function: __construct
htaccessBlockMaker __construct ([string $file = ''])
  • string $file: A file to automatically set
add_ip (line 353)

Adds a new IP to the IP List

Adds a new IP to the IP list.

  • return: Returns true on success, false on failure
  • function: add_ip
bool add_ip (string $ip)
  • string $ip: An IP address in the form of *.*.*.*
get_custom (line 427)

Gets a custom list

Gets a custom list with the specified index.

  • return: The custom list or false on failure
  • function: get_custom
Array(string) get_custom (int $n)
  • int $n: The index
get_customdef (line 481)

Gets the custom definition

Gets a custom definition based on a index

  • return: The definition, or false on failure
  • function: get_customdef
string get_customdef (int $n)
  • int $n: The index
get_ipdef (line 341)

Gets the IP definition

Gets the definition of the IP blocking. Default is "deny from REPLACE".

  • return: The definition
  • function: get_ipdef
string get_ipdef ()
get_iplist (line 302)

Gets the IP banlist

Gets the IP banlist (array).

  • return: The IP banlist
  • function: get_iplist
Array(string) get_iplist ()
get_uadef (line 415)

Gets the useragent def

Gets the definition for the User Agent

  • return: The definition
  • function: get_uadef
string get_uadef ()
get_ualist (line 383)

Gets the UserAgent banlist

Gets the User Agent banlist in array form.

  • function: get_ualist
Array(string) get_ualist ()
loadfile (line 175)

Loads a file

Loads a datafile. If the file is not supplied, it is overridden by the filestring variable, set through set_file.

  • return: Returns true on success, false on failure
  • function: loadfile
bool loadfile ([string $string = 'by default reverts to filestring'])
  • string $string: The file to load
load_file (line 162)

Loads a file

Alias of loadfile.

  • return: Returns true on success and false on failure
  • function: load_file
bool load_file ([string $filename = 'by default reverts to filestring'])
  • string $filename: The file to load
process (line 245)

Process the file

Processes the file into a .htaccess.

  • return: Returns true on success, false on failure
  • function: process
bool process ()
reset_error (line 291)

Resets the error code

Resets the error code back to zero.

  • function: reset_error
void reset_error ()
savefile (line 508)

Saves a file

Saves the file.

  • return: The XML file, or false on failure
  • function: savefile
string savefile ([bool $force = false])
  • bool $force: Force saving, even if not updated?
save_file (line 496)
void save_file ([ $force = false])
  • $force
set_custom (line 453)

Sets a custom list

Sets the specified index's list

  • return: Returns true on success, false on failure
  • function: set_custom
bool set_custom (int $n, Array(string) $v)
  • int $n: The index
  • Array(string) $v: The list
set_file (line 141)

Sets the file to load

Sets the name of the file to load.

  • return: Returns true on success, false on failure.
  • function: set_file
bool set_file (string $filename)
  • string $filename: The name of the file to load
set_iplist (line 314)

Sets the IP banlist

Sets the IP banlist (array).

  • return: Returns true on success, false on failure
  • function: set_iplist
bool set_iplist (Array(string) $ipl)
  • Array(string) $ipl: The new IP banlist
set_ualist (line 395)

Sets the User Agent list

Sets the new User Agent list in the array form.

  • return: Returns true on success, false on failure
  • function: set_ualist
bool set_ualist (Array(string) $li)
  • Array(string) $li: The new UserAgent list

Documentation generated on Tue, 09 Sep 2008 19:27:53 -0400 by phpDocumentor 1.4.1