mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 09:53:20 +01:00
Applied patch 1058956: use SEP instead of slashes
This commit is contained in:
parent
78ac3f7122
commit
355d32ec28
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once(GALAXIA_LIBRARY.'/src/ProcessManager/BaseManager.php');
|
include_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'BaseManager.php');
|
||||||
//!! ProcessManager
|
//!! ProcessManager
|
||||||
//! A class to maniplate processes.
|
//! A class to maniplate processes.
|
||||||
/*!
|
/*!
|
||||||
@ -62,7 +62,7 @@ class ProcessManager extends BaseManager {
|
|||||||
$out.=' <description>'.htmlspecialchars($proc_info['wf_description']).'</description>'."\n";
|
$out.=' <description>'.htmlspecialchars($proc_info['wf_description']).'</description>'."\n";
|
||||||
$out.= ' <lastModif>'.date("d/m/Y [h:i:s]",$proc_info['wf_last_modif']).'</lastModif>'."\n";
|
$out.= ' <lastModif>'.date("d/m/Y [h:i:s]",$proc_info['wf_last_modif']).'</lastModif>'."\n";
|
||||||
$out.= ' <sharedCode><![CDATA[';
|
$out.= ' <sharedCode><![CDATA[';
|
||||||
$fp=fopen(GALAXIA_PROCESSES."/$wf_procname/code/shared.php","r");
|
$fp=fopen(GALAXIA_PROCESSES.SEP."$wf_procname".SEP."code".SEP."shared.php","r");
|
||||||
while(!feof($fp)) {
|
while(!feof($fp)) {
|
||||||
$line=fread($fp,8192);
|
$line=fread($fp,8192);
|
||||||
$out.=$line;
|
$out.=$line;
|
||||||
@ -91,7 +91,7 @@ class ProcessManager extends BaseManager {
|
|||||||
}
|
}
|
||||||
$out.=' </roles>'."\n";
|
$out.=' </roles>'."\n";
|
||||||
$out.=' <code><![CDATA[';
|
$out.=' <code><![CDATA[';
|
||||||
$fp=fopen(GALAXIA_PROCESSES."/$wf_procname/code/activities/$name.php","r");
|
$fp=fopen(GALAXIA_PROCESSES.SEP."$wf_procname".SEP."code".SEP."activities".SEP."$name.php","r");
|
||||||
while(!feof($fp)) {
|
while(!feof($fp)) {
|
||||||
$line=fread($fp,8192);
|
$line=fread($fp,8192);
|
||||||
$out.=$line;
|
$out.=$line;
|
||||||
@ -100,7 +100,7 @@ class ProcessManager extends BaseManager {
|
|||||||
$out.=' ]]></code>';
|
$out.=' ]]></code>';
|
||||||
if($res['wf_is_interactive']=='y') {
|
if($res['wf_is_interactive']=='y') {
|
||||||
$out.=' <template><![CDATA[';
|
$out.=' <template><![CDATA[';
|
||||||
$fp=fopen(GALAXIA_PROCESSES."/$wf_procname/code/templates/$name.tpl","r");
|
$fp=fopen(GALAXIA_PROCESSES.SEP."$wf_procname".SEP."code".SEP."templates".SEP."$name.tpl","r");
|
||||||
while(!feof($fp)) {
|
while(!feof($fp)) {
|
||||||
$line=fread($fp,8192);
|
$line=fread($fp,8192);
|
||||||
$out.=$line;
|
$out.=$line;
|
||||||
@ -241,7 +241,7 @@ class ProcessManager extends BaseManager {
|
|||||||
//Put the shared code
|
//Put the shared code
|
||||||
$proc_info = $this->get_process($pid);
|
$proc_info = $this->get_process($pid);
|
||||||
$wf_procname = $proc_info['wf_normalized_name'];
|
$wf_procname = $proc_info['wf_normalized_name'];
|
||||||
$fp = fopen(GALAXIA_PROCESSES."/$wf_procname/code/shared.php","w");
|
$fp = fopen(GALAXIA_PROCESSES.SEP."$wf_procname".SEP."code".SEP."shared.php","w");
|
||||||
fwrite($fp,$data['sharedCode']);
|
fwrite($fp,$data['sharedCode']);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
$actids = Array();
|
$actids = Array();
|
||||||
@ -258,11 +258,11 @@ class ProcessManager extends BaseManager {
|
|||||||
$actname=$am->_normalize_name($activity['wf_name']);
|
$actname=$am->_normalize_name($activity['wf_name']);
|
||||||
|
|
||||||
$actid = $am->replace_activity($pid,0,$vars);
|
$actid = $am->replace_activity($pid,0,$vars);
|
||||||
$fp = fopen(GALAXIA_PROCESSES."/$wf_procname/code/activities/$actname".'.php',"w");
|
$fp = fopen(GALAXIA_PROCESSES.SEP."$wf_procname".SEP."code".SEP."activities".SEP."$actname".'.php',"w");
|
||||||
fwrite($fp,$activity['code']);
|
fwrite($fp,$activity['code']);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if($activity['isInteractive']=='y') {
|
if($activity['isInteractive']=='y') {
|
||||||
$fp = fopen(GALAXIA_PROCESSES."/$wf_procname/code/templates/$actname".'.tpl',"w");
|
$fp = fopen(GALAXIA_PROCESSES.SEP."$wf_procname".SEP."code".SEP."templates".SEP."$actname".'.tpl',"w");
|
||||||
fwrite($fp,$activity['template']);
|
fwrite($fp,$activity['template']);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@ -336,8 +336,9 @@ class ProcessManager extends BaseManager {
|
|||||||
// create transitions
|
// create transitions
|
||||||
$query = "select * from ".GALAXIA_TABLE_PREFIX."transitions where wf_p_id=$oldpid";
|
$query = "select * from ".GALAXIA_TABLE_PREFIX."transitions where wf_p_id=$oldpid";
|
||||||
$result = $this->query($query);
|
$result = $this->query($query);
|
||||||
while($res = $result->fetchRow()) {
|
|
||||||
if (empty($newaid[$res['wf_act_from_id']]) || empty($newaid[$res['wf_act_io_id']])) {
|
while($res = $result->fetchRow()) {
|
||||||
|
if (empty($newaid[$res['wf_act_from_id']]) || empty($newaid[$res['wf_act_to_id']])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$am->add_transition($pid,$newaid[$res['wf_act_from_id']],$newaid[$res['wf_act_to_id']]);
|
$am->add_transition($pid,$newaid[$res['wf_act_from_id']],$newaid[$res['wf_act_to_id']]);
|
||||||
@ -382,7 +383,7 @@ class ProcessManager extends BaseManager {
|
|||||||
//the old directory structure to the new directory
|
//the old directory structure to the new directory
|
||||||
$oldname = $proc_info['wf_normalized_name'];
|
$oldname = $proc_info['wf_normalized_name'];
|
||||||
$newname = $this->_get_normalized_name($pid);
|
$newname = $this->_get_normalized_name($pid);
|
||||||
$this->_rec_copy(GALAXIA_PROCESSES."/$oldname",GALAXIA_PROCESSES."/$newname");
|
$this->_rec_copy(GALAXIA_PROCESSES.SEP."$oldname",GALAXIA_PROCESSES.SEP."$newname");
|
||||||
|
|
||||||
// create a graph for the new process
|
// create a graph for the new process
|
||||||
$am->build_process_graph($pid);
|
$am->build_process_graph($pid);
|
||||||
@ -480,11 +481,11 @@ class ProcessManager extends BaseManager {
|
|||||||
$this->query($query);
|
$this->query($query);
|
||||||
|
|
||||||
// Remove the directory structure
|
// Remove the directory structure
|
||||||
if (!empty($name) && is_dir(GALAXIA_PROCESSES."/$name")) {
|
if (!empty($name) && is_dir(GALAXIA_PROCESSES.SEP."$name")) {
|
||||||
$this->_remove_directory(GALAXIA_PROCESSES."/$name",true);
|
$this->_remove_directory(GALAXIA_PROCESSES.SEP."$name",true);
|
||||||
}
|
}
|
||||||
if (GALAXIA_TEMPLATES && !empty($name) && is_dir(GALAXIA_TEMPLATES."/$name")) {
|
if (GALAXIA_TEMPLATES && !empty($name) && is_dir(GALAXIA_TEMPLATES.SEP."$name")) {
|
||||||
$this->_remove_directory(GALAXIA_TEMPLATES."/$name",true);
|
$this->_remove_directory(GALAXIA_TEMPLATES.SEP."$name",true);
|
||||||
}
|
}
|
||||||
// And finally remove the proc
|
// And finally remove the proc
|
||||||
$query = "delete from ".GALAXIA_TABLE_PREFIX."processes where wf_p_id=$pId";
|
$query = "delete from ".GALAXIA_TABLE_PREFIX."processes where wf_p_id=$pId";
|
||||||
@ -529,7 +530,7 @@ class ProcessManager extends BaseManager {
|
|||||||
$oldname = $old_proc['wf_normalized_name'];
|
$oldname = $old_proc['wf_normalized_name'];
|
||||||
$newname = $vars['wf_normalized_name'];
|
$newname = $vars['wf_normalized_name'];
|
||||||
if ($newname != $oldname) {
|
if ($newname != $oldname) {
|
||||||
rename(GALAXIA_PROCESSES."/$oldname",GALAXIA_PROCESSES."/$newname");
|
rename(GALAXIA_PROCESSES.SEP."$oldname",GALAXIA_PROCESSES.SEP."$newname");
|
||||||
}
|
}
|
||||||
$msg = sprintf(tra('Process %s has been updated'),$vars['wf_name']);
|
$msg = sprintf(tra('Process %s has been updated'),$vars['wf_name']);
|
||||||
$this->notify_all(3,$msg);
|
$this->notify_all(3,$msg);
|
||||||
@ -632,17 +633,17 @@ class ProcessManager extends BaseManager {
|
|||||||
function _create_directory_structure($name)
|
function _create_directory_structure($name)
|
||||||
{
|
{
|
||||||
// Create in processes a directory with this name
|
// Create in processes a directory with this name
|
||||||
mkdir(GALAXIA_PROCESSES."/$name",0770);
|
mkdir(GALAXIA_PROCESSES.SEP."$name",0770);
|
||||||
mkdir(GALAXIA_PROCESSES."/$name/graph",0770);
|
mkdir(GALAXIA_PROCESSES.SEP."$name".SEP."graph",0770);
|
||||||
mkdir(GALAXIA_PROCESSES."/$name/code",0770);
|
mkdir(GALAXIA_PROCESSES.SEP."$name".SEP."code",0770);
|
||||||
mkdir(GALAXIA_PROCESSES."/$name/compiled",0770);
|
mkdir(GALAXIA_PROCESSES.SEP."$name".SEP."compiled",0770);
|
||||||
mkdir(GALAXIA_PROCESSES."/$name/code/activities",0770);
|
mkdir(GALAXIA_PROCESSES.SEP."$name".SEP."code".SEP."activities",0770);
|
||||||
mkdir(GALAXIA_PROCESSES."/$name/code/templates",0770);
|
mkdir(GALAXIA_PROCESSES.SEP."$name".SEP."code".SEP."templates",0770);
|
||||||
if (GALAXIA_TEMPLATES) {
|
if (GALAXIA_TEMPLATES) {
|
||||||
mkdir(GALAXIA_TEMPLATES."/$name",0770);
|
mkdir(GALAXIA_TEMPLATES.SEP."$name",0770);
|
||||||
}
|
}
|
||||||
// Create shared file
|
// Create shared file
|
||||||
$fp = fopen(GALAXIA_PROCESSES."/$name/code/shared.php","w");
|
$fp = fopen(GALAXIA_PROCESSES.SEP."$name".SEP."code".SEP."shared.php","w");
|
||||||
fwrite($fp,'<'.'?'.'php'."\n".'?'.'>');
|
fwrite($fp,'<'.'?'.'php'."\n".'?'.'>');
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@ -654,14 +655,14 @@ class ProcessManager extends BaseManager {
|
|||||||
function _remove_directory($dir,$rec=false)
|
function _remove_directory($dir,$rec=false)
|
||||||
{
|
{
|
||||||
// Prevent a disaster
|
// Prevent a disaster
|
||||||
if(trim($dir) == '/'|| trim($dir)=='.' || trim($dir)=='templates' || trim($dir)=='templates/') return false;
|
if(trim($dir) == SEP || trim($dir)=='.' || trim($dir)=='templates' || trim($dir)=='templates'.SEP) return false;
|
||||||
$h = opendir($dir);
|
$h = opendir($dir);
|
||||||
while(($file = readdir($h)) != false) {
|
while(($file = readdir($h)) != false) {
|
||||||
if(is_file($dir.'/'.$file)) {
|
if(is_file($dir.SEP.$file)) {
|
||||||
@unlink($dir.'/'.$file);
|
@unlink($dir.SEP.$file);
|
||||||
} else {
|
} else {
|
||||||
if($rec && $file != '.' && $file != '..') {
|
if($rec && $file != '.' && $file != '..') {
|
||||||
$this->_remove_directory($dir.'/'.$file, true);
|
$this->_remove_directory($dir.SEP.$file, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -675,11 +676,11 @@ class ProcessManager extends BaseManager {
|
|||||||
@mkdir($dir2,0777);
|
@mkdir($dir2,0777);
|
||||||
$h = opendir($dir1);
|
$h = opendir($dir1);
|
||||||
while(($file = readdir($h)) !== false) {
|
while(($file = readdir($h)) !== false) {
|
||||||
if(is_file($dir1.'/'.$file)) {
|
if(is_file($dir1.SEP.$file)) {
|
||||||
copy($dir1.'/'.$file,$dir2.'/'.$file);
|
copy($dir1.SEP.$file,$dir2.SEP.$file);
|
||||||
} else {
|
} else {
|
||||||
if($file != '.' && $file != '..') {
|
if($file != '.' && $file != '..') {
|
||||||
$this->_rec_copy($dir1.'/'.$file, $dir2.'/'.$file);
|
$this->_rec_copy($dir1.SEP.$file, $dir2.SEP.$file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user