more phpdoc in DirOptions and DirProtections
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -18,6 +18,30 @@
|
||||
class DirOptions extends ApiCommand implements ResourceEntity
|
||||
{
|
||||
|
||||
/**
|
||||
* add options for a given directory
|
||||
*
|
||||
* @param int $customerid
|
||||
* optional, admin-only, the customer-id
|
||||
* @param string $loginname
|
||||
* optional, admin-only, the loginname
|
||||
* @param string $path
|
||||
* path relative to the customer's home-Directory
|
||||
* @param bool $options_indexes
|
||||
* optional, activate directory-listing for this path, default 0 (false)
|
||||
* @param bool $options_cgi
|
||||
* optional, allow Perl/CGI execution, default 0 (false)
|
||||
* @param string $error404path
|
||||
* optional, custom 404 error string/file
|
||||
* @param string $error403path
|
||||
* optional, custom 403 error string/file
|
||||
* @param string $error500path
|
||||
* optional, custom 500 error string/file
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->isAdmin() == false && Settings::IsInList('panel.customer_hide_options', 'extras')) {
|
||||
@@ -116,12 +140,10 @@ class DirOptions extends ApiCommand implements ResourceEntity
|
||||
}
|
||||
|
||||
/**
|
||||
* return a directory-protection entry by either id or username
|
||||
* return a directory-protection entry by id
|
||||
*
|
||||
* @param int $id
|
||||
* optional, the customer-id
|
||||
* @param string $username
|
||||
* optional, the username
|
||||
* id of dir-protection entry
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws Exception
|
||||
@@ -148,7 +170,7 @@ class DirOptions extends ApiCommand implements ResourceEntity
|
||||
}
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
|
||||
WHERE `customerid` IN (".implode(", ", $customer_ids).")
|
||||
WHERE `customerid` IN (" . implode(", ", $customer_ids) . ")
|
||||
AND `id` = :id
|
||||
");
|
||||
} else {
|
||||
@@ -178,6 +200,30 @@ class DirOptions extends ApiCommand implements ResourceEntity
|
||||
throw new Exception("Directory option with " . $key . " could not be found", 404);
|
||||
}
|
||||
|
||||
/**
|
||||
* update options for a given directory by id
|
||||
*
|
||||
* @param int $id
|
||||
* id of dir-protection entry
|
||||
* @param int $customerid
|
||||
* optional, admin-only, the customer-id
|
||||
* @param string $loginname
|
||||
* optional, admin-only, the loginname
|
||||
* @param bool $options_indexes
|
||||
* optional, activate directory-listing for this path, default 0 (false)
|
||||
* @param bool $options_cgi
|
||||
* optional, allow Perl/CGI execution, default 0 (false)
|
||||
* @param string $error404path
|
||||
* optional, custom 404 error string/file
|
||||
* @param string $error403path
|
||||
* optional, custom 403 error string/file
|
||||
* @param string $error500path
|
||||
* optional, custom 500 error string/file
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$id = $this->getParam('id', true, 0);
|
||||
@@ -274,7 +320,7 @@ class DirOptions extends ApiCommand implements ResourceEntity
|
||||
$result = array();
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
|
||||
WHERE `customerid` IN (".implode(', ', $customer_ids).")
|
||||
WHERE `customerid` IN (" . implode(', ', $customer_ids) . ")
|
||||
");
|
||||
Database::pexecute($result_stmt, null, true, true);
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
@@ -18,6 +18,23 @@
|
||||
class DirProtections extends ApiCommand implements ResourceEntity
|
||||
{
|
||||
|
||||
/**
|
||||
* add htaccess protection to a given directory
|
||||
*
|
||||
* @param int $customerid
|
||||
* optional, admin-only, the customer-id
|
||||
* @param string $loginname
|
||||
* optional, admin-only, the loginname
|
||||
* @param string $path
|
||||
* @param string $username
|
||||
* @param string $directory_password
|
||||
* @param string $directory_authname
|
||||
* optional name/description for the protection
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->isAdmin() == false && Settings::IsInList('panel.customer_hide_options', 'extras')) {
|
||||
@@ -103,7 +120,7 @@ class DirProtections extends ApiCommand implements ResourceEntity
|
||||
* return a directory-protection entry by either id or username
|
||||
*
|
||||
* @param int $id
|
||||
* optional, the customer-id
|
||||
* optional, the entry-id
|
||||
* @param string $username
|
||||
* optional, the username
|
||||
*
|
||||
@@ -134,7 +151,7 @@ class DirProtections extends ApiCommand implements ResourceEntity
|
||||
}
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
WHERE `customerid` IN (".implode(", ", $customer_ids).")
|
||||
WHERE `customerid` IN (" . implode(", ", $customer_ids) . ")
|
||||
AND (`id` = :idun OR `username` = :idun)
|
||||
");
|
||||
} else {
|
||||
@@ -164,6 +181,26 @@ class DirProtections extends ApiCommand implements ResourceEntity
|
||||
throw new Exception("Directory protection with " . $key . " could not be found", 404);
|
||||
}
|
||||
|
||||
/**
|
||||
* update htaccess protection of a given directory
|
||||
*
|
||||
* @param int $id
|
||||
* optional, the entry-id
|
||||
* @param string $username
|
||||
* optional, the username
|
||||
* @param int $customerid
|
||||
* optional, admin-only, the customer-id
|
||||
* @param string $loginname
|
||||
* optional, admin-only, the loginname
|
||||
* @param string $directory_password
|
||||
* optional, leave empty for no change
|
||||
* @param string $directory_authname
|
||||
* optional name/description for the protection
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$id = $this->getParam('id', true, 0);
|
||||
@@ -252,7 +289,7 @@ class DirProtections extends ApiCommand implements ResourceEntity
|
||||
$result = array();
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
WHERE `customerid` IN (".implode(', ', $customer_ids).")
|
||||
WHERE `customerid` IN (" . implode(', ', $customer_ids) . ")
|
||||
");
|
||||
Database::pexecute($result_stmt, null, true, true);
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
Reference in New Issue
Block a user