Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getFormDiffPath($FormName, &$files)
- {
- $FormName = str_replace('\\','/',$FormName);
- $a = explode('.d/', $FormName);
- $c = count($a);
- while($c > 1)
- {
- $c--;
- $l = explode('/', $a[$c]);
- $f = explode('/', $a[$c - 1]);
- $bool = true;
- $res = array();
- for($li = 0, $cl = count($l); $li < $cl; $li++)
- {
- if(!isset($f[$li]) || $f[$li] != $l[$li] || !$bool)
- {
- $res[] = $l[$li];
- $bool = false;
- }
- }
- $a[$c] = implode('/', $res);
- }
- $FormName = implode('.d/', $a);
- $path = '';
- if(is_dir($d = dirname($_SERVER["SCRIPT_FILENAME"]) . get_option('Forms') . $FormName . '.d/'))
- {
- $path = $d;
- if($dirh = @opendir($path))
- {
- while(($file = readdir($dirh)) !== false)
- {
- $pi = pathinfo($path . $file);
- if(is_dir($path . $file . '/') || $pi['extension'] != 'dfrm')
- continue;
- //Для замены если есть в UserForms
- $files[$file] = $path . $file;
- }
- closedir($dirh);
- }
- }
- if(is_dir($d = dirname($_SERVER["SCRIPT_FILENAME"]) . getUserForms() . $FormName . '.d/'))
- {
- $path = $d;
- if($dirh = @opendir($path))
- {
- while(($file = readdir($dirh)) !== false)
- {
- $pi = pathinfo($path . $file);
- if(is_dir($path . $file . '/') || $pi['extension'] != 'dfrm')
- continue;
- //Заменяем если есть в базовом
- $files[$file] = $path . $file;
- }
- closedir($dirh);
- }
- }
- return $path;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement