', '" +String.fromCharCode(62)+ "', $data); //$data = addslashes($data); $data = str_replace("\t", "\\t", $data); //$data = str_replace("\n", "\\n", $data); //} return $data; } /** * Save the source * @param string $proc_name process name * @param string $file_name file name * @param string $type type * @param string $source * @access public * @return string */ function save_source($proc_name, $file_name, $type, $source) { if ((strpos($file_name,'/') !== false) || (strpos($file_name,'/') !== false)) return 'Não foi possível executar a operação solicitada'; if ((strpos($proc_name,'/') !== false) || (strpos($proc_name,'/') !== false)) return 'Não foi possível executar a operação solicitada'; // in case code was filtered //if (!$source) $source = @$GLOBALS['egw_unset_vars']['_POST[source]']; switch($type) { case 'atividade': $path = 'activities' . SEP . $file_name; $complete_path = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; break; case 'template': $path = 'templates' . SEP . $file_name; $complete_path = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; break; case 'include': $path = $file_name; $complete_path = GALAXIA_PROCESSES . SEP . $proc_name . SEP . 'code' . SEP . $path; break; case 'resource': $complete_path = GALAXIA_PROCESSES . '/' . $proc_name . '/resources/' . $file_name; break; } // In case you want to be warned when source code is changed: // mail('yourmail@domain.com', 'source changed', "PATH: $complete_path \n\n SOURCE: $source"); $erro = false; if ($fp = fopen($complete_path, 'w')) { $erro = !fwrite($fp, $source); fclose($fp); } else { $erro = true; } return ($erro ? 'Erro ao salvar o arquivo.' : 'Arquivo salvo com sucesso.'); } /** * Check process * * @param integer $pid pid * @param object $activity_manager * @param string $error_str error string * @access public * @return string */ function check_process($pid, &$activity_manager, &$error_str) { $valid = $activity_manager->validate_process_activities($pid); if (!$valid) { $errors = $activity_manager->get_error(true); $error_str = 'Os seguintes items devem ser corrigidos para ativar o processo:'; foreach ($errors as $error) { if (strlen($error) > 0) { $error_str .= '