diff --git a/app/calls_active/calls_active_inc.php b/app/calls_active/calls_active_inc.php index 74bb0e2296..449cbab77c 100644 --- a/app/calls_active/calls_active_inc.php +++ b/app/calls_active/calls_active_inc.php @@ -217,7 +217,7 @@ else { echo " ".$text['label-park']." \n"; //record start/stop $tmp_dir = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d"); - mkdir($tmp_dir, 0777, true); + mkdir($tmp_dir, 1777, true); $tmp_file = $tmp_dir."/".$uuid.".wav"; if (file_exists($tmp_file)) { //stop diff --git a/app/dialplan_inbound/app_defaults.php b/app/dialplan_inbound/app_defaults.php index 918f0787d1..3040b62011 100644 --- a/app/dialplan_inbound/app_defaults.php +++ b/app/dialplan_inbound/app_defaults.php @@ -52,7 +52,7 @@ //if the public directory doesn't exist then create it if ($domains_processed == 1) { if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) { - if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) { mkdir($_SESSION['switch']['dialplan']['dir'].'/public',0777,true); } + if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) { mkdir($_SESSION['switch']['dialplan']['dir'].'/public',2777,true); } } } @@ -61,7 +61,7 @@ //make sure the public directory and xml file exist if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) { if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public'.$_SESSION['domains'][$domain_uuid]['domain_name'])) { - mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'],0777,true); + mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'],2777,true); } $file = $_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$domain_uuid]['domain_name'].".xml"; if (!file_exists($file)) { diff --git a/app/extensions/app_defaults.php b/app/extensions/app_defaults.php index 1f97d52bed..8ef262fa01 100644 --- a/app/extensions/app_defaults.php +++ b/app/extensions/app_defaults.php @@ -27,7 +27,7 @@ //if the extensions dir doesn't exist then create it if ($domains_processed == 1) { if (strlen($_SESSION['switch']['extensions']['dir']) > 0) { - if (!is_dir($_SESSION['switch']['extensions']['dir'])) { mkdir($_SESSION['switch']['extensions']['dir'],0777,true); } + if (!is_dir($_SESSION['switch']['extensions']['dir'])) { mkdir($_SESSION['switch']['extensions']['dir'],2770,true); } } } diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index 266aaccecd..fec9a3c92a 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -397,7 +397,7 @@ if (!class_exists('extension')) { $xml .= " \n"; if (!is_readable($_SESSION['switch']['extensions']['dir']."/".$row['user_context'])) { - mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'],0755,true); + mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'],2755,true); } if (strlen($extension) > 0) { $fout = fopen($_SESSION['switch']['extensions']['dir']."/".$row['user_context']."/v_".$extension.".xml","w"); diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php index 5dacd2118a..a14fcbf8d4 100644 --- a/app/music_on_hold/music_on_hold.php +++ b/app/music_on_hold/music_on_hold.php @@ -134,7 +134,7 @@ else { //process sampling rate(s) if (isset($sampling_rate_dirs)) foreach ($sampling_rate_dirs as $sampling_rate_dir) { if (!is_dir($music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir)) { - @mkdir($music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir, 0777, true); + mkdir($music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir, 2777, true); } if (is_dir($music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir)) { copy($_FILES['upload_file']['tmp_name'], $music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir."/".$new_file_name); @@ -149,7 +149,7 @@ else { //process sampling rate(s) if (isset($sampling_rate_dirs)) foreach ($sampling_rate_dirs as $sampling_rate_dir) { if (!is_dir($music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir)) { - @mkdir($music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir, 0777, true); + mkdir($music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir, 2777, true); } if (is_dir($music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir)) { copy($_FILES['upload_file']['tmp_name'], $music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir."/".$new_file_name); @@ -165,7 +165,7 @@ else { //process sampling rate(s) if (isset($sampling_rate_dirs)) foreach ($sampling_rate_dirs as $sampling_rate_dir) { if (!is_dir($music_on_hold_dir."/".$sampling_rate_dir)) { - @mkdir($music_on_hold_dir."/".$sampling_rate_dir, 0777, true); + mkdir($music_on_hold_dir."/".$sampling_rate_dir, 2777, true); } if (is_dir($music_on_hold_dir."/".$sampling_rate_dir)) { copy($_FILES['upload_file']['tmp_name'], $music_on_hold_dir."/".$sampling_rate_dir."/".$new_file_name); diff --git a/app/phrases/app_defaults.php b/app/phrases/app_defaults.php index 0dd4b67582..9aaac50d4f 100644 --- a/app/phrases/app_defaults.php +++ b/app/phrases/app_defaults.php @@ -69,7 +69,7 @@ if ($domains_processed == 1) { foreach ($conf_lang_folders as $conf_lang_folder) { //create phrases folder, if necessary if (!file_exists($conf_lang_folder."/phrases/")) { - mkdir($conf_lang_folder."/phrases/", 0777); + mkdir($conf_lang_folder."/phrases/", 2777); } //parse language, open xml file $conf_lang = substr($conf_lang_folder, -2); diff --git a/app/recordings/app_defaults.php b/app/recordings/app_defaults.php index 7e22c12191..2ad20d9df8 100644 --- a/app/recordings/app_defaults.php +++ b/app/recordings/app_defaults.php @@ -26,7 +26,7 @@ //if the recordings directory doesn't exist then create it if (strlen($_SESSION['switch']['recordings']['dir']."/".$domain_name) > 0) { - if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) { mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name,0777,true); } + if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) { mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name,2770,true); } } if ($domains_processed == 1) { diff --git a/app/voicemail_greetings/voicemail_greetings.php b/app/voicemail_greetings/voicemail_greetings.php index eb511333e5..e1db1bf51a 100644 --- a/app/voicemail_greetings/voicemail_greetings.php +++ b/app/voicemail_greetings/voicemail_greetings.php @@ -155,7 +155,7 @@ require_once "resources/check_auth.php"; $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); if (count($result) == 0 && !file_exists($v_greeting_dir.'/'.$file_name)) { //move the uploaded greeting - mkdir($v_greeting_dir, 0777, true); + mkdir($v_greeting_dir, 2777, true); move_uploaded_file($_FILES['file']['tmp_name'], $v_greeting_dir.'/'.$file_name); //set newly uploaded greeting as active greeting for voicemail box $sql = "update v_voicemails "; diff --git a/app/voicemails/app_defaults.php b/app/voicemails/app_defaults.php index 057d4ac770..7a6d83a008 100644 --- a/app/voicemails/app_defaults.php +++ b/app/voicemails/app_defaults.php @@ -89,7 +89,7 @@ if ($domains_processed == 1) { foreach ($voicemails as $row) { $path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$row['domain_name'].'/'.$row['voicemail_id']; if (!file_exists($path)) { - mkdir($path, 0777, true); + mkdir($path, 2777, true); } } unset ($prep_statement, $sql); diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 79b6002882..42cc5d0514 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -386,7 +386,7 @@ if (!class_exists('xml_cdr')) { catch(PDOException $e) { $tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/failed/'; if(!file_exists($tmp_dir)) { - mkdir($tmp_dir, 0777, true); + mkdir($tmp_dir, 2777, true); } if ($_SESSION['cdr']['format']['text'] == "xml") { $tmp_file = $uuid.'.xml'; @@ -413,7 +413,7 @@ if (!class_exists('xml_cdr')) { $tmp_day = date("d", $tmp_time); $tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; if(!file_exists($tmp_dir)) { - mkdir($tmp_dir, 0777, true); + mkdir($tmp_dir, 2777, true); } if ($_SESSION['cdr']['format']['text'] == "xml") { $tmp_file = $uuid.'.xml'; diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index 8903dbfdc8..d8ad6146b7 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -440,7 +440,7 @@ catch(PDOException $e) { $tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/failed/'; if(!file_exists($tmp_dir)) { - mkdir($tmp_dir, 0777, true); + mkdir($tmp_dir, 2777, true); } if ($_SESSION['cdr']['format']['text'] == "xml") { $tmp_file = $uuid.'.xml'; @@ -467,7 +467,7 @@ $tmp_day = date("d", $tmp_time); $tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; if(!file_exists($tmp_dir)) { - mkdir($tmp_dir, 0777, true); + mkdir($tmp_dir, 2777, true); } if ($_SESSION['cdr']['format']['text'] == "xml") { $tmp_file = $uuid.'.xml'; diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index b1713bb2bc..ce53a58e33 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -99,7 +99,7 @@ include "root.php"; //make sure the conf directory exists if (!is_dir($this->global_settings->switch_conf_dir())) { - if (!mkdir($this->global_settings->switch_conf_dir(), 0774, true)) { + if (!mkdir($this->global_settings->switch_conf_dir(), 2774, true)) { throw new Exception("Failed to create the switch conf directory '".$this->global_settings->switch_conf_dir()."'. "); } } @@ -117,9 +117,9 @@ include "root.php"; unset($src_dir, $dst_dir); } $fax_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'fax')); - if (!is_readable($fax_dir)) { mkdir($fax_dir,0777,true); } + if (!is_readable($fax_dir)) { mkdir($fax_dir,2777,true); } $voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'voicemail')); - if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,0777,true); } + if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,2777,true); } //write the xml_cdr.conf.xml file if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/xml_cdr")) { diff --git a/resources/functions.php b/resources/functions.php index 46d2deeb2f..8c04e87892 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -175,7 +175,7 @@ throw new Exception("recursive_copy() source directory '".$src."' does not exist."); } if (!is_dir($dst)) { - if (!mkdir($dst)) { + if (!mkdir($dst,2770,true)) { throw new Exception("recursive_copy() failed to create destination directory '".$dst."'"); } } diff --git a/resources/switch.php b/resources/switch.php index 10a8bc8e05..0d58c4b2ba 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -991,12 +991,12 @@ function save_dialplan_xml() { $dialplan_filename = $dialplan_order."_v_".$dialplan_name.".xml"; if (strlen($row['dialplan_context']) > 0) { if (!is_dir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'])) { - mkdir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'],0755,true); + mkdir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'],2755,true); } if ($row['dialplan_context'] == "public") { if (count($_SESSION['domains']) > 1 && strlen($row['domain_uuid']) > 0) { if (!is_dir($_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$row['domain_uuid']]['domain_name'])) { - mkdir($_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$row['domain_uuid']]['domain_name'],0755,true); + mkdir($_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$row['domain_uuid']]['domain_name'],2755,true); } file_put_contents($_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$row['domain_uuid']]['domain_name']."/".$dialplan_filename, $tmp); } @@ -1006,7 +1006,7 @@ function save_dialplan_xml() { } else { if (!is_dir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'])) { - mkdir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'],0755,true); + mkdir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'],2755,true); } file_put_contents($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context']."/".$dialplan_filename, $tmp); } @@ -1383,7 +1383,7 @@ if (!function_exists('save_sip_profile_xml')) { // make profile dir if needed $profile_dir = $_SESSION['switch']['conf']['dir']."/sip_profiles"; - if (!is_readable($profile_dir)) { mkdir($profile_dir,0775,true); } + if (!is_readable($profile_dir)) { mkdir($profile_dir,2775,true); } //get the global variables global $domain_uuid; @@ -1448,7 +1448,7 @@ if (!function_exists('save_sip_profile_xml')) { } //if the directory does not exist then create it - if (!is_readable($profile_dir.'/'.$sip_profile_name)) { mkdir($profile_dir.'/'.$sip_profile_name,0775,true); } + if (!is_readable($profile_dir.'/'.$sip_profile_name)) { mkdir($profile_dir.'/'.$sip_profile_name,2775,true); } } //end foreach unset($sql, $result, $row_count);