Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation



integrationblogcta.jpg

Htaccess Module Documentation

Allows you to access the .htaccess handling functionality such as password protecting directory.

The functions within this module may or may not be governed by a feature list. The required feature list may vary from function to function, to review a total list of the available features sets on a cPanel server, please see "Feature Manager" in WHM.

Htaccess::del_user

API Version: 1 - Click here for documentation
Syntax: Htaccess::del_user( dir, user )
Description: Revoke a user's access to a password protected directory.
Parameters:  
  dir (string)
  The directory from which the user should be removed.
  user (string)
  The user whose access should be removed.
Returns:  
 
This function does not produce any output.

Htaccess::checkprotected

API Version: 1 - Click here for documentation
Syntax: Htaccess::checkprotected( dir )
Description: Discern whether a specific directory is protected by the 'Password Protect' feature.
Parameters:  
  dir (string)
  The directory that to check for password protection.
Returns:  
 
'checked="checked"' if the directory is password protected. If the directory is not password protected, the function does not produce any output.

Htaccess::getindex

API Version: 1 - Click here for documentation
Syntax: Htaccess::getindex( dir, indextype )
Description: Discern whether a directory contains a custom index page, as configured on the 'Index Manager' feature in cPanel.
Parameters:  
  dir (string)
  The directory in which to check for an index page.
  indextype (integer)
  An integer that represents the type of indexing for which to check:
0 - No indexing
1 - Standard Indexing
2 - Fancy Indexing.
Returns:  
 
'checked="checked"' if the input index type matches what is in use.

Htaccess::set_pass

API Version: 1 - Click here for documentation
Syntax: Htaccess::set_pass( dir, user, pass )
Description: Create a new user and password for a protected directory. This function requires access to the 'webprotect' feature. This function is not available in demo mode.
Parameters:  
  dir (string)
  The directory for which to add the new user.
  user (string)
  The username to add.
  pass (string)
  The password for the new user.
Returns:  
 
This function does not produce any output.

Htaccess::setphppreference

API Version: 1 - Click here for documentation
Syntax: Htaccess::setphppreference( php_version )
Description: Set the default PHP version for a cPanel account on a system that uses both PHP 4 and 5.
Parameters:  
  php_version (integer)
  The PHP version to set as the default version for the cPanel account.
Returns:  
 
This function does not produce any output.

Htaccess::showusers

API Version: 1 - Click here for documentation
Syntax: Htaccess::showusers( dir )
Description: Retrieve the number of users currently allowed into a specified directory. This function requires access to the 'webprotect' feature.
Parameters:  
  dir (string)
  The directory to query.
Returns:  
 
An integer value that contains the number of users allowed to access the specified directory (e.g., 10).

Htaccess::setindex

API Version: 1 - Click here for documentation
Syntax: Htaccess::setindex( dir, ival )
Description: Set the index behavior for a particular directory. This function requires access to the 'indexmanager' feature. This function is not available in demo mode.
Parameters:  
  dir (string)
  The directory whose index behavior will be set.
  ival (integer)
  The directory behavior to set for the index. Acceptable values include -1, 0, 1, or 2:
2:
Options All, Indexes
IndexOptions FancyIndexing
1:
Options All Indexes
IndexOptions -FancyIndexing
0:
Options All -Indexes
-1:
Options All.
Returns:  
 
The output will contain a brief synopsis (e.g., set to the System Default).

Htaccess::htdirls

API Version: 1 - Click here for documentation
Syntax: Htaccess::htdirls( dir, listtype )
Description: Create an interface for sending arguments to the calling HTML file and dohtaccess.html. This function requires access to the 'webprotect' feature.
Parameters:  
  dir (string)
  The directory to include in the listing.
  listtype (1 or 2)
  Passing 1 to this parameter causes the function to print HTML that links to images/noindex.gif. Passing 2 to this parameter causes the function to provide HTML that links to images/leech.jpg (for leech protection).
Returns:  
 
The output should resemble the following:
<b><a href="/frontend/x3/test.html?dir=%2fhome%2fusername%2fpublic_html%2ftest"><img src="images/i-directory.gif" border="0"></a> <a href="/frontend/x3/test.html">/</a></b>
<a href="/frontend/x3/test.html?dir=%2fhome%2fusername%2Fpublic_html%2f">public_html</a> /
<a href="dohtaccess.html?dir=%2fhome%2fusername%2Fpublic_html%2ftest%2f">test</a> /
<i>(Current Folder)</i>
<br />
<a href="/frontend/x3/test.html?dir=%2fhome%2fusername%2fpublic_html%2f"><img src="images/i-directory.gif" border="0"></a> <a href="/frontend/x3/test.html?dir=%2fhome%2fusername%2fpublic_html%2f"><b>Up One Level</b></a>

Htaccess::resname

API Version: 1 - Click here for documentation
Syntax: Htaccess::resname( dir )
Description: Retrieve the authname value from an .htaccess file. This function requires access to the 'webprotect' feature.
Parameters:  
  dir (string)
  The directory to query.
Returns:  
 
A string value that contains the authname.

Htaccess::phpselectable

API Version: 1 - Click here for documentation
Syntax: Htaccess::phpselectable( )
Description: Retrieve the php_selected environment variable that indicates the account's default PHP version. This function will also set the php_selectable environment variable to 1 if both PHP 4 and PHP 5 are installed.
Returns:  
 
This function does not produce any output.

Htaccess::set_protect

API Version: 1 - Click here for documentation
Syntax: Htaccess::set_protect( dir, pval, resname )
Description: Enable password protection for a directory. This function requires access to the 'webprotect' feature. This function is not available in demo mode.
Parameters:  
  dir (string)
  The directory to protect.
  pval (boolean)
  Passing 1 to this parameter enables password protection for the specified directory. Passing 0 to this parameter will remove password protection.
  resname (string)
  The string to put in the authname field. This parameter is essentially the name of the directory protection instance.
Returns:  
 
This function does not produce any output unless there is an error.

Htaccess::number_of_users

API Version: 1 - Click here for documentation
Syntax: Htaccess::number_of_users( dir )
Description: Retrieve the number of users allowed to access a specific directory. This function requires access to the 'webprotect' feature.
Parameters:  
  dir (string)
  The directory to query.
Returns:  
 
An integer value that displays the number of users (e.g., 10).

Topic revision: r2 - 27 Mar 2012 - 18:32:21 - Main.JenniferDoubrava