Changeset 8280 for freepbx

Show
Ignore:
Timestamp:
09/05/09 20:35:56 (4 years ago)
Author:
p_lindheimer
Message:

fixes #3678 parse voicemail includes even when they have single/double quotes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.6/amp_conf/htdocs/admin/functions.inc.php

    r8273 r8280  
    17181718          } 
    17191719        } 
    1720       } else if (preg_match("/^\s*#include\s+(.*)\s*([;#].*)?/",$line,$matches)) { 
     1720      } else if (preg_match('/^(?:\s*)#include(?:\s+)["\']{0,1}([^"\']*)["\']{0,1}(\s*[;#].*)?$/',$line,$matches)) { 
    17211721        // include another file 
    17221722         
    17231723        if ($matches[1][0] == "/") { 
    17241724          // absolute path 
    1725           $filename = $matches[1]
     1725          $filename = trim($matches[1])
    17261726        } else { 
    17271727          // relative path 
    1728           $filename =  dirname($filename)."/".$matches[1]
     1728          $filename =  dirname($filename)."/".trim($matches[1])
    17291729        } 
    17301730         
     
    17601760  // if the file does not, copy if from the template. 
    17611761  // TODO: is this logical? 
    1762   // TODO: don't use hardcoded path...?  
    17631762  if (!file_exists($filename)) { 
    17641763    if (!copy( rtrim($amp_conf["ASTETCDIR"],"/")."/voicemail.conf.template", $filename )){ 
     
    18021801        } 
    18031802         
    1804       } else if (preg_match("/^(\s*)#include(\s+)(.*)(\s*[;#].*)?$/",$line,$matches)) { 
     1803      } else if (preg_match('/^(\s*)#include(\s+)["\']{0,1}([^"\']*)["\']{0,1}(\s*[;#].*)?$/',$line,$matches)) { 
    18051804        // include another file 
    18061805        //DEBUG echo "\ninclude ".$matches[3]."<blockquote>"; 
     
    18131812        if ($matches[3][0] == "/") { 
    18141813          // absolute path 
    1815           $include_filename = $matches[3]
     1814          $include_filename = trim($matches[3])
    18161815        } else { 
    18171816          // relative path 
    1818           $include_filename =  dirname($filename)."/".$matches[3]
     1817          $include_filename =  dirname($filename)."/".trim($matches[3])
    18191818        } 
    18201819         
    1821         $output[] = $matches[1]."#include".$matches[2].$matches[3].$matches[4]
     1820        $output[] = trim($matches[0])
    18221821        write_voicemailconf($include_filename, $vmconf, $section, $iteration+1); 
    18231822