function module_get_annoucements() { global $db; global $amp_conf; $fn = generate_module_repo_url("/version-" . getversion() . ".html"); $announcement = file_get_contents_url($fn); return $announcement; }
/** * Downloads a file and places it in the destination defined * @version 2.11 * @param string $url_file URL of File * @param string $destination_file Destination of file * @package epm_system */ function download_file($url_file, $destination_file, &$error = array()) { //Determine if file_get_contents_url exists which is the default FreePBX Standard for downloading straight files if (function_exists('file_get_contents_url')) { $contents = file_get_contents_url($url_file); } else { //I really hope we NEVER get here. $contents = file_get_contents($url_file); if (!preg_match('/200/', $http_response_header[0])) { $error['download_file'] = "Unknown Error in Download_file"; return false; } } //If contents are emtpy then we failed. Or something is wrong if (!empty($contents)) { $dirname = dirname($destination_file); if (!file_exists($dirname)) { mkdir($dirname); } if (!is_writable($dirname)) { $error['download_file'] = "Directory '" . $dirname . "' is not writable! Unable to download files"; return false; } file_put_contents($destination_file, $contents); //check file placement if (!file_exists($destination_file)) { $error['download_file'] = "File Doesn't Exist in '" . $dirname . "'. Unable to download files"; return false; } return true; } else { $error['download_file'] = "Contents of Remote file are blank! URL:" . $url_file; return false; } }