Example #1
0
     $destination = '/etc/fusionpbx/resources/templates/conf/sip_profiles';
 }
 if (file_exists('/usr/local/share/fusionpbx/resources/templates/conf')) {
     //bsd
     $source = '/usr/local/share/fusionpbx/resources/templates/conf/sip_profiles';
     $destination = '/usr/local/etc/fusionpbx/resources/templates/conf/sip_profiles';
 }
 //copy the conf sip profiles to the /etc/fusionpbx/resources/templates/conf directory
 if (strlen($source) > 0 && strlen($destination) > 0) {
     if (!file_exists($destination)) {
         if (file_exists($source)) {
             //add the directory structure
             mkdir($destination, 0777, true);
             //copy from source to destination
             $obj = new install();
             $obj->recursive_copy($source, $destination);
         }
     }
 }
 //add the sip profiles to the database
 $sql = "select count(*) as num_rows from v_sip_profiles ";
 $prep_statement = $db->prepare(check_sql($sql));
 if ($prep_statement) {
     $prep_statement->execute();
     $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
     if ($row['num_rows'] == 0) {
         if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf/sip_profiles')) {
             $sip_profile_dir = '/usr/share/examples/fusionpbx/resources/templates/conf/sip_profiles/*.xml';
         } elseif (file_exists('/usr/local/share/fusionpbx/resources/templates/conf/sip_profiles')) {
             $sip_profile_dir = '/usr/local/share/fusionpbx/resources/templates/conf/sip_profiles/*.xml';
         } else {