Create more documentation (#7627)

* Documentation, format class, no modification.
This commit is contained in:
frytimo
2025-11-18 21:33:07 -04:00
committed by GitHub
parent e619c97ce6
commit adfc4cc469
104 changed files with 24461 additions and 21721 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -61,6 +61,13 @@
$available_columns[] = 'voicemail_tutorial';
//define the functions
/**
* Converts a 2D array into a CSV string.
*
* @param array &$array The input array to convert. Each inner array represents a row in the CSV output.
*
* @return string|null The CSV data as a string, or null if the input array is empty.
*/
function array2csv(array &$array) {
if (count($array) == 0) {
return null;
@@ -75,6 +82,13 @@
return ob_get_clean();
}
/**
* Sends HTTP headers to initiate a file download.
*
* @param string $filename The name of the file to be downloaded.
*
* @return void
*/
function download_send_headers($filename) {
// disable caching
$now = gmdate("D, d M Y H:i:s");

View File

@@ -38,18 +38,6 @@
$language = new text;
$text = $language->get();
//built in str_getcsv requires PHP 5.3 or higher, this function can be used to reproduct the functionality but requirs PHP 5.1.0 or higher
if (!function_exists('str_getcsv')) {
function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") {
$fp = fopen("php://memory", 'r+');
fputs($fp, $input);
rewind($fp);
$data = fgetcsv($fp, null, $delimiter, $enclosure); // $escape only got added in 5.3.0
fclose($fp);
return $data;
}
}
//set the max php execution time
ini_set('max_execution_time', 7200);
@@ -230,7 +218,15 @@
}
//get the parent table
function get_parent($schema,$table_name) {
/**
* Retrieves the parent table for a given table name from a schema.
*
* @param array $schema A multidimensional array representing the schema of tables.
* @param string $table_name The name of the table to retrieve the parent for.
*
* @return string|null The name of the parent table, or null if not found in the schema.
*/
function get_parent($schema, $table_name) {
foreach ($schema as $row) {
if ($row['table'] == $table_name) {
return $row['parent'];

View File

@@ -38,6 +38,13 @@
$voicemail_id = trim($_GET['id']);
//used (above) to search the array to determine if an extension is assigned to the user
/**
* Checks if a specific extension has been assigned to the current user.
*
* @param string $number The extension number or alias to check for assignment.
*
* @return boolean True if the extension is assigned, false otherwise.
*/
function extension_assigned($number) {
foreach ($_SESSION['user']['extension'] as $row) {
if ((is_numeric($row['number_alias']) && $row['number_alias'] == $number) || $row['user'] == $number) {
@@ -75,6 +82,14 @@
}
//define the download function (helps safari play audio sources)
/**
* Downloads a file in range mode.
*
* This function sends the file to the client in chunks, allowing for partial downloads
* and resuming from where the download was left off.
*
* @param string $file The path to the file being downloaded.
*/
function range_download($file) {
$fp = @fopen($file, 'rb');
@@ -103,7 +118,7 @@
$c_start = $start;
$c_end = $end;
// Extract the range string
list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
[, $range] = explode('=', $_SERVER['HTTP_RANGE'], 2);
// Make sure the client hasn't sent us a multibyte range
if (strpos($range, ',') !== false) {
// (?) Shoud this be issued here, or should the first

View File

@@ -138,6 +138,14 @@
case 'recorded_name':
//used below to search the array to determine if an extension is assigned to the user
/**
* Checks if an extension has been assigned to the current user.
*
* @param string $number The number of the extension, or the name of a user who is currently assigned this extension
*
* @return bool True if the extension has been assigned, False otherwise
*/
function extension_assigned($number) {
foreach ($_SESSION['user']['extension'] as $row) {
if ((is_numeric($row['number_alias']) && $row['number_alias'] == $number) || $row['user'] == $number) {