Merge remote-tracking branch 'origin/bugfix/HOR-3670' into release/3.2.2

This commit is contained in:
David Callizaya
2017-08-15 10:07:12 -04:00
326 changed files with 11383 additions and 24998 deletions

View File

@@ -1,7 +1,8 @@
<?php
class actionsByEmailCoreClass extends PMPlugin
class ActionsByEmailCoreClass extends PMPlugin
{
public function __construct()
{
@@ -170,7 +171,7 @@ class actionsByEmailCoreClass extends PMPlugin
$field->label = '';
$actionField = str_replace(array('@@', '@#', '@=', '@%', '@?', '@$'), '', $configuration['ABE_ACTION_FIELD']);
$obj = new pmDynaform($configuration['DYN_UID']);
$obj = new PmDynaform($configuration['DYN_UID']);
$configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID'];
$file = $obj->printPmDynaformAbe($configuration);
$__ABE__ .= $file;
@@ -221,7 +222,7 @@ class actionsByEmailCoreClass extends PMPlugin
}
}
$obj = new pmDynaform($configuration['DYN_UID']);
$obj = new PmDynaform($configuration['DYN_UID']);
$configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID'];
$file = $obj->printPmDynaformAbe($configuration);
$__ABE__ .= $file;
@@ -290,7 +291,7 @@ class actionsByEmailCoreClass extends PMPlugin
}
}
$wsBaseInstance = new wsBase();
$wsBaseInstance = new WsBase();
$result = $wsBaseInstance->sendMessage(
$data->APP_UID,
$emailFrom,
@@ -333,4 +334,3 @@ class actionsByEmailCoreClass extends PMPlugin
}
}
}

View File

@@ -1,13 +1,17 @@
<?php
/**
* Class InputDocumentDrive
*/
/**
* Class InputDocumentDrive
*/
class AppDocumentDrive
{
/**
* @var PMDrive $drive
* @var PmDrive $drive
*/
private $drive;
/**
@@ -28,7 +32,7 @@ class AppDocumentDrive
*/
public function __construct()
{
$this->drive = new PMDrive();
$this->drive = new PmDrive();
$status = $this->drive->getServiceDriveStatus();
$status = !empty($status) ? ($status == 1 ? true : false): false;
$this->usersEmail = '';

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
<?php
/**
* Invalid search text for Solr exception
*/
/**
* Application APP_DATA could not be unserialized exception
*/
class ApplicationAppDataUnserializeException extends Exception
{
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0)
{
// some code
// make sure everything is assigned properly
parent::__construct ($message, $code);
}
// custom string representation of object
public function __toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}

View File

@@ -0,0 +1,27 @@
<?php
/**
* Invalid search text for Solr exception
*
* @author Herbert Saal Gutierrez
*
*/
/**
* Dynaform file corrupt
*/
class ApplicationWithCorruptDynaformException extends Exception
{
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0)
{
// some code
// make sure everything is assigned properly
parent::__construct ($message, $code);
}
// custom string representation of object
public function __toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* Application without Delegations exception
*/
class ApplicationWithoutDelegationRecordsException extends Exception
{
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0)
{
// some code
// make sure everything is assigned properly
parent::__construct($message, $code);
}
// custom string representation of object
public function __toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}

View File

@@ -2,6 +2,7 @@
use ProcessMaker\Plugins\PluginRegistry;
class Applications
{
/**
@@ -1213,4 +1214,3 @@ class Applications
return $steps;
}
}

View File

@@ -0,0 +1,365 @@
<?php
/*--------------------------------------------------
* TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.1
* By Devin Doucette
* Copyright (c) 2005 Devin Doucette
* Email: darksnoopy@shaw.ca
*--------------------------------------------------
* Email bugs/suggestions to darksnoopy@shaw.ca
*--------------------------------------------------
* This script has been created and released under
* the GNU GPL and is free to use and redistribute
* only if this copyright statement is not removed
*--------------------------------------------------*/
/**
*
* @package workflow.engine.classes
*/
class Archive
{
/**
* This function is the constructor of the class archive
*
* @param string $name
* @return void
*
*/
public function archive($name)
{
$this->options = array('basedir' => ".", 'name' => $name, 'prepend' => "", 'inmemory' => 0, 'overwrite' => 0, 'recurse' => 1, 'storepaths' => 1, 'followlinks' => 0, 'level' => 3, 'method' => 1, 'sfx' => "", 'type' => "", 'comment' => ""
);
$this->files = array();
$this->exclude = array();
$this->storeonly = array();
$this->error = array();
}
/**
* This function gives options to a archive
*
* @param array $options
* @return void
*/
public function set_options($options)
{
foreach ($options as $key => $value) {
$this->options[$key] = $value;
}
if (!empty($this->options['basedir'])) {
$this->options['basedir'] = str_replace("\\", "/", $this->options['basedir']);
$this->options['basedir'] = preg_replace("/\/+/", "/", $this->options['basedir']);
$this->options['basedir'] = preg_replace("/\/$/", "", $this->options['basedir']);
}
if (!empty($this->options['name'])) {
$this->options['name'] = str_replace("\\", "/", $this->options['name']);
$this->options['name'] = preg_replace("/\/+/", "/", $this->options['name']);
}
if (!empty($this->options['prepend'])) {
$this->options['prepend'] = str_replace("\\", "/", $this->options['prepend']);
$this->options['prepend'] = preg_replace("/^(\.*\/+)+/", "", $this->options['prepend']);
$this->options['prepend'] = preg_replace("/\/+/", "/", $this->options['prepend']);
$this->options['prepend'] = preg_replace("/\/$/", "", $this->options['prepend']) . "/";
}
}
/**
* This function is used to create a archive.
*
* @return boolean
*/
public function create_archive()
{
$this->make_list();
if ($this->options['inmemory'] == 0) {
$pwd = getcwd();
chdir($this->options['basedir']);
if ($this->options['overwrite'] == 0 && file_exists($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : ""))) {
$this->error[] = "File {$this->options['name']} already exist.";
chdir($pwd);
return 0;
} elseif ($this->archive = @fopen($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : ""), "wb+")) {
chdir($pwd);
} else {
$this->error[] = "Could not open {$this->options['name']} for writing.";
chdir($pwd);
return 0;
}
} else {
$this->archive = "";
}
switch ($this->options['type']) {
case "zip":
if (!$this->create_zip()) {
$this->error[] = "Could not create zip file.";
return 0;
}
break;
case "bzip":
if (!$this->create_tar()) {
$this->error[] = "Could not create tar file.";
return 0;
}
if (!$this->create_bzip()) {
$this->error[] = "Could not create bzip2 file.";
return 0;
}
break;
case "gzip":
if (!$this->create_tar()) {
$this->error[] = "Could not create tar file.";
return 0;
}
if (!$this->create_gzip()) {
$this->error[] = "Could not create gzip file.";
return 0;
}
break;
case "tar":
if (!$this->create_tar()) {
$this->error[] = "Could not create tar file.";
return 0;
}
}
if ($this->options['inmemory'] == 0) {
fclose($this->archive);
if ($this->options['type'] == "gzip" || $this->options['type'] == "bzip") {
unlink($this->options['basedir'] . "/" . $this->options['name'] . ".tmp");
}
}
}
/**
* This function is used for add data to a archive
*
* @param string $data
* @return void
*/
public function add_data($data)
{
if ($this->options['inmemory'] == 0) {
fwrite($this->archive, $data);
} else {
$this->archive .= $data;
}
}
/**
* This function make a list
*
* @return void
*/
public function make_list()
{
if (!empty($this->exclude)) {
foreach ($this->files as $key => $value) {
foreach ($this->exclude as $current) {
if ($value['name'] == $current['name']) {
unset($this->files[$key]);
}
}
}
}
if (!empty($this->storeonly)) {
foreach ($this->files as $key => $value) {
foreach ($this->storeonly as $current) {
if ($value['name'] == $current['name']) {
$this->files[$key]['method'] = 0;
}
}
}
}
unset($this->exclude, $this->storeonly);
}
/**
* Add files a list
*
* @param array $list
* @return void
*/
public function add_files($list)
{
$temp = $this->list_files($list);
foreach ($temp as $current) {
$this->files[] = $current;
}
}
/**
* This function exclude files of a list
*
* @param array $list
* @return void
*/
public function exclude_files($list)
{
$temp = $this->list_files($list);
foreach ($temp as $current) {
$this->exclude[] = $current;
}
}
/**
* This function store files
*
* @param array $list
*/
public function store_files($list)
{
$temp = $this->list_files($list);
foreach ($temp as $current) {
$this->storeonly[] = $current;
}
}
/**
* List files gives a List
*
* @param array $list
* @return array
*/
public function list_files($list)
{
if (!is_array($list)) {
$temp = $list;
$list = array($temp
);
unset($temp);
}
$files = array();
$pwd = getcwd();
chdir($this->options['basedir']);
foreach ($list as $current) {
$current = str_replace("\\", "/", $current);
$current = preg_replace("/\/+/", "/", $current);
$current = preg_replace("/\/$/", "", $current);
if (strstr($current, "*")) {
$regex = preg_replace("/([\\\^\$\.\[\]\|\(\)\?\+\{\}\/])/", "\\\\\\1", $current);
$regex = str_replace("*", ".*", $regex);
$dir = strstr($current, "/") ? substr($current, 0, strrpos($current, "/")) : ".";
$temp = $this->parse_dir($dir);
foreach ($temp as $current2) {
if (preg_match("/^{$regex}$/i", $current2['name'])) {
$files[] = $current2;
}
}
unset($regex, $dir, $temp, $current);
} elseif (@is_dir($current)) {
$temp = $this->parse_dir($current);
foreach ($temp as $file) {
$files[] = $file;
}
unset($temp, $file);
} elseif (@file_exists($current)) {
$files[] = array('name' => $current, 'name2' => $this->options['prepend'] . preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($current, "/")) ? substr($current, strrpos($current, "/") + 1) : $current), 'type' => @is_link($current) && $this->options['followlinks'] == 0 ? 2 : 0, 'ext' => substr($current, strrpos($current, ".")), 'stat' => stat($current)
);
}
}
chdir($pwd);
unset($current, $pwd);
usort($files, array("archive", "sort_files"
));
return $files;
}
/**
* This function is for parse a directory name
*
* @param string $dirname
* @return array
*/
public function parse_dir($dirname)
{
if ($this->options['storepaths'] == 1 && !preg_match("/^(\.+\/*)+$/", $dirname)) {
$files = array(array('name' => $dirname, 'name2' => $this->options['prepend'] . preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($dirname, "/")) ? substr($dirname, strrpos($dirname, "/") + 1) : $dirname), 'type' => 5, 'stat' => stat($dirname)
)
);
} else {
$files = array();
}
$dir = @opendir($dirname);
while ($file = @readdir($dir)) {
$fullname = $dirname . "/" . $file;
if ($file == "." || $file == "..") {
continue;
} elseif (@is_dir($fullname)) {
if (empty($this->options['recurse'])) {
continue;
}
$temp = $this->parse_dir($fullname);
foreach ($temp as $file2) {
$files[] = $file2;
}
} elseif (@file_exists($fullname)) {
$files[] = array('name' => $fullname, 'name2' => $this->options['prepend'] . preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($fullname, "/")) ? substr($fullname, strrpos($fullname, "/") + 1) : $fullname), 'type' => @is_link($fullname) && $this->options['followlinks'] == 0 ? 2 : 0, 'ext' => substr($file, strrpos($file, ".")), 'stat' => stat($fullname)
);
}
}
@closedir($dir);
return $files;
}
/**
* This function sort two files
*
* @param array $a
* @param array $b
* @return boolean
*/
public function sort_files($a, $b)
{
if ($a['type'] != $b['type']) {
if ($a['type'] == 5 || $b['type'] == 2) {
return -1;
} elseif ($a['type'] == 2 || $b['type'] == 5) {
return 1;
} elseif ($a['type'] == 5) {
return strcmp(strtolower($a['name']), strtolower($b['name']));
} elseif ($a['ext'] != $b['ext']) {
return strcmp($a['ext'], $b['ext']);
} elseif ($a['stat'][7] != $b['stat'][7]) {
return $a['stat'][7] > $b['stat'][7] ? -1 : 1;
} else {
return strcmp(strtolower($a['name']), strtolower($b['name']));
}
}
return 0;
}
/**
* This function download a file
*
* @return void
*/
public function download_file()
{
if ($this->options['inmemory'] == 0) {
$this->error[] = "Can only use download_file() if archive is in memory. Redirect to file otherwise, it is faster.";
return;
}
switch ($this->options['type']) {
case "zip":
header("Content-Type: application/zip");
break;
case "bzip":
header("Content-Type: application/x-bzip2");
break;
case "gzip":
header("Content-Type: application/x-gzip");
break;
case "tar":
header("Content-Type: application/x-tar");
}
$header = "Content-Disposition: attachment; filename=\"";
$header .= strstr($this->options['name'], "/") ? substr($this->options['name'], strrpos($this->options['name'], "/") + 1) : $this->options['name'];
$header .= "\"";
header($header);
header("Content-Length: " . strlen($this->archive));
header("Content-Transfer-Encoding: binary");
header("Cache-Control: no-cache, must-revalidate, max-age=60");
header("Expires: Sat, 01 Jan 2000 12:00:00 GMT");
print ($this->archive);
}
}

View File

@@ -1,34 +1,6 @@
<?php
/**
* class.ArrayPeer.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class.
// actual class may be a subclass -- as returned by ApplicationPeer::getOMClass()
include_once 'classes/model/Application.php';
/**
* Base static class for performing query and update operations on the 'APPLICATION' table.
@@ -37,18 +9,11 @@ include_once 'classes/model/Application.php';
*/
abstract class ArrayBasePeer
{
/**
* The default database name for this class
*/
const DATABASE_NAME = 'dbarray';
/**
* The table name for this class
*/
//const TABLE_NAME = 'APPLICATION';
/**
* A class that can be returned by this peer.
*/
@@ -150,10 +115,10 @@ abstract class ArrayBasePeer
* First dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (BasePeer::TYPE_PHPNAME => array ('AppUid','AppNumber','AppParent','AppStatus','ProUid','AppProcStatus','AppProcCode','AppParallel','AppInitUser','AppCurUser','AppCreateDate','AppInitDate','AppFinishDate','AppUpdateDate','AppData'
),BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID,ApplicationPeer::APP_NUMBER,ApplicationPeer::APP_PARENT,ApplicationPeer::APP_STATUS,ApplicationPeer::PRO_UID,ApplicationPeer::APP_PROC_STATUS,ApplicationPeer::APP_PROC_CODE,ApplicationPeer::APP_PARALLEL,ApplicationPeer::APP_INIT_USER,ApplicationPeer::APP_CUR_USER,ApplicationPeer::APP_CREATE_DATE,ApplicationPeer::APP_INIT_DATE,ApplicationPeer::APP_FINISH_DATE,ApplicationPeer::APP_UPDATE_DATE,ApplicationPeer::APP_DATA
),BasePeer::TYPE_FIELDNAME => array ('APP_UID','APP_NUMBER','APP_PARENT','APP_STATUS','PRO_UID','APP_PROC_STATUS','APP_PROC_CODE','APP_PARALLEL','APP_INIT_USER','APP_CUR_USER','APP_CREATE_DATE','APP_INIT_DATE','APP_FINISH_DATE','APP_UPDATE_DATE','APP_DATA'
),BasePeer::TYPE_NUM => array (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
private static $fieldNames = array(BasePeer::TYPE_PHPNAME => array('AppUid', 'AppNumber', 'AppParent', 'AppStatus', 'ProUid', 'AppProcStatus', 'AppProcCode', 'AppParallel', 'AppInitUser', 'AppCurUser', 'AppCreateDate', 'AppInitDate', 'AppFinishDate', 'AppUpdateDate', 'AppData'
), BasePeer::TYPE_COLNAME => array(ApplicationPeer::APP_UID, ApplicationPeer::APP_NUMBER, ApplicationPeer::APP_PARENT, ApplicationPeer::APP_STATUS, ApplicationPeer::PRO_UID, ApplicationPeer::APP_PROC_STATUS, ApplicationPeer::APP_PROC_CODE, ApplicationPeer::APP_PARALLEL, ApplicationPeer::APP_INIT_USER, ApplicationPeer::APP_CUR_USER, ApplicationPeer::APP_CREATE_DATE, ApplicationPeer::APP_INIT_DATE, ApplicationPeer::APP_FINISH_DATE, ApplicationPeer::APP_UPDATE_DATE, ApplicationPeer::APP_DATA
), BasePeer::TYPE_FIELDNAME => array('APP_UID', 'APP_NUMBER', 'APP_PARENT', 'APP_STATUS', 'PRO_UID', 'APP_PROC_STATUS', 'APP_PROC_CODE', 'APP_PARALLEL', 'APP_INIT_USER', 'APP_CUR_USER', 'APP_CREATE_DATE', 'APP_INIT_DATE', 'APP_FINISH_DATE', 'APP_UPDATE_DATE', 'APP_DATA'
), BasePeer::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
)
);
@@ -163,10 +128,10 @@ abstract class ArrayBasePeer
* First dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (BasePeer::TYPE_PHPNAME => array ('AppUid' => 0,'AppNumber' => 1,'AppParent' => 2,'AppStatus' => 3,'ProUid' => 4,'AppProcStatus' => 5,'AppProcCode' => 6,'AppParallel' => 7,'AppInitUser' => 8,'AppCurUser' => 9,'AppCreateDate' => 10,'AppInitDate' => 11,'AppFinishDate' => 12,'AppUpdateDate' => 13,'AppData' => 14
),BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID => 0,ApplicationPeer::APP_NUMBER => 1,ApplicationPeer::APP_PARENT => 2,ApplicationPeer::APP_STATUS => 3,ApplicationPeer::PRO_UID => 4,ApplicationPeer::APP_PROC_STATUS => 5,ApplicationPeer::APP_PROC_CODE => 6,ApplicationPeer::APP_PARALLEL => 7,ApplicationPeer::APP_INIT_USER => 8,ApplicationPeer::APP_CUR_USER => 9,ApplicationPeer::APP_CREATE_DATE => 10,ApplicationPeer::APP_INIT_DATE => 11,ApplicationPeer::APP_FINISH_DATE => 12,ApplicationPeer::APP_UPDATE_DATE => 13,ApplicationPeer::APP_DATA => 14
),BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0,'APP_NUMBER' => 1,'APP_PARENT' => 2,'APP_STATUS' => 3,'PRO_UID' => 4,'APP_PROC_STATUS' => 5,'APP_PROC_CODE' => 6,'APP_PARALLEL' => 7,'APP_INIT_USER' => 8,'APP_CUR_USER' => 9,'APP_CREATE_DATE' => 10,'APP_INIT_DATE' => 11,'APP_FINISH_DATE' => 12,'APP_UPDATE_DATE' => 13,'APP_DATA' => 14
),BasePeer::TYPE_NUM => array (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
private static $fieldKeys = array(BasePeer::TYPE_PHPNAME => array('AppUid' => 0, 'AppNumber' => 1, 'AppParent' => 2, 'AppStatus' => 3, 'ProUid' => 4, 'AppProcStatus' => 5, 'AppProcCode' => 6, 'AppParallel' => 7, 'AppInitUser' => 8, 'AppCurUser' => 9, 'AppCreateDate' => 10, 'AppInitDate' => 11, 'AppFinishDate' => 12, 'AppUpdateDate' => 13, 'AppData' => 14
), BasePeer::TYPE_COLNAME => array(ApplicationPeer::APP_UID => 0, ApplicationPeer::APP_NUMBER => 1, ApplicationPeer::APP_PARENT => 2, ApplicationPeer::APP_STATUS => 3, ApplicationPeer::PRO_UID => 4, ApplicationPeer::APP_PROC_STATUS => 5, ApplicationPeer::APP_PROC_CODE => 6, ApplicationPeer::APP_PARALLEL => 7, ApplicationPeer::APP_INIT_USER => 8, ApplicationPeer::APP_CUR_USER => 9, ApplicationPeer::APP_CREATE_DATE => 10, ApplicationPeer::APP_INIT_DATE => 11, ApplicationPeer::APP_FINISH_DATE => 12, ApplicationPeer::APP_UPDATE_DATE => 13, ApplicationPeer::APP_DATA => 14
), BasePeer::TYPE_FIELDNAME => array('APP_UID' => 0, 'APP_NUMBER' => 1, 'APP_PARENT' => 2, 'APP_STATUS' => 3, 'PRO_UID' => 4, 'APP_PROC_STATUS' => 5, 'APP_PROC_CODE' => 6, 'APP_PARALLEL' => 7, 'APP_INIT_USER' => 8, 'APP_CUR_USER' => 9, 'APP_CREATE_DATE' => 10, 'APP_INIT_DATE' => 11, 'APP_FINISH_DATE' => 12, 'APP_UPDATE_DATE' => 13, 'APP_DATA' => 14
), BasePeer::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
)
);
@@ -176,10 +141,10 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder ()
public static function getMapBuilder()
{
include_once 'classes/model/map/ApplicationMapBuilder.php';
return BasePeer::getMapBuilder( 'classes.model.map.ApplicationMapBuilder' );
return BasePeer::getMapBuilder('classes.model.map.ApplicationMapBuilder');
}
/**
@@ -190,12 +155,12 @@ abstract class ArrayBasePeer
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap ()
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = ApplicationPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array ();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
@@ -213,12 +178,12 @@ abstract class ArrayBasePeer
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName ($name, $fromType, $toType)
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames( $toType );
$key = isset( self::$fieldKeys[$fromType][$name] ) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException( "'$name' could not be found in the field names of type '$fromType'. These are: " . print_r( self::$fieldKeys[$fromType], true ) );
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@@ -232,10 +197,10 @@ abstract class ArrayBasePeer
* @return array A list of field names
*/
static public function getFieldNames ($type = BasePeer::TYPE_PHPNAME)
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (! array_key_exists( $type, self::$fieldNames )) {
throw new PropelException( 'Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.' );
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
@@ -253,9 +218,9 @@ abstract class ArrayBasePeer
* @param string $column The column name for current table. (i.e. ApplicationPeer::COLUMN_NAME).
* @return string
*/
public static function alias ($alias, $column)
public static function alias($alias, $column)
{
return str_replace( ApplicationPeer::TABLE_NAME . '.', $alias . '.', $column );
return str_replace(ApplicationPeer::TABLE_NAME . '.', $alias . '.', $column);
}
/**
@@ -269,7 +234,7 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns (Criteria $criteria)
public static function addSelectColumns(Criteria $criteria)
{
}
@@ -286,7 +251,7 @@ abstract class ArrayBasePeer
* @return int Number of matching rows.
* @todo Review declarated constant d'not used COUNT, COUNT_DISTINCT
*/
public static function doCount (Criteria $criteria, $distinct = false, $con = null)
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
@@ -301,14 +266,14 @@ abstract class ArrayBasePeer
$criteria->addSelectColumn(ApplicationPeer::COUNT);
}
*/
$criteria->addSelectColumn( 'COUNT(*)' );
$criteria->addSelectColumn('COUNT(*)');
// just in case we're grouping: add those columns to the select statement
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn( $column );
$criteria->addSelectColumn($column);
}
$rs = ArrayBasePeer::doSelectRS( $criteria, $con );
$rs = ArrayBasePeer::doSelectRS($criteria, $con);
if ($rs->next()) {
$row = $rs->getRow();
return $row[1];
@@ -327,11 +292,11 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne (Criteria $criteria, $con = null)
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit( 1 );
$objects = ApplicationPeer::doSelect( $critcopy, $con );
$critcopy->setLimit(1);
$objects = ApplicationPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
@@ -347,18 +312,18 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
private function createSelectSql ($criteria, $tableName, &$params)
private function createSelectSql($criteria, $tableName, &$params)
{
$db = Propel::getDB( $criteria->getDbName() );
$db = Propel::getDB($criteria->getDbName());
// redundant definition $selectModifiers = array();
$selectClause = array ();
$fromClause = array ();
$joinClause = array ();
$joinTables = array ();
$whereClause = array ();
$orderByClause = array ();
$groupByClause = array ();
$selectClause = array();
$fromClause = array();
$joinClause = array();
$joinTables = array();
$whereClause = array();
$orderByClause = array();
$groupByClause = array();
$orderBy = $criteria->getOrderByColumns();
$groupBy = $criteria->getGroupByColumns();
@@ -376,8 +341,8 @@ abstract class ArrayBasePeer
$selectClause[] = $columnName; // the full column name: e.g. MAX(books.price)
$parenPos = strpos( $columnName, '(' );
$dotPos = strpos( $columnName, '.' );
$parenPos = strpos($columnName, '(');
$dotPos = strpos($columnName, '.');
// [HL] I think we really only want to worry about adding stuff to
// the fromClause if this function has a TABLE.COLUMN in it at all.
@@ -386,18 +351,18 @@ abstract class ArrayBasePeer
if ($dotPos !== false) {
if ($parenPos === false) { // table.column
$tableName = substr( $columnName, 0, $dotPos );
$tableName = substr($columnName, 0, $dotPos);
} else { // FUNC(table.column)
$tableName = substr( $columnName, $parenPos + 1, $dotPos - ($parenPos + 1) );
$tableName = substr($columnName, $parenPos + 1, $dotPos - ($parenPos + 1));
// functions may contain qualifiers so only take the last
// word as the table name.
// COUNT(DISTINCT books.price)
$lastSpace = strpos( $tableName, ' ' );
$lastSpace = strpos($tableName, ' ');
if ($lastSpace !== false) { // COUNT(DISTINCT books.price)
$tableName = substr( $tableName, $lastSpace + 1 );
$tableName = substr($tableName, $lastSpace + 1);
}
}
$tableName2 = $criteria->getTableForAlias( $tableName );
$tableName2 = $criteria->getTableForAlias($tableName);
if ($tableName2 !== null) {
$fromClause[] = $tableName2 . ' ' . $tableName;
} else {
@@ -415,13 +380,13 @@ abstract class ArrayBasePeer
// add the criteria to WHERE clause
foreach ($criteria->keys() as $key) {
$criterion = $criteria->getCriterion( $key );
$criterion = $criteria->getCriterion($key);
$someCriteria = $criterion->getAttachedCriterion();
$someCriteriaLength = count( $someCriteria );
$someCriteriaLength = count($someCriteria);
$table = null;
for ($i = 0; $i < $someCriteriaLength; $i ++) {
for ($i = 0; $i < $someCriteriaLength; $i++) {
$tableName = $someCriteria[$i]->getTable();
$table = $criteria->getTableForAlias( $tableName );
$table = $criteria->getTableForAlias($tableName);
if ($table !== null) {
$fromClause[] = $table . ' ' . $tableName;
} else {
@@ -429,11 +394,11 @@ abstract class ArrayBasePeer
$table = $tableName;
}
$ignoreCase = (($criteria->isIgnoreCase() || $someCriteria[$i]->isIgnoreCase()) && ($dbMap->getTable( $table )->getColumn( $someCriteria[$i]->getColumn() )->getType() == "string"));
$ignoreCase = (($criteria->isIgnoreCase() || $someCriteria[$i]->isIgnoreCase()) && ($dbMap->getTable($table)->getColumn($someCriteria[$i]->getColumn())->getType() == "string"));
$someCriteria[$i]->setIgnoreCase( $ignoreCase );
$someCriteria[$i]->setIgnoreCase($ignoreCase);
}
$criterion->setDB( $db );
$criterion->setDB($db);
$cri['table'] = $criterion->table;
$cri['field'] = $criterion->column;
@@ -449,41 +414,41 @@ abstract class ArrayBasePeer
}
// Unique from clause elements
$fromClause = array_unique( $fromClause );
$fromClause = array_unique($fromClause);
if (! empty( $orderBy )) {
if (!empty($orderBy)) {
foreach ($orderBy as $orderByColumn) {
// Add function expression as-is.
if (strpos( $orderByColumn, '(' ) !== false) {
if (strpos($orderByColumn, '(') !== false) {
$orderByClause[] = $orderByColumn;
continue;
}
// Split orderByColumn (i.e. "table.column DESC")
$dotPos = strpos( $orderByColumn, '.' );
$dotPos = strpos($orderByColumn, '.');
if ($dotPos !== false) {
$tableName = substr( $orderByColumn, 0, $dotPos );
$columnName = substr( $orderByColumn, $dotPos + 1 );
$tableName = substr($orderByColumn, 0, $dotPos);
$columnName = substr($orderByColumn, $dotPos + 1);
} else {
$tableName = '';
$columnName = $orderByColumn;
}
$spacePos = strpos( $columnName, ' ' );
$spacePos = strpos($columnName, ' ');
if ($spacePos !== false) {
$direction = substr( $columnName, $spacePos );
$columnName = substr( $columnName, 0, $spacePos );
$direction = substr($columnName, $spacePos);
$columnName = substr($columnName, 0, $spacePos);
} else {
$direction = '';
}
$orderByClause[] = array ('columnName' => $columnName,'direction' => $direction
$orderByClause[] = array('columnName' => $columnName, 'direction' => $direction
);
}
}
// Build the SQL from the arrays we compiled
$sql = "SELECT " . ($selectModifiers ? implode( " ", $selectModifiers ) . " " : "") . implode( ", ", $selectClause ) . " FROM " . $fromClause[0] . ($whereClause ? " WHERE " . implode( " AND ", $whereClause ) : "") . ($groupByClause ? " GROUP BY " . implode( ",", $groupByClause ) : "");
$sql = "SELECT " . ($selectModifiers ? implode(" ", $selectModifiers) . " " : "") . implode(", ", $selectClause) . " FROM " . $fromClause[0] . ($whereClause ? " WHERE " . implode(" AND ", $whereClause) : "") . ($groupByClause ? " GROUP BY " . implode(",", $groupByClause) : "");
$dataSql['selectClause'] = $selectClause;
$dataSql['fromClause'] = $fromClause;
@@ -503,27 +468,27 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect (Criteria $criteria, $tableName, $con = null)
public static function doSelect(Criteria $criteria, $tableName, $con = null)
{
$dbMap = Propel::getDatabaseMap( $criteria->getDbName() );
$dbMap = Propel::getDatabaseMap($criteria->getDbName());
$stmt = null;
try {
$params = array ();
$sql = self::createSelectSql( $criteria, $tableName, $params );
$params = array();
$sql = self::createSelectSql($criteria, $tableName, $params);
$sql['params'] = $params;
$stmt = $con->prepareStatement( $sql );
$stmt = $con->prepareStatement($sql);
//$stmt->setLimit($criteria->getLimit());
$sql['limit'] = $criteria->getLimit();
//$stmt->setOffset($criteria->getOffset());
$sql['offset'] = $criteria->getOffset();
//$rs = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
$rs = $con->executeQuery( $sql, ResultSet::FETCHMODE_NUM );
$rs = $con->executeQuery($sql, ResultSet::FETCHMODE_NUM);
} catch (Exception $e) {
if ($stmt)
$stmt->close();
throw new PropelException( $e );
throw new PropelException($e);
}
return $rs;
@@ -543,34 +508,34 @@ abstract class ArrayBasePeer
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS (Criteria $criteria, $con = null)
public static function doSelectRS(Criteria $criteria, $con = null)
{
global $_DBArray;
if (! isset( $_DBArray )) {
if (!isset($_DBArray)) {
$_DBArray = $_SESSION['_DBArray'];
}
$tableName = $criteria->getDBArrayTable();
if (! isset( $_DBArray[$tableName] )) {
throw new Exception( "Error: the table '$tableName' doesn't exist in DBArray " );
if (!isset($_DBArray[$tableName])) {
throw new Exception("Error: the table '$tableName' doesn't exist in DBArray ");
}
$arrayTable = $_DBArray[$tableName];
if ($con === null) {
$con = Propel::getConnection( self::DATABASE_NAME );
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (! $criteria->getSelectColumns()) {
foreach (array_keys( $_DBArray[$tableName][0] ) as $key => $val)
$criteria->addSelectColumn( $tableName . '.' . $val );
if (!$criteria->getSelectColumns()) {
foreach (array_keys($_DBArray[$tableName][0]) as $key => $val)
$criteria->addSelectColumn($tableName . '.' . $val);
}
// Set the correct dbName
$criteria->setDbName( self::DATABASE_NAME );
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
return ArrayBasePeer::doSelect( $criteria, $tableName, $con );
return ArrayBasePeer::doSelect($criteria, $tableName, $con);
}
/**
@@ -580,17 +545,17 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects (ResultSet $rs)
public static function populateObjects(ResultSet $rs)
{
$results = array ();
$results = array();
// set the class once to avoid overhead in the loop
$cls = ApplicationPeer::getOMClass();
$cls = Propel::import( $cls );
$cls = Propel::import($cls);
// populate the object(s)
while ($rs->next()) {
$obj = new $cls();
$obj->hydrate( $rs );
$obj->hydrate($rs);
$results[] = $obj;
}
return $results;
@@ -604,9 +569,9 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap ()
public static function getTableMap()
{
return Propel::getDatabaseMap( self::DATABASE_NAME )->getTable( self::TABLE_NAME );
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
@@ -618,7 +583,7 @@ abstract class ArrayBasePeer
*
* @return string path.to.ClassName
*/
public static function getOMClass ()
public static function getOMClass()
{
return ApplicationPeer::CLASS_DEFAULT;
}
@@ -632,10 +597,10 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert ($values, $con = null)
public static function doInsert($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection( self::DATABASE_NAME );
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
@@ -645,13 +610,13 @@ abstract class ArrayBasePeer
}
// Set the correct dbName
$criteria->setDbName( self::DATABASE_NAME );
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert( $criteria, $con );
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
@@ -670,20 +635,20 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate ($values, $con = null)
public static function doUpdate($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection( self::DATABASE_NAME );
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria( self::DATABASE_NAME );
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison( ApplicationPeer::APP_UID );
$selectCriteria->add( ApplicationPeer::APP_UID, $criteria->remove( ApplicationPeer::APP_UID ), $comparison );
$comparison = $criteria->getComparison(ApplicationPeer::APP_UID);
$selectCriteria->add(ApplicationPeer::APP_UID, $criteria->remove(ApplicationPeer::APP_UID), $comparison);
} else { // $values is Application object
$criteria = $values->buildCriteria(); // gets full criteria
@@ -691,9 +656,9 @@ abstract class ArrayBasePeer
}
// set the correct dbName
$criteria->setDbName( self::DATABASE_NAME );
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate( $selectCriteria, $criteria, $con );
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
@@ -702,17 +667,17 @@ abstract class ArrayBasePeer
* @param Connection $con The connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll ($con = null)
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection( self::DATABASE_NAME );
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll( ApplicationPeer::TABLE_NAME, $con );
$affectedRows += BasePeer::doDeleteAll(ApplicationPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
@@ -732,10 +697,10 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete ($values, $con = null)
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection( ApplicationPeer::DATABASE_NAME );
$con = Propel::getConnection(ApplicationPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
@@ -745,12 +710,12 @@ abstract class ArrayBasePeer
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria( self::DATABASE_NAME );
$criteria->add( ApplicationPeer::APP_UID, (array) $values, Criteria::IN );
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(ApplicationPeer::APP_UID, (array)$values, Criteria::IN);
}
}
// Set the correct dbName
$criteria->setDbName( self::DATABASE_NAME );
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@@ -760,7 +725,7 @@ abstract class ArrayBasePeer
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete( $criteria, $con );
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
@@ -781,33 +746,33 @@ abstract class ArrayBasePeer
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate (Application $obj, $cols = null)
public static function doValidate(Application $obj, $cols = null)
{
$columns = array ();
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap( ApplicationPeer::DATABASE_NAME );
$tableMap = $dbMap->getTable( ApplicationPeer::TABLE_NAME );
$dbMap = Propel::getDatabaseMap(ApplicationPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(ApplicationPeer::TABLE_NAME);
if (! is_array( $cols )) {
$cols = array ($cols
if (!is_array($cols)) {
$cols = array($cols
);
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn( $colName )) {
$get = 'get' . $tableMap->getColumn( $colName )->getPhpName();
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
if ($obj->isNew() || $obj->isColumnModified( ApplicationPeer::APP_STATUS ))
if ($obj->isNew() || $obj->isColumnModified(ApplicationPeer::APP_STATUS))
$columns[ApplicationPeer::APP_STATUS] = $obj->getAppStatus();
}
return BasePeer::doValidate( ApplicationPeer::DATABASE_NAME, ApplicationPeer::TABLE_NAME, $columns );
return BasePeer::doValidate(ApplicationPeer::DATABASE_NAME, ApplicationPeer::TABLE_NAME, $columns);
}
/**
@@ -817,19 +782,19 @@ abstract class ArrayBasePeer
* @param Connection $con the connection to use
* @return Application
*/
public static function retrieveByPK ($pk, $con = null)
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection( self::DATABASE_NAME );
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria( ApplicationPeer::DATABASE_NAME );
$criteria = new Criteria(ApplicationPeer::DATABASE_NAME);
$criteria->add( ApplicationPeer::APP_UID, $pk );
$criteria->add(ApplicationPeer::APP_UID, $pk);
$v = ApplicationPeer::doSelect( $criteria, $con );
$v = ApplicationPeer::doSelect($criteria, $con);
return ! empty( $v ) > 0 ? $v[0] : null;
return !empty($v) > 0 ? $v[0] : null;
}
/**
@@ -840,38 +805,21 @@ abstract class ArrayBasePeer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs ($pks, $con = null)
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection( self::DATABASE_NAME );
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty( $pks )) {
$objs = array ();
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add( ApplicationPeer::APP_UID, $pks, Criteria::IN );
$objs = ApplicationPeer::doSelect( $criteria, $con );
$criteria->add(ApplicationPeer::APP_UID, $pks, Criteria::IN);
$objs = ApplicationPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseApplicationPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseApplicationPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log( 'Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR );
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
require_once 'classes/model/map/ApplicationMapBuilder.php';
Propel::registerMapBuilder( 'classes.model.map.ApplicationMapBuilder' );
}

View File

@@ -0,0 +1,601 @@
<?php
use ProcessMaker\Core\System;
/**
* Interface to the Solr Search server
*/
class BpmnEngineSearchIndexAccessSolr
{
const SOLR_VERSION = '&version=2.2';
private $_solrIsEnabled = false;
private $_solrHost = "";
public function __construct($solrIsEnabled = false, $solrHost = "")
{
// use the parameters to initialize class
$this->_solrIsEnabled = $solrIsEnabled;
$this->_solrHost = $solrHost;
}
/**
* Verify if the Solr service is available
* @gearman = false
* @rest = false
* @background = false
*
* @return bool
*/
public function isEnabled($workspace)
{
$resultServerStatus = false;
// verify solr server response
try {
$resultServerStatus = $this->ping($workspace);
} catch (Exception $ex) {
$resultServerStatus = false;
}
return $resultServerStatus;
}
/**
* Returns the total number of indexed documents
* @gearman = false
* @rest = false
* @background = false
*
* @param
* workspace: workspace name
* @return total
*/
public function getNumberDocuments($workspace)
{
// get total number of documents in registry
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/select/?q=*:*";
$solrIntruct .= self::SOLR_VERSION;
$solrIntruct .= "&start=0&rows=0&echoParams=none&wt=json";
$handlerTotal = curl_init($solrIntruct);
curl_setopt($handlerTotal, CURLOPT_RETURNTRANSFER, true);
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handlerTotal, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handlerTotal, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handlerTotal, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handlerTotal, CURLOPT_HTTPHEADER, array('Expect:'));
}
$responseTotal = curl_exec($handlerTotal);
curl_close($handlerTotal);
// verify the result of solr
$responseSolrTotal = G::json_decode($responseTotal);
if ($responseSolrTotal->responseHeader->status != 0) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error returning the total number of documents in Solr." . $solrIntruct . " response error: " . $response . "\n");
}
$numTotalDocs = $responseSolrTotal->response->numFound;
return $numTotalDocs;
}
/**
* Execute a query in base to Requested data
* @gearman = false
* @rest = false
* @background = false
*
* @return solr response
*/
public function executeQuery($solrRequestData)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$workspace = $solrRequestData->workspace;
// format request
$query = empty($solrRequestData->searchText) ? '*:*' : $solrRequestData->searchText;
$query = rawurlencode($query);
$start = '&start=' . $solrRequestData->startAfter;
$rows = '&rows=' . $solrRequestData->pageSize;
$fieldList = '';
$cols = $solrRequestData->includeCols;
if (!empty($cols)) {
$fieldList = "&fl=" . implode(",", $cols);
}
$sort = '';
if ($solrRequestData->numSortingCols > 0) {
$sort = '&sort=';
for ($i = 0; $i < $solrRequestData->numSortingCols; $i++) {
$sort .= $solrRequestData->sortCols [$i] . "%20" . $solrRequestData->sortDir [$i] . ",";
}
$sort = substr_replace($sort, "", -1);
}
$resultFormat = empty($solrRequestData->resultFormat) ? '' : '&wt=' . $solrRequestData->resultFormat;
$filters = '';
$aFilters = explode(',', $solrRequestData->filterText);
foreach ($aFilters as $value) {
$filters .= '&fq=' . urlencode($value);
}
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/select/?q=$query";
$solrIntruct .= "&echoParams=none";
$solrIntruct .= self::SOLR_VERSION;
$solrIntruct .= $start;
$solrIntruct .= $rows;
$solrIntruct .= $fieldList;
$solrIntruct .= $sort;
$solrIntruct .= $filters;
$solrIntruct .= $resultFormat;
// send query
// search the cases in base to datatable parameters
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
// decode
$responseSolr = G::json_decode($response);
if ($responseSolr->responseHeader->status != 0) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error executing query to Solr." . $solrIntruct . " response error: " . $response . "\n");
}
return $responseSolr;
}
/**
* Insert or Update document index
* @gearman = false
* @rest = false
* @background = false
*
* @return solr response
*/
public function updateDocument($solrUpdateDocument)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $solrUpdateDocument->workspace;
$solrIntruct .= "/update";
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
'Content-type:application/xml'
));
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
curl_setopt($handler, CURLOPT_POSTFIELDS, $solrUpdateDocument->document); // data
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
$swOk = strpos($response, '<int name="status">0</int>');
if (!$swOk) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error updating document in Solr." . $solrIntruct . " response error: " . $response . "\n");
}
}
/**
* Commit the changes since the last commit
* @gearman = false
* @rest = false
* @background = false
*
* @return solr response
*/
public function commitChanges($workspace)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/update";
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
'Content-type:application/xml'
));
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
curl_setopt($handler, CURLOPT_POSTFIELDS, "<commit/>"); // data
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
$swOk = strpos($response, '<int name="status">0</int>');
if (!$swOk) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error commiting changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
}
}
/**
* Rollback the changes since the last commit
* @gearman = false
* @rest = false
* @background = false
*
* @return solr response
*/
public function rollbackChanges($workspace)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/update";
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
'Content-type:application/xml'
));
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
curl_setopt($handler, CURLOPT_POSTFIELDS, "<rollback/>"); // data
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
$swOk = strpos($response, '<int name="status">0</int>');
if (!$swOk) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error rolling back changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
}
}
/**
* Optimize Solr index
* @gearman = false
* @rest = false
* @background = false
*
* @return solr response
*/
public function optimizeChanges($workspace)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/update";
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
'Content-type:application/xml'
));
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
curl_setopt($handler, CURLOPT_POSTFIELDS, "<optimize/>"); // data
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
$swOk = strpos($response, '<int name="status">0</int>');
if (!$swOk) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error optimizing changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
}
}
/**
* Return the list of the stored fields in Solr
*
* @param string $workspace
* Solr instance name
* @throws Exception
* @return void mixed of field names
*/
public function getListIndexedStoredFields($workspace)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/admin/luke?numTerms=0&wt=json";
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
// decode
$responseSolr = G::json_decode($response);
if ($responseSolr->responseHeader->status != 0) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error getting index fields in Solr." . $solrIntruct . " response error: " . $response . "\n");
}
return $responseSolr;
}
/**
* Ping the Solr Server to check his health
*
* @param string $workspace
* Solr instance name
* @throws Exception
* @return void mixed of field names
*/
public function ping($workspace)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/admin/ping?wt=json";
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($handler);
curl_close($handler);
//there's no response
if (!$response) {
return false;
}
// decode
$responseSolr = G::json_decode($response);
if ($responseSolr->responseHeader->status != "OK") {
throw new Exception(date('Y-m-d H:i:s:u') . " Error pinging Solr server." . $solrIntruct . " response error: " . $response . "\n");
}
return true;
}
/**
* Delete all documents from index
* @gearman = false
* @rest = false
* @background = false
*
* @return solr response
*/
public function deleteAllDocuments($workspace)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/update";
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
'Content-type:application/xml'
));
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
curl_setopt($handler, CURLOPT_POSTFIELDS, "<delete><query>*:*</query></delete>"); // data
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
$swOk = strpos($response, '<int name="status">0</int>');
if (!$swOk) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error deleting all documents in Solr." . $solrIntruct . " response error: " . $response . "\n");
}
}
/**
* Delete specified documents from index
* @gearman = false
* @rest = false
* @background = false
*
* @return solr response
*/
public function deleteDocument($workspace, $idQuery)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/update";
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
'Content-type:application/xml'
));
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
curl_setopt($handler, CURLOPT_POSTFIELDS, "<delete><query>" . $idQuery . "</query></delete>"); // data
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
$swOk = strpos($response, '<int name="status">0</int>');
if (!$swOk) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error deleting document in Solr." . $solrIntruct . " response error: " . $response . "\n");
}
}
/**
* Execute a query in base to Request data
*
* @param EntityFacetRequest $facetRequestEntity
* @return solr response: list of facets array
*/
public function getFacetsList($facetRequest)
{
$solrIntruct = '';
// get configuration information in base to workspace parameter
$workspace = $facetRequest->workspace;
// format request
$query = empty($facetRequest->searchText) ? '*:*' : $facetRequest->searchText;
$query = rawurlencode($query);
$start = '&start=0';
$rows = '&rows=0';
$facets = '&facet=on&facet.mincount=1&facet.limit=20'; // enable facet and
// only return facets
// with minimun one
// instance
foreach ($facetRequest->facetFields as $value) {
$facets .= '&facet.field=' . $value;
}
foreach ($facetRequest->facetQueries as $value) {
$facets .= '&facet.query=' . $value;
}
if (!empty($facetRequest->facetDates)) {
foreach ($facetRequest->facetDates as $value) {
$facets .= '&facet.date=' . $value;
}
$facets .= '&facet.date.start=' . $facetRequest->facetDatesStart;
$facets .= '&facet.date.end=' . $facetRequest->facetDatesEnd;
$facets .= '&facet.date.gap=' . $facetRequest->facetDateGap;
}
$filters = '';
foreach ($facetRequest->filters as $value) {
$filters .= '&fq=' . $value;
}
$resultFormat = '&wt=json';
$solrIntruct = (substr($this->_solrHost, -1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace;
$solrIntruct .= "/select/?q=$query";
$solrIntruct .= "&echoParams=none";
$solrIntruct .= self::SOLR_VERSION;
$solrIntruct .= $start;
$solrIntruct .= $rows;
$solrIntruct .= $facets;
$solrIntruct .= $filters;
$solrIntruct .= $resultFormat;
// send query
// search the cases in base to datatable parameters
$handler = curl_init($solrIntruct);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec($handler);
curl_close($handler);
// decode
$responseSolr = G::json_decode($response);
if ($responseSolr->responseHeader->status != 0) {
throw new Exception(date('Y-m-d H:i:s:u') . " Error getting faceted list from Solr." . $solrIntruct . " response error: " . $response . "\n");
}
return $responseSolr;
}
}

View File

@@ -0,0 +1,346 @@
<?php
/**
* Class used as interface to have access to the search index services
*/
class BpmnEngineServicesSearchIndex
{
private $_solrIsEnabled = false;
private $_solrHost = "";
public function __construct($solrIsEnabled = false, $solrHost = "")
{
$this->_solrIsEnabled = $solrIsEnabled;
$this->_solrHost = $solrHost;
}
/**
* Verify if the Solr service is available
*
* @gearman = false
* @rest = false
* @background = false no input parameters @param[in]
* @param [out] bool true if index service is enabled false in other case
*/
public function isEnabled($workspace)
{
require_once('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
return $solr->isEnabled($workspace);
}
/**
* Get the list of facets in base to the specified query and filter
*
* @gearman = true
* @rest = false
* @background = false
* @param [in] Entity_FacetRequest facetRequestEntity Facet request entity
* @param [out] array FacetGroup
*/
public function getFacetsList($facetRequestEntity)
{
require_once('class.solr.php');
require_once('entities/FacetGroup.php');
require_once('entities/FacetItem.php');
require_once('entities/SelectedFacetGroupItem.php');
require_once('entities/FacetResult.php');
// get array of selected facet groups
$facetRequestEntity->selectedFacetsString = str_replace(',,', ',', $facetRequestEntity->selectedFacetsString);
// remove descriptions of selected facet groups
$aGroups = explode(',', $facetRequestEntity->selectedFacetsString);
$aGroups = array_filter($aGroups); // remove empty items
$aSelectedFacetGroups = array();
foreach ($aGroups as $i => $value) {
$gi = explode(':::', $value);
$gr = explode('::', $gi [0]);
$it = explode('::', $gi [1]);
// create string for remove condition
$count = 0;
$removeCondition = str_replace($value . ',', '', $facetRequestEntity->selectedFacetsString, $count);
if ($count == 0) {
$removeCondition = str_replace($value, '', $facetRequestEntity->selectedFacetsString, $count);
}
$selectedFacetGroupData = array(
'selectedFacetGroupName' => $gr [0],
'selectedFacetGroupPrintName' => $gr [1],
'selectedFacetItemName' => $it [0],
'selectedFacetItemPrintName' => $it [1],
'selectedFacetRemoveCondition' => $removeCondition
);
$aSelectedFacetGroups [] = EntitySelectedFacetGroupItem::createForRequest($selectedFacetGroupData);
}
// convert request to index request
// create filters
$filters = array();
if (!empty($aSelectedFacetGroups)) {
// exclude facetFields and facetDates included in filter from the next
// list of facets
foreach ($aSelectedFacetGroups as $value) {
$facetRequestEntity->facetFields = array_diff($facetRequestEntity->facetFields, array(
$value->selectedFacetGroupName
));
$facetRequestEntity->facetDates = array_diff($facetRequestEntity->facetDates, array(
$value->selectedFacetGroupName
));
}
foreach ($aSelectedFacetGroups as $group) {
$filters [] = $group->selectedFacetGroupName . ':' . urlencode($group->selectedFacetItemName);
}
}
$facetRequestEntity->filters = $filters;
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$facetsList = $solr->getFacetsList($facetRequestEntity);
$numFound = $facetsList->response->numFound;
$facetCounts = $facetsList->facet_counts;
$facetGroups = array();
// convert facet fields result to objects
// include facet field results
$facetFieldsResult = $facetsList->facet_counts->facet_fields;
if (!empty($facetFieldsResult)) {
foreach ($facetFieldsResult as $facetGroup => $facetvalues) {
if (count($facetvalues) > 0) { // if the group have facets included
$data = array(
'facetGroupName' => $facetGroup
);
$data ['facetGroupPrintName'] = $facetGroup;
$data ['facetGroupType'] = 'field';
$facetItems = array();
for ($i = 0; $i < count($facetvalues); $i += 2) {
$dataItem = array();
$dataItem ['facetName'] = $facetvalues [$i];
$dataItem ['facetPrintName'] = $facetvalues [$i];
$dataItem ['facetCount'] = $facetvalues [$i + 1];
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
$newFacetItem = EntityFacetItem::createForInsert($dataItem);
$facetItems [] = $newFacetItem;
}
$data ['facetItems'] = $facetItems;
$newFacetGroup = EntityFacetGroup::createForInsert($data);
$facetGroups [] = $newFacetGroup;
}
}
}
// include facet date ranges results
$facetDatesResult = $facetsList->facet_counts->facet_dates;
if (!empty($facetDatesResult)) {
foreach ($facetDatesResult as $facetGroup => $facetvalues) {
if (count((array) $facetvalues) > 3) { // if the group have any facets included
// besides start, end and gap
$data = array(
'facetGroupName' => $facetGroup
);
$data ['facetGroupPrintName'] = $facetGroup;
$data ['facetGroupType'] = 'daterange';
$facetItems = array();
$facetvalueskeys = array_keys((array) $facetvalues);
foreach ($facetvalueskeys as $i => $k) {
if ($k != 'gap' && $k != 'start' && $k != 'end') {
$dataItem = array();
if ($i < count($facetvalueskeys) - 4) {
$dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
} else {
// the last group
$dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
}
$dataItem ['facetCount'] = $facetvalues->$k;
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
$newFacetItem = EntityFacetItem::createForInsert($dataItem);
$facetItems [] = $newFacetItem;
}
}
$data ['facetItems'] = $facetItems;
$newFacetGroup = EntityFacetGroup::createForInsert($data);
$facetGroups [] = $newFacetGroup;
}
}
}
// TODO:convert facet queries
// Create a filter string used in the filter of results of a datatable
$filterText = ''; // the list of selected filters used for filtering result,
// send in ajax
foreach ($aSelectedFacetGroups as $selectedFacetGroup) {
$filterText .= $selectedFacetGroup->selectedFacetGroupName . ':' . urlencode($selectedFacetGroup->selectedFacetItemName) . ',';
}
$filterText = substr_replace($filterText, '', - 1);
// Create result
$dataFacetResult = array(
'aFacetGroups' => $facetGroups,
'aSelectedFacetGroups' => $aSelectedFacetGroups,
'sFilterText' => $filterText
);
$facetResult = EntityFacetResult::createForRequest($dataFacetResult);
return $facetResult;
}
/**
* Get the total number of documents in search server
* @param string $workspace
* @return integer number of documents
*
*/
public function getNumberDocuments($workspace)
{
require_once('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$numberDocuments = $solr->getNumberDocuments($workspace);
return $numberDocuments;
}
/**
* Update document Index
* @param SolrUpdateDocumentEntity $solrUpdateDocumentEntity
*/
public function updateIndexDocument($solrUpdateDocumentEntity)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$solr->updateDocument($solrUpdateDocumentEntity);
}
/**
* Delete document from index
* @param string $workspace
* @param string $idQuery
*/
public function deleteDocumentFromIndex($workspace, $idQuery)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$solr->deleteDocument($workspace, $idQuery);
}
/**
* Commit index changes
* @param string $workspace
*/
public function commitIndexChanges($workspace)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// commit
$solr->commitChanges($workspace);
}
/**
* Optimize index changes
* @param string $workspace
*/
public function optimizeIndexChanges($workspace)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// commit
$solr->optimizeChanges($workspace);
}
/**
* Call Solr server to return the list of paginated pages.
* @param FacetRequest $solrRequestData
* @return EntitySolrQueryResult
*/
public function getDataTablePaginatedList($solrRequestData)
{
require_once('class.solr.php');
require_once('entities/SolrRequestData.php');
require_once('entities/SolrQueryResult.php');
// execute query
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
$solrPaginatedResult = $solr->executeQuery($solrRequestData);
// get total number of documents in index
$numTotalDocs = $solr->getNumberDocuments($solrRequestData->workspace);
// create the Datatable response of the query
$numFound = $solrPaginatedResult->response->numFound;
$docs = $solrPaginatedResult->response->docs;
// insert list of names in docs result
$data = array(
"sEcho" => '', // must be completed in response
"iTotalRecords" => intval($numTotalDocs), // we must get the
// total number of documents
"iTotalDisplayRecords" => $numFound,
"aaData" => array()
);
// copy result document or add placeholders to result
foreach ($docs as $i => $doc) {
$data ['aaData'] [$i] = array();
foreach ($solrRequestData->includeCols as $columnName) {
if ($columnName == '') {
$data ['aaData'] [$i] [] = ''; // placeholder
} else {
if (isset($doc->$columnName)) {
$data ['aaData'] [$i] [$columnName] = $doc->$columnName;
} else {
$data ['aaData'] [$i] [$columnName] = '';
}
}
}
}
$solrQueryResponse = EntitySolrQueryResult::createForRequest($data);
return $solrQueryResponse;
}
/**
* Return the list of stored fields in the index.
* @param string $workspace
* @return array of index fields
*/
public function getIndexFields($workspace)
{
require_once('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
$solrFieldsData = $solr->getListIndexedStoredFields($workspace);
// copy list of arrays
$listFields = array();
foreach ($solrFieldsData->fields as $key => $fieldData) {
if (array_key_exists('dynamicBase', $fieldData)) {
$originalFieldName = substr($key, 0, - strlen($fieldData->dynamicBase) + 1);
// Maintain case sensitive variable names
$listFields [$originalFieldName] = $key;
} else {
// Maintain case sensitive variable names
$listFields [$key] = $key;
}
}
return $listFields;
}
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* This class is derived from the class archive, is employed to use files .bzip
*/
class BzipFile extends TarFile
{
/**
* This function is the constructor of the class bzip_file
*
* @param string $name
* @return void
*/
public function BzipFile($name)
{
$this->tar_file($name);
$this->options['type'] = "bzip";
}
/**
* This function is employed to create files .
* bzip
*
* @return boolean
*/
public function create_bzip()
{
if ($this->options['inmemory'] == 0) {
$pwd = getcwd();
chdir($this->options['basedir']);
if ($fp = bzopen($this->options['name'], "wb")) {
fseek($this->archive, 0);
while ($temp = fread($this->archive, 1048576)) {
bzwrite($fp, $temp);
}
bzclose($fp);
chdir($pwd);
} else {
$this->error[] = "Could not open {$this->options['name']} for writing.";
chdir($pwd);
return 0;
}
} else {
$this->archive = bzcompress($this->archive, $this->options['level']);
}
return 1;
}
/**
* This function open a archive of the class bzip_file
*
* @return void
*/
public function open_archive()
{
return @bzopen($this->options['name'], "rb");
}
}

View File

@@ -31,7 +31,11 @@
*
* @package workflow.engine.classes
*/
class CLI
/**
*
* @package workflow.engine.classes
*/class CLI
{
public static $tasks = array ();
public static $currentTask = null;
@@ -384,4 +388,3 @@ EOT;
}
}
}

View File

@@ -1,32 +1,7 @@
<?php
use \ProcessMaker\BusinessModel\WebEntryEvent;
/**
* class.case.php
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
/**
@@ -36,7 +11,6 @@ use ProcessMaker\Plugins\PluginRegistry;
*/
class Cases
{
private $appSolr = null;
public $dir = 'ASC';
public $sort = 'APP_MSG_DATE';
@@ -45,7 +19,7 @@ class Cases
public function __construct()
{
//get Solr initialization variables
if (($solrConf = PmSystem::solrEnv()) !== false) {
if (($solrConf = System::solrEnv()) !== false) {
$this->appSolr = new AppSolr($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
}
}
@@ -167,7 +141,7 @@ class Cases
$c->addSelectColumn(TaskPeer::TAS_TITLE);
$c->addSelectColumn(TaskPeer::PRO_UID);
$c->addSelectColumn(ProcessPeer::PRO_TITLE);
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
$c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE);
@@ -278,7 +252,7 @@ class Cases
$aConditions[] = array('PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID');
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
}
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
$c->add(ProcessPeer::PRO_SUBPROCESS, '0');
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
@@ -385,7 +359,7 @@ class Cases
$c->addSelectColumn(TaskPeer::TAS_TITLE);
$c->addSelectColumn(TaskPeer::PRO_UID);
$c->addSelectColumn(ProcessPeer::PRO_TITLE);
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
$c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE);
@@ -538,14 +512,13 @@ class Cases
$aFields['CURRENT_USER'] = implode(" - ", array_values($aFields['CURRENT_USER']));
$tasksArray = array_filter(explode('|', $aFields['TAS_UID']));
if(count($tasksArray) == 1) {
if (count($tasksArray) == 1) {
$aFields['TAS_UID'] = $tasksArray[0];
}
} else {
$oCurUser->load($aAppDel['USR_UID']);
$aFields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
}
} catch (Exception $oError) {
$aFields['CURRENT_USER'] = '';
}
@@ -714,7 +687,7 @@ class Cases
$cri->addSelectColumn(AppDelegationPeer::TAS_UID);
$cri->add(AppDelegationPeer::APP_UID, $sAppUid);
$cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
if(isset($fields['DEL_INDEX'])){
if (isset($fields['DEL_INDEX'])) {
$cri->add(AppDelegationPeer::DEL_INDEX, $fields['DEL_INDEX']);
}
$rsCri = AppDelegationPeer::doSelectRS($cri);
@@ -843,7 +816,8 @@ class Cases
return $aReturn;
}
public function array_key_intersect(&$a, &$b) {
public function array_key_intersect(&$a, &$b)
{
$array = array();
while (list($key, $value) = each($a)) {
if (isset($b[$key])) {
@@ -893,7 +867,7 @@ class Cases
if (isset($Fields['APP_DESCRIPTION'])) {
$appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION'];
}
if(isset($Fields['DEL_INDEX'])){
if (isset($Fields['DEL_INDEX'])) {
$appFields['DEL_INDEX'] = $Fields['DEL_INDEX'];
}
@@ -908,9 +882,9 @@ class Cases
//Add fields that weren't in previous version
foreach ($aApplicationFields as $key => $value) {
if (is_array($value) && isset($fieldsOnBoth[$key]) && is_array($fieldsOnBoth[$key])) {
$afieldDifference = $this->arrayRecursiveDiff($value,$fieldsOnBoth[$key]);
$dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key],$value);
if ($afieldDifference || $dfieldDifference){
$afieldDifference = $this->arrayRecursiveDiff($value, $fieldsOnBoth[$key]);
$dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key], $value);
if ($afieldDifference || $dfieldDifference) {
$FieldsDifference[$key] = $value;
}
} else {
@@ -1015,8 +989,8 @@ class Cases
}
/*----------------------------------********---------------------------------*/
if(!isset($Fields['DEL_INDEX'])){
$Fields['DEL_INDEX'] = 1;
if (!isset($Fields['DEL_INDEX'])) {
$Fields['DEL_INDEX'] = 1;
}
$inbox = new ListInbox();
unset($Fields['DEL_INIT_DATE']);
@@ -1046,7 +1020,7 @@ class Cases
$oAppDocument = new AppDocument();
if($deleteDelegation) {
if ($deleteDelegation) {
//Delete the delegations of a application
$this->deleteDelegation($sAppUid);
}
@@ -1103,7 +1077,7 @@ class Cases
$oDerivation = new Derivation();
$oDerivation->verifyIsCaseChild($sAppUid);
}
} catch(Exception $e) {
} catch (Exception $e) {
Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], SYS_SYS, 'processmaker.log');
}
@@ -1246,13 +1220,13 @@ class Cases
}
/*
* Determines if the all threads of a multiinstance task are closed
*
* @$appUid string appUid of the instance to be tested
* @$tasUid string task uid of the multiinstance task
* @$previousDelIndex int previous del index of the instance corresponding to the multiinstance task
*/
/*
* Determines if the all threads of a multiinstance task are closed
*
* @$appUid string appUid of the instance to be tested
* @$tasUid string task uid of the multiinstance task
* @$previousDelIndex int previous del index of the instance corresponding to the multiinstance task
*/
public function multiInstanceIsCompleted($appUid, $tasUid, $previousDelIndex)
{
@@ -1267,15 +1241,14 @@ class Cases
$rs = AppDelegationPeer::doSelectRs($c);
if ($rs->next()) {
$result = false;
$result = false;
} else {
$result = true;
}
} catch (exception $e) {
throw ($e);
} finally {
return $result;
return $result;
}
}
@@ -1434,7 +1407,8 @@ class Cases
* @param array $previousTasks
* @return array $taskReviewed
*/
public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks) {
public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks)
{
$taskReviewed = array();
$oCriteria = new Criteria('workflow');
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
@@ -1494,11 +1468,11 @@ class Cases
//If exist paused cases
$closedTasks[] = $row;
$aIndex[] = $row['DEL_INDEX'];
$res = $this->GetAllOpenDelegation( array('APP_UID'=>$sAppUid, 'APP_THREAD_PARENT'=>$row['DEL_PREVIOUS']), 'NONE' );
$res = $this->GetAllOpenDelegation(array('APP_UID'=>$sAppUid, 'APP_THREAD_PARENT'=>$row['DEL_PREVIOUS']), 'NONE');
foreach ($res as $in) {
$aIndex[] = $in['DEL_INDEX'];
}
$pausedTasks = $this->getReviewedTasksPaused($sAppUid,$aIndex);
$pausedTasks = $this->getReviewedTasksPaused($sAppUid, $aIndex);
}
}
@@ -1516,7 +1490,7 @@ class Cases
* @return array within the paused tasks
* false -> when has not any delegation started for that task
*/
public function getReviewedTasksPaused($sAppUid,$aDelIndex)
public function getReviewedTasksPaused($sAppUid, $aDelIndex)
{
$oCriteria = new Criteria('workflow');
$oCriteria->add(AppDelayPeer::APP_UID, $sAppUid);
@@ -2157,19 +2131,19 @@ class Cases
$aUserFields = array();
$taskAssignType = $task->getTasAssignType();
$nextTaskAssignVariable = $task->getTasAssignVariable();
if($taskAssignType == "MULTIPLE_INSTANCE" || $taskAssignType == "MULTIPLE_INSTANCE_VALUE_BASED"){
if ($taskAssignType == "MULTIPLE_INSTANCE" || $taskAssignType == "MULTIPLE_INSTANCE_VALUE_BASED") {
switch ($taskAssignType) {
case 'MULTIPLE_INSTANCE':
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
break;
default:
throw (new Exception( 'Invalid Task Assignment method' ));
throw (new Exception('Invalid Task Assignment method'));
break;
}
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
$count = 0;
foreach($userFields as $rowUser){
if($rowUser["USR_UID"] != $sUsrUid){
foreach ($userFields as $rowUser) {
if ($rowUser["USR_UID"] != $sUsrUid) {
//appDelegation
$AppDelegation = new AppDelegation;
$iAppThreadIndex ++; // Start Thread
@@ -2193,13 +2167,13 @@ class Cases
(empty($user)) ? 0 : $user->getUsrId(),
$this->Process->getProId()
);
//appThread
$AppThread = new AppThread;
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex1, 0);
//Save Information
$aUserFields[$count] = $rowUser;
$aUserFields[$count]["DEL_INDEX"] = $iDelIndex1;
$count++;
//appThread
$AppThread = new AppThread;
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex1, 0);
//Save Information
$aUserFields[$count] = $rowUser;
$aUserFields[$count]["DEL_INDEX"] = $iDelIndex1;
$count++;
}
}
}
@@ -2343,7 +2317,6 @@ class Cases
$iPosition += 1;
$aNextStep = null;
if ($iPosition <= $iLastStep) {
while ($iPosition <= $iLastStep) {
$bAccessStep = false;
//step
@@ -2374,25 +2347,25 @@ class Cases
$sAction = '';
break;
}
if(array_key_exists('gmail',$_SESSION) || (array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1)){
$aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction .
'&gmail=1'
);
} else{
$aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction
);
if (array_key_exists('gmail', $_SESSION) || (array_key_exists('gmail', $_GET) && $_GET['gmail'] == 1)) {
$aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction .
'&gmail=1'
);
} else {
$aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction
);
}
$iPosition = $iLastStep;
}
@@ -2401,21 +2374,21 @@ class Cases
}
}
if (!$aNextStep) {
if(array_key_exists('gmail',$_SESSION) || (array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1)){
$aNextStep = array(
'TYPE' => 'DERIVATION',
'UID' => -1,
'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN&gmail=1'
);
}else {
$aNextStep = array(
'TYPE' => 'DERIVATION',
'UID' => -1,
'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'
);
}
if (array_key_exists('gmail', $_SESSION) || (array_key_exists('gmail', $_GET) && $_GET['gmail'] == 1)) {
$aNextStep = array(
'TYPE' => 'DERIVATION',
'UID' => -1,
'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN&gmail=1'
);
} else {
$aNextStep = array(
'TYPE' => 'DERIVATION',
'UID' => -1,
'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'
);
}
}
return $aNextStep;
} catch (exception $e) {
@@ -2621,7 +2594,6 @@ class Cases
///-- $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
if (G::LoadSystemExist($sDataBase)) {
$oDataBase = new database();
$c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
$c->addAsColumn(
@@ -3373,7 +3345,7 @@ class Cases
if (!is_null($oApplication)) {
return $oApplication->getDelIndex();
}
throw ( new Exception('This case has 0 current delegations') );
throw (new Exception('This case has 0 current delegations'));
}
/*
@@ -4011,11 +3983,12 @@ class Cases
* @param string $iDelegation
* @return boolean
*/
public static function isUnassignedPauseCase($sAppUid, $iDelegation){
public static function isUnassignedPauseCase($sAppUid, $iDelegation)
{
$oAppDelegation = new AppDelegation();
$aFieldsDel = $oAppDelegation->Load($sAppUid, $iDelegation);
$usrUid = $aFieldsDel['USR_UID'];
if($usrUid === ''){
if ($usrUid === '') {
return true;
} else {
return false;
@@ -4036,8 +4009,8 @@ class Cases
public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null, $appTitle = null)
{
// Check if the case is unassigned
if($this->isUnassignedPauseCase($sApplicationUID, $iDelegation)){
throw new Exception( G::LoadTranslation("ID_CASE_NOT_PAUSED", array(G::LoadTranslation("ID_UNASSIGNED_STATUS"))) );
if ($this->isUnassignedPauseCase($sApplicationUID, $iDelegation)) {
throw new Exception(G::LoadTranslation("ID_CASE_NOT_PAUSED", array(G::LoadTranslation("ID_UNASSIGNED_STATUS"))));
}
$oApplication = new Application();
@@ -4295,7 +4268,7 @@ class Cases
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
}
/*----------------------------------********---------------------------------*/
$data = array (
$data = array(
'APP_UID' => $sApplicationUID,
'DEL_INDEX' => $iIndex,
'USR_UID' => $user_logged,
@@ -5531,7 +5504,7 @@ class Cases
}
if ($sTo != null) {
$oSpool = new spoolRun();
$oSpool = new SpoolRun();
$oSpool->setConfig($dataLastEmail['configuration']);
$oSpool->create(array(
@@ -5599,10 +5572,10 @@ class Cases
{
$sTo = null;
$sCc = null;
$arrayResp = array ();
$arrayResp = array();
$tasks = new Tasks();
$group = new Groups ();
$oUser = new Users ();
$group = new Groups();
$oUser = new Users();
$task = TaskPeer::retrieveByPK($taskUid);
@@ -5693,14 +5666,14 @@ class Cases
$arrayResp['to'] = $to;
$arrayResp['cc'] = $cc;
break;
case "MULTIPLE_INSTANCE" :
case "MULTIPLE_INSTANCE":
$to = null;
$cc = null;
$sw = 1;
$oDerivation = new Derivation ();
$userFields = $oDerivation->getUsersFullNameFromArray ( $oDerivation->getAllUsersFromAnyTask ( $taskUid ) );
if (isset ( $userFields )) {
foreach ( $userFields as $row ) {
$oDerivation = new Derivation();
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($taskUid));
if (isset($userFields)) {
foreach ($userFields as $row) {
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
if ($sw == 1) {
$to = $toAux;
@@ -5713,19 +5686,19 @@ class Cases
$arrayResp ['cc'] = $cc;
}
break;
case "MULTIPLE_INSTANCE_VALUE_BASED" :
$oTask = new Task ();
$aTaskNext = $oTask->load ( $taskUid );
if (isset ( $aTaskNext ["TAS_ASSIGN_VARIABLE"] ) && ! empty ( $aTaskNext ["TAS_ASSIGN_VARIABLE"] )) {
case "MULTIPLE_INSTANCE_VALUE_BASED":
$oTask = new Task();
$aTaskNext = $oTask->load($taskUid);
if (isset($aTaskNext ["TAS_ASSIGN_VARIABLE"]) && ! empty($aTaskNext ["TAS_ASSIGN_VARIABLE"])) {
$to = null;
$cc = null;
$sw = 1;
$nextTaskAssignVariable = trim ( $aTaskNext ["TAS_ASSIGN_VARIABLE"], " @#" );
$nextTaskAssignVariable = trim($aTaskNext ["TAS_ASSIGN_VARIABLE"], " @#");
$arrayUsers = $arrayData [$nextTaskAssignVariable];
$oDerivation = new Derivation ();
$userFields = $oDerivation->getUsersFullNameFromArray ( $arrayUsers );
$oDerivation = new Derivation();
$userFields = $oDerivation->getUsersFullNameFromArray($arrayUsers);
foreach ( $userFields as $row ) {
foreach ($userFields as $row) {
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
if ($sw == 1) {
$to = $toAux;
@@ -5738,7 +5711,7 @@ class Cases
$arrayResp ['cc'] = $cc;
}
break;
default :
default:
if (isset($userUid) && !empty($userUid)) {
$aUser = $oUser->load($userUid);
@@ -5762,9 +5735,9 @@ class Cases
*/
public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $delIndex = 0)
{
$ACTIONS = Array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE
$MAIN_OBJECTS = Array();
$RESULT_OBJECTS = Array();
$ACTIONS = array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE
$MAIN_OBJECTS = array();
$RESULT_OBJECTS = array();
foreach ($ACTIONS as $action) {
$MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action, $delIndex);
@@ -5988,9 +5961,9 @@ class Cases
"OUTPUT_DOCUMENTS" => $result['OUTPUT'],
"CASES_NOTES" => $result['CASES_NOTES'],
"MSGS_HISTORY" => $result['MSGS_HISTORY']
/*----------------------------------********---------------------------------*/
/*----------------------------------********---------------------------------*/
,"SUMMARY_FORM" => $result['SUMMARY_FORM']
/*----------------------------------********---------------------------------*/
/*----------------------------------********---------------------------------*/
);
}
@@ -6416,7 +6389,7 @@ class Cases
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('messages');
usort( $aMessages, array($this, "ordProcess") );
usort($aMessages, array($this, "ordProcess"));
return $aMessages;
}
@@ -6455,7 +6428,7 @@ class Cases
public function getAllObjectsFromProcess($PRO_UID, $OBJ_TYPE = '%')
{
$RESULT = Array();
$RESULT = array();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
$oCriteria->addSelectColumn(AppDocumentPeer::APP_UID);
@@ -6753,7 +6726,7 @@ class Cases
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if (isset($sumary) && $sumary === true) {
$sumary = Array();
$sumary = array();
while ($rs->next()) {
$nCount++;
$row = $rs->getRow();
@@ -6764,7 +6737,7 @@ class Cases
$sumary[$row['PRO_UID']]['name'] = $row['APP_PRO_TITLE'];
}
}
return Array('count' => $nCount, 'sumary' => $sumary);
return array('count' => $nCount, 'sumary' => $sumary);
} else {
while ($rs->next()) {
$nCount++;
@@ -6783,7 +6756,7 @@ class Cases
*/
public function getAllConditionCasesCount($types, $sumary = null)
{
$aResult = Array();
$aResult = array();
foreach ($types as $type) {
$aResult[$type] = $this->getConditionCasesCount($type, $sumary);
}
@@ -6890,7 +6863,7 @@ class Cases
$c = new Criteria();
$c->add(AppDelegationPeer::APP_UID, $aData['APP_UID']);
$c->add(AppDelegationPeer::DEL_PREVIOUS, $aData['APP_THREAD_PARENT']);
if($status === 'OPEN'){
if ($status === 'OPEN') {
$c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
}
$rs = AppDelegationPeer::doSelectRs($c);
@@ -6954,7 +6927,7 @@ class Cases
global $RBAC;
//Adding the actual user if this has the PM_SUPERVISOR permission assigned.
if ($RBAC->userCanAccess('PM_SUPERVISOR') == 1) {
if(!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)) {
if (!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)) {
$row[] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
}
}
@@ -6969,7 +6942,7 @@ class Cases
$rs = UsersPeer::doSelectRs($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rows = Array();
$rows = array();
while ($rs->next()) {
$rows[] = $rs->getRow();
}
@@ -6995,8 +6968,8 @@ class Cases
$flagSupervisors = false;
if ($oDataset->next()) {
if (!in_array($USR_UID,$row)) {
$rows[] = $oDataset->getRow();
if (!in_array($USR_UID, $row)) {
$rows[] = $oDataset->getRow();
}
$flagSupervisors = true;
}
@@ -7025,7 +6998,7 @@ class Cases
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataset->next()) {
if (!in_array($USR_UID,$row)) {
if (!in_array($USR_UID, $row)) {
$rows[] = $oDataset->getRow();
}
}
@@ -7051,7 +7024,7 @@ class Cases
$c->addSelectColumn(UsersPeer::USR_USERNAME);
$c->addSelectColumn(UsersPeer::USR_EMAIL);
if($usrStatus != '') {
if ($usrStatus != '') {
$c->add(UsersPeer::USR_STATUS, $usrStatus, CRITERIA::EQUAL);
}
@@ -7064,7 +7037,7 @@ class Cases
$rs->next();
while ($row = $rs->getRow()) {
//In some cases the thread does not have a User Script task, Itee
if($row['USR_UID'] !== ''){
if ($row['USR_UID'] !== '') {
$rows[$row['USR_UID']] = $row;
}
$rs->next();
@@ -7076,7 +7049,7 @@ class Cases
public function getCaseNotes($applicationID, $type = 'array', $userUid = '')
{
require_once ( "classes/model/AppNotes.php" );
require_once("classes/model/AppNotes.php");
$appNotes = new AppNotes();
$appNotes = $appNotes->getNotesList($applicationID, $userUid);
$response = '';
@@ -7201,27 +7174,26 @@ class Cases
$pmTableName = $pmTable->toCamelCase($tableName);
//DELETE
require_once (PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php");
require_once(PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php");
$criteria3 = new Criteria("workflow");
eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);");
eval($pmTableName . "Peer::doDelete(\$criteria3);");
} catch (Exception $e) {
throw $e;
}
}
}
public function ordProcess ($a, $b)
public function ordProcess($a, $b)
{
if ($this->sort == '') {
$this->sort = 'APP_MSG_DATE';
}
if ($this->dir=='ASC') {
if ($a[$this->sort] > $b[$this->sort]) {
return 1;
if ($this->sort == '') {
$this->sort = 'APP_MSG_DATE';
}
if ($this->dir=='ASC') {
if ($a[$this->sort] > $b[$this->sort]) {
return 1;
} elseif ($a[$this->sort] < $b[$this->sort]) {
return - 1;
} else {
@@ -7229,16 +7201,17 @@ class Cases
}
} else {
if ($a[$this->sort] > $b[$this->sort]) {
return - 1;
return - 1;
} elseif ($a[$this->sort] < $b[$this->sort]) {
return 1;
return 1;
} else {
return 0;
return 0;
}
}
}
public function unserializeData($data) {
public function unserializeData($data)
{
$unserializedData = @unserialize($data);
// BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble
@@ -7310,26 +7283,27 @@ class Cases
}
}
private function orderStartCasesByCategoryAndName ($rows) {
private function orderStartCasesByCategoryAndName($rows)
{
//now we order in category, proces_name order:
$comparatorSequence = array(
function($a, $b) {
function ($a, $b) {
$retval = 0;
if(array_key_exists('catname', $a) && array_key_exists('catname', $b)) {
if (array_key_exists('catname', $a) && array_key_exists('catname', $b)) {
$retval = strcmp($a['catname'], $b['catname']);
}
return $retval;
}
, function($a, $b) {
$retval = 0;
if(array_key_exists('value', $a) && array_key_exists('value', $b)) {
$retval = strcmp($a['value'], $b['value']);
}
return $retval;
, function ($a, $b) {
$retval = 0;
if (array_key_exists('value', $a) && array_key_exists('value', $b)) {
$retval = strcmp($a['value'], $b['value']);
}
return $retval;
}
);
usort($rows, function($a, $b) use ($comparatorSequence) {
usort($rows, function ($a, $b) use ($comparatorSequence) {
foreach ($comparatorSequence as $cmpFn) {
$diff = call_user_func($cmpFn, $a, $b);
if ($diff !== 0) {

View File

@@ -1,57 +1,14 @@
<?php
/**
* class.configuration.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
//
// It works with the table CONFIGURATION in a WF dataBase
// Copyright (C) 2007 COLOSA
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
/**
* ProcessConfiguration - ProcessConfiguration class
*
* @author David S. Callizaya S.
* @copyright 2007 COLOSA
*/
require_once 'classes/model/Configuration.php';
/**
* ProcessConfiguration - ProcessConfiguration
* Extends Configuration
*
*
* @copyright 2007 COLOSA
* @version Release: @package_version@
* @package workflow.engine.ProcessMaker
*/
class Configurations // extends Configuration
{
public $aConfig = array();
private $Configuration = null;
private $UserConfig = null;
@@ -81,16 +38,16 @@ class Configurations // extends Configuration
$this->arrayClone($object[$k], $cloneObject[$k]);
}
} else {
if (is_object( $object )) {
if (is_object($object)) {
} else {
$cloneObject = null;
}
}
}
public function exists($cfgID,$objID='')
public function exists($cfgID, $objID='')
{
return $this->Configuration->exists($cfgID,$objID,'','','');
return $this->Configuration->exists($cfgID, $objID, '', '', '');
}
/**
@@ -169,7 +126,6 @@ class Configurations // extends Configuration
try {
$this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app);
} catch (Exception $e) {
} // the configuration does not exist
@@ -178,7 +134,7 @@ class Configurations // extends Configuration
}
if (!is_array($this->aConfig)) {
$this->aConfig = Array();
$this->aConfig = array();
}
return $this->aConfig;
@@ -325,8 +281,8 @@ class Configurations // extends Configuration
$theFormat = $this->UserConfig['format'];
$fname = $oUser->getUsrFirstname();
$lname = $oUser->getUsrLastname();
if (strpos($theFormat, ',') !== false && ( trim($fname) == '' || trim($lname) == '')) {
$theFormat = str_replace(',', '', $theFormat);
if (strpos($theFormat, ',') !== false && (trim($fname) == '' || trim($lname) == '')) {
$theFormat = str_replace(',', '', $theFormat);
}
$aux = str_replace('@userName', trim($username), $theFormat);
@@ -537,15 +493,15 @@ class Configurations // extends Configuration
public function getUserNameFormats()
{
$formats[] = Array('id' => '@firstName @lastName', //the id , don't translate
$formats[] = array('id' => '@firstName @lastName', //the id , don't translate
'name' => G::loadTranslation('ID_USERNAME_FORMAT_1') //label displayed, can be translated
);
$formats[] = Array('id' => '@firstName @lastName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_2'));
$formats[] = Array('id' => '@userName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3'));
$formats[] = Array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4'));
$formats[] = Array('id' => '@lastName @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_5'));
$formats[] = Array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6'));
$formats[] = Array('id' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7'));
$formats[] = array('id' => '@firstName @lastName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_2'));
$formats[] = array('id' => '@userName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3'));
$formats[] = array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4'));
$formats[] = array('id' => '@lastName @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_5'));
$formats[] = array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6'));
$formats[] = array('id' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7'));
return $formats;
}
@@ -560,9 +516,9 @@ class Configurations // extends Configuration
$creationDateMask = ($creationDateMask == '') ? $dateFormat : $creationDateMask;
if ($creationDateMask != '') {
if (strpos($dateTime, ' ') !== false) {
list ($date, $time) = explode(' ', $dateTime);
list ($y, $m, $d) = explode('-', $date);
list ($h, $i, $s) = explode(':', $time);
list($date, $time) = explode(' ', $dateTime);
list($y, $m, $d) = explode('-', $date);
list($h, $i, $s) = explode(':', $time);
$newCreation = '';
$maskTime = array('d' => '%d', 'D' => '%A', 'j' => '%d', 'l' => '%A', 'G' => '%I', 'g' => '%i', 'N' => '%u', 'S' => '%d', 'w' => '%w', 'z' => '%j', 'W' => '%W', 'F' => '%B', 'm' => '%m', 'M' => '%B', 'n' => '%m', 'o' => '%Y', 'Y' => '%Y', 'y' => '%g', 'a' => '%p', 'A' => '%p', 'g' => '%I', 'G' => '%H', 'h' => '%I', 'H' => '%H', 'i' => '%M', 's' => '%S');
$creationDateMask = trim($creationDateMask);
@@ -589,9 +545,9 @@ class Configurations // extends Configuration
if (G::toLower(PHP_OS) == 'linux' || G::toLower(PHP_OS) == 'darwin') {
if (SYS_LANG == 'es') {
$langLocate = 'es_ES';
} else if (strlen(SYS_LANG) > 2) {
} elseif (strlen(SYS_LANG) > 2) {
$langLocate = str_replace('-', '_', SYS_LANG);
} else if ($location != '') {
} elseif ($location != '') {
$langLocate = SYS_LANG.'_'.$location;
} else {
$langLocate = 'en_US';
@@ -1006,4 +962,3 @@ class Configurations // extends Configuration
return $ver;
}
}

View File

@@ -1,5 +1,6 @@
<?php
class ConsolidatedCases
{
private $existTable;
@@ -51,7 +52,7 @@ class ConsolidatedCases
$oReportTables = new ReportTables();
$oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']);
$pmDyna = new pmDynaform(array());
$pmDyna = new PmDynaform(array());
$pmDyna->fields["CURRENT_DYNAFORM"] = $DynUid;
$dataDyna = $pmDyna->getDynaform();
$json = G::json_decode($dataDyna["DYN_CONTENT"]);

View File

@@ -1,16 +1,11 @@
<?php
class Dashboards
{
public function getListDashboards ($start=0, $limit=20, $sort='', $dir='DESC', $search='')
{
require_once 'classes/model/Dashboard.php';
require_once 'classes/model/DashboardIndicator.php';
require_once 'classes/model/Users.php';
require_once 'classes/model/Groupwf.php';
require_once 'classes/model/DashboardDasInd.php';
$limit_size = isset($limit) ? $limit: 20;
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;

View File

@@ -1,8 +1,7 @@
<?php
require_once 'classes/interfaces/dashletInterface.php';
class dashletOpenVSCompleted implements DashletInterface
class DashletOpenVsCompleted implements DashletInterface
{
const version = '1.0';
@@ -275,7 +274,7 @@ class dashletOpenVSCompleted implements DashletInterface
public function render ($width = 300)
{
$g = new pmGauge();
$g = new PmGauge();
$g->w = $width;
$g->value = $this->value;

View File

@@ -1,8 +1,8 @@
<?php
require_once 'classes/interfaces/dashletInterface.php';
class dashletProcessMakerCommunity implements DashletInterface
class DashletProcessMakerCommunity implements DashletInterface
{
const version = '1.0';

View File

@@ -1,8 +1,8 @@
<?php
require_once 'classes/interfaces/dashletInterface.php';
class dashletProcessMakerEnterprise implements DashletInterface
class DashletProcessMakerEnterprise implements DashletInterface
{
const version = '1.0';

View File

@@ -1,8 +1,8 @@
<?php
require_once 'classes/interfaces/dashletInterface.php';
use ProcessMaker\Core\System;
class dashletRssReader implements DashletInterface
class DashletRssReader implements DashletInterface
{
const version = '1.0';
@@ -54,7 +54,7 @@ class dashletRssReader implements DashletInterface
curl_setopt( $pCurl, CURLOPT_VERBOSE, false );
//Apply proxy settings
$sysConf = PmSystem::getSystemConfiguration();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt( $pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') );
if ($sysConf['proxy_port'] != '') {

View File

@@ -1,44 +1,6 @@
<?php
/**
* class.dates.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
* /
*
* /*
* Created on 21/01/2008
* This class is used for handling dates
*
* @author David Callizaya <davidsantos@colosa.com>
*/
require_once ("classes/model/TaskPeer.php");
require_once ("classes/model/HolidayPeer.php");
/**
*
* @package workflow.engine.classes
*/
class dates
class Dates
{
private $holidays = array();
@@ -529,4 +491,3 @@ class dates
return $iDate;
}
}

View File

@@ -1,26 +1,5 @@
<?php
/**
* Author: Erik Amaru Ortiz <erik@colosa.com>
* Description:This is a class for load all additional connections; if exist in a particular proccess
* Date: 15-05-2008
*
*
* class.dbConnections.php
*
* Email bugs/suggestions to erik@colosa.com
*/
require_once 'model/DbSource.php';
require_once 'model/Content.php';
/**
* dbConnections
*
*
* @copyright 2008 Colosa
* @package workflow.engine.classes
*
*/
class DbConnections
{
private $PRO_UID;

View File

@@ -1,12 +1,5 @@
<?php
/**
* derivation - derivation class
*
* @package workflow.engine.ProcessMaker
*
*/
class Derivation
{
var $case;
@@ -1701,7 +1694,6 @@ class Derivation
function getGrpUser ($aData)
{
require_once 'classes/model/Content.php';
$oTasks = new Tasks();
$oGroups = new Groups();
$oContent = new Content();

View File

@@ -1,36 +1,5 @@
<?php
/**
* class.dynaFormField.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* Dynaform Field - DynaformField class
*
* @package workflow.engine.classes
*/
class DynaFormField extends DBTable
{

View File

@@ -0,0 +1,293 @@
<?php
/**
* Created on 21/12/2007
* Dynaform - Dynaform
/**
*
* @package workflow.engine.classes
*/class DynaformEditor extends WebResource
{
private $isOldCopy = false;
public $file = '';
public $title = 'New Dynaform';
public $dyn_uid = '';
public $dyn_type = '';
public $home = '';
/**
* Other Options for Editor:
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
* top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))',
* height: '3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)',
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))'
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))'
*
* Other Options for Toolbar:
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
* top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))',
*/
public $defaultConfig = array('Editor' => array('left' => '0', 'top' => '0', 'width' => 'document.body.clientWidth-4', 'height' => 'document.body.clientHeight-4'),
'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7', 'top' => '52'),
'FieldsList' => array('left' => '4+toolbar.clientWidth+24', 'top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', 'width' => 244, 'height' => 400)
);
public $panelConf = array('style' => array('title' => array('textAlign' => 'center')),
'width' => 700, 'height' => 600, 'tabWidth' => 120, 'modal' => true, 'drag' => false, 'resize' => false, 'blinkToFront' => false
);
/**
* Constructor of the class dynaformEditor
*
* @param string $get
* @return void
*/
public function __construct($get)
{
$this->panelConf = array_merge($this->panelConf, $this->defaultConfig['Editor']);
//'title' => G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$this->title.']',
}
/**
* Create the xml form default
*
* @param string $filename
* @return void
*/
public function _createDefaultXmlForm($fileName)
{
//Create the default Dynaform
$sampleForm = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$sampleForm .= '<dynaForm type="' . $this->dyn_type . '" name="" width="500" enabletemplate="0" mode="edit">' . "\n";
switch ($this->dyn_type) {
case "xmlform":
/* $sampleForm.='<title type="title" enablehtml="0">' . "\n" .
' <en>Sample form</en>' . "\n" .
'</title>'."\n";
$sampleForm.='<submit type="submit" enablehtml="0" onclick="">' . "\n" .
' <en>Submit</en>' . "\n" .
'</submit>'."\n"; */
break;
case "grid":
/* $sampleForm.='<fieldA type="text" >' . "\n" .
'<en>A</en>' . "\n" .
'</fieldA>'."\n";
$sampleForm.='<fieldB type="text" >' . "\n" .
'<en>B</en>' . "\n" .
'</fieldB>'."\n"; */
break;
}
$sampleForm .= '</dynaForm>';
G::verifyPath(dirname($fileName), true);
$fp = fopen($fileName, 'w');
$sampleForm = str_replace('name=""', 'name="' . $this->_getFilename($this->file) . '"', $sampleForm);
fwrite($fp, $sampleForm);
fclose($fp);
}
/**
* Prints the DynaformEditor
*
* @return void
*/
public function _render()
{
global $G_PUBLISH;
$script = '';
/* Start Block: Load (Create if doesn't exist) the xmlform */
$Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor
);
$_SESSION['Current_Dynafom']['Parameters'] = $Parameters;
$XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '' //$openDoc->getXml()
);
$JSEditor = array('URL' => G::encrypt($this->file, URL_KEY)
);
$A = G::encrypt($this->file, URL_KEY);
try {
$openDoc = new Xml_Document();
$fileName = $this->home . $this->file . '.xml';
if (file_exists($fileName)) {
$openDoc->parseXmlFile($fileName);
} else {
$this->_createDefaultXmlForm($fileName);
$openDoc->parseXmlFile($fileName);
}
//$form = new Form( $this->file , $this->home, SYS_LANG, true );
$Properties = DynaformEditorAjax::get_properties($A, $this->dyn_uid);
/* Start Block: Prepare the XMLDB connection */
define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml');
define('DB_XMLDB_USER', '');
define('DB_XMLDB_PASS', '');
define('DB_XMLDB_NAME', '');
define('DB_XMLDB_TYPE', 'myxml');
/* Start Block: Prepare the dynaformEditor */
$G_PUBLISH = new Publisher();
$sName = 'dynaformEditor';
$G_PUBLISH->publisherId = $sName;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']);
$G_PUBLISH->AddContent('blank');
$this->panelConf['title'] = '';
$G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf);
if ($Properties['DYN_TYPE'] == 'xmlform') {
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', '');
} else {
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', '');
}
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', '');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', '');
$G_PUBLISH->AddContent('blank');
$i = 0;
$aFields = array();
$aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char'
);
$oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml'));
$oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
$iMaximun = $oDataset->count();
while ($aRow = $oDataset->Read()) {
$aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), 'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : ''), 'row__' => ($i + 1)
);
$i++;
break;
}
global $_DBArray;
$_DBArray['fields'] = $aFields;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('fields');
/**
* *@Erik-> this is deprecated,.
* (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');**
*/
$G_PUBLISH->AddContent('blank');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', '');
} catch (Exception $e) {
}
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', '');
//for showHide tab option @Neyek
$G_PUBLISH->AddContent('blank');
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView');
if ($Properties['DYN_TYPE'] != 'grid') {
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView');
}
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView');
if ($Properties["DYN_TYPE"] != "grid") {
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView');
}
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView');
//for showHide tab option @Neyek
if ($Properties["DYN_TYPE"] != "grid") {
$G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide");
}
$G_PUBLISH->AddContent('panel-close');
$oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js",2);
$oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js');
$oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js',1);
$oHeadPublisher->addScriptFile('/js/grid/core/grid.js');
$oHeadPublisher->addScriptCode('
var DYNAFORM_URL="' . $Parameters['URL'] . '";
leimnud.event.add(window,"load",function(){ loadEditor(); });
');
$oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLoggedDE__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";');
$arrayParameterAux = $Parameters;
$arrayParameterAux["DYNAFORM_NAME"] = base64_encode($arrayParameterAux["DYNAFORM_NAME"]);
$oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($arrayParameterAux) . '\';');
G::RenderPage("publish", 'blank');
}
/**
* Get the filename
*
* @param string $file
* @return string
*/
public function _getFilename($file)
{
return (strcasecmp(substr($file, - 5), '_tmp0') == 0) ? substr($file, 0, strlen($file) - 5) : $file;
}
/**
* Set the temporal copy
*
* @param string $onOff
* @return void
*/
public function _setUseTemporalCopy($onOff)
{
$file = self::_getFilename($this->file);
if ($onOff) {
$this->file = $file . '_tmp0';
self::_setTmpData(array('useTmpCopy' => true ));
if (!file_exists(PATH_DYNAFORM . $file . '.xml')) {
$this->_createDefaultXmlForm(PATH_DYNAFORM . $file . '.xml');
}
//Creates a copy if it doesn't exist, else, use the old copy
if (!file_exists(PATH_DYNAFORM . $this->file . '.xml')) {
self::_copyFile(PATH_DYNAFORM . $file . '.xml', PATH_DYNAFORM . $this->file . '.xml');
}
if (!file_exists(PATH_DYNAFORM . $this->file . '.html') && file_exists(PATH_DYNAFORM . $file . '.html')) {
self::_copyFile(PATH_DYNAFORM . $file . '.html', PATH_DYNAFORM . $this->file . '.html');
}
} else {
$this->file = $file;
self::_setTmpData(array());
}
}
/**
* Set temporal data
*
* @param $data
* @return void
*/
public function _setTmpData($data)
{
G::verifyPath(PATH_C . 'dynEditor/', true);
$fp = fopen(PATH_C . 'dynEditor/' . session_id() . '.php', 'w');
fwrite($fp, '$tmpData=unserialize(\'' . addcslashes(serialize($data), '\\\'') . '\');');
fclose($fp);
}
/**
* Get temporal data
*
* @param string $filename
* @return array
*/
public function _getTmpData()
{
$tmpData = array();
$file = PATH_C . 'dynEditor/' . session_id() . '.php';
if (file_exists($file)) {
eval(implode('', file($file)));
}
return $tmpData;
}
/**
* Copy files
*
* @param file $from
* @param file $to
* @return void
*/
public function _copyFile($from, $to)
{
$copy = implode('', file($from));
$fcopy = fopen($to, "w");
fwrite($fcopy, $copy);
fclose($fcopy);
}
}

View File

@@ -1,15 +1,6 @@
<?php
require_once ("classes" . PATH_SEP . "class.enterpriseUtils.php");
if (!defined("PM_VERSION")) {
if (file_exists(PATH_METHODS . "login/version-pmos.php")) {
include (PATH_METHODS . "login/version-pmos.php");
} else {
define("PM_VERSION", "2.0.0");
}
}
class enterpriseClass extends PMPlugin
class EnterpriseClass extends PMPlugin
{
public function __construct()
{
@@ -108,7 +99,7 @@ class enterpriseClass extends PMPlugin
public function enterpriseLimitCreateUser()
{
$oServerConf = &serverConf::getSingleton();
$oServerConf = &ServerConf::getSingleton();
$infoLicense =$oServerConf->getProperty('LICENSE_INFO');
if (isset($infoLicense[SYS_SYS]['LIMIT_USERS'])) {
$criteria = new Criteria('workflow');
@@ -156,8 +147,3 @@ class enterpriseClass extends PMPlugin
}
}
}
if (!class_exists("pmLicenseManager")) {
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
}

View File

@@ -1,5 +1,6 @@
<?php
require_once ("classes/model/Configuration.php");
use ProcessMaker\Core\System;
class EnterpriseUtils
{
@@ -40,7 +41,7 @@ class EnterpriseUtils
curl_setopt($ch, CURLOPT_VERBOSE, true);
//Apply proxy settings
$sysConf = PmSystem::getSystemConfiguration();
$sysConf = System::getSystemConfiguration();
if (isset($sysConf['proxy_host'])) {
if ($sysConf['proxy_host'] != '') {
curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
@@ -149,4 +150,3 @@ class EnterpriseUtils
return $sw;
}
}

View File

@@ -0,0 +1,23 @@
<?php
class FeaturesDetail
{
public $featureName;
public $description = null;
public $enabled = false;
public $workspaces = null;
/**
* This function is the constructor of the featuresDetail class
*
* @param string $featureName
* @param string $name
* @param string $description
* @return void
*/
public function __construct ($featureName, $description = '')
{
$this->featureName = $featureName;
$this->description = $description;
}
}

View File

@@ -1,4 +1,5 @@
<?php
class FieldValidator
{
/**
@@ -240,4 +241,3 @@ class FieldValidator
return $result;
}
}

View File

@@ -25,6 +25,7 @@
*
*/
class FileCache
{
function __construct ($dir)
@@ -122,4 +123,3 @@ class FileCache
return null;
}
}

View File

@@ -1,4 +1,5 @@
<?php
class FormBatchRouting extends Form
{
public function getVars($bWhitSystemVars = true)
@@ -18,4 +19,3 @@ class FormBatchRouting extends Form
return $aFields;
}
}

View File

@@ -1,34 +1,7 @@
<?php
/**
* class.groups.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/Groupwf.php';
require_once 'classes/model/GroupUser.php';
require_once 'classes/model/Users.php';
* Groups - Groups
/**
* Groups - Groups class
*
@@ -463,4 +436,3 @@ class Groups
}
}
}

View File

@@ -1,35 +1,7 @@
<?php
/**
* class.BasePeer.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class.
// actual class may be a subclass -- as returned by ApplicationPeer::getOMClass()
include_once 'classes/model/Application.php';
// The object
/**
* Base static class for performing query and update operations on the 'APPLICATION' table.
*
@@ -702,20 +674,3 @@ abstract class GulliverBasePeer
}
} // BaseApplicationPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseApplicationPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log( 'Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR );
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
require_once 'classes/model/map/ApplicationMapBuilder.php';
Propel::registerMapBuilder( 'classes.model.map.ApplicationMapBuilder' );
}

View File

@@ -0,0 +1,74 @@
<?php
/*--------------------------------------------------
* TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.1
* By Devin Doucette
* Copyright (c) 2005 Devin Doucette
* Email: darksnoopy@shaw.ca
*--------------------------------------------------
* Email bugs/suggestions to darksnoopy@shaw.ca
*--------------------------------------------------
* This script has been created and released under
* the GNU GPL and is free to use and redistribute
* only if this copyright statement is not removed
*--------------------------------------------------*/
/**
* This class is derived of the class archive, is employed to use archives .
* gzip
* @package workflow.engine.classes
*/
class GzipFile extends TarFile
{
/**
* This function is the constructor of the class gzip_file
*
* @param string $name
* @return void
*/
public function gzip_file($name)
{
$this->tar_file($name);
$this->options['type'] = "gzip";
}
/**
* This function is employed to create files .
* gzip
*
* @return boolean
*/
public function create_gzip()
{
if ($this->options['inmemory'] == 0) {
$pwd = getcwd();
chdir($this->options['basedir']);
if ($fp = gzopen($this->options['name'], "wb{$this->options['level']}")) {
fseek($this->archive, 0);
while ($temp = fread($this->archive, 1048576)) {
gzwrite($fp, $temp);
}
gzclose($fp);
chdir($pwd);
} else {
$this->error[] = "Could not open {$this->options['name']} for writing.";
chdir($pwd);
return 0;
}
} else {
$this->archive = gzencode($this->archive, $this->options['level']);
}
return 1;
}
/**
* This function open a archive of the class gzip_file
*
* @return void
*/
public function open_archive()
{
return @gzopen($this->options['name'], "rb");
}
}

View File

@@ -0,0 +1,6 @@
<?php
interface IDynaformEditorAjax
{
}

View File

@@ -651,7 +651,7 @@ class IndicatorsCalculator
private function pdoConnection() {
$currentWS = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined';
$workSpace = new workspaceTools($currentWS);
$workSpace = new WorkspaceTools($currentWS);
$arrayHost = explode(':', $workSpace->dbHost);
$host = "host=".$arrayHost[0];
$port = count($arrayHost) > 1 ? ";port=".$arrayHost[1] : "";

View File

@@ -0,0 +1,68 @@
<?php
/**
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 5304 Ventura Drive,
* Delray Beach, FL, 33484, USA, or email info@colosa.com.
*
*/
require_once "classes/model/Application.php";
require_once "classes/model/AppDelegation.php";
require_once "classes/model/AppThread.php";
require_once "classes/model/Content.php";
require_once "classes/model/Users.php";
require_once "classes/model/GroupUser.php";
require_once "classes/model/Task.php";
require_once "classes/model/TaskUser.php";
require_once "classes/model/Dynaform.php";
require_once "classes/model/ProcessVariables.php";
require_once "entities/SolrRequestData.php";
require_once "entities/SolrUpdateDocument.php";
require_once "entities/AppSolrQueue.php";
require_once "classes/model/AppSolrQueue.php";
/**
* Invalid search text for Solr exception
*
* @author Herbert Saal Gutierrez
*
*/
/**
* Invalid search text for Solr exception
*
* @author Herbert Saal Gutierrez
*
*/class InvalidIndexSearchTextException extends Exception
{
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0)
{
// some code
// make sure everything is assigned properly
parent::__construct ($message, $code);
}
// custom string representation of object
public function __toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}

View File

@@ -38,7 +38,11 @@ if (! defined( 'JAVA_BRIDGE_HOST' )) {
*
* @package workflow.engine.classes
*/
class JavaBridgePM
/**
*
* @package workflow.engine.classes
*/class JavaBridgePM
{
public $JavaBridgeDir = JAVA_BRIDGE_PATH;
public $JavaBridgePort = JAVA_BRIDGE_PORT;
@@ -174,4 +178,3 @@ class JavaBridgePM
printf( "saved %s bytes in file %s \n", $iSize, $reportFilename );
}
}

View File

@@ -1,5 +1,6 @@
<?php
class labelsGmail
{
function listLabels($service)
@@ -97,9 +98,9 @@ class labelsGmail
//The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PMGoogleApi();
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service);
@@ -147,9 +148,9 @@ class labelsGmail
//The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PMGoogleApi();
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service);
@@ -201,11 +202,11 @@ class labelsGmail
//The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PMGoogleApi();
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
@@ -280,9 +281,9 @@ class labelsGmail
//The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PMGoogleApi();
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service);
@@ -328,11 +329,11 @@ class labelsGmail
*/
public function deletePMGmailLabels($mail)
{
$pmGoogle = new PMGoogleApi();
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PMGoogleApi::GMAIL_MODIFY);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);

View File

@@ -1,39 +1,10 @@
<?php
/**
* class.ldapAdvanced.php
* LDAP plugin for the RBAC class. This class encapsulates all the methods required in order to bind
* ProcessMaker and a Ldap Directory server.
*
* @author
* Fernando Ontiveros
* Colosa
* @copyright
* Copyright (C) 2004 - 2008 Colosa Inc.
* @package plugins.ldapAdvanced.classes
* LDAP plugin for the RBAC class. This
*/
// evaluating the requiring of some classes
if (!class_exists("Department")) {
require_once "classes/model/Department.php";
}
if (!class_exists("Groupwf")) {
require_once "classes/model/Groupwf.php";
}
if (!class_exists("GroupUser")) {
require_once "classes/model/GroupUser.php";
}
if (!class_exists("RbacUsers")) {
require_once PATH_RBAC."model/RbacUsers.php";
}
if (!class_exists("RBAC")) {
require_once PATH_TRUNK . "gulliver/system/class.rbac.php";
}
class ldapAdvanced
class LdapAdvanced
{
/**
* The authsource id
@@ -69,7 +40,7 @@ class ldapAdvanced
* Object where an rbac instance is set
* @var Object
*/
static private $instance = null;
private static $instance = null;
private $arrayObjectClassFilter = array(
"user" => "|(objectclass=inetorgperson)(objectclass=organizationalperson)(objectclass=person)(objectclass=user)",
@@ -488,14 +459,14 @@ class ldapAdvanced
$logFile = PATH_DATA . "log/ldapAdvanced.log";
if (!file_exists($logFile) || is_writable($logFile)) {
$fpt= fopen ($logFile, "a");
$fpt= fopen($logFile, "a");
$ldapErrorMsg = "";
$ldapErrorNr = 0;
if ($link != null) {
$ldapErrorNr = ldap_errno($link);
if ( $ldapErrorNr != 0 ) {
if ($ldapErrorNr != 0) {
$ldapErrorMsg = ldap_error($link);
$text = $ldapErrorMsg . " : " . $text;
}
@@ -505,7 +476,7 @@ class ldapAdvanced
fwrite($fpt, sprintf("%s %s %s %s %s \n", date("Y-m-d H:i:s"), getenv("REMOTE_ADDR"), SYS_SYS, $ldapErrorNr, $text));
fclose($fpt);
} else {
error_log ("file $logFile is not writable ");
error_log("file $logFile is not writable ");
}
}
@@ -536,11 +507,11 @@ class ldapAdvanced
*/
public function ldapConnection($aAuthSource)
{
$pass = explode("_",$aAuthSource["AUTH_SOURCE_PASSWORD"]);
$pass = explode("_", $aAuthSource["AUTH_SOURCE_PASSWORD"]);
foreach ($pass as $index => $value) {
if ($value == "2NnV3ujj3w") {
$aAuthSource["AUTH_SOURCE_PASSWORD"] = G::decrypt($pass[0],$aAuthSource["AUTH_SOURCE_SERVER_NAME"]);
$aAuthSource["AUTH_SOURCE_PASSWORD"] = G::decrypt($pass[0], $aAuthSource["AUTH_SOURCE_SERVER_NAME"]);
}
}
@@ -1076,11 +1047,11 @@ class ldapAdvanced
$strUser = trim($strUser);
}
if ( $strUser == "" ) {
if ($strUser == "") {
return -1;
}
if ( strlen( $strPass ) == 0) {
if (strlen($strPass) == 0) {
return -2;
}
@@ -1171,7 +1142,7 @@ class ldapAdvanced
$ldapcnn = $this->ldapConnection($arrayAuthSource);
$flagUpdate = false;
switch(ldap_errno($ldapcnn)) {
switch (ldap_errno($ldapcnn)) {
case '0x00':
$flagUpdate = true;
$statusRbac = 1;
@@ -1226,7 +1197,7 @@ class ldapAdvanced
$validUserPass = -5;
}
if ( $validUserPass == 1 ) {
if ($validUserPass == 1) {
$this->log($ldapcnn, "sucessful login user " . $verifiedUser["sDN"]);
} else {
$this->log($ldapcnn, "failure authentication for user $strUser");
@@ -1326,7 +1297,7 @@ class ldapAdvanced
$entries = ldap_count_entries($ldapcnn, $oSearch);
$totalUser = $entries;
if ( $entries > 0) {
if ($entries > 0) {
$oEntry = ldap_first_entry($ldapcnn, $oSearch);
$countEntries=0;
@@ -1577,11 +1548,11 @@ class ldapAdvanced
$res = 0;
if (!empty($user)) {
if ($this->VerifyLogin( $user['sUsername'], $strPass) === true) {
if ($this->VerifyLogin($user['sUsername'], $strPass) === true) {
$res = 1;
}
if ($res == 0 && $this->VerifyLogin( $user['sDN'], $strPass) === true) {
if ($res == 0 && $this->VerifyLogin($user['sDN'], $strPass) === true) {
$res = 1;
}
} else {
@@ -1614,8 +1585,8 @@ class ldapAdvanced
if (!empty($aAttributes)) {
foreach ($aAttributes as $value) {
if (isset( $user[$value['attributeUser']] )) {
$aData[$value['attributeUser']] = str_replace( "*", "'", $user[$value['attributeUser']] );
if (isset($user[$value['attributeUser']])) {
$aData[$value['attributeUser']] = str_replace("*", "'", $user[$value['attributeUser']]);
if ($value['attributeUser'] == 'USR_STATUS') {
$evalValue = $aData[$value['attributeUser']];
$statusValue = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] :'ACTIVE';
@@ -1626,7 +1597,7 @@ class ldapAdvanced
}
//req - accountexpires
if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"]!='' ) {
if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"]!='') {
$aData["USR_DUE_DATE"] = $this->convertDateADtoPM($user["USR_DUE_DATE"]);
}
//end
@@ -1799,12 +1770,12 @@ class ldapAdvanced
* @param <type> $currentDN
* @return <type>
*/
public function getDepUidIfExistsDN ($currentDN)
public function getDepUidIfExistsDN($currentDN)
{
try {
$oCriteria = new Criteria('workflow');
$oCriteria->add(DepartmentPeer::DEP_STATUS , 'ACTIVE' );
$oCriteria->add(DepartmentPeer::DEP_LDAP_DN, $currentDN );
$oCriteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
$oCriteria->add(DepartmentPeer::DEP_LDAP_DN, $currentDN);
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
@@ -1919,7 +1890,7 @@ class ldapAdvanced
BasePeer::doUpdate($c1, $c2, $con);
}
public function deactivateUser ($userUid)
public function deactivateUser($userUid)
{
if (!class_exists('RbacUsers')) {
require_once(PATH_RBAC.'model/RbacUsers.php');
@@ -2076,7 +2047,7 @@ class ldapAdvanced
$criteriaCount = new Criteria('workflow');
$criteriaCount->clearSelectColumns();
$criteriaCount->addSelectColumn( 'COUNT(*)' );
$criteriaCount->addSelectColumn('COUNT(*)');
$criteriaCount->add(DepartmentPeer::DEP_PARENT, $oDepartment->getDepUid(), Criteria::EQUAL);
$rs = DepartmentPeer::doSelectRS($criteriaCount);
$rs->next();
@@ -2085,7 +2056,7 @@ class ldapAdvanced
$result[] = $node;
}
if ( count($result) >= 1 ) {
if (count($result) >= 1) {
$result[ count($result) -1 ]['DEP_LAST'] = 1;
}
@@ -2139,11 +2110,11 @@ class ldapAdvanced
$attributes = $aAuthSource["AUTH_SOURCE_DATA"];
$this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU'])? trim($attributes['AUTH_SOURCE_RETIRED_OU']) : '';
if ($this->sTerminatedOu == '' ) {
if ($this->sTerminatedOu == '') {
return $aUsers;
}
return $this->getUsersFromDepartmentByName( $this->sTerminatedOu );
return $this->getUsersFromDepartmentByName($this->sTerminatedOu);
}
/**
@@ -2173,8 +2144,8 @@ class ldapAdvanced
$con = Propel::getConnection('rbac');
// select set
$c1 = new Criteria('rbac');
$c1->add(RbacUsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN );
$c1->add(RbacUsersPeer::USR_STATUS, 1 );
$c1->add(RbacUsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN);
$c1->add(RbacUsersPeer::USR_STATUS, 1);
// update set
$c2 = new Criteria('rbac');
$c2->add(RbacUsersPeer::USR_STATUS, '0');
@@ -2183,7 +2154,7 @@ class ldapAdvanced
$con = Propel::getConnection('workflow');
// select set
$c1 = new Criteria('workflow');
$c1->add(UsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN );
$c1->add(UsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN);
// update set
$c2 = new Criteria('workflow');
$c2->add(UsersPeer::USR_STATUS, 'INACTIVE');
@@ -2391,7 +2362,7 @@ class ldapAdvanced
{
try {
$criteria = new Criteria('workflow');
$criteria->add(GroupwfPeer::GRP_STATUS , 'ACTIVE');
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
$criteria->add(GroupwfPeer::GRP_LDAP_DN, $currentDN);
$dataset = GroupwfPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

View File

@@ -1,31 +1,6 @@
<?php
/**
* Project: Distrubution License Class
* File: class.license.app.php
*
* Copyright (C) 2005 Oliver Lillie
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @link http://www.buggedcom.co.uk/
* @link http://www.phpclasses.org/browse/package/2298.html
* @author Oliver Lillie, buggedcom <publicmail at buggedcom dot co dot uk>
* @history---------------------------------------------
* see CHANGELOG
*/
class license_application extends padl
class license_application extends Padl
{
/**
* The number of allowed differences between the $_SERVER vars and the vars
@@ -513,4 +488,3 @@ class license_application extends padl
return (empty($data['RESULT'])) ? 'SOCKET_FAILED' : $data['RESULT'];
}
}

View File

@@ -0,0 +1,229 @@
<?php
/**
* Class MultipleFilesBackup
* create a backup of this workspace
*
* Exports the database and copies the files to an tar archive o several if the max filesize is reached.
*/
class MultipleFilesBackup
{
private $dir_to_compress = "";
private $filename = "backUpProcessMaker.tar";
private $fileSize = "1000";
// 1 GB by default.
private $sizeDescriptor = "m";
//megabytes
private $tempDirectories = array();
/* Constructor
* @filename contains the path and filename of the comppress file(s).
* @size got the Max size of the compressed files, by default if the $size less to zero will mantains 1000 Mb as Max size.
*/
public function MultipleFilesBackup($filename, $size)
{
if (!empty($filename)) {
$this->filename = $filename;
}
if (!empty($size) && (int) $size > 0) {
$this->fileSize = $size;
}
}
/* Gets workspace information enough to make its backup.
* @workspace contains the workspace to be add to the commpression process.
*/
public function addToBackup($workspace)
{
//verifing if workspace exists.
if (!$workspace->workspaceExists()) {
echo "Workspace {$workspace->name} not found\n";
return false;
}
//create destination path
if (!file_exists(PATH_DATA . "upgrade/")) {
mkdir(PATH_DATA . "upgrade/");
}
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
mkdir($tempDirectory);
$metadata = $workspace->getMetadata();
CLI::logging("Creating temporary files on database...\n");
$metadata["databases"] = $workspace->exportDatabase($tempDirectory);
$metadata["directories"] = array("{$workspace->name}");
$metadata["version"] = 1;
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
if (!file_put_contents($metaFilename, str_replace(array(",", "{", "}"), array(",\n ", "{\n ", "\n}\n"), G::json_encode($metadata)))) {
CLI::logging("Could not create backup metadata");
}
CLI::logging("Adding database to backup...\n");
$this->addDirToBackup($tempDirectory);
CLI::logging("Adding files to backup...\n");
$this->addDirToBackup($workspace->path);
$this->tempDirectories[] = $tempDirectory;
}
/* Add a directory containing Db files or info files to be commpressed
* @directory the name and path of the directory to be add to the commpression process.
*/
private function addDirToBackup($directory)
{
if (!empty($directory)) {
$this->dir_to_compress .= $directory . " ";
}
}
// Commpress the DB and files into a single or several files with numerical series extentions
public function letsBackup()
{
// creating command
$CommpressCommand = "tar czv ";
$CommpressCommand .= $this->dir_to_compress;
$CommpressCommand .= "| split -b ";
$CommpressCommand .= $this->fileSize;
$CommpressCommand .= "m -d - ";
$CommpressCommand .= $this->filename . ".";
//executing command to create the files
echo exec($CommpressCommand);
//Remove leftovers dirs.
foreach ($this->tempDirectories as $tempDirectory) {
CLI::logging("Deleting: " . $tempDirectory . "\n");
G::rm_dir($tempDirectory);
}
}
/* Restore from file(s) commpressed by letsBackup function, into a temporary directory
* @ filename got the name and path of the compressed file(s), if there are many files with file extention as a numerical series, the extention should be discriminated.
* @ srcWorkspace contains the workspace to be restored.
* @ dstWorkspace contains the workspace to be overwriting.
* @ overwrite got the option true if the workspace will be overwrite.
*/
public static function letsRestore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
{
// Needed info:
// TEMPDIR /shared/workflow_data/upgrade/
// BACKUPS /shared/workflow_data/backups/
// Creating command cat myfiles_split.tgz_* | tar xz
$DecommpressCommand = "cat " . $filename . ".* ";
$DecommpressCommand .= " | tar xzv";
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
$tempDirectoryHelp = $tempDirectory;
$parentDirectory = PATH_DATA . "upgrade";
if (is_writable($parentDirectory)) {
mkdir($tempDirectory);
} else {
throw new Exception("Could not create directory:" . $parentDirectory);
}
//Extract all backup files, including database scripts and workspace files
CLI::logging("Restoring into " . $tempDirectory . "\n");
chdir($tempDirectory);
echo exec($DecommpressCommand);
CLI::logging("\nUncompressed into: " . $tempDirectory . "\n");
//Search for metafiles in the new standard (the old standard would contain meta files.
$decommpressedfile = scandir($tempDirectoryHelp . dirname($tempDirectoryHelp), 1);
$tempDirectory = $tempDirectoryHelp . dirname($tempDirectoryHelp) . "/" . $decommpressedfile[0];
$metaFiles = glob($tempDirectory . "/*.meta");
if (empty($metaFiles)) {
$metaFiles = glob($tempDirectory . "/*.txt");
if (!empty($metaFiles)) {
return WorkspaceTools::restoreLegacy($tempDirectory);
} else {
throw new Exception("No metadata found in backup");
}
} else {
CLI::logging("Found " . count($metaFiles) . " workspaces in backup:\n");
foreach ($metaFiles as $metafile) {
CLI::logging("-> " . basename($metafile) . "\n");
}
}
if (count($metaFiles) > 1 && (!isset($srcWorkspace))) {
throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
}
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(basename, $metaFiles))) {
throw new Exception("Workspace $srcWorkspace not found in backup");
}
foreach ($metaFiles as $metaFile) {
$metadata = G::json_decode(file_get_contents($metaFile));
if ($metadata->version != 1) {
throw new Exception("Backup version {$metadata->version} not supported");
}
$backupWorkspace = $metadata->WORKSPACE_NAME;
if (isset($dstWorkspace)) {
$workspaceName = $dstWorkspace;
$createWorkspace = true;
} else {
$workspaceName = $metadata->WORKSPACE_NAME;
$createWorkspace = false;
}
if (isset($srcWorkspace) && strcmp($metadata->WORKSPACE_NAME, $srcWorkspace) != 0) {
CLI::logging(CLI::warning("> Workspace $backupWorkspace found, but not restoring.") . "\n");
continue;
} else {
CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n");
}
$workspace = new WorkspaceTools($workspaceName);
if ($workspace->workspaceExists()) {
if ($overwrite) {
CLI::logging(CLI::warning("> Workspace $workspaceName already exist, overwriting!") . "\n");
} else {
throw new Exception("Destination workspace already exist (use -o to overwrite)");
}
}
if (file_exists($workspace->path)) {
G::rm_dir($workspace->path);
}
$tempDirectorySite = $tempDirectoryHelp . dirname($workspace->path);
foreach ($metadata->directories as $dir) {
CLI::logging("+> Restoring directory '$dir'\n");
if (!rename("$tempDirectorySite/$dir", $workspace->path)) {
throw new Exception("There was an error copying the backup files ($tempDirectory/$dir) to the workspace directory {$workspace->path}.");
}
}
CLI::logging("> Changing file permissions\n");
$shared_stat = stat(PATH_DATA);
if ($shared_stat !== false) {
WorkspaceTools::dirPerms($workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
} else {
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
}
list($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
CLI::logging("> Connecting to system database in '$dbHost'\n");
$link = mysql_connect($dbHost, $dbUser, $dbPass);
@mysql_query("SET NAMES 'utf8';");
@mysql_query("SET FOREIGN_KEY_CHECKS=0;");
if (!$link) {
throw new Exception('Could not connect to system database: ' . mysql_error());
}
if (strpos($metadata->DB_RBAC_NAME, 'rb_') === false) {
$onedb = true;
} else {
$onedb = false;
}
$newDBNames = $workspace->resetDBInfo($dbHost, $createWorkspace, $onedb);
$aParameters = array('dbHost' => $dbHost, 'dbUser' => $dbUser, 'dbPass' => $dbPass);
foreach ($metadata->databases as $db) {
$dbName = $newDBNames[$db->name];
CLI::logging("+> Restoring database {$db->name} to $dbName\n");
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql", $aParameters);
$workspace->createDBUser($dbName, $db->pass, "localhost", $dbName);
$workspace->createDBUser($dbName, $db->pass, "%", $dbName);
}
$workspace->upgradeCacheView(false);
mysql_close($link);
}
CLI::logging("Removing temporary files\n");
G::rm_dir($tempDirectory);
CLI::logging(CLI::info("Done restoring") . "\n");
}
}

View File

@@ -1,15 +1,6 @@
<?php
/**
* LastModification 30/05/2008
*/
/**
*
* @package workflow.engine.classes
*/
class NET
class Net
{
public $hostname;
public $ip;
@@ -58,9 +49,9 @@ class NET
$this->errstr = "";
$this->db_instance = "";
unset( $this->db_user );
unset( $this->db_passwd );
unset( $this->db_sourcename );
unset($this->db_user);
unset($this->db_passwd);
unset($this->db_sourcename);
#verifing valid param
if ($pHost == "") {
@@ -68,7 +59,7 @@ class NET
$this->errstr = "NET::You must specify a host";
//$this->showMsg();
}
$this->resolv( $pHost );
$this->resolv($pHost);
}
/**
@@ -77,31 +68,31 @@ class NET
* @param string $pHost
* @return void
*/
public function resolv ($pHost)
public function resolv($pHost)
{
$aHost = explode( "\\", $pHost );
if (count( $aHost ) > 1) {
$aHost = explode("\\", $pHost);
if (count($aHost) > 1) {
$ipHost = $aHost[0];
$this->db_instance = $aHost[1];
} else {
$ipHost = $pHost;
}
if ($this->is_ipaddress( $ipHost )) {
if ($this->is_ipaddress($ipHost)) {
$this->ip = $ipHost;
if (! $this->hostname = @gethostbyaddr( $ipHost )) {
if (! $this->hostname = @gethostbyaddr($ipHost)) {
$this->errno = 2000;
$this->errstr = "NET::Host down";
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
}
} else {
$ip = @gethostbyname( $ipHost );
$long = ip2long( $ip );
$ip = @gethostbyname($ipHost);
$long = ip2long($ip);
if ($long == - 1 || $long === false) {
$this->errno = 2000;
$this->errstr = "NET::Host down";
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
} else {
$this->ip = @gethostbyname( $ipHost );
$this->ip = @gethostbyname($ipHost);
$this->hostname = $pHost;
}
}
@@ -113,14 +104,14 @@ class NET
* @param string $pPort
* @return true
*/
public function scannPort ($pPort)
public function scannPort($pPort)
{
define( 'TIMEOUT', 5 );
$hostip = @gethostbyname( $host ); // resloves IP from Hostname returns hostname on failure
define('TIMEOUT', 5);
$hostip = @gethostbyname($host); // resloves IP from Hostname returns hostname on failure
// attempt to connect
if (@fsockopen( $this->ip, $pPort, $this->errno, $this->errstr, TIMEOUT )) {
if (@fsockopen($this->ip, $pPort, $this->errno, $this->errstr, TIMEOUT)) {
return true;
@fclose( $x ); //close connection (i dont know if this is needed or not).
@fclose($x); //close connection (i dont know if this is needed or not).
} else {
$this->errno = 9999;
$this->errstr = "NET::Port Host Unreachable";
@@ -135,16 +126,16 @@ class NET
* @param string $pHost
* @return true
*/
public function is_ipaddress ($pHost)
public function is_ipaddress($pHost)
{
$key = true;
#verifing if is a ip address
$tmp = explode( ".", $pHost );
$tmp = explode(".", $pHost);
#if have a ip address format
if (count( $tmp ) == 4) {
if (count($tmp) == 4) {
#if a correct ip address
for ($i = 0; $i < count( $tmp ); $i ++) {
if (! is_int( $tmp[$i] )) {
for ($i = 0; $i < count($tmp); $i ++) {
if (! is_int($tmp[$i])) {
$key = false;
break;
}
@@ -161,12 +152,12 @@ class NET
* @param string $pHost
* @return true
*/
public function ping ($pTTL = 3000)
public function ping($pTTL = 3000)
{
$cmd = "ping -w $pTTL $this->ip";
$output = exec( $cmd, $a, $a1 );
$output = exec($cmd, $a, $a1);
$this->errstr = "";
for ($i = 0; $i < count( $a ); $i ++) {
for ($i = 0; $i < count($a); $i ++) {
$this->errstr += $a[$i];
}
$this->errno = $a1;
@@ -179,7 +170,7 @@ class NET
* @param string $pPasswd
* @return void
*/
public function loginDbServer ($pUser, $pPasswd)
public function loginDbServer($pUser, $pPasswd)
{
$this->db_user = $pUser;
$this->db_passwd = $pPasswd;
@@ -192,7 +183,7 @@ class NET
* @param string $pPort
* @return void
*/
public function setDataBase ($pDb, $pPort = '')
public function setDataBase($pDb, $pPort = '')
{
$this->db_sourcename = $pDb;
$this->db_port = $pPort;
@@ -208,10 +199,9 @@ class NET
*/
public function tryConnectServer($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
{
$filter = new InputFilter();
$this->ip = $filter->validateInput($this->ip);
$this->db_port = $filter->validateInput($this->db_port,'int');
$this->db_port = $filter->validateInput($this->db_port, 'int');
$this->db_user = $filter->validateInput($this->db_user);
$this->db_passwd = $filter->validateInput($this->db_passwd);
$this->db_sourcename = $filter->validateInput($this->db_sourcename);
@@ -223,10 +213,10 @@ class NET
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
$flagTns=1;
}else{
} else {
$flagTns=0;
}
}else{
} else {
$flagTns=0;
}
@@ -234,12 +224,12 @@ class NET
switch ($pDbDriver) {
case 'mysql':
if ($this->db_passwd == '') {
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user );
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user);
} else {
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd );
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd);
}
if ($link) {
if (@mysql_ping( $link )) {
if (@mysql_ping($link)) {
$stat->status = 'SUCCESS';
$this->errstr = "";
$this->errno = 0;
@@ -256,7 +246,7 @@ class NET
break;
case 'pgsql':
$this->db_port = ($this->db_port == "") ? "5432" : $this->db_port;
$link = @pg_connect( "host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'" );
$link = @pg_connect("host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'");
if ($link) {
$stat->status = 'SUCCESS';
$this->errstr = "";
@@ -270,10 +260,10 @@ class NET
case 'mssql':
if ($this->db_instance != "") {
$str_port = "";
$link = @mssql_connect( $this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd );
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
} else {
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
$link = @mssql_connect( $this->ip . $str_port, $this->db_user, $this->db_passwd );
$link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
}
if ($link) {
@@ -306,7 +296,7 @@ class NET
$this->errno = 30001;
}
} catch (Exception $e) {
throw new Exception( "[erik] Couldn't connect to Oracle Server! - " . $e->getMessage() );
throw new Exception("[erik] Couldn't connect to Oracle Server! - " . $e->getMessage());
}
break;
case 'informix':
@@ -315,7 +305,7 @@ class NET
break;
}
} else {
throw new Exception( "CLASS::NET::ERROR: No connections param." );
throw new Exception("CLASS::NET::ERROR: No connections param.");
}
return $stat;
@@ -331,10 +321,9 @@ class NET
*/
public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
{
$filter = new InputFilter();
$this->ip = $filter->validateInput($this->ip);
$this->db_port = $filter->validateInput($this->db_port,'int');
$this->db_port = $filter->validateInput($this->db_port, 'int');
$this->db_user = $filter->validateInput($this->db_user);
$this->db_passwd = $filter->validateInput($this->db_passwd);
$this->db_sourcename = $filter->validateInput($this->db_sourcename);
@@ -342,32 +331,32 @@ class NET
return 0;
}
set_time_limit( 0 );
set_time_limit(0);
$stat = new Stat();
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
$flagTns=1;
}else{
} else {
$flagTns=0;
}
}else{
} else {
$flagTns=0;
}
if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) {
switch ($pDbDriver) {
case 'mysql':
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd );
$db = @mysql_select_db( $this->db_sourcename );
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd);
$db = @mysql_select_db($this->db_sourcename);
if ($link) {
if ($db) {
$result = @mysql_query( "show tables;" );
$result = @mysql_query("show tables;");
if ($result) {
$stat->status = 'SUCCESS';
$this->errstr = "";
$this->errno = 0;
@mysql_free_result( $result );
@mysql_free_result($result);
} else {
$this->error = "the user $this->db_user doesn't have privileges to run queries!";
$this->errstr = "NET::MYSQL->Test query failed";
@@ -386,9 +375,9 @@ class NET
break;
case 'pgsql':
$this->db_port = (($this->db_port == "") || ($this->db_port == 0)) ? "5432" : $this->db_port;
$link = @pg_connect( "host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'" );
$link = @pg_connect("host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'");
if ($link) {
if (@pg_ping( $link )) {
if (@pg_ping($link)) {
$stat->status = 'SUCCESS';
$this->errstr = "";
$this->errno = 0;
@@ -408,13 +397,13 @@ class NET
// $link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
if ($this->db_instance != "") {
$str_port = "";
$link = @mssql_connect( $this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd );
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
} else {
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
$link = @mssql_connect( $this->ip . $str_port, $this->db_user, $this->db_passwd );
$link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
}
if ($link) {
$db = @mssql_select_db( $this->db_sourcename, $link );
$db = @mssql_select_db($this->db_sourcename, $link);
if ($db) {
$stat->status = 'SUCCESS';
$this->errstr = "";
@@ -441,7 +430,7 @@ class NET
if ($cnn) {
$stid = @oci_parse($cnn, 'select AUTHENTICATION_TYPE from v$session_connect_info');
$result = @oci_execute( $stid, OCI_DEFAULT );
$result = @oci_execute($stid, OCI_DEFAULT);
if ($result) {
$stat->status = 'SUCCESS';
$this->errstr = "";
@@ -464,7 +453,7 @@ class NET
break;
}
} else {
throw new Exception( "CLASS::NET::ERROR: No connections param." );
throw new Exception("CLASS::NET::ERROR: No connections param.");
}
return $stat;
}
@@ -475,30 +464,29 @@ class NET
* @param string $driver
* @return void
*/
public function getDbServerVersion ($driver)
public function getDbServerVersion($driver)
{
if (! isset( $this->ip )) {
$this->ip = getenv( 'HTTP_CLIENT_IP' );
if (! isset($this->ip)) {
$this->ip = getenv('HTTP_CLIENT_IP');
}
if (isset( $this->ip ) && isset( $this->db_user ) && isset( $this->db_passwd )) {
if (isset($this->ip) && isset($this->db_user) && isset($this->db_passwd)) {
try {
if (! isset( $this->db_sourcename )) {
if (! isset($this->db_sourcename)) {
$this->db_sourcename = DB_NAME;
}
$value = 'none';
$sDataBase = 'database_' . strtolower( DB_ADAPTER );
if (G::LoadSystemExist( $sDataBase )) {
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
if (G::LoadSystemExist($sDataBase)) {
$oDataBase = new database();
$value = $oDataBase->getServerVersion( $driver, $this->ip, $this->db_port, $this->db_user, $this->db_passwd, $this->db_sourcename );
$value = $oDataBase->getServerVersion($driver, $this->ip, $this->db_port, $this->db_user, $this->db_passwd, $this->db_sourcename);
}
return $value;
} catch (Exception $e) {
throw new Exception( $e->getMessage() );
throw new Exception($e->getMessage());
}
} else {
throw new Exception( 'NET::Error->No params for Data Base Server!' );
throw new Exception('NET::Error->No params for Data Base Server!');
}
}
@@ -508,7 +496,7 @@ class NET
* @param string $pAdapter
* @return void
*/
public function dbName ($pAdapter)
public function dbName($pAdapter)
{
switch ($pAdapter) {
case 'mysql':
@@ -538,7 +526,7 @@ class NET
* @param string $pAdapter
* @return void
*/
public function showMsg ()
public function showMsg()
{
if ($this->errno != 0) {
$msg = "
@@ -552,7 +540,7 @@ class NET
</div>
</fieldset>
<center>";
print ($msg) ;
print($msg) ;
}
}
@@ -562,7 +550,7 @@ class NET
*
* @return string
*/
public function getErrno ()
public function getErrno()
{
return $this->errno;
}
@@ -573,22 +561,8 @@ class NET
*
* @return string
*/
public function getErrmsg ()
public function getErrmsg()
{
return $this->errstr;
}
}
/**
*
* @package workflow.engine.classes
*/
class Stat
{
public $stutus;
public function __construct ()
{
$this->status = false;
}
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* ObjectDocument Collection
*
* @package workflow.engine.ProcessMaker
*/
class ObjectCollection
{
public $num;
public $swapc;
public $objects;
/**
* Constructor
*/
public function __construct()
{
$this->objects = array();
$this->num = 0;
$this->swapc = $this->num;
array_push($this->objects, 'void');
}
/**
* add in the collecetion a new object Document
*
* @param $name name object document
* @param $type type object document
* @param $data data object document
* @param $origin origin object document
* @return void
*/
public function add($name, $type, $data, $origin)
{
$o = new ObjectDocument();
$o->name = $name;
$o->type = $type;
$o->data = $data;
$o->origin = $origin;
$this->num++;
array_push($this->objects, $o);
$this->swapc = $this->num;
}
/**
* get the collection of ObjectDocument
*
* @param $name name object document
* @param $type type object document
* @param $data data object document
* @param $origin origin object document
* @return void
*/
public function get()
{
if ($this->swapc > 0) {
$e = $this->objects[$this->swapc];
$this->swapc--;
return $e;
} else {
$this->swapc = $this->num;
return false;
}
}
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* Object Document class
*
* @package workflow.engine.ProcessMaker
*/class ObjectDocument
{
public $type;
public $name;
public $data;
public $origin;
/**
* Constructor
*/
public function __construct()
{
$this->type = '';
$this->name = '';
$this->data = '';
$this->origin = '';
}
}

View File

@@ -1,20 +1,8 @@
<?php
/**
* class, helping to set some not desirable settings but necesary
* @author reav
*
*/
use ProcessMaker\Core\System;
abstract class patch
{
static protected $isPathchable = false;
static public $dbAdapter = 'mysql';
abstract static public function isApplicable();
abstract static public function execute();
}
class p11835 extends patch
class P11835 extends Patch
{
/*
* Note.- Use before upgrade DB.
@@ -30,7 +18,7 @@ class p11835 extends patch
$rs->next();
while($row = $rs->getRow()) {
if ($row ['Field'] == "TAS_GROUP_VARIABLE") {
$version = PmSystem::getVersion ();
$version = System::getVersion ();
$version = explode('-',$version);
if ($version[0] == '2.5.1') {
echo "Version " . $version[0] . " Patch\n";
@@ -98,7 +86,7 @@ class p11835 extends patch
$arrayHotfix = $conf->getConfiguration("HOTFIX", "");
$arrayHotfix = (is_array($arrayHotfix))? $arrayHotfix : array($arrayHotfix);
$pmVersion = self::pmVersion(PmSystem::getVersion()) . "";
$pmVersion = self::pmVersion(System::getVersion()) . "";
if (($pmVersion == "2.5.2.4" || $pmVersion == "2.8") && !in_array("15394", $arrayHotfix)) {
$cnn = Propel::getConnection("workflow");
@@ -116,4 +104,3 @@ class p11835 extends patch
echo $count . " records where patched to use SELF_SERVICE feature.\n";
}
}

View File

@@ -1,28 +1,5 @@
<?php
class featuresDetail
{
public $featureName;
public $description = null;
public $enabled = false;
public $workspaces = null;
/**
* This function is the constructor of the featuresDetail class
*
* @param string $featureName
* @param string $name
* @param string $description
* @return void
*/
public function __construct ($featureName, $description = '')
{
$this->featureName = $featureName;
$this->description = $description;
}
}
class PMLicensedFeatures
{
private $featuresDetails = array ();
@@ -336,7 +313,7 @@ class PMLicensedFeatures
$addons = AddonsManagerPeer::doSelect($criteria);
foreach ($addons as $addon) {
$this->features[] = $addon->getAddonId();
$detail = new featuresDetail($addon->getAddonNick(), $addon->getAddonDescription());
$detail = new FeaturesDetail($addon->getAddonNick(), $addon->getAddonDescription());
$this->featuresDetails[$addon->getAddonId()] = $detail;
}
}
@@ -357,14 +334,10 @@ class PMLicensedFeatures
/*----------------------------------********---------------------------------*/
public function verifyfeature ($featureName)
{
if (!class_exists("pmLicenseManager")) {
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
}
$licenseManager = pmLicenseManager::getSingleton(false);
$licenseManager = PmLicenseManager::getSingleton(false);
$_SESSION['__sw__'] = true;
$padl = new padl();
$padl = new Padl();
$value = $padl->_decrypt($featureName);
if (is_array($value)) {

View File

@@ -1,90 +1,8 @@
<?php
/**
* class.pluginRegistry.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
/**
*
* @package workflow.engine.classes
*/
require_once 'class.plugin.php';
class pluginDetail
{
public $sNamespace;
public $sClassName;
public $sFriendlyName = null;
public $sDescription = null;
public $sSetupPage = null;
public $sFilename;
public $sPluginFolder = '';
public $sCompanyLogo = '';
public $iVersion = 0;
public $enabled = false;
public $aWorkspaces = null;
public $bPrivate = false;
/**
* This function is the constructor of the pluginDetail class
*
* @param string $sNamespace
* @param string $sClassName
* @param string $sFilename
* @param string $sFriendlyName
* @param string $sPluginFolder
* @param string $sDescription
* @param string $sSetupPage
* @param integer $iVersion
* @return void
*/
public function __construct ($sNamespace, $sClassName, $sFilename, $sFriendlyName = '', $sPluginFolder = '', $sDescription = '', $sSetupPage = '', $iVersion = 0)
{
$this->sNamespace = $sNamespace;
$this->sClassName = $sClassName;
$this->sFriendlyName = $sFriendlyName;
$this->sDescription = $sDescription;
$this->sSetupPage = $sSetupPage;
$this->iVersion = $iVersion;
$this->sFilename = $sFilename;
if ($sPluginFolder == '') {
$this->sPluginFolder = $sNamespace;
} else {
$this->sPluginFolder = $sPluginFolder;
}
}
}
/**
*
* @package workflow.engine.classes
*/
class PMPluginRegistry
{
private $_aPluginDetails = array ();
@@ -212,7 +130,7 @@ class PMPluginRegistry
return;
}
$detail = new pluginDetail( $sNamespace, $sClassName, $sFilename, $plugin->sFriendlyName, $plugin->sPluginFolder, $plugin->sDescription, $plugin->sSetupPage, $plugin->iVersion );
$detail = new PluginDetail( $sNamespace, $sClassName, $sFilename, $plugin->sFriendlyName, $plugin->sPluginFolder, $plugin->sDescription, $plugin->sSetupPage, $plugin->iVersion );
if (isset( $plugin->aWorkspaces )) {
$detail->aWorkspaces = $plugin->aWorkspaces;
@@ -585,7 +503,7 @@ class PMPluginRegistry
public function uninstallPluginWorkspaces ($arrayPlugin)
{
$workspace = PmSystem::listWorkspaces();
$workspace = System::listWorkspaces();
foreach ($workspace as $indexWS => $ws) {
$wsPathDataSite = PATH_DATA . "sites" . PATH_SEP . $ws->name . PATH_SEP;
@@ -1183,11 +1101,8 @@ class PMPluginRegistry
public function setupPlugins ()
{
try {
require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php");
require_once("class.serverConfiguration.php");
$iPlugins = 0;
$oServerConf = & serverConf::getSingleton();
$oServerConf = & ServerConf::getSingleton();
$oServerConf->addPlugin( SYS_SYS, $this->_aPluginDetails );
foreach ($this->_aPluginDetails as $namespace => $detail) {
if (isset( $detail->enabled ) && $detail->enabled) {
@@ -1294,7 +1209,7 @@ class PMPluginRegistry
//Found a License
if (class_exists( 'pmLicenseManager' )) {
$sSerializedFile = PATH_DATA_SITE . 'lmn.singleton';
$pmLicenseManagerO = & pmLicenseManager::getSingleton();
$pmLicenseManagerO = & PmLicenseManager::getSingleton();
if (file_exists( $sSerializedFile )) {
$pmLicenseManagerO->unSerializeInstance( file_get_contents( $sSerializedFile ) );
}
@@ -1629,7 +1544,7 @@ class PMPluginRegistry
if (isset($pluginDetails->aWorkspaces) && is_array($pluginDetails->aWorkspaces) && count($pluginDetails->aWorkspaces) > 0) {
$arrayWorkspace = array();
foreach (PmSystem::listWorkspaces() as $value) {
foreach (System::listWorkspaces() as $value) {
$workspaceTools = $value;
$arrayWorkspace[] = $workspaceTools->name;

View File

@@ -1,35 +1,4 @@
<?php
/**
* class.memcached.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* The ProcessMaker memcached class
*
* @package workflow.engine.ProcessMaker
*/
class PMmemcached
{
@@ -65,7 +34,6 @@ class PMmemcached
$this->version = $this->mem->getVersion();
}
} else {
require_once ("classes" . PATH_SEP . "class.fileCache.php");
//Create cache folder
$cacheFolder = PATH_DATA . "sites". PATH_SEP . $workspace . PATH_SEP . "cachefiles" . PATH_SEP;
@@ -218,4 +186,3 @@ class PMmemcached
echo "</table>";
}
}

View File

@@ -26,7 +26,37 @@
* @history---------------------------------------------
* see CHANGELOG
*/
class padl
use ProcessMaker\Core\System;
/**
* Project: Distrubution License Class
* File: class.license.lib.php
*
* Copyright (C) 2005 Oliver Lillie
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @link http://www.buggedcom.co.uk/
* @link http://www.phpclasses.org/browse/package/2298.html
* @author Oliver Lillie, buggedcom <publicmail at buggedcom dot co dot uk>
* @version 0.1
* @history---------------------------------------------
* see CHANGELOG
*/
class Padl
{
/**
* hash key 1 used to encrypt the generate key data.
@@ -236,7 +266,7 @@ class padl
}
// Proxy settings
$sysConf = PmSystem::getSystemConfiguration();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
if (!is_array($params['http'])) {
$params['http'] = array();
@@ -673,32 +703,3 @@ class padl
}
}
}
/**
* custom functions to aid in debugging
*
* @var mixed
*/
function trace()
{
$message = '';
for ($i = 0; $i < func_num_args(); $i++) {
if (is_array(func_get_arg($i))) {
trace_r(func_get_arg($i));
} else {
$message .= func_get_arg($i);
}
if ($i <= func_num_args() - 2) {
$message.=' : ';
}
}
echo "<br><b>\r\r" . $message . "\r\r</b>";
}
function trace_r($array = "array is empty")
{
echo "<pre><b>\r\r";
print_r($array);
echo "\r\r</b></pre>";
}

View File

@@ -0,0 +1,14 @@
<?php
/**
* class, helping to set some not desirable settings but necesary
* @author reav
*
*/
abstract class Patch
{
static protected $isPathchable = false;
static public $dbAdapter = 'mysql';
abstract static public function isApplicable();
abstract static public function execute();
}

View File

@@ -0,0 +1,57 @@
<?php
/**
*
* @package workflow.engine.classes
*/
//@todo: Pending until class.plugin.php is solved.
require_once 'class.plugin.php';
/**
*
* @package workflow.engine.classes
*/class PluginDetail
{
public $sNamespace;
public $sClassName;
public $sFriendlyName = null;
public $sDescription = null;
public $sSetupPage = null;
public $sFilename;
public $sPluginFolder = '';
public $sCompanyLogo = '';
public $iVersion = 0;
public $enabled = false;
public $aWorkspaces = null;
public $bPrivate = false;
/**
* This function is the constructor of the pluginDetail class
*
* @param string $sNamespace
* @param string $sClassName
* @param string $sFilename
* @param string $sFriendlyName
* @param string $sPluginFolder
* @param string $sDescription
* @param string $sSetupPage
* @param integer $iVersion
* @return void
*/
public function __construct($sNamespace, $sClassName, $sFilename, $sFriendlyName = '', $sPluginFolder = '', $sDescription = '', $sSetupPage = '', $iVersion = 0)
{
$this->sNamespace = $sNamespace;
$this->sClassName = $sClassName;
$this->sFriendlyName = $sFriendlyName;
$this->sDescription = $sDescription;
$this->sSetupPage = $sSetupPage;
$this->iVersion = $iVersion;
$this->sFilename = $sFilename;
if ($sPluginFolder == '') {
$this->sPluginFolder = $sNamespace;
} else {
$this->sPluginFolder = $sPluginFolder;
}
}
}

View File

@@ -2,11 +2,8 @@
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/interfaces/dashletInterface.php';
require_once 'classes/model/Dashlet.php';
require_once 'classes/model/DashletInstance.php';
class PMDashlet extends DashletInstance implements DashletInterface
class PmDashlet extends DashletInstance implements DashletInterface
{
// Own properties

View File

@@ -6,8 +6,7 @@
* @package workflow.engine.class
*
*/
class PMDrive extends PMGoogleApi
class PmDrive extends PmGoogleApi
{
private $folderIdPMDrive = '';
private $folderNamePMDrive;

View File

@@ -1,13 +1,12 @@
<?php
use ProcessMaker\Core\System;
/**
* class.pmDynaform.php
* Implementing pmDynaform library in the running case.
*
* @author Roly Rudy Gutierrez Pinto
* @package engine.classes
*/
class pmDynaform
*/class PmDynaform
{
public static $instance = null;
@@ -36,7 +35,7 @@ class pmDynaform
$this->context = \Bootstrap::getDefaultContextLog();
$this->dataSources = array("database", "dataVariable");
$this->pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css';
$this->serverConf = &serverConf::getSingleton();
$this->serverConf = &ServerConf::getSingleton();
$this->isRTL = ($this->serverConf->isRtl(SYS_LANG)) ? 'true' : 'false';
$this->fields = $fields;
$this->propertiesToExclude = array('dataVariable');
@@ -1059,7 +1058,7 @@ class pmDynaform
$javascript = "
<script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . ";
var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";
var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";
var pm_run_outside_main_app = \"\";
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "\";
@@ -1120,7 +1119,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
@@ -1199,7 +1198,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . $this->json_encode($json) . ";\n" .
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = '" . $this->fields["PM_RUN_OUTSIDE_MAIN_APP"] . "';\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
@@ -1256,7 +1255,7 @@ class pmDynaform
$javascrip = "
<script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . ";
var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";
var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";
var pm_run_outside_main_app = null;
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->fields["PRO_UID"] . "_" . $this->fields["CURRENT_DYNAFORM"] . "\";
@@ -1300,7 +1299,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = null;\n" .
@@ -1342,7 +1341,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = null;\n" .
@@ -1384,7 +1383,7 @@ class pmDynaform
"var pathRTLCss = '" . $this->pathRTLCss . "';\n" .
"var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "0") . ";\n" .
"var jsonData = " . $this->json_encode($json) . ";\n" .
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var leaveCaseWarning = " . $this->getLeaveCaseWarning() . ";\n" .
$js .
"</script>";
@@ -1406,7 +1405,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . PmSystem::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $currentDynaform . "';\n" .
"var __DynaformName__ = null;\n" .

View File

@@ -1,6 +1,7 @@
<?php
class pmGauge
class PmGauge
{
/**
@@ -280,4 +281,3 @@ class pmGauge
imagettftext($im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay);
}
}

View File

@@ -7,7 +7,11 @@
require_once PATH_TRUNK . 'vendor' . PATH_SEP . 'google' . PATH_SEP . 'apiclient' . PATH_SEP . 'src' . PATH_SEP . 'Google' . PATH_SEP . 'autoload.php';
class PMGoogleApi
/**
* class.pmGoogleApi.php
*
*/class PmGoogleApi
{
const DRIVE = 'https://www.googleapis.com/auth/drive';
const DRIVE_FILE = 'https://www.googleapis.com/auth/drive.file';

View File

@@ -1,757 +0,0 @@
<?php
/**
* class.Installer.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
//
// It works with the table CONFIGURATION in a WF dataBase
//
// Copyright (C) 2007 COLOSA
//
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
/**
* Processmaker Installer
*
* @package workflow.engine.ProcessMaker
* @author maborak
* @copyright 2008 COLOSA
*/
class PmInstaller
{
public $options = Array();
public $result = Array();
public $error = Array();
public $report = Array();
private $connection_database;
/**
* construct of insert
*
* @param string $pPRO_UID
* @return void
*/
public function __construct()
{
}
/**
* create_site
*
* @param array $config
* @param boolean $confirmed
* @return void
*/
public function create_site($config = Array(), $confirmed = false)
{
$this->options = G::array_concat(Array('isset' => false, 'password' => G::generate_password(15), 'path_data' => @PATH_DATA, 'path_compiled' => @PATH_C, 'name' => $config['name'], 'database' => Array(), 'admin' => Array('username' => 'admin', 'password' => 'admin'
), 'advanced' => Array('ao_db_wf' => 'wf_' . $config['name'], 'ao_db_rb' => 'rb_' . $config['name'], 'ao_db_rp' => 'rp_' . $config['name'], 'ao_db_drop' => false
)
), $config);
$a = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
$this->options['database'] = G::array_concat(Array('username' => @$a[1], 'password' => @$a[2], 'hostname' => @$a[0]
), $this->options['database']);
return ($confirmed === true) ? $this->make_site() : $this->create_site_test();
}
/**
* isset_site
*
* @param string $name Default value "workflow"
* @return string file_exists(PATH_DATA."sites/".$name);
*/
public static function isset_site($name = "workflow")
{
$pathSites = PATH_DATA . 'sites/'. '*';
$directories = glob($pathSites, GLOB_ONLYDIR);
foreach ($directories as $directory){
$site = basename($directory);
if(strtolower($site) === strtolower($name)){
return true;
}
}
return false;
}
/**
* create_site_test
*
* @return void
*/
private function create_site_test()
{
$name = (preg_match('/^[\w]+$/i', trim($this->options['name']))) ? true : false;
$result = Array('path_data' => $this->is_dir_writable($this->options['path_data']), 'path_compiled' => $this->is_dir_writable($this->options['path_compiled']), 'database' => $this->check_connection(), 'access_level' => $this->cc_status, 'isset' => ($this->options['isset'] == true) ? $this->isset_site($this->options['name']) : false, 'microtime' => microtime(), 'workspace' => $this->options['name'], 'name' => array('status' => $name, 'message' => ($name) ? 'PASSED' : 'Workspace name invalid'
), 'admin' => array('username' => (preg_match('/^[\w@\.-]+$/i', trim($this->options['admin']['username']))) ? true : false, 'password' => ((trim($this->options['admin']['password']) == '') ? false : true)
)
);
$result['name']['message'] = ($result['isset']) ? 'Workspace already exist' : $result['name']['message'];
$result['name']['status'] = ($result['isset']) ? false : $result['name']['status'];
//print_r($result);
return Array('created' => G::var_compare(true,
$result['path_data'],
$result['database']['connection'],
$result['name']['status'],
$result['database']['version'],
$result['database']['ao']['ao_db_wf']['status'],
$result['admin']['username'],
(($result['isset']) ? false : true),
$result['admin']['password']),
'result' => $result
);
}
/**
* make_site
*
* @return array $test
*/
private function make_site()
{
$test = $this->create_site_test();
if ($test["created"] == true || $this->options["advanced"]["ao_db_drop"] == true) {
/* Check if the hostname is local (localhost or 127.0.0.1) */
$islocal = (strcmp(substr($this->options['database']['hostname'], 0, strlen('localhost')), 'localhost') === 0) || (strcmp(substr($this->options['database']['hostname'], 0, strlen('127.0.0.1')), '127.0.0.1') === 0);
$this->wf_site_name = $wf = $this->options['advanced']['ao_db_wf'];
$this->wf_user_db = isset($this->options['advanced']['ao_user_wf'])?$this->options['advanced']['ao_user_wf']:uniqid('wf_');
$this->rbac_site_name = $rb = $this->options['advanced']['ao_db_rb'];
$this->report_site_name = $rp = $this->options['advanced']['ao_db_rp'];
$schema = "schema.sql";
$values = "insert.sql";
if ($this->options['advanced']['ao_db_drop'] === true) {
//Delete workspace directory if exists
//Drop databases
$this->run_query("DROP DATABASE IF EXISTS " . $wf, "Drop database $wf");
}
$this->run_query("CREATE DATABASE IF NOT EXISTS " . $wf . " DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci", "Create database $wf");
if ($this->cc_status == 1) {
$host = ($islocal) ? "localhost" : "%";
$this->run_query("GRANT ALL PRIVILEGES ON `$wf`.* TO {$this->wf_user_db}@'$host' IDENTIFIED BY '{$this->options['password']}' WITH GRANT OPTION", "Grant privileges for user {$this->wf_user_db} on database $wf");
}
/* Dump schema workflow && data */
$this->log("Import database schema:\n");
$myPortA = explode(":", $this->options['database']['hostname']);
if (count($myPortA) < 2) {
$myPortA[1] = "3306";
}
$myPort = $myPortA[1];
$this->options['database']['hostname'] = $myPortA[0];
mysql_select_db($wf, $this->connection_database);
$pws = PATH_WORKFLOW_MYSQL_DATA . $schema;
$qws = $this->query_sql_file(PATH_WORKFLOW_MYSQL_DATA . $schema, $this->connection_database);
$this->log($qws, isset($qws['errors']));
$qwv = $this->query_sql_file(PATH_WORKFLOW_MYSQL_DATA . $values, $this->connection_database);
$this->log($qwv, isset($qwv['errors']));
$http = (G::is_https() == true) ? 'https' : 'http';
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
$workspace = $this->options['name'];
$endpoint = sprintf(
'%s://%s/sys%s/%s/%s/oauth2/grant',
$http,
$host,
$workspace,
$lang,
SYS_SKIN
);
// inserting the outh_client
$query = ( "INSERT INTO OAUTH_CLIENTS (CLIENT_ID,CLIENT_SECRET,CLIENT_NAME,CLIENT_DESCRIPTION,CLIENT_WEBSITE,REDIRECT_URI,USR_UID ) VALUES
('x-pm-local-client','179ad45c6ce2cb97cf1029e212046e81','PM Web Designer','ProcessMaker Web Designer App','www.processmaker.com','" . $endpoint . "','00000000000000000000000000000001' )");
$this->run_query( $query );
/* Dump schema rbac && data */
$pws = PATH_RBAC_MYSQL_DATA . $schema;
mysql_select_db($rb, $this->connection_database);
$qrs = $this->query_sql_file(PATH_RBAC_MYSQL_DATA . $schema, $this->connection_database);
$this->log($qrs, isset($qrs['errors']));
$qrv = $this->query_sql_file(PATH_RBAC_MYSQL_DATA . $values, $this->connection_database);
$this->log($qrv, isset($qrv['errors']));
mysql_select_db($wf, $this->connection_database);
require_once ("propel/Propel.php");
require_once ('classes/model/AppCacheView.php');
$appCache = new AppCacheView();
$appCache->setPathToAppCacheFiles(PATH_METHODS . 'setup/setupSchemas/');
$triggers = $appCache->getTriggers("en");
$this->log("Create 'cases list cache' triggers");
foreach ($triggers as $triggerName => $trigger) {
$this->run_query($trigger, "-> Trigger $triggerName");
}
$path_site = $this->options['path_data'] . "/sites/" . $this->options['name'] . "/";
@mkdir($path_site, 0777, true);
@mkdir($path_site . "files/", 0777, true);
@mkdir($path_site . "mailTemplates/", 0777, true);
@mkdir($path_site . "public/", 0777, true);
@mkdir($path_site . "reports/", 0777, true);
@mkdir($path_site . "xmlForms", 0777, true);
//Generate the db.php file
$db_file = $path_site . 'db.php';
$db_text = "<?php\n" . "// Processmaker configuration\n" . "define ('DB_ADAPTER', 'mysql' );\n" . "define ('DB_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_NAME', '" . $wf . "' );\n" . "define ('DB_USER', '" . (($this->cc_status == 1) ? $this->wf_user_db : $this->options['database']['username']) . "' );\n" . "define ('DB_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_RBAC_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_RBAC_NAME', '" . $rb . "' );\n" . "define ('DB_RBAC_USER', '" . (($this->cc_status == 1) ? $this->wf_user_db : $this->options['database']['username']) . "' );\n" . "define ('DB_RBAC_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_REPORT_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_REPORT_NAME', '" . $rp . "' );\n" . "define ('DB_REPORT_USER', '" . (($this->cc_status == 1) ? $this->wf_user_db : $this->options['database']['username']) . "' );\n" . "define ('DB_REPORT_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n";
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
$db_text .= "define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG') && PARTNER_FLAG != '') ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG'] : 'false')) . ");\n";
if (defined('SYSTEM_NAME')) {
$db_text .= " define ('SYSTEM_NAME', '" . SYSTEM_NAME . "');\n";
}
}
$db_text .="?>";
$fp = @fopen($db_file, "w");
$this->log("Create: " . $db_file . " => " . ((!$fp) ? $fp : "OK") . "\n", $fp === false);
$ff = @fputs($fp, $db_text, strlen($db_text));
$this->log("Write: " . $db_file . " => " . ((!$ff) ? $ff : "OK") . "\n", $ff === false);
fclose($fp);
/*----------------------------------********---------------------------------*/
//Generate the env.ini file
$envIniFile = $path_site . 'env.ini';
$content = 'system_utc_time_zone = 1' . "\n";
$fp = @fopen($envIniFile, 'w');
$this->log('Create: ' . $envIniFile . ' => ' . ((!$fp)? $fp : 'OK') . "\n", $fp === false);
$ff = @fputs($fp, $content, strlen($content));
$this->log('Write: ' . $envIniFile . ' => ' . ((!$ff)? $ff : 'OK') . "\n", $ff === false);
fclose($fp);
/*----------------------------------********---------------------------------*/
//Set data
$this->setPartner();
$this->setAdmin();
$querySql = "INSERT INTO EMAIL_SERVER(MESS_UID, MESS_ENGINE) VALUES('" . \ProcessMaker\Util\Common::generateUID() . "', 'MAIL')";
$this->run_query($querySql);
}
return $test;
}
/**
* set_partner
*
* @return void
*/
public function setPartner()
{
$partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false;
if ($partnerFlag) {
// Execute sql for partner
$pathMysqlPartner = PATH_CORE . 'data' . PATH_SEP . 'partner' . PATH_SEP . 'mysql' . PATH_SEP;
if (G::verifyPath($pathMysqlPartner)) {
$res = array();
$filesSlq = glob($pathMysqlPartner . '*.sql');
foreach ($filesSlq as $value) {
$this->query_sql_file($value, $this->connection_database);
}
}
// Execute to change of skin
$pathSkinPartner = PATH_CORE . 'data' . PATH_SEP . 'partner' . PATH_SEP . 'skin' . PATH_SEP;
if (G::verifyPath($pathSkinPartner)) {
$res = array();
$fileTar = glob($pathSkinPartner . '*.tar');
foreach ($fileTar as $value) {
$dataFile = pathinfo($value);
$nameSkinTmp = $dataFile['filename'];
$tar = new Archive_Tar( $value );
$pathSkinTmp = $pathSkinPartner . 'tmp' . PATH_SEP;
G::rm_dir($pathSkinTmp);
G::verifyPath($pathSkinTmp, true);
chmod( $pathSkinTmp, 0777);
$tar->extract($pathSkinTmp);
$pathSkinName = $pathSkinTmp . $nameSkinTmp . PATH_SEP;
chmod( $pathSkinName, 0777);
G::verifyPath(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp', true);
$skinClassic = PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp' . PATH_SEP;
if (is_dir($pathSkinName)) {
$this->copyFile($pathSkinName, $skinClassic);
}
G::rm_dir(PATH_CORE . 'skinEngine' . PATH_SEP . 'base');
rename(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp', PATH_CORE . 'skinEngine' . PATH_SEP . 'base');
G::rm_dir(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp');
break;
}
}
//ACTIVE ENTERPRISE
ini_set('max_execution_time', '0');
ini_set('memory_limit', '256M');
$serv = 'http://';
if (isset($_SERVER['HTTPS']) && trim($_SERVER['HTTPS']) != '') {
$serv = 'https://';
}
$serv .= $_SERVER['SERVER_NAME'];
if (isset($_SERVER['SERVER_PORT']) && trim($_SERVER['SERVER_PORT']) != '') {
$serv .= ':' . $_SERVER['SERVER_PORT'];
}
// create session
$cookiefile = sys_get_temp_dir() . PATH_SEP . 'curl-session';
$fp = fopen($cookiefile, "w");
fclose($fp);
chmod($cookiefile, 0777);
$user = urlencode($this->options['admin']['username']);
$pass = urlencode($this->options['admin']['password']);
$workspace = $this->options['name'];
$lang = SYS_LANG;
$skinName = SYS_SKIN;
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "$serv/sys{$workspace}/{$lang}/{$skinName}/login/authentication");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "form[USR_USERNAME]=$user&form[USR_PASSWORD]=$pass&form[USER_LANG]=$lang");
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
$output = curl_exec($ch);
curl_close($ch);
$ch = curl_init();
$postData = array();
// resolv the plugin name
$plugins = glob(PATH_CORE."plugins/*.tar");
if (count($plugins) > 0) {
$pluginName = $plugins[0];
// File to upload/post
$postData['form[PLUGIN_FILENAME]'] = "@{$pluginName}";
curl_setopt($ch, CURLOPT_URL, "$serv/sys{$workspace}/{$lang}/{$skinName}/setup/pluginsImportFile");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
$output = curl_exec($ch);
curl_close($ch);
}
}
}
function copyFile($fromDir, $toDir, $chmod=0777)
{
$errors = array();
$messages = array();
if (!is_writable($toDir)) {
$errors[]='target '.$toDir.' is not writable';
}
if (!is_dir($toDir)) {
$errors[]='target '.$toDir.' is not a directory';
}
if (!is_dir($fromDir)) {
$errors[]='source '.$fromDir.' is not a directory';
}
if (!empty($errors)) {
return false;
}
$exceptions = array ('.','..');
$handle = opendir($fromDir);
while (false !== ($item=readdir($handle))) {
if (!in_array($item,$exceptions)) {
$from = str_replace('//','/',$fromDir.'/'.$item);
$to = str_replace('//','/',$toDir.'/'.$item);
if (is_file($from)) {
if (@copy($from,$to)) {
chmod($to,$chmod);
touch($to,filemtime($from));
}
}
if (is_dir($from)) {
if (@mkdir($to)) {
chmod($to,$chmod);
}
$this->copyFile($from,$to,$chmod);
}
}
}
closedir($handle);
}
/**
* set_configuration
*
* @return void
*/
public function setConfiguration()
{
$oConf = new Configuration();
$dataCondif = $oConf->getAll();
if (count($dataCondif)) {
foreach ($dataCondif as $value) {
if ($value['CFG_UID'] == 'ENVIRONMENT_SETTINGS') {
$query = 'INSERT INTO CONFIGURATION (CFG_UID, OBJ_UID, CFG_VALUE, PRO_UID, USR_UID, APP_UID) VALUES';
$query .= "('" .
$value['CFG_UID'] . "', '".
$value['OBJ_UID'] . "', '".
$value['CFG_VALUE'] . "', '".
$value['PRO_UID'] . "', '".
$value['USR_UID'] . "', '".
$value['APP_UID'] . "')";
mysql_select_db($this->wf_site_name, $this->connection_database);
$this->run_query($query, "Copy configuracion environment");
break;
}
}
}
}
/**
* set_admin
*
* @return void
*/
public function setAdmin()
{
mysql_select_db($this->wf_site_name, $this->connection_database);
// The mysql_escape_string function has been DEPRECATED as of PHP 5.3.0.
// $this->run_query('UPDATE USERS SET USR_USERNAME = \''.mysql_escape_string($this->options['admin']['username']).'\', `USR_PASSWORD` = \''.md5($this->options['admin']['password']).'\' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1',
// "Add 'admin' user in ProcessMaker (wf)");
$this->run_query('UPDATE USERS SET USR_USERNAME = \'' . mysql_real_escape_string($this->options['admin']['username']) . '\', ' . ' `USR_PASSWORD` = \'' . G::encryptHash($this->options['admin']['password']) . '\' ' . ' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1', "Add 'admin' user in ProcessMaker (wf)");
mysql_select_db($this->rbac_site_name, $this->connection_database);
// The mysql_escape_string function has been DEPRECATED as of PHP 5.3.0.
// $this->run_query('UPDATE USERS SET USR_USERNAME = \''.mysql_escape_string($this->options['admin']['username']).'\', `USR_PASSWORD` = \''.md5($this->options['admin']['password']).'\' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1',
// "Add 'admin' user in ProcessMaker (rb)");
$this->run_query('UPDATE RBAC_USERS SET USR_USERNAME = \'' . mysql_real_escape_string($this->options['admin']['username']) . '\', ' . ' `USR_PASSWORD` = \'' . G::encryptHash($this->options['admin']['password']) . '\' ' . ' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1', "Add 'admin' user in ProcessMaker (rb)");
}
/**
* Run a mysql query on the current database and take care of logging and
* error handling.
*
* @param string $query SQL command
* @param string $description Description to log instead of $query
*/
private function run_query($query, $description = null)
{
$result = @mysql_query($query, $this->connection_database);
$error = ($result) ? false : mysql_error();
$this->log(($description ? $description : $query) . " => " . (($error) ? $error : "OK") . "\n", $error);
}
/**
* query_sql_file
*
* @param string $file
* @param string $connection
* @return array $report
*/
public function query_sql_file($file, $connection)
{
$lines = file($file);
$previous = null;
$errors = '';
@mysql_query("SET NAMES 'utf8';");
foreach ($lines as $j => $line) {
$line = trim($line); // Remove comments from the script
if (strpos($line, "--") === 0) {
$line = substr($line, 0, strpos($line, "--"));
}
if (empty($line)) {
continue;
}
if (strpos($line, "#") === 0) {
$line = substr($line, 0, strpos($line, "#"));
}
if (empty($line)) {
continue;
}
// Concatenate the previous line, if any, with the current
if ($previous) {
$line = $previous . " " . $line;
}
$previous = null;
// If the current line doesnt end with ; then put this line together
// with the next one, thus supporting multi-line statements.
if (strrpos($line, ";") != strlen($line) - 1) {
$previous = $line;
continue;
}
$line = substr($line, 0, strrpos($line, ";"));
@mysql_query($line, $connection);
}
}
/**
* check_path
*
* @return void
* @todo Empty function
*/
private function check_path()
{
}
/**
* function find_root_path
*
* @param string $path
* @return string $path
*/
private function find_root_path($path)
{
$i = 0; //prevent loop inifinity
while (!is_dir($path) && ($path = dirname($path)) && ((strlen($path) > 1) && $i < 10)) {
$i++;
}
return $path;
}
/**
* file_permisions
*
* @param string $file
* @param integer $def default value 777
* @return integer $def
*/
public function file_permisions($file, $def = 777)
{
if (PHP_OS == 'WINNT') {
return $def;
} else {
return (int) substr(sprintf('%o', @fileperms($file)), - 4);
}
}
/**
* is_dir_writable
*
* @param string $dir default value empty
* @return string $path
*/
public function is_dir_writable($dir = '')
{
if (PHP_OS == 'WINNT') {
$dir = $this->find_root_path($dir);
return file_exists($dir);
} else {
$dir = $this->find_root_path($dir);
return (is_writable($dir) && is_readable($dir));
}
}
/**
* getDirectoryFiles
*
* @param string $dir default value empty
* @return string $path
*/
public function getDirectoryFiles($dir, $extension)
{
$filesArray = array();
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
$fileParts = explode(".", $file);
if ($fileParts[count($fileParts) - 1] == $extension) {
$filesArray[] = $file;
}
}
closedir($handle);
}
}
return $filesArray;
}
/**
* check_db_empty
*
* @param string $dbName
* @return boolean true or false
*/
public function check_db_empty($dbName)
{
$a = @mysql_select_db($dbName, $this->connection_database);
if (!$a) {
return true;
}
$q = @mysql_query('SHOW TABLES', $this->connection_database);
return (@mysql_num_rows($q) > 0) ? false : true;
}
/**
* check_db
*
* @param string $dbName
* @return Array Array('status' => true or false,'message' => string)
*/
public function check_db($dbName)
{
if (!$this->connection_database) {
//erik: new verification if the mysql extension is enabled
$error = class_exists('mysql_error') ? mysql_error() : 'Mysql Module for PHP is not enabled!';
return Array('status' => false, 'message' => $error
);
} else {
if (!mysql_select_db($dbName, $this->connection_database) && $this->cc_status != 1) {
return Array('status' => false, 'message' => mysql_error()
);
} else {
/* var_dump($this->options['advanced']['ao_db_drop'],$this->cc_status,$this->check_db_empty($dbName));
if(($this->options['advanced']['ao_db_drop']===false && $this->cc_status!=1 && !$this->check_db_empty($dbName)) )
{
return Array('status'=>false,'message'=>'Database is not empty');
}
else
{
return Array('status'=>true,'message'=>'OK');
} */
if ($this->options['advanced']['ao_db_drop'] === true || $this->check_db_empty($dbName)) {
return Array('status' => true, 'message' => 'PASSED'
);
} else {
return Array('status' => false, 'message' => 'Database is not empty'
);
}
}
}
}
/**
* check_connection
*
* @return Array $rt
*/
private function check_connection()
{
if (!function_exists("mysql_connect")) {
$this->cc_status = 0;
$rt = Array('connection' => false, 'grant' => 0, 'version' => false, 'message' => "ERROR: Mysql Module for PHP is not enabled, try install <b>php-mysql</b> package.", 'ao' => Array('ao_db_wf' => false, 'ao_db_rb' => false, 'ao_db_rp' => false
)
);
} else {
$this->connection_database = @mysql_connect($this->options['database']['hostname'], $this->options['database']['username'], $this->options['database']['password']);
$rt = Array('version' => false, 'ao' => Array('ao_db_wf' => false, 'ao_db_rb' => false, 'ao_db_rp' => false
)
);
if (!$this->connection_database) {
$this->cc_status = 0;
$rt['connection'] = false;
$rt['grant'] = 0;
$rt['message'] = "Mysql error: " . mysql_error();
} else {
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', mysql_get_server_info($this->connection_database), $version);
$rt['version'] = version_compare(@$version[0], "4.1.0", ">=");
$rt['connection'] = true;
$dbNameTest = "PROCESSMAKERTESTDC";
$db = @mysql_query("CREATE DATABASE " . $dbNameTest, $this->connection_database);
if (!$db) {
$this->cc_status = 3;
$rt['grant'] = 3;
//$rt['message'] = "Db GRANTS error: ".mysql_error();
$rt['message'] = "Successful connection";
} else {
//@mysql_drop_db("processmaker_testGA");
$usrTest = "wfrbtest";
$chkG = "GRANT ALL PRIVILEGES ON `" . $dbNameTest . "`.* TO " . $usrTest . "@'%' IDENTIFIED BY 'sample' WITH GRANT OPTION";
$ch = @mysql_query($chkG, $this->connection_database);
if (!$ch) {
$this->cc_status = 2;
$rt['grant'] = 2;
//$rt['message'] = "USER PRIVILEGES ERROR";
$rt['message'] = "Successful connection";
} else {
$this->cc_status = 1;
@mysql_query("DROP USER " . $usrTest . "@'%'", $this->connection_database);
$rt['grant'] = 1;
$rt['message'] = "Successful connection";
}
@mysql_query("DROP DATABASE " . $dbNameTest, $this->connection_database);
}
// var_dump($wf,$rb,$rp);
}
}
$rt['ao']['ao_db_wf'] = $this->check_db($this->options['advanced']['ao_db_wf']);
//$rt['ao']['ao_db_rb'] = $this->check_db($this->options['advanced']['ao_db_rb']);
//$rt['ao']['ao_db_rp'] = $this->check_db($this->options['advanced']['ao_db_rp']);
return $rt;
}
/**
* log
*
* @param string $text
* @return void
*/
public function log($text, $failed = null)
{
array_push($this->report, $text);
if ($failed) {
throw new Exception(is_string($text) ? $text : var_export($text, true) );
}
}
}

View File

@@ -2,28 +2,29 @@
use ProcessMaker\Plugins\PluginRegistry;
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.enterpriseUtils.php';
/**
* class.pmLicenseManager.php
*
*/
class pmLicenseManager
/**
* class.pmLicenseManager.php
*
*/class PmLicenseManager
{
private static $instance = null;
public function __construct($flagActivatePlugins = true)
{
$oServerConf = &serverConf::getSingleton();
$oServerConf = &ServerConf::getSingleton();
$oServerConf->setProperty('LOGIN_NO_WS', true);
//to do: this files probably needs to be in core, since they are GPL2
//include_once (PATH_PLUGINS . 'enterprise' . PATH_SEP . 'classes' . PATH_SEP . 'class.license.lib.php');
//include_once (PATH_PLUGINS . 'enterprise' . PATH_SEP . 'classes' . PATH_SEP . 'class.license.app.php');
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.license.lib.php';
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.license.app.php';
//searching .dat files in workspace folder
$server_array = $_SERVER;
@@ -119,7 +120,7 @@ class pmLicenseManager
public static function getSingleton($flagActivatePlugins = true)
{
if (self::$instance == null) {
self::$instance = new pmLicenseManager($flagActivatePlugins);
self::$instance = new PmLicenseManager($flagActivatePlugins);
}
return self::$instance;
}
@@ -379,7 +380,7 @@ class pmLicenseManager
return false;
} else {
$oServerConf = & serverConf::getSingleton ();
$oServerConf = & ServerConf::getSingleton ();
$oServerConf->setProperty ( 'ACTIVE_LICENSE',array(SYS_SYS => $path));
$this->saveDataLicense( $results, $path, $redirect );
if ($redirect) {
@@ -510,4 +511,3 @@ class pmLicenseManager
return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default')));
}
}

View File

@@ -0,0 +1,13 @@
<?php
/**
* Phing Class Wrapper
*
*/
class PmPhing extends Phing
{
public function getPhingVersion()
{
return 'pmPhing Ver 1.0';
}
}

View File

@@ -3,8 +3,7 @@
* class.pmSso.php
*
*/
class pmSsoClass extends PMPlugin {
class PmSsoClass extends PMPlugin {
function __construct() {
}
@@ -63,4 +62,3 @@
return $res;
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -914,7 +914,7 @@ class PmTable
Phing::startup();
Phing::setProperty('phing.home', getenv('PHING_HOME'));
$m = new pmPhing();
$m = new PmPhing();
$m->execute($args);
$m->runBuild();
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* PopupMenu - PopupMenu
/**
* PopupMenu - PopupMenu class
*
* @package workflow.engine.ProcessMaker
* @copyright COLOSA
*/
class PopupMenu extends Form
{
var $type = 'PopupMenu';
var $theme = 'processmaker';
/**
* Print the popup
*
* @param string $tableId
* @param array $tableFields
* @return array
*/
function renderPopup ($tableId, $tableFields)
{
$this->name = $tableId;
$fields = array_keys( $tableFields );
foreach ($fields as $f) {
switch (strtolower( $tableFields[$f]['Type'] )) {
case 'javascript':
case 'button':
case 'private':
case 'hidden':
case 'cellmark':
break;
default:
$label = ($tableFields[$f]['Label'] != '') ? $tableFields[$f]['Label'] : $f;
$label = str_replace( "\n", ' ', $label );
$pmXmlNode = new Xml_Node( $f, 'complete', '', array ('label' => $label,'type' => 'popupOption','launch' => $tableId . '.showHideField("' . $f . '")'
) );
$this->fields[$f] = new XmlFormFieldPopupOption( $pmXmlNode );
$this->values[$f] = '';
}
}
$scTemp = '';
$this->values['PAGED_TABLE_ID'] = $tableId;
print (parent::render( PATH_CORE . 'templates/popupMenu.html', $scTemp )) ;
$sc = "<script type=\"text/javascript\">\n$scTemp\n loadPopupMenu_$tableId(); \n</script>";
return $sc;
}
}

View File

@@ -1,28 +1,6 @@
<?php
/**
* class.processes.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Core\System;
class Processes
{
@@ -5795,7 +5773,7 @@ class Processes
$endpoint = PML_WSDL_URL;
$sessionId = '';
$proxy = array();
$sysConf = PmSystem::getSystemConfiguration();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
$proxy['proxy_host'] = $sysConf['proxy_host'];
if ($sysConf['proxy_port'] != '') {
@@ -5837,7 +5815,7 @@ class Processes
ini_set("soap.wsdl_cache_enabled", "0"); // enabling WSDL cache
try {
$proxy = array();
$sysConf = PmSystem::getSystemConfiguration();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
$proxy['proxy_host'] = $sysConf['proxy_host'];
if ($sysConf['proxy_port'] != '') {
@@ -5869,7 +5847,7 @@ class Processes
$endpoint = PML_WSDL_URL;
$proxy = array();
$sysConf = PmSystem::getSystemConfiguration();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
$proxy['proxy_host'] = $sysConf['proxy_host'];
@@ -5946,7 +5924,7 @@ class Processes
$endpoint = PML_WSDL_URL;
$proxy = array();
$sysConf = PmSystem::getSystemConfiguration();
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
$proxy['proxy_host'] = $sysConf['proxy_host'];
if ($sysConf['proxy_port'] != '') {
@@ -6183,96 +6161,3 @@ class Processes
return $proTitle;
}
}
//end class processes
/**
* Object Document class
*
* @package workflow.engine.ProcessMaker
*/
class ObjectDocument
{
public $type;
public $name;
public $data;
public $origin;
/**
* Constructor
*/
public function __construct()
{
$this->type = '';
$this->name = '';
$this->data = '';
$this->origin = '';
}
}
/**
* ObjectDocument Collection
*
* @package workflow.engine.ProcessMaker
*/
class ObjectCellection
{
public $num;
public $swapc;
public $objects;
/**
* Constructor
*/
public function __construct()
{
$this->objects = Array();
$this->num = 0;
$this->swapc = $this->num;
array_push($this->objects, 'void');
}
/**
* add in the collecetion a new object Document
*
* @param $name name object document
* @param $type type object document
* @param $data data object document
* @param $origin origin object document
* @return void
*/
public function add($name, $type, $data, $origin)
{
$o = new ObjectDocument();
$o->name = $name;
$o->type = $type;
$o->data = $data;
$o->origin = $origin;
$this->num++;
array_push($this->objects, $o);
$this->swapc = $this->num;
}
/**
* get the collection of ObjectDocument
*
* @param $name name object document
* @param $type type object document
* @param $data data object document
* @param $origin origin object document
* @return void
*/
public function get()
{
if ($this->swapc > 0) {
$e = $this->objects[$this->swapc];
$this->swapc--;
return $e;
} else {
$this->swapc = $this->num;
return false;
}
}
}

View File

@@ -1,42 +1,22 @@
<?php
/**
* class.propelTable.php
*
* @package workflow.gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
* Class pagedTable
*
* @author David S. Callizaya S. <davidsantos@colosa.com> *
* @access public
* @package workflow.gulliver.system
* dependencies TemplatePower Form XmlForm
*/
class propelTable
/**
* Class pagedTable
*
* @access public
* @package workflow.gulliver.system
* dependencies TemplatePower Form XmlForm
*/
class PropelTable
{
public $xmlFormFile;
public $currentPage;
@@ -95,7 +75,7 @@ class propelTable
public $name = 'pagedTable';
public $id = 'A1';
public $disableFooter = false;
//This attribute is used to set STYLES to groups of TD, using the field type "cellMark" (see XmlForm_Field_cellMark)
//This attribute is used to set STYLES to groups of TD, using the field type "cellMark" (see XmlFormFieldCellMark)
public $tdStyle = '';
public $tdClass = '';
//Config Save definition
@@ -910,4 +890,3 @@ class propelTable
G::RenderPage( "publish", "blank" );
}
}

View File

@@ -1,41 +1,15 @@
<?php
/**
* class.replacementLogo.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
/**
*
* @package workflow.engine.classes
*/
class replacementLogo
class ReplacementLogo
{
//var $dir='';
/**
* This function is the constructor of the replacementLogo class
* This function is the constructor of the ReplacementLogo class
* param
*
* @return void
@@ -109,4 +83,3 @@ class replacementLogo
return ($ainfoLogo);
}
}

View File

@@ -0,0 +1,823 @@
<?php
/**
* Report - Report
*/
class Report
{
/**
* This function does a sql statment to a report
*
*
* @name generatedReport1
*
* param
* @return object
*/
public function generatedReport1()
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addSelectColumn(ProcessPeer::PRO_TITLE);
$oCriteria->addAsColumn("MIN", "MIN(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("MAX", "MAX(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("TOTALDUR", "SUM(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("PROMEDIO", "AVG(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addJoin(AppDelegationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$oCriteria->addGroupByColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addGroupByColumn(ProcessPeer::PRO_TITLE);
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aProcess[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float'
);
while ($aRow = $oDataset->getRow()) {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria->add(ApplicationPeer::PRO_UID, $aRow['PRO_UID']);
$aProcess[] = array('PRO_UID' => $aRow['PRO_UID'], 'PRO_TITLE' => $aRow['PRO_TITLE'], 'CANTCASES' => ApplicationPeer::doCount($oCriteria), 'MIN' => number_format($aRow['MIN'], 2), 'MAX' => number_format($aRow['MAX'], 2), 'TOTALDUR' => number_format($aRow['TOTALDUR'], 2), 'PROMEDIO' => number_format($aRow['PROMEDIO'], 2)
);
$oDataset->next();
}
global $_DBArray;
$_DBArray['reports'] = $aProcess;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function does a sql statment to a report wiht a condition
* or maybe when you're looking for some specials cases
*
* @name generatedReport1_filter
*
* @param string $from
* @param string $to
* @param string $startedby
* @return object
*/
public function generatedReport1_filter($from, $to, $startedby)
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addSelectColumn(ProcessPeer::PRO_TITLE);
$oCriteria->addAsColumn("MIN", "MIN(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("MAX", "MAX(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("TOTALDUR", "SUM(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("PROMEDIO", "AVG(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addJoin(AppDelegationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$oCriteria->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
//$oCriteria->add(AppDelegationPeer::DEL_DURATION, $from, Criteria::GREATER_EQUAL);
//$oCriteria->add(AppDelegationPeer::DEL_DURATION, $to, Criteria::LESS_EQUAL);
//$aAux1 = explode('-', $from); date('Y-m-d H:i:s', mktime(0, 0, 0, $aAux1[1], $aAux1[2], $aAux1[0]))
$oCriteria->add($oCriteria->getNewCriterion(AppDelegationPeer::DEL_INIT_DATE, $from . ' 00:00:00', Criteria::GREATER_EQUAL)->addAnd($oCriteria->getNewCriterion(AppDelegationPeer::DEL_INIT_DATE, $to . ' 23:59:59', Criteria::LESS_EQUAL)));
if ($startedby != '') {
$oCriteria->add(ApplicationPeer::APP_INIT_USER, $startedby);
}
$oCriteria->addGroupByColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addGroupByColumn(ProcessPeer::PRO_TITLE);
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aProcess[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float'
);
while ($aRow = $oDataset->getRow()) {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria->add(ApplicationPeer::PRO_UID, $aRow['PRO_UID']);
if ($startedby != '') {
$oCriteria->add(ApplicationPeer::APP_INIT_USER, $startedby);
}
$aProcess[] = array('PRO_UID' => $aRow['PRO_UID'], 'PRO_TITLE' => $aRow['PRO_TITLE'], 'CANTCASES' => ApplicationPeer::doCount($oCriteria), 'MIN' => number_format($aRow['MIN'], 2), 'MAX' => number_format($aRow['MAX'], 2), 'TOTALDUR' => number_format($aRow['TOTALDUR'], 2), 'PROMEDIO' => number_format($aRow['PROMEDIO'], 2));
$oDataset->next();
}
global $_DBArray;
$_DBArray['reports'] = $aProcess;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function gets info about a report
*
*
* @name descriptionReport1
*
* @param string $PRO_UID
* @return object
*/
public function descriptionReport1($PRO_UID)
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Task.php';
require_once 'classes/model/Content.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$oCriteria->addSelectColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addSelectColumn(TaskPeer::TAS_TITLE);
$oCriteria->addAsColumn("MIN", "MIN(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("MAX", "MAX(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("TOTALDUR", "SUM(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("PROMEDIO", "AVG(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$oCriteria->add(AppDelegationPeer::PRO_UID, $PRO_UID);
$oCriteria->addGroupByColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addGroupByColumn(TaskPeer::TAS_TITLE);
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aProcess[] = array('TAS_TITLE' => 'char', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float'
);
while ($aRow = $oDataset->getRow()) {
$aProcess[] = array('TAS_TITLE' => $aRow['TAS_TITLE'], 'MIN' => number_format($aRow['MIN'], 2), 'MAX' => number_format($aRow['MAX'], 2), 'TOTALDUR' => number_format($aRow['TOTALDUR'], 2), 'PROMEDIO' => number_format($aRow['PROMEDIO'], 2)
);
$oDataset->next();
}
global $_DBArray;
$_DBArray['reports'] = $aProcess;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function generates a other kind of report
*
*
* @name generatedReport2
*
* param
* @return object
*/
public function generatedReport2()
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$oCriteria->addSelectColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addSelectColumn(ProcessPeer::PRO_TITLE);
$oCriteria->addAsColumn("MIN", "MIN(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("MAX", "MAX(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addJoin(AppDelegationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$oCriteria->addGroupByColumn(AppDelegationPeer::PRO_UID);
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$month = date('Y-m-d', mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")));
$lastmonth = date('Y-m-d', mktime(0, 0, 0, date("m") - 2, date("d"), date("Y")));
$day = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$lastday = mktime(0, 0, 0, date("m"), date("d") - 2, date("Y"));
$aProcess[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'CASELASTMONTH' => 'integer', 'CASELASTDAY' => 'integer'
);
while ($aRow = $oDataset->getRow()) {
$oCriteria2 = new Criteria('workflow');
$oCriteria2->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria2->addAsColumn("CANTCASES", "COUNT(*)");
$oCriteria2->add(ApplicationPeer::PRO_UID, $aRow['PRO_UID']);
$oCriteria2->addGroupByColumn(ApplicationPeer::PRO_UID);
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow2 = $oDataset2->getRow();
$cant = $aRow2['CANTCASES'];
$oCriteria2 = new Criteria('workflow');
$oCriteria2->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria2->addAsColumn("CANTCASES", "COUNT(*)");
$oCriteria2->add(ApplicationPeer::PRO_UID, $aRow['PRO_UID']);
$oCriteria2->add(ApplicationPeer::APP_INIT_DATE, $lastmonth, Criteria::GREATER_EQUAL);
$oCriteria2->add(ApplicationPeer::APP_INIT_DATE, $month, Criteria::LESS_EQUAL);
$oCriteria2->addGroupByColumn(ApplicationPeer::PRO_UID);
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow2 = $oDataset2->getRow();
$cant1 = $aRow2['CANTCASES'];
$oCriteria2 = new Criteria('workflow');
$oCriteria2->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria2->addAsColumn("CANTCASES", "COUNT(*)");
$oCriteria2->add(ApplicationPeer::PRO_UID, $aRow['PRO_UID']);
$oCriteria2->add(ApplicationPeer::APP_INIT_DATE, $lastday, Criteria::GREATER_EQUAL);
$oCriteria2->add(ApplicationPeer::APP_INIT_DATE, $day, Criteria::LESS_EQUAL);
$oCriteria2->addGroupByColumn(ApplicationPeer::PRO_UID);
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow2 = $oDataset2->getRow();
$cant2 = $aRow2['CANTCASES'];
$aProcess[] = array('PRO_UID' => $aRow['PRO_UID'], 'PRO_TITLE' => $aRow['PRO_TITLE'], 'CANTCASES' => $cant, 'MIN' => number_format($aRow['MIN'], 2), 'MAX' => number_format($aRow['MAX'], 2), 'CASELASTMONTH' => number_format($cant1, 2), 'CASELASTDAY' => number_format($cant2, 2)
);
$oDataset->next();
}
global $_DBArray;
$_DBArray['reports'] = $aProcess;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function generates the description about a report
*
*
* @name reports_Description_filter
*
* @param string $from
* @param string $to
* @param string $startedby
* @param string $PRO_UID
* @return object
*/
public function reports_Description_filter($from, $to, $startedby, $PRO_UID)
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Task.php';
require_once 'classes/model/Content.php';
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$oCriteria->addSelectColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addSelectColumn(TaskPeer::TAS_TITLE);
$oCriteria->addAsColumn("MIN", "MIN(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("MAX", "MAX(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("TOTALDUR", "SUM(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("PROMEDIO", "AVG(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$oCriteria->add($oCriteria->getNewCriterion(AppDelegationPeer::DEL_INIT_DATE, $from . ' 00:00:00', Criteria::GREATER_EQUAL)->addAnd($oCriteria->getNewCriterion(AppDelegationPeer::DEL_INIT_DATE, $to . ' 23:59:59', Criteria::LESS_EQUAL)));
if ($startedby != '') {
$oCriteria->add(AppDelegationPeer::USR_UID, $startedby);
}
$oCriteria->add(AppDelegationPeer::PRO_UID, $PRO_UID);
$oCriteria->addGroupByColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addGroupByColumn(TaskPeer::TAS_TITLE);
return $oCriteria;
}
/**
* This function looks for an special case it has a condition
*
*
* @name generatedReport2_filter
*
* @param string $from
* @param string $to
* @param string $startedby
* @return object
*/
public function generatedReport2_filter($from, $to, $startedby)
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$oCriteria->addSelectColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addSelectColumn(ProcessPeer::PRO_TITLE);
$oCriteria->addAsColumn("MIN", "MIN(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addAsColumn("MAX", "MAX(" . AppDelegationPeer::DEL_DURATION . ")");
$oCriteria->addJoin(AppDelegationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$oCriteria->addGroupByColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addGroupByColumn(ProcessPeer::PRO_TITLE);
$oCriteria->add($oCriteria->getNewCriterion(AppDelegationPeer::DEL_INIT_DATE, $from . ' 00:00:00', Criteria::GREATER_EQUAL)->addAnd($oCriteria->getNewCriterion(AppDelegationPeer::DEL_INIT_DATE, $to . ' 23:59:59', Criteria::LESS_EQUAL)));
if ($startedby != '') {
$oCriteria->add(AppDelegationPeer::USR_UID, $startedby);
}
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$month = date('Y-m-d', mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")));
$lastmonth = date('Y-m-d', mktime(0, 0, 0, date("m") - 2, date("d"), date("Y")));
$day = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$lastday = mktime(0, 0, 0, date("m"), date("d") - 2, date("Y"));
$aProcess[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'CASELASTMONTH' => 'integer', 'CASELASTDAY' => 'integer');
while ($aRow = $oDataset->getRow()) {
$oCriteria2 = new Criteria('workflow');
$oCriteria2->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria2->addAsColumn("CANTCASES", "COUNT(*)");
$oCriteria2->add(ApplicationPeer::PRO_UID, $aRow['PRO_UID']);
if ($startedby != '') {
$oCriteria2->add(ApplicationPeer::APP_INIT_USER, $startedby);
}
$oCriteria2->addGroupByColumn(ApplicationPeer::PRO_UID);
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow2 = $oDataset2->getRow();
$cant = $aRow2['CANTCASES'];
$oCriteria2 = new Criteria('workflow');
$oCriteria2->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria2->addAsColumn("CANTCASES", "COUNT(*)");
$oCriteria2->add(ApplicationPeer::PRO_UID, $aRow['PRO_UID']);
$oCriteria2->add(ApplicationPeer::APP_INIT_DATE, $lastmonth, Criteria::GREATER_EQUAL);
$oCriteria2->add(ApplicationPeer::APP_INIT_DATE, $month, Criteria::LESS_EQUAL);
if ($startedby != '') {
$oCriteria2->add(ApplicationPeer::APP_INIT_USER, $startedby);
}
$oCriteria2->addGroupByColumn(ApplicationPeer::PRO_UID);
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow2 = $oDataset2->getRow();
$cant1 = $aRow2['CANTCASES'];
$oCriteria2 = new Criteria('workflow');
$oCriteria2->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria2->addAsColumn("CANTCASES", "COUNT(*)");
$oCriteria2->add(ApplicationPeer::PRO_UID, $aRow['PRO_UID']);
$oCriteria2->add(ApplicationPeer::APP_INIT_DATE, $lastday, Criteria::GREATER_EQUAL);
$oCriteria2->add(ApplicationPeer::APP_INIT_DATE, $day, Criteria::LESS_EQUAL);
if ($startedby != '') {
$oCriteria2->add(ApplicationPeer::APP_INIT_USER, $startedby);
}
$oCriteria2->addGroupByColumn(ApplicationPeer::PRO_UID);
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow2 = $oDataset2->getRow();
$cant2 = $aRow2['CANTCASES'];
/*$aProcess[] = array('PRO_UID' => $aRow['PRO_UID'],
'PRO_TITLE' => $aRow['PRO_TITLE'],
'CANTCASES' => $cant,
'CASELASTMONTH' => $cant1,
'CASELASTDAY' => $cant2
);*/
$aProcess[] = array('PRO_UID' => $aRow['PRO_UID'], 'PRO_TITLE' => $aRow['PRO_TITLE'], 'CANTCASES' => $cant, 'MIN' => number_format($aRow['MIN'], 2), 'MAX' => number_format($aRow['MAX'], 2), 'CASELASTMONTH' => number_format($cant1, 2), 'CASELASTDAY' => number_format($cant2, 2));
$oDataset->next();
}
global $_DBArray;
$_DBArray['reports'] = $aProcess;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function looks for an special case it has a condition
*
*
* @name generatedReport2_filter
*
* @param string $from
* @param string $to
* @param string $startedby
* @return object
*/
public function generatedReport3()
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$sql = "SELECT CONCAT(SUBSTRING(AD.DEL_INIT_DATE,6,2),'-', SUBSTRING(AD.DEL_INIT_DATE,1,4)) AS FECHA,
COUNT(DISTINCT(AD.APP_UID)) AS CANTCASES,
MIN(AD.DEL_DURATION) AS MIN,
MAX(AD.DEL_DURATION) AS MAX,
SUM(AD.DEL_DURATION) AS TOTALDUR,
AVG(AD.DEL_DURATION) AS PROMEDIO
FROM APP_DELEGATION AS AD
LEFT JOIN PROCESS AS P ON (P.PRO_UID = AD.PRO_UID)
WHERE AD.APP_UID<>'' AND P.PRO_STATUS<>'DISABLED'
GROUP BY FECHA";
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
$ROW[] = array('FECHA' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float');
while ($rs->next()) {
$ROW[] = array('FECHA' => $rs->getString('FECHA'), 'CANTCASES' => $rs->getString('CANTCASES'), 'MIN' => number_format($rs->getString('MIN'), 2), 'MAX' => number_format($rs->getString('MAX'), 2), 'TOTALDUR' => number_format($rs->getString('TOTALDUR'), 2), 'PROMEDIO' => number_format($rs->getString('PROMEDIO'), 2));
}
global $_DBArray;
$_DBArray['reports'] = $ROW;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function looks for an special case it has a condition
*
*
* @name generatedReport3_filter
*
* @param string $process
* @param string $task
* @return object
*/
public function generatedReport3_filter($process, $task)
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
if ($process == '') {
$var = " WHERE P.PRO_STATUS<>'DISABLED'";
} else {
if ($task == '') {
$var = " LEFT JOIN TASK AS T ON (AD.TAS_UID = T.TAS_UID)
WHERE P.PRO_STATUS<>'DISABLED' AND AD.PRO_UID='" . $process . "'";
} else {
$var = " LEFT JOIN TASK AS T ON (AD.TAS_UID = T.TAS_UID)
WHERE P.PRO_STATUS<>'DISABLED' AND AD.PRO_UID='" . $process . "' AND AD.TAS_UID='" . $task . "' ";
}
}
$sql = "SELECT CONCAT(SUBSTRING(AD.DEL_INIT_DATE,6,2),'-', SUBSTRING(AD.DEL_INIT_DATE,1,4)) AS FECHA,
COUNT(DISTINCT(AD.APP_UID)) AS CANTCASES,
MIN(AD.DEL_DURATION) AS MIN,
MAX(AD.DEL_DURATION) AS MAX,
SUM(AD.DEL_DURATION) AS TOTALDUR,
AVG(AD.DEL_DURATION) AS PROMEDIO
FROM APP_DELEGATION AS AD
LEFT JOIN PROCESS AS P ON (P.PRO_UID = AD.PRO_UID)
" . $var . "
GROUP BY FECHA";
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
$ROW[] = array('FECHA' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float');
while ($rs->next()) {
$ROW[] = array('FECHA' => $rs->getString('FECHA'), 'CANTCASES' => $rs->getString('CANTCASES'), 'MIN' => number_format($rs->getString('MIN'), 2), 'MAX' => number_format($rs->getString('MAX'), 2), 'TOTALDUR' => number_format($rs->getString('TOTALDUR'), 2), 'PROMEDIO' => number_format($rs->getString('PROMEDIO'), 2));
}
global $_DBArray;
$_DBArray['reports'] = $ROW;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function generates a report
*
*
* @name generatedReport4
*
* param
* @return object
*/
public function generatedReport4()
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$sql = "SELECT CONCAT(U.USR_LASTNAME,' ',USR_FIRSTNAME) AS USER,
COUNT(*) AS CANTCASES,
MIN(AD.DEL_DURATION) AS MIN,
MAX(AD.DEL_DURATION) AS MAX,
SUM(AD.DEL_DURATION) AS TOTALDUR,
AVG(AD.DEL_DURATION) AS PROMEDIO
FROM APPLICATION AS A
LEFT JOIN APP_DELEGATION AS AD ON(A.APP_UID = AD.APP_UID AND AD.DEL_INDEX=1)
LEFT JOIN USERS AS U ON(U.USR_UID = A.APP_INIT_USER)
WHERE A.APP_UID<>''
GROUP BY USER";
// AND P.PRO_STATUS<>'DISABLED' that hapens when it is created to new version it exists at the moment to import
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
$ROW[] = array('USER' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float'
);
while ($rs->next()) {
$ROW[] = array('USER' => $rs->getString('USER'), 'CANTCASES' => $rs->getString('CANTCASES'), 'MIN' => number_format($rs->getString('MIN'), 2), 'MAX' => number_format($rs->getString('MAX'), 2), 'TOTALDUR' => number_format($rs->getString('TOTALDUR'), 2), 'PROMEDIO' => number_format($rs->getString('PROMEDIO'), 2)
);
}
global $_DBArray;
$_DBArray['reports'] = $ROW;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function generates a filter to report 4
*
*
* @name generatedReport4_filter
*
* @param string process
* @param string task
* @return object
*/
public function generatedReport4_filter($process, $task)
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
if ($process == '') {
$var = " ";
} else {
if ($task == '') {
$var = " LEFT JOIN TASK AS T ON (AD.TAS_UID = T.TAS_UID)
WHERE AD.PRO_UID='" . $process . "'";
} else {
$var = " LEFT JOIN TASK AS T ON (AD.TAS_UID = T.TAS_UID)
WHERE AD.PRO_UID='" . $process . "' AND AD.TAS_UID='" . $task . "' ";
}
}
$sql = "SELECT CONCAT(U.USR_LASTNAME,' ',USR_FIRSTNAME) AS USER,
COUNT(*) AS CANTCASES,
MIN(AD.DEL_DURATION) AS MIN,
MAX(AD.DEL_DURATION) AS MAX,
SUM(AD.DEL_DURATION) AS TOTALDUR,
AVG(AD.DEL_DURATION) AS PROMEDIO
FROM APPLICATION AS A
LEFT JOIN APP_DELEGATION AS AD ON(A.APP_UID = AD.APP_UID AND AD.DEL_INDEX=1)
LEFT JOIN USERS AS U ON(U.USR_UID = A.APP_INIT_USER)
" . $var . "
GROUP BY USER";
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
$ROW[] = array('USER' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float'
);
while ($rs->next()) {
$ROW[] = array('USER' => $rs->getString('USER'), 'CANTCASES' => $rs->getString('CANTCASES'), 'MIN' => number_format($rs->getString('MIN'), 2), 'MAX' => number_format($rs->getString('MAX'), 2), 'TOTALDUR' => number_format($rs->getString('TOTALDUR'), 2), 'PROMEDIO' => number_format($rs->getString('PROMEDIO'), 2)
);
}
global $_DBArray;
$_DBArray['reports'] = $ROW;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function generates a Report
*
*
* @name generatedReport4_filter
*
* @param string process
* @param string task
* @return object
*/
public function generatedReport5()
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$sql = "SELECT CONCAT(U.USR_LASTNAME,' ',USR_FIRSTNAME) AS USER,
COUNT(*) AS CANTCASES,
MIN(AD.DEL_DURATION) AS MIN,
MAX(AD.DEL_DURATION) AS MAX,
SUM(AD.DEL_DURATION) AS TOTALDUR,
AVG(AD.DEL_DURATION) AS PROMEDIO
FROM APP_DELEGATION AS AD
LEFT JOIN PROCESS AS P ON (P.PRO_UID = AD.PRO_UID)
LEFT JOIN USERS AS U ON(U.USR_UID = AD.USR_UID)
WHERE AD.APP_UID<>'' AND AD.DEL_FINISH_DATE IS NULL
GROUP BY USER";
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
$ROW[] = array('USER' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float'
);
while ($rs->next()) {
$ROW[] = array('USER' => $rs->getString('USER'), 'CANTCASES' => $rs->getString('CANTCASES'), 'MIN' => number_format($rs->getString('MIN'), 2), 'MAX' => number_format($rs->getString('MAX'), 2), 'TOTALDUR' => number_format($rs->getString('TOTALDUR'), 2), 'PROMEDIO' => number_format($rs->getString('PROMEDIO'), 2)
);
}
global $_DBArray;
$_DBArray['reports'] = $ROW;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function generates a filter to report 5
*
*
* @name generatedReport5_filter
*
* @param string process
* @param string task
* @return object
*/
public function generatedReport5_filter($process, $task)
{
$this->reportsPatch();
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Application.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
if ($process == '') {
$var = " WHERE AD.DEL_FINISH_DATE IS NULL";
} else {
if ($task == '') {
$var = " LEFT JOIN TASK AS T ON (AD.TAS_UID = T.TAS_UID)
WHERE AD.PRO_UID='" . $process . "' AND AD.DEL_FINISH_DATE IS NULL";
} else {
$var = " LEFT JOIN TASK AS T ON (AD.TAS_UID = T.TAS_UID)
WHERE AD.PRO_UID='" . $process . "' AND AD.TAS_UID='" . $task . "' ";
}
}
$sql = "SELECT CONCAT(U.USR_LASTNAME,' ',USR_FIRSTNAME) AS USER,
COUNT(*) AS CANTCASES,
MIN(AD.DEL_DURATION) AS MIN,
MAX(AD.DEL_DURATION) AS MAX,
SUM(AD.DEL_DURATION) AS TOTALDUR,
AVG(AD.DEL_DURATION) AS PROMEDIO
FROM APP_DELEGATION AS AD
LEFT JOIN PROCESS AS P ON (P.PRO_UID = AD.PRO_UID)
LEFT JOIN USERS AS U ON(U.USR_UID = AD.USR_UID)
" . $var . "
GROUP BY USER";
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
$ROW[] = array('USER' => 'char', 'CANTCASES' => 'integer', 'MIN' => 'float', 'MAX' => 'float', 'TOTALDUR' => 'float', 'PROMEDIO' => 'float'
);
while ($rs->next()) {
$ROW[] = array('USER' => $rs->getString('USER'), 'CANTCASES' => $rs->getString('CANTCASES'), 'MIN' => number_format($rs->getString('MIN'), 2), 'MAX' => number_format($rs->getString('MAX'), 2), 'TOTALDUR' => number_format($rs->getString('TOTALDUR'), 2), 'PROMEDIO' => number_format($rs->getString('PROMEDIO'), 2)
);
}
global $_DBArray;
$_DBArray['reports'] = $ROW;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('reports');
return $oCriteria;
}
/**
* This function returns an array, it has the reports' names
*
*
* @name getAvailableReports
*
* param
* @return array
*/
public function getAvailableReports()
{
return array('ID_REPORT1', 'ID_REPORT2', 'ID_REPORT3', 'ID_REPORT4', 'ID_REPORT5'
);
}
/**
* Patch for reports by The Answer (17-10-2k8)
*
*
* @name reportsPatch
*
* param
* @return void
*/
public function reportsPatch()
{
require_once 'classes/model/AppDelegation.php';
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$oCriteria->addSelectColumn(AppDelegationPeer::APP_UID);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_DURATION);
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$oAppDelegation = new AppDelegation();
$aData['APP_UID'] = $aRow['APP_UID'];
$aData['DEL_INDEX'] = $aRow['DEL_INDEX'];
$aData['DEL_DELEGATE_DATE'] = $aRow['DEL_DELEGATE_DATE'];
if ($aRow['DEL_INIT_DATE'] == null) {
$aData['DEL_INIT_DATE'] = $aRow['DEL_DELEGATE_DATE'];
} else {
$aData['DEL_INIT_DATE'] = $aRow['DEL_INIT_DATE'];
}
//$aData['DEL_FINISH_DATE']=$aRow['DEL_FINISH_DATE'];
if ($aRow['DEL_DURATION'] != 0) {
$oDates = new dates();
$aData['DEL_DURATION'] = $oDates->calculateDuration($aData['DEL_INIT_DATE'], $aRow['DEL_FINISH_DATE'], null, null, $aRow['TAS_UID']);
}
$oAppDelegation->update($aData);
$oDataset->next();
}
return;
}
}

View File

@@ -1,45 +1,14 @@
<?php
/**
* class.reportTables.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* ReportTables - Report tables class
*
* @package workflow.engine.ProcessMaker
* @author Julio Cesar Laura Avenda<EFBFBD>o
* @copyright 2007 COLOSA
* ReportTables - Report tables
*/
class ReportTables
{
private $aDef = array ('mysql' => array ('number' => 'DOUBLE','char' => 'VARCHAR(255)','text' => 'TEXT','date' => 'DATETIME'
),'pgsql' => array ('number' => 'DOUBLE','char' => 'VARCHAR(255)','text' => 'TEXT','date' => 'DATETIME'
),'mssql' => array ('number' => 'FLOAT','char' => 'NVARCHAR(255)','text' => 'TEXT','date' => 'CHAR(19)'
) /* Changed DATETIME CHAR(19) for compatibility issues. */ );
private $aDef = array('mysql' => array('number' => 'DOUBLE', 'char' => 'VARCHAR(255)', 'text' => 'TEXT', 'date' => 'DATETIME'
), 'pgsql' => array('number' => 'DOUBLE', 'char' => 'VARCHAR(255)', 'text' => 'TEXT', 'date' => 'DATETIME'
), 'mssql' => array('number' => 'FLOAT', 'char' => 'NVARCHAR(255)', 'text' => 'TEXT', 'date' => 'CHAR(19)'
) /* Changed DATETIME CHAR(19) for compatibility issues. */);
//private $sPrefix = 'REP_';
private $sPrefix = '';
@@ -51,12 +20,12 @@ class ReportTables
* @param string $$sRepTabUid
* @return void
*/
public function deleteAllReportVars ($sRepTabUid = '')
public function deleteAllReportVars($sRepTabUid = '')
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ReportVarPeer::REP_TAB_UID, $sRepTabUid );
ReportVarPeer::doDelete( $oCriteria );
$oCriteria = new Criteria('workflow');
$oCriteria->add(ReportVarPeer::REP_TAB_UID, $sRepTabUid);
ReportVarPeer::doDelete($oCriteria);
} catch (Exception $oError) {
throw ($oError);
}
@@ -71,21 +40,21 @@ class ReportTables
* @param string $sConnection Conexion
* @return void
*/
public function dropTable ($sTableName, $sConnection = 'report')
public function dropTable($sTableName, $sConnection = 'report')
{
$sTableName = $this->sPrefix . $sTableName;
//we have to do the propel connection
$PropelDatabase = $this->chooseDB( $sConnection );
$con = Propel::getConnection( $PropelDatabase );
$PropelDatabase = $this->chooseDB($sConnection);
$con = Propel::getConnection($PropelDatabase);
$stmt = $con->createStatement();
try {
switch (DB_ADAPTER) {
case 'mysql':
$rs = $stmt->executeQuery( 'DROP TABLE IF EXISTS `' . $sTableName . '`' );
$rs = $stmt->executeQuery('DROP TABLE IF EXISTS `' . $sTableName . '`');
break;
case 'mssql':
$rs = $stmt->executeQuery( "IF OBJECT_ID (N'" . $sTableName . "', N'U') IS NOT NULL
DROP TABLE [" . $sTableName . "]" );
$rs = $stmt->executeQuery("IF OBJECT_ID (N'" . $sTableName . "', N'U') IS NOT NULL
DROP TABLE [" . $sTableName . "]");
break;
}
} catch (Exception $oError) {
@@ -105,12 +74,12 @@ class ReportTables
* @param string $bDefaultFields
* @return void
*/
public function createTable ($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $bDefaultFields = true)
public function createTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $bDefaultFields = true)
{
$sTableName = $this->sPrefix . $sTableName;
//we have to do the propel connection
$PropelDatabase = $this->chooseDB( $sConnection );
$con = Propel::getConnection( $PropelDatabase );
$PropelDatabase = $this->chooseDB($sConnection);
$con = Propel::getConnection($PropelDatabase);
$stmt = $con->createStatement();
try {
switch (DB_ADAPTER) {
@@ -142,7 +111,7 @@ class ReportTables
$sQuery .= 'PRIMARY KEY (APP_UID' . ($sType == 'GRID' ? ',ROW' : '') . ')) ';
}
$sQuery .= ' DEFAULT CHARSET=utf8;';
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
break;
case 'mssql':
$sQuery = 'CREATE TABLE [' . $sTableName . '] (';
@@ -174,7 +143,7 @@ class ReportTables
$sQuery .= ' ';
}
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
break;
}
@@ -196,88 +165,88 @@ class ReportTables
* @param string $sGrid
* @return void
*/
public function populateTable ($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
public function populateTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
{
$sTableName = $this->sPrefix . $sTableName;
//we have to do the propel connection
$PropelDatabase = $this->chooseDB( $sConnection );
$con = Propel::getConnection( $PropelDatabase );
$PropelDatabase = $this->chooseDB($sConnection);
$con = Propel::getConnection($PropelDatabase);
$stmt = $con->createStatement();
if ($sType == 'GRID') {
$aAux = explode( '-', $sGrid );
$aAux = explode('-', $sGrid);
$sGrid = $aAux[0];
}
try {
switch (DB_ADAPTER) {
case 'mysql':
//select cases for this Process, ordered by APP_NUMBER
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ApplicationPeer::PRO_UID, $sProcessUid );
$oCriteria->addAscendingOrderByColumn( ApplicationPeer::APP_NUMBER );
$oDataset = ApplicationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oCriteria = new Criteria('workflow');
$oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUid);
$oCriteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
$oDataset = ApplicationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aData = unserialize( $aRow['APP_DATA'] );
$aData = unserialize($aRow['APP_DATA']);
//delete previous record from this report table ( previous records in case this is a grid )
$deleteSql = 'DELETE FROM `' . $sTableName . "` WHERE APP_UID = '" . $aRow['APP_UID'] . "'";
$rsDel = $stmt->executeQuery( $deleteSql );
$rsDel = $stmt->executeQuery($deleteSql);
if ($sType == 'NORMAL') {
$sQuery = 'INSERT INTO `' . $sTableName . '` (';
$sQuery .= '`APP_UID`,`APP_NUMBER`';
foreach ($aFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int) $aRow['APP_NUMBER'];
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'];
foreach ($aFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset( $aData[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aData[$aField['sFieldName']] ) : '0');
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(',', '', $aData[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (! isset( $aData[$aField['sFieldName']] )) {
if (!isset($aData[$aField['sFieldName']])) {
$aData[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset( $aData[$aField['sFieldName']] ) ? @mysql_real_escape_string( $aData[$aField['sFieldName']] ) : '') . "'";
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? @mysql_real_escape_string($aData[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$value = (isset( $aData[$aField['sFieldName']] ) && trim( $aData[$aField['sFieldName']] )) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL';
$value = (isset($aData[$aField['sFieldName']]) && trim($aData[$aField['sFieldName']])) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL';
$sQuery .= "," . $value;
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
} else {
if (isset( $aData[$sGrid] )) {
if (isset($aData[$sGrid])) {
foreach ($aData[$sGrid] as $iRow => $aGridRow) {
$sQuery = 'INSERT INTO `' . $sTableName . '` (';
$sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
foreach ($aFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int) $aRow['APP_NUMBER'] . ',' . $iRow;
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'] . ',' . $iRow;
foreach ($aFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset( $aGridRow[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aGridRow[$aField['sFieldName']] ) : '0');
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (! isset( $aGridRow[$aField['sFieldName']] )) {
if (!isset($aGridRow[$aField['sFieldName']])) {
$aGridRow[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? mysql_real_escape_string( $aGridRow[$aField['sFieldName']] ) : '') . "'";
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$value = (isset( $aGridRow[$aField['sFieldName']] ) && trim( $aGridRow[$aField['sFieldName']] )) != '' ? "'" . $aGridRow[$aField['sFieldName']] . "'" : 'NULL';
$value = (isset($aGridRow[$aField['sFieldName']]) && trim($aGridRow[$aField['sFieldName']])) != '' ? "'" . $aGridRow[$aField['sFieldName']] . "'" : 'NULL';
$sQuery .= "," . $value;
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
}
}
}
@@ -289,69 +258,69 @@ class ReportTables
* For SQLServer code
*/
case 'mssql':
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ApplicationPeer::PRO_UID, $sProcessUid );
$oCriteria->addAscendingOrderByColumn( ApplicationPeer::APP_NUMBER );
$oDataset = ApplicationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oCriteria = new Criteria('workflow');
$oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUid);
$oCriteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
$oDataset = ApplicationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aData = unserialize( $aRow['APP_DATA'] );
mysql_query( 'DELETE FROM [' . $sTableName . "] WHERE APP_UID = '" . $aRow['APP_UID'] . "'" );
$aData = unserialize($aRow['APP_DATA']);
mysql_query('DELETE FROM [' . $sTableName . "] WHERE APP_UID = '" . $aRow['APP_UID'] . "'");
if ($sType == 'NORMAL') {
$sQuery = 'INSERT INTO [' . $sTableName . '] (';
$sQuery .= '[APP_UID],[APP_NUMBER]';
foreach ($aFields as $aField) {
$sQuery .= ',[' . $aField['sFieldName'] . ']';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int) $aRow['APP_NUMBER'];
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'];
foreach ($aFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset( $aData[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aData[$aField['sFieldName']] ) : '0');
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(',', '', $aData[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (! isset( $aData[$aField['sFieldName']] )) {
if (!isset($aData[$aField['sFieldName']])) {
$aData[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset( $aData[$aField['sFieldName']] ) ? mysql_real_escape_string( $aData[$aField['sFieldName']] ) : '') . "'";
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysql_real_escape_string($aData[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset( $aData[$aField['sFieldName']] ) ? $aData[$aField['sFieldName']] : '') . "'";
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? $aData[$aField['sFieldName']] : '') . "'";
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
} else {
if (isset( $aData[$sGrid] )) {
if (isset($aData[$sGrid])) {
foreach ($aData[$sGrid] as $iRow => $aGridRow) {
$sQuery = 'INSERT INTO [' . $sTableName . '] (';
$sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
foreach ($aFields as $aField) {
$sQuery .= ',[' . $aField['sFieldName'] . ']';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int) $aRow['APP_NUMBER'] . ',' . $iRow;
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'] . ',' . $iRow;
foreach ($aFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset( $aGridRow[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aGridRow[$aField['sFieldName']] ) : '0');
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (! isset( $aGridRow[$aField['sFieldName']] )) {
if (!isset($aGridRow[$aField['sFieldName']])) {
$aGridRow[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? mysql_real_escape_string( $aGridRow[$aField['sFieldName']] ) : '') . "'";
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? $aGridRow[$aField['sFieldName']] : '') . "'";
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
}
}
}
@@ -373,21 +342,21 @@ class ReportTables
* @param boolean $bWhitType
* @return void
*/
public function getTableVars ($sRepTabUid, $bWhitType = false)
public function getTableVars($sRepTabUid, $bWhitType = false)
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ReportVarPeer::REP_TAB_UID, $sRepTabUid );
$oDataset = ReportVarPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oCriteria = new Criteria('workflow');
$oCriteria->add(ReportVarPeer::REP_TAB_UID, $sRepTabUid);
$oDataset = ReportVarPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aVars = array ();
$aImportedVars = array (); //This array will help to control if the variable already exist
$aVars = array();
$aImportedVars = array(); //This array will help to control if the variable already exist
while ($aRow = $oDataset->getRow()) {
if ($bWhitType) {
if (! in_array( $aRow['REP_VAR_NAME'], $aImportedVars )) {
if (!in_array($aRow['REP_VAR_NAME'], $aImportedVars)) {
$aImportedVars[] = $aRow['REP_VAR_NAME'];
$aVars[] = array ('sFieldName' => $aRow['REP_VAR_NAME'],'sType' => $aRow['REP_VAR_TYPE']
$aVars[] = array('sFieldName' => $aRow['REP_VAR_NAME'], 'sType' => $aRow['REP_VAR_TYPE']
);
}
} else {
@@ -409,17 +378,17 @@ class ReportTables
* @param string $sRepTabUid
* @return void
*/
public function deleteReportTable ($sRepTabUid)
public function deleteReportTable($sRepTabUid)
{
try {
$oReportTable = new ReportTable();
$aFields = $oReportTable->load( $sRepTabUid );
if (! (empty( $aFields ))) {
$this->dropTable( $aFields['REP_TAB_NAME'], $aFields['REP_TAB_CONNECTION'] );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ReportVarPeer::REP_TAB_UID, $sRepTabUid );
$oDataset = ReportVarPeer::doDelete( $oCriteria );
$oReportTable->remove( $sRepTabUid );
$aFields = $oReportTable->load($sRepTabUid);
if (!(empty($aFields))) {
$this->dropTable($aFields['REP_TAB_NAME'], $aFields['REP_TAB_CONNECTION']);
$oCriteria = new Criteria('workflow');
$oCriteria->add(ReportVarPeer::REP_TAB_UID, $sRepTabUid);
$oDataset = ReportVarPeer::doDelete($oCriteria);
$oReportTable->remove($sRepTabUid);
}
} catch (Exception $oError) {
throw ($oError);
@@ -435,22 +404,22 @@ class ReportTables
* @param string $mask
* @return array
*/
public function getSplitDate ($date, $mask)
public function getSplitDate($date, $mask)
{
$sw1 = false;
for ($i = 0; $i < 3; $i ++) {
$item = substr( $mask, $i * 2, 1 );
for ($i = 0; $i < 3; $i++) {
$item = substr($mask, $i * 2, 1);
switch ($item) {
case 'Y':
switch ($i) {
case 0:
$d1 = substr( $date, 0, 4 );
$d1 = substr($date, 0, 4);
break;
case 1:
$d1 = substr( $date, 3, 4 );
$d1 = substr($date, 3, 4);
break;
case 2:
$d1 = substr( $date, 6, 4 );
$d1 = substr($date, 6, 4);
break;
}
$sw1 = true;
@@ -458,45 +427,45 @@ class ReportTables
case 'y':
switch ($i) {
case 0:
$d1 = substr( $date, 0, 2 );
$d1 = substr($date, 0, 2);
break;
case 1:
$d1 = substr( $date, 3, 2 );
$d1 = substr($date, 3, 2);
break;
case 2:
$d1 = substr( $date, 6, 2 );
$d1 = substr($date, 6, 2);
break;
}
break;
case 'm':
switch ($i) {
case 0:
$d2 = substr( $date, 0, 2 );
$d2 = substr($date, 0, 2);
break;
case 1:
$d2 = ($sw1) ? substr( $date, 5, 2 ) : substr( $date, 3, 2 );
$d2 = ($sw1) ? substr($date, 5, 2) : substr($date, 3, 2);
break;
case 2:
$d2 = ($sw1) ? substr( $date, 8, 2 ) : substr( $date, 5, 2 );
$d2 = ($sw1) ? substr($date, 8, 2) : substr($date, 5, 2);
break;
}
break;
case 'd':
switch ($i) {
case 0:
$d3 = substr( $date, 0, 2 );
$d3 = substr($date, 0, 2);
break;
case 1:
$d3 = ($sw1) ? substr( $date, 5, 2 ) : substr( $date, 3, 2 );
$d3 = ($sw1) ? substr($date, 5, 2) : substr($date, 3, 2);
break;
case 2:
$d3 = ($sw1) ? substr( $date, 8, 2 ) : substr( $date, 5, 2 );
$d3 = ($sw1) ? substr($date, 8, 2) : substr($date, 5, 2);
break;
}
break;
}
}
return Array (isset( $d1 ) ? $d1 : '',isset( $d2 ) ? $d2 : '',isset( $d3 ) ? $d3 : ''
return Array(isset($d1) ? $d1 : '', isset($d2) ? $d2 : '', isset($d3) ? $d3 : ''
);
}
@@ -509,30 +478,30 @@ class ReportTables
* @param date $sMask
* @return date
*/
public function getFormatDate ($sDate, $sMask)
public function getFormatDate($sDate, $sMask)
{
//print $sDate." *** ". $sMask."<BR>";
$dateTime = explode( " ", $sDate ); //To accept the Hour part
$aDate = explode( '-', str_replace( "/", "-", $dateTime[0] ) );
$dateTime = explode(" ", $sDate); //To accept the Hour part
$aDate = explode('-', str_replace("/", "-", $dateTime[0]));
$bResult = true;
foreach ($aDate as $sDate) {
if (! is_numeric( $sDate )) {
if (!is_numeric($sDate)) {
$bResult = false;
break;
}
}
if ($sMask != '') {
$aDate = $this->getSplitDate( $dateTime[0], $sMask );
$aDate[0] = ($aDate[0] == '') ? date( 'Y' ) : $aDate[0];
$aDate[1] = ($aDate[1] == '') ? date( 'm' ) : $aDate[1];
$aDate[2] = ($aDate[2] == '') ? date( 'd' ) : $aDate[2];
if (checkdate( $aDate[1], $aDate[2], $aDate[0] )) {
$aDate = $this->getSplitDate($dateTime[0], $sMask);
$aDate[0] = ($aDate[0] == '') ? date('Y') : $aDate[0];
$aDate[1] = ($aDate[1] == '') ? date('m') : $aDate[1];
$aDate[2] = ($aDate[2] == '') ? date('d') : $aDate[2];
if (checkdate($aDate[1], $aDate[2], $aDate[0])) {
} else {
return false;
}
}
$sDateC = '';
for ($i = 0; $i < count( $aDate ); $i ++) {
for ($i = 0; $i < count($aDate); $i++) {
$sDateC .= (($i == 0) ? "" : "-") . $aDate[$i];
}
return ($sDateC);
@@ -549,7 +518,7 @@ class ReportTables
* @param string $aFields
* @return void
*/
public function updateTables ($sProcessUid, $sApplicationUid, $iApplicationNumber, $aFields)
public function updateTables($sProcessUid, $sApplicationUid, $iApplicationNumber, $aFields)
{
try {
$c = new Criteria('workflow');
@@ -562,73 +531,73 @@ class ReportTables
$isBpmn = isset($row['PRJ_UID']);
if (!class_exists('ReportTablePeer')) {
require_once 'classes/model/ReportTablePeer.php';
}
require_once 'classes/model/ReportTablePeer.php';
}
//get all Active Report Tables
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ReportTablePeer::PRO_UID, $sProcessUid );
$oCriteria->add( ReportTablePeer::REP_TAB_STATUS, 'ACTIVE' );
$oDataset = ReportTablePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oCriteria = new Criteria('workflow');
$oCriteria->add(ReportTablePeer::PRO_UID, $sProcessUid);
$oCriteria->add(ReportTablePeer::REP_TAB_STATUS, 'ACTIVE');
$oDataset = ReportTablePeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aVars = array ();
$aVars = array();
while ($aRow = $oDataset->getRow()) {
$aRow['REP_TAB_NAME'] = $this->sPrefix . $aRow['REP_TAB_NAME'];
$PropelDatabase = $this->chooseDB( $aRow['REP_TAB_CONNECTION'] );
$con = Propel::getConnection( $PropelDatabase );
$PropelDatabase = $this->chooseDB($aRow['REP_TAB_CONNECTION']);
$con = Propel::getConnection($PropelDatabase);
$stmt = $con->createStatement();
switch (DB_ADAPTER) {
case 'mysql':
$aTableFields = $this->getTableVars( $aRow['REP_TAB_UID'], true );
$aTableFields = $this->getTableVars($aRow['REP_TAB_UID'], true);
if ($aRow['REP_TAB_TYPE'] == 'NORMAL') {
$sqlExists = "SELECT * FROM `" . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
$rsExists = $stmt->executeQuery( $sqlExists, ResultSet::FETCHMODE_ASSOC );
$rsExists = $stmt->executeQuery($sqlExists, ResultSet::FETCHMODE_ASSOC);
$rsExists->next();
$aRow2 = $rsExists->getRow();
if (is_array( $aRow2 )) {
if (is_array($aRow2)) {
$sQuery = 'UPDATE `' . $aRow['REP_TAB_NAME'] . '` SET ';
foreach ($aTableFields as $aField) {
$sQuery .= '`' . $aField['sFieldName'] . '` = ';
if(!$isBpmn && !isset($aFields[$aField['sFieldName']])){
foreach($aFields as $row){
if(is_array($row) && isset($row[count($row)])){
$aFields = $row[count($row)];
}
}
if (!$isBpmn && !isset($aFields[$aField['sFieldName']])) {
foreach ($aFields as $row) {
if (is_array($row) && isset($row[count($row)])) {
$aFields = $row[count($row)];
}
}
}
switch ($aField['sType']) {
case 'number':
$sQuery .= (isset( $aFields[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aFields[$aField['sFieldName']] ) : '0') . ',';
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(',', '', $aFields[$aField['sFieldName']]) : '0') . ',';
break;
case 'char':
case 'text':
if (! isset( $aFields[$aField['sFieldName']] )) {
if (!isset($aFields[$aField['sFieldName']])) {
$aFields[$aField['sFieldName']] = '';
}
if (! isset( $aFields[$aField['sFieldName'] . '_label'] )) {
if (!isset($aFields[$aField['sFieldName'] . '_label'])) {
$aFields[$aField['sFieldName'] . '_label'] = '';
}
if(is_array($aFields[$aField['sFieldName']])){
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? $aFields[$aField['sFieldName']][0] : '') . "',";
}else{
$sQuery .= '\'' . ((isset($aFields[$aField['sFieldName']]))? @mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . '\',';
if (is_array($aFields[$aField['sFieldName']])) {
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']][0] : '') . "',";
} else {
$sQuery .= '\'' . ((isset($aFields[$aField['sFieldName']])) ? @mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . '\',';
}
break;
case 'date':
$mysqlDate = (isset( $aFields[$aField['sFieldName']] ) ? $aFields[$aField['sFieldName']] : '');
$mysqlDate = (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '');
if ($mysqlDate != '') {
$mysqlDate = str_replace( '/', '-', $mysqlDate );
$mysqlDate = date( 'Y-m-d', strtotime( $mysqlDate ) );
$mysqlDate = str_replace('/', '-', $mysqlDate);
$mysqlDate = date('Y-m-d', strtotime($mysqlDate));
}
$value = trim( $mysqlDate ) != '' ? "'" . $mysqlDate . "'" : 'NULL';
$value = trim($mysqlDate) != '' ? "'" . $mysqlDate . "'" : 'NULL';
$sQuery .= $value . ",";
break;
}
}
$sQuery = substr( $sQuery, 0, - 1 );
$sQuery = substr($sQuery, 0, -1);
$sQuery .= " WHERE APP_UID = '" . $sApplicationUid . "'";
} else {
$sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` (';
@@ -636,40 +605,40 @@ class ReportTables
foreach ($aTableFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`';
}
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int) $iApplicationNumber;
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber;
foreach ($aTableFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset( $aFields[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aFields[$aField['sFieldName']] ) : '0');
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(',', '', $aFields[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (! isset( $aFields[$aField['sFieldName']] )) {
if (!isset($aFields[$aField['sFieldName']])) {
$aFields[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset( $aFields[$aField['sFieldName']] ) ? mysql_real_escape_string( $aFields[$aField['sFieldName']] ) : '') . "'";
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$mysqlDate = (isset( $aFields[$aField['sFieldName']] ) ? $aFields[$aField['sFieldName']] : '');
$mysqlDate = (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '');
if ($mysqlDate != '') {
$mysqlDate = str_replace( '/', '-', $mysqlDate );
$mysqlDate = date( 'Y-m-d', strtotime( $mysqlDate ) );
$mysqlDate = str_replace('/', '-', $mysqlDate);
$mysqlDate = date('Y-m-d', strtotime($mysqlDate));
}
$value = trim( $mysqlDate ) != '' ? "'" . $mysqlDate . "'" : 'NULL';
$value = trim($mysqlDate) != '' ? "'" . $mysqlDate . "'" : 'NULL';
$sQuery .= "," . $value;
break;
}
}
$sQuery .= ')';
}
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
} else {
//remove old rows from database
$sqlDelete = 'DELETE FROM `' . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
$rsDelete = $stmt->executeQuery( $sqlDelete );
$rsDelete = $stmt->executeQuery($sqlDelete);
$aAux = explode( '-', $aRow['REP_TAB_GRID'] );
if (isset( $aFields[$aAux[0]] )) {
$aAux = explode('-', $aRow['REP_TAB_GRID']);
if (isset($aFields[$aAux[0]])) {
if (is_array($aFields[$aAux[0]])) {
foreach ($aFields[$aAux[0]] as $iRow => $aGridRow) {
$sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` (';
@@ -677,26 +646,26 @@ class ReportTables
foreach ($aTableFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`';
}
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int) $iApplicationNumber . ',' . $iRow;
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber . ',' . $iRow;
foreach ($aTableFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset( $aGridRow[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aGridRow[$aField['sFieldName']] ) : '0');
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (! isset( $aGridRow[$aField['sFieldName']] )) {
if (!isset($aGridRow[$aField['sFieldName']])) {
$aGridRow[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? mysql_real_escape_string( $aGridRow[$aField['sFieldName']] ) : '') . "'";
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? $aGridRow[$aField['sFieldName']] : '') . "'";
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
}
}
}
@@ -707,30 +676,30 @@ class ReportTables
* For SQLServer code
*/
case 'mssql':
$aTableFields = $this->getTableVars( $aRow['REP_TAB_UID'], true );
$aTableFields = $this->getTableVars($aRow['REP_TAB_UID'], true);
if ($aRow['REP_TAB_TYPE'] == 'NORMAL') {
$oDataset2 = mssql_query( "SELECT * FROM [" . $aRow['REP_TAB_NAME'] . "] WHERE APP_UID = '" . $sApplicationUid . "'" );
if ($aRow2 = mssql_fetch_row( $oDataset2 )) {
$oDataset2 = mssql_query("SELECT * FROM [" . $aRow['REP_TAB_NAME'] . "] WHERE APP_UID = '" . $sApplicationUid . "'");
if ($aRow2 = mssql_fetch_row($oDataset2)) {
$sQuery = 'UPDATE [' . $aRow['REP_TAB_NAME'] . '] SET ';
foreach ($aTableFields as $aField) {
$sQuery .= '[' . $aField['sFieldName'] . '] = ';
switch ($aField['sType']) {
case 'number':
$sQuery .= (isset( $aFields[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aFields[$aField['sFieldName']] ) : '0') . ',';
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(',', '', $aFields[$aField['sFieldName']]) : '0') . ',';
break;
case 'char':
case 'text':
if (! isset( $aFields[$aField['sFieldName']] )) {
if (!isset($aFields[$aField['sFieldName']])) {
$aFields[$aField['sFieldName']] = '';
}
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? mysql_real_escape_string( $aFields[$aField['sFieldName']] ) : '') . "',";
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . "',";
break;
case 'date':
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? $aFields[$aField['sFieldName']] : '') . "',";
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '') . "',";
break;
}
}
$sQuery = substr( $sQuery, 0, - 1 );
$sQuery = substr($sQuery, 0, -1);
$sQuery .= " WHERE APP_UID = '" . $sApplicationUid . "'";
} else {
$sQuery = 'INSERT INTO [' . $aRow['REP_TAB_NAME'] . '] (';
@@ -738,57 +707,57 @@ class ReportTables
foreach ($aTableFields as $aField) {
$sQuery .= ',[' . $aField['sFieldName'] . ']';
}
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int) $iApplicationNumber;
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber;
foreach ($aTableFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset( $aFields[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aFields[$aField['sFieldName']] ) : '0');
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(',', '', $aFields[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (! isset( $aFields[$aField['sFieldName']] )) {
if (!isset($aFields[$aField['sFieldName']])) {
$aFields[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset( $aFields[$aField['sFieldName']] ) ? mysql_real_escape_string( $aFields[$aField['sFieldName']] ) : '') . "'";
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset( $aFields[$aField['sFieldName']] ) ? $aFields[$aField['sFieldName']] : '') . "'";
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '') . "'";
break;
}
}
$sQuery .= ')';
}
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
} else {
mysql_query( 'DELETE FROM [' . $aRow['REP_TAB_NAME'] . "] WHERE APP_UID = '" . $sApplicationUid . "'" );
$aAux = explode( '-', $aRow['REP_TAB_GRID'] );
if (isset( $aFields[$aAux[0]] )) {
mysql_query('DELETE FROM [' . $aRow['REP_TAB_NAME'] . "] WHERE APP_UID = '" . $sApplicationUid . "'");
$aAux = explode('-', $aRow['REP_TAB_GRID']);
if (isset($aFields[$aAux[0]])) {
foreach ($aFields[$aAux[0]] as $iRow => $aGridRow) {
$sQuery = 'INSERT INTO [' . $aRow['REP_TAB_NAME'] . '] (';
$sQuery .= '[APP_UID],[APP_NUMBER],[ROW]';
foreach ($aTableFields as $aField) {
$sQuery .= ',[' . $aField['sFieldName'] . ']';
}
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int) $iApplicationNumber . ',' . $iRow;
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber . ',' . $iRow;
foreach ($aTableFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset( $aGridRow[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aGridRow[$aField['sFieldName']] ) : '0');
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (! isset( $aGridRow[$aField['sFieldName']] )) {
if (!isset($aGridRow[$aField['sFieldName']])) {
$aGridRow[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? mysql_real_escape_string( $aGridRow[$aField['sFieldName']] ) : '') . "'";
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? $aGridRow[$aField['sFieldName']] : '') . "'";
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery( $sQuery );
$rs = $stmt->executeQuery($sQuery);
}
}
}
@@ -809,10 +778,10 @@ class ReportTables
* @access public
* @return boolean
*/
public function tableExist ()
public function tableExist()
{
$bExists = true;
$sDataBase = 'database_' . strtolower( DB_ADAPTER );
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
$oDataBase = new database();
$bExists = $oDataBase->reportTableExist();
@@ -828,9 +797,9 @@ class ReportTables
* @param string $TabConnectionk
* @return string
*/
public function chooseDB ($TabConnectionk)
public function chooseDB($TabConnectionk)
{
$repTabConnection = trim( strtoupper( $TabConnectionk ) );
$repTabConnection = trim(strtoupper($TabConnectionk));
$PropelDatabase = 'rp';
if ($repTabConnection == '' || $repTabConnection == 'REPORT') {
$PropelDatabase = 'rp';
@@ -844,4 +813,3 @@ class ReportTables
return ($PropelDatabase);
}
}

View File

@@ -1,39 +1,9 @@
<?php
/**
* class.serverConfiguration.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
* ServerConfiguration - serverConf
*/
/**
* ServerConfiguration - serverConf class
*
* @author Hugo Loza
* @copyright 2010 COLOSA
* @license GNU Affero General Public License
* @package workflow.engine.ProcessMaker
*/
class serverConf
class ServerConf
{
private $_aProperties = array();
@@ -79,7 +49,7 @@ class serverConf
public static function &getSingleton()
{
if (self::$instance == null) {
self::$instance = new serverConf();
self::$instance = new ServerConf();
if ((file_exists(self::$instance->filePath)) && (filesize(self::$instance->filePath) > 0)) {
self::$instance->unSerializeInstance(file_get_contents(self::$instance->filePath));
}
@@ -107,10 +77,10 @@ class serverConf
public function unSerializeInstance($serialized)
{
if (self::$instance == null) {
self::$instance = new serverConf();
self::$instance = new ServerConf();
}
if ($instance = @unserialize($serialized)) {
if ($instance = unserialize($serialized)) {
self::$instance = $instance;
}
}
@@ -271,11 +241,10 @@ class serverConf
$wsInfo = $this->aWSinfo[$file];
} else {
$wsInfo['num_processes'] = "not gathered yet";
$wsInfo['num_cases'] = "not gathered yet";
;
$wsInfo['num_cases'] = "not gathered yet";;
$wsInfo['num_users'] = "not gathered yet";
}
$wsArray[$file] = array ('WSP_ID' => $file,'WSP_NAME' => $file,'WSP_STATUS' => $statusl,'WSP_PROCESS_COUNT' => $wsInfo['num_processes'],'WSP_CASES_COUNT' => $wsInfo['num_cases'],'WSP_USERS_COUNT' => isset( $wsInfo['num_users'] ) ? $wsInfo['num_users'] : "");
$wsArray[$file] = array('WSP_ID' => $file, 'WSP_NAME' => $file, 'WSP_STATUS' => $statusl, 'WSP_PROCESS_COUNT' => $wsInfo['num_processes'], 'WSP_CASES_COUNT' => $wsInfo['num_cases'], 'WSP_USERS_COUNT' => isset($wsInfo['num_users']) ? $wsInfo['num_users'] : "");
if (isset($this->workspaces[$file]['WSP_LOGINS'])) {
$wsArray[$file]['WSP_LOGINS'] = $this->workspaces[$file]['WSP_LOGINS'];
}
@@ -317,7 +286,7 @@ class serverConf
$Criteria = new Criteria('workflow');
$Criteria->add(UsersPeer::USR_STATUS, array('DELETED', 'DISABLED'
), CRITERIA::NOT_IN);
), CRITERIA::NOT_IN);
$aResult['num_users'] = UsersPeer::doCount($Criteria);
return $aResult;
}
@@ -346,7 +315,7 @@ class serverConf
{
$sMySQLVersion = '?????';
if (defined("DB_HOST")) {
$dbNetView = new NET(DB_HOST);
$dbNetView = new Net(DB_HOST);
$dbNetView->loginDbServer(DB_USER, DB_PASS);
$dbConns = new DbConnections('');

View File

@@ -27,13 +27,11 @@
require_once 'classes/model/Session.php';
/**
* Sessions - Sessions
* /**
* Sessions - Sessions class
*
* @package workflow.engine.ProcessMaker
* @author Everth S. Berrios Morales
* @copyright 2008 COLOSA
*/
class Sessions
{
@@ -47,7 +45,7 @@ class Sessions
* @param string $sSessionId
* @return void
*/
public function __construct ($sSessionId = NULL)
public function __construct($sSessionId = NULL)
{
$this->sessionId = $sSessionId;
}
@@ -61,27 +59,27 @@ class Sessions
* @param string sSessionId
* @return array
*/
public function getSessionUser ($sSessionId = NULL)
public function getSessionUser($sSessionId = NULL)
{
try {
if ($sSessionId != NULL) {
$this->sessionId = $sSessionId;
} else if ($this->sessionId == NULL) {
throw new Exception( 'session id was not set.' );
throw new Exception('session id was not set.');
}
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( SessionPeer::USR_UID );
$oCriteria->addSelectColumn( SessionPeer::SES_STATUS );
$oCriteria->addSelectColumn( SessionPeer::SES_DUE_DATE );
$oCriteria->add( SessionPeer::SES_UID, $this->sessionId );
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(SessionPeer::USR_UID);
$oCriteria->addSelectColumn(SessionPeer::SES_STATUS);
$oCriteria->addSelectColumn(SessionPeer::SES_DUE_DATE);
$oCriteria->add(SessionPeer::SES_UID, $this->sessionId);
$oDataset = SessionPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset = SessionPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
if (! is_array( $aRow )) {
if (!is_array($aRow)) {
$this->deleteTmpfile();
}
return $aRow;
@@ -99,30 +97,30 @@ class Sessions
* @param string sSessionId
* @return array
*/
public function verifySession ($sSessionId = NULL)
public function verifySession($sSessionId = NULL)
{
try {
if ($sSessionId != NULL) {
$this->sessionId = $sSessionId;
} else if ($this->sessionId == NULL) {
throw new Exception( 'session id was not set.' );
throw new Exception('session id was not set.');
}
$date = date( 'Y-m-d H:i:s' );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( SessionPeer::USR_UID );
$oCriteria->addSelectColumn( SessionPeer::SES_STATUS );
$oCriteria->addSelectColumn( SessionPeer::SES_DUE_DATE );
$oCriteria->add( SessionPeer::SES_UID, $this->sessionId );
$oCriteria->add( SessionPeer::SES_STATUS, 'ACTIVE' );
$oCriteria->add( SessionPeer::SES_DUE_DATE, $date, Criteria::GREATER_EQUAL );
$date = date('Y-m-d H:i:s');
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(SessionPeer::USR_UID);
$oCriteria->addSelectColumn(SessionPeer::SES_STATUS);
$oCriteria->addSelectColumn(SessionPeer::SES_DUE_DATE);
$oCriteria->add(SessionPeer::SES_UID, $this->sessionId);
$oCriteria->add(SessionPeer::SES_STATUS, 'ACTIVE');
$oCriteria->add(SessionPeer::SES_DUE_DATE, $date, Criteria::GREATER_EQUAL);
$oDataset = SessionPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset = SessionPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
if (! is_array( $aRow )) {
if (!is_array($aRow)) {
$this->deleteTmpfile();
}
@@ -142,32 +140,32 @@ class Sessions
* @param string $value
* @return void
*/
public function registerGlobal ($name, $value)
public function registerGlobal($name, $value)
{
$this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
if ($this->sessionId == NULL) {
throw new Exception( 'session id was not set.' );
throw new Exception('session id was not set.');
}
$tmpfile_content = '';
if (is_file( $this->tmpfile ) && trim( file_get_contents( $this->tmpfile ) ) != '') {
$tmpfile_content = file_get_contents( $this->tmpfile );
if (is_file($this->tmpfile) && trim(file_get_contents($this->tmpfile)) != '') {
$tmpfile_content = file_get_contents($this->tmpfile);
}
//getting the global array
if ($tmpfile_content != '') {
$this->globals = unserialize( $tmpfile_content );
$this->globals = unserialize($tmpfile_content);
} else {
$this->globals = Array ();
$this->globals = Array();
}
//registering the new global variable
$this->globals[$name] = $value;
//saving the global array
$tmpfile_content = serialize( $this->globals );
file_put_contents( $this->tmpfile, $tmpfile_content );
$tmpfile_content = serialize($this->globals);
file_put_contents($this->tmpfile, $tmpfile_content);
}
@@ -180,28 +178,28 @@ class Sessions
* @param string $name
* @return string
*/
public function getGlobal ($name)
public function getGlobal($name)
{
$this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
if ($this->sessionId == NULL) {
throw new Exception( 'session id was not set.' );
throw new Exception('session id was not set.');
}
$tmpfile_content = '';
if (is_file( $this->tmpfile ) && trim( file_get_contents( $this->tmpfile ) ) != '') {
$tmpfile_content = file_get_contents( $this->tmpfile );
if (is_file($this->tmpfile) && trim(file_get_contents($this->tmpfile)) != '') {
$tmpfile_content = file_get_contents($this->tmpfile);
}
//getting the global array
if ($tmpfile_content != '') {
$this->globals = unserialize( $tmpfile_content );
$this->globals = unserialize($tmpfile_content);
} else {
$this->globals = Array ();
$this->globals = Array();
}
//getting the new global variable
if (isset( $this->globals[$name] )) {
if (isset($this->globals[$name])) {
return $this->globals[$name];
} else {
return '';
@@ -217,24 +215,24 @@ class Sessions
* @param string $name
* @return array
*/
public function getGlobals ()
public function getGlobals()
{
$this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
if ($this->sessionId == NULL) {
throw new Exception( 'session id was not set.' );
throw new Exception('session id was not set.');
}
$tmpfile_content = '';
if (is_file( $this->tmpfile ) && trim( file_get_contents( $this->tmpfile ) ) != '') {
$tmpfile_content = file_get_contents( $this->tmpfile );
if (is_file($this->tmpfile) && trim(file_get_contents($this->tmpfile)) != '') {
$tmpfile_content = file_get_contents($this->tmpfile);
}
//getting the global array
if ($tmpfile_content != '') {
$this->globals = unserialize( $tmpfile_content );
$this->globals = unserialize($tmpfile_content);
} else {
$this->globals = Array ();
$this->globals = Array();
}
return $this->globals;
}
@@ -248,31 +246,13 @@ class Sessions
* param
* @return void
*/
private function deleteTmpfile ()
private function deleteTmpfile()
{
if ($this->sessionId == NULL) {
throw new Exception( 'session id was not set.' );
throw new Exception('session id was not set.');
}
$this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
@unlink( $this->tmpfile );
@unlink($this->tmpfile);
}
}

View File

@@ -1,30 +1,4 @@
<?php
/**
* class.spool.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* spoolRun - brief send email from the spool database, and see if we have all the addresses we send to.
*
@@ -34,26 +8,12 @@
* @link http://www.openmail.cc
*/
/**
* LOG FIXES
* =========
*
* 24-03-2010 Erik A.O. <erik@colosa.com>
* class: the $ExceptionCode and $aWarnings class attributes were added
* function handleFrom(): Validations for invalid data for {$this->fileData['from_email']} were added
* function resendEmails(): handler for warnings was added and fixes
* function getWarnings(): added
* function sendMail(): now is handling the exception
*/
require_once ('classes/model/AppMessage.php');
use ProcessMaker\Core\System;
/**
*
* @package workflow.engine.ProcessMaker
*/
class spoolRun
class SpoolRun
{
public $config;
private $fileData;
@@ -61,8 +21,8 @@ class spoolRun
public $status;
public $error;
private $ExceptionCode = Array (); //Array to define the Expetion codes
private $aWarnings = Array (); //Array to store the warning that were throws by the class
private $ExceptionCode = Array(); //Array to define the Expetion codes
private $aWarnings = Array(); //Array to store the warning that were throws by the class
private $longMailEreg;
@@ -74,10 +34,10 @@ class spoolRun
* @param none
* @return none
*/
public function __construct ()
public function __construct()
{
$this->config = array ();
$this->fileData = array ();
$this->config = array();
$this->fileData = array();
$this->spool_id = '';
$this->status = 'pending';
$this->error = '';
@@ -96,35 +56,35 @@ class spoolRun
* @param none
* @return none
*/
public function getSpoolFilesList ()
public function getSpoolFilesList()
{
$sql = "SELECT * FROM APP_MESSAGE WHERE APP_MSG_STATUS ='pending'";
$con = Propel::getConnection( "workflow" );
$stmt = $con->prepareStatement( $sql );
$con = Propel::getConnection("workflow");
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery();
while ($rs->next()) {
$this->spool_id = $rs->getString( 'APP_MSG_UID' );
$this->fileData['subject'] = $rs->getString( 'APP_MSG_SUBJECT' );
$this->fileData['from'] = $rs->getString( 'APP_MSG_FROM' );
$this->fileData['to'] = $rs->getString( 'APP_MSG_TO' );
$this->fileData['body'] = $rs->getString( 'APP_MSG_BODY' );
$this->fileData['date'] = $rs->getString( 'APP_MSG_DATE' );
$this->fileData['cc'] = $rs->getString( 'APP_MSG_CC' );
$this->fileData['bcc'] = $rs->getString( 'APP_MSG_BCC' );
$this->fileData['template'] = $rs->getString( 'APP_MSG_TEMPLATE' );
$this->fileData['attachments'] = array (); //$rs->getString('APP_MSG_ATTACH');
$this->fileData['error'] = $rs->getString( 'APP_MSG_ERROR' );
$this->spool_id = $rs->getString('APP_MSG_UID');
$this->fileData['subject'] = $rs->getString('APP_MSG_SUBJECT');
$this->fileData['from'] = $rs->getString('APP_MSG_FROM');
$this->fileData['to'] = $rs->getString('APP_MSG_TO');
$this->fileData['body'] = $rs->getString('APP_MSG_BODY');
$this->fileData['date'] = $rs->getString('APP_MSG_DATE');
$this->fileData['cc'] = $rs->getString('APP_MSG_CC');
$this->fileData['bcc'] = $rs->getString('APP_MSG_BCC');
$this->fileData['template'] = $rs->getString('APP_MSG_TEMPLATE');
$this->fileData['attachments'] = array(); //$rs->getString('APP_MSG_ATTACH');
$this->fileData['error'] = $rs->getString('APP_MSG_ERROR');
if ($this->config['MESS_ENGINE'] == 'OPENMAIL') {
if ($this->config['MESS_SERVER'] != '') {
if (($sAux = @gethostbyaddr( $this->config['MESS_SERVER'] ))) {
if (($sAux = @gethostbyaddr($this->config['MESS_SERVER']))) {
$this->fileData['domain'] = $sAux;
} else {
$this->fileData['domain'] = $this->config['MESS_SERVER'];
}
} else {
$this->fileData['domain'] = gethostbyaddr( '127.0.0.1' );
$this->fileData['domain'] = gethostbyaddr('127.0.0.1');
}
}
$this->sendMail();
@@ -137,7 +97,7 @@ class spoolRun
* @param array $aData
* @return none
*/
public function create ($aData)
public function create($aData)
{
if (is_array($aData['app_msg_attach'])) {
$attachment = $aData['app_msg_attach'];
@@ -149,16 +109,16 @@ class spoolRun
}
$aData['app_msg_attach'] = serialize($attachment);
$aData['app_msg_show_message'] = (isset($aData['app_msg_show_message'])) ? $aData['app_msg_show_message'] : 1;
$aData["app_msg_error"] = (isset($aData["app_msg_error"]))? $aData["app_msg_error"] : '';
$sUID = $this->db_insert( $aData );
$aData["app_msg_error"] = (isset($aData["app_msg_error"])) ? $aData["app_msg_error"] : '';
$sUID = $this->db_insert($aData);
$aData['app_msg_date'] = isset( $aData['app_msg_date'] ) ? $aData['app_msg_date'] : '';
$aData['app_msg_date'] = isset($aData['app_msg_date']) ? $aData['app_msg_date'] : '';
if (isset( $aData['app_msg_status'] )) {
$this->status = strtolower( $aData['app_msg_status'] );
if (isset($aData['app_msg_status'])) {
$this->status = strtolower($aData['app_msg_status']);
}
$aData["contentTypeIsHtml"] = (isset($aData["contentTypeIsHtml"]))? $aData["contentTypeIsHtml"] : true;
$aData["contentTypeIsHtml"] = (isset($aData["contentTypeIsHtml"])) ? $aData["contentTypeIsHtml"] : true;
$this->setData($sUID, $aData["app_msg_subject"], $aData["app_msg_from"], $aData["app_msg_to"], $aData["app_msg_body"], $aData["app_msg_date"], $aData["app_msg_cc"], $aData["app_msg_bcc"], $aData["app_msg_template"], $aData["app_msg_attach"], $aData["contentTypeIsHtml"], $aData["app_msg_error"]);
}
@@ -169,7 +129,7 @@ class spoolRun
* @param array $aConfig
* @return none
*/
public function setConfig ($aConfig)
public function setConfig($aConfig)
{
// Processing password
$passwd = isset($aConfig['MESS_PASSWORD']) ? $aConfig['MESS_PASSWORD'] : '';
@@ -186,17 +146,17 @@ class spoolRun
$aConfig['MESS_PASSWORD'] = $passwd;
// Validating authorization flag
if(!isset($aConfig['SMTPAuth'])){
if (isset($aConfig['MESS_RAUTH'])) {
if ($aConfig['MESS_RAUTH'] == false || (is_string($aConfig['MESS_RAUTH']) && $aConfig['MESS_RAUTH'] == 'false')) {
$aConfig['MESS_RAUTH'] = 0;
} else {
$aConfig['MESS_RAUTH'] = 1;
}
} else {
$aConfig['MESS_RAUTH'] = 0;
}
$aConfig['SMTPAuth'] = $aConfig['MESS_RAUTH'];
if (!isset($aConfig['SMTPAuth'])) {
if (isset($aConfig['MESS_RAUTH'])) {
if ($aConfig['MESS_RAUTH'] == false || (is_string($aConfig['MESS_RAUTH']) && $aConfig['MESS_RAUTH'] == 'false')) {
$aConfig['MESS_RAUTH'] = 0;
} else {
$aConfig['MESS_RAUTH'] = 1;
}
} else {
$aConfig['MESS_RAUTH'] = 0;
}
$aConfig['SMTPAuth'] = $aConfig['MESS_RAUTH'];
}
// Validating for old configurations
@@ -213,7 +173,7 @@ class spoolRun
/**
* set email parameters
*
* @param string $sAppMsgUid, $sSubject, $sFrom, $sTo, $sBody, $sDate, $sCC, $sBCC, $sTemplate
* @param string $sAppMsgUid , $sSubject, $sFrom, $sTo, $sBody, $sDate, $sCC, $sBCC, $sTemplate
* @return none
*/
public function setData($sAppMsgUid, $sSubject, $sFrom, $sTo, $sBody, $sDate = "", $sCC = "", $sBCC = "", $sTemplate = "", $aAttachment = array(), $bContentTypeIsHtml = true, $sError = "")
@@ -223,25 +183,25 @@ class spoolRun
$this->fileData['from'] = $sFrom;
$this->fileData['to'] = $sTo;
$this->fileData['body'] = $sBody;
$this->fileData['date'] = ($sDate != '' ? $sDate : date( 'Y-m-d H:i:s' ));
$this->fileData['date'] = ($sDate != '' ? $sDate : date('Y-m-d H:i:s'));
$this->fileData['cc'] = $sCC;
$this->fileData['bcc'] = $sBCC;
$this->fileData['template'] = $sTemplate;
$this->fileData['attachments'] = $aAttachment;
$this->fileData['envelope_to'] = array ();
$this->fileData['envelope_to'] = array();
$this->fileData["contentTypeIsHtml"] = $bContentTypeIsHtml;
$this->fileData["error"] = $sError;
if (array_key_exists('MESS_ENGINE',$this->config)) {
if (array_key_exists('MESS_ENGINE', $this->config)) {
if ($this->config['MESS_ENGINE'] == 'OPENMAIL') {
if ($this->config['MESS_SERVER'] != '') {
if (($sAux = @gethostbyaddr( $this->config['MESS_SERVER'] ))) {
if (($sAux = @gethostbyaddr($this->config['MESS_SERVER']))) {
$this->fileData['domain'] = $sAux;
} else {
$this->fileData['domain'] = $this->config['MESS_SERVER'];
}
} else {
$this->fileData['domain'] = gethostbyaddr( '127.0.0.1' );
$this->fileData['domain'] = gethostbyaddr('127.0.0.1');
}
}
}
@@ -253,7 +213,7 @@ class spoolRun
* @param none
* @return boolean true or exception
*/
public function sendMail ()
public function sendMail()
{
try {
$this->handleFrom();
@@ -272,15 +232,15 @@ class spoolRun
* @param none
* @return none
*/
private function updateSpoolStatus ()
private function updateSpoolStatus()
{
$oAppMessage = AppMessagePeer::retrieveByPK( $this->spool_id );
if (is_array( $this->fileData['attachments'] )) {
$attachment = implode( ",", $this->fileData['attachments'] );
$oAppMessage->setappMsgAttach( $attachment );
$oAppMessage = AppMessagePeer::retrieveByPK($this->spool_id);
if (is_array($this->fileData['attachments'])) {
$attachment = implode(",", $this->fileData['attachments']);
$oAppMessage->setappMsgAttach($attachment);
}
$oAppMessage->setappMsgstatus( $this->status );
$oAppMessage->setappMsgsenddate( date( 'Y-m-d H:i:s' ) );
$oAppMessage->setappMsgstatus($this->status);
$oAppMessage->setappMsgsenddate(date('Y-m-d H:i:s'));
$oAppMessage->save();
}
@@ -290,35 +250,35 @@ class spoolRun
* @param none
* @return boolean true or exception
*/
private function handleFrom ()
private function handleFrom()
{
$eregA = "/^'.*@.*$/";
if (strpos( $this->fileData['from'], '<' ) !== false) {
if (strpos($this->fileData['from'], '<') !== false) {
//to validate complex email address i.e. Erik A. O <erik@colosa.com>
$ereg = (preg_match($eregA, $this->fileData["from"]))? $this->longMailEreg : "/^(.*)(<(.*)>)$/";
$ereg = (preg_match($eregA, $this->fileData["from"])) ? $this->longMailEreg : "/^(.*)(<(.*)>)$/";
preg_match($ereg, $this->fileData["from"], $matches);
if (isset( $matches[1] ) && $matches[1] != '') {
if (isset($matches[1]) && $matches[1] != '') {
//drop the " characters if they exist
$this->fileData['from_name'] = trim( str_replace( '"', '', $matches[1] ) );
$this->fileData['from_name'] = trim(str_replace('"', '', $matches[1]));
} else {
//if the from name was not set
$this->fileData['from_name'] = '';
}
if (! isset( $matches[3] )) {
throw new Exception( 'Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->ExceptionCode['WARNING'] );
if (!isset($matches[3])) {
throw new Exception('Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->ExceptionCode['WARNING']);
}
$this->fileData['from_email'] = trim( $matches[3] );
$this->fileData['from_email'] = trim($matches[3]);
} else {
//to validate simple email address i.e. erik@colosa.com
$ereg = (preg_match($eregA, $this->fileData["from"]))? $this->mailEreg : "/^(.*)$/";
$ereg = (preg_match($eregA, $this->fileData["from"])) ? $this->mailEreg : "/^(.*)$/";
preg_match($ereg, $this->fileData["from"], $matches);
if (! isset( $matches[0] )) {
throw new Exception( 'Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->ExceptionCode['WARNING'] );
if (!isset($matches[0])) {
throw new Exception('Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->ExceptionCode['WARNING']);
}
$this->fileData['from_name'] = '';
@@ -326,12 +286,12 @@ class spoolRun
}
// Set reply to
preg_match( $this->longMailEreg, $this->fileData['from_name'], $matches );
preg_match($this->longMailEreg, $this->fileData['from_name'], $matches);
if (isset($matches[3])) {
$this->fileData['reply_to'] = $matches[3];
$this->fileData['reply_to_name'] = isset($matches[1]) ? $matches[1] : $this->fileData['from_name'];
} else {
preg_match( $this->mailEreg, $this->fileData['from_name'], $matches );
preg_match($this->mailEreg, $this->fileData['from_name'], $matches);
if (isset($matches[1])) {
$this->fileData['reply_to'] = $matches[1];
$this->fileData['reply_to_name'] = '';
@@ -349,65 +309,65 @@ class spoolRun
* @param none
* @return boolean true or exception
*/
private function handleEnvelopeTo ()
private function handleEnvelopeTo()
{
$hold = array ();
$holdcc = array ();
$holdbcc = array ();
$text = trim( $this->fileData['to'] );
$hold = array();
$holdcc = array();
$holdbcc = array();
$text = trim($this->fileData['to']);
$textcc = '';
$textbcc = '';
if (isset( $this->fileData['cc'] ) && trim( $this->fileData['cc'] ) != '') {
$textcc = trim( $this->fileData['cc'] );
if (isset($this->fileData['cc']) && trim($this->fileData['cc']) != '') {
$textcc = trim($this->fileData['cc']);
}
if (isset( $this->fileData['bcc'] ) && trim( $this->fileData['bcc'] ) != '') {
$textbcc = trim( $this->fileData['bcc'] );
if (isset($this->fileData['bcc']) && trim($this->fileData['bcc']) != '') {
$textbcc = trim($this->fileData['bcc']);
}
if (false !== (strpos( $text, ',' ))) {
$hold = explode( ',', $text );
if (false !== (strpos($text, ','))) {
$hold = explode(',', $text);
foreach ($hold as $val) {
if (strlen( $val ) > 0) {
if (strlen($val) > 0) {
$this->fileData['envelope_to'][] = "$val";
}
}
} elseif ($text != '') {
$this->fileData['envelope_to'][] = "$text";
} else {
$this->fileData['envelope_to'] = Array ();
$this->fileData['envelope_to'] = Array();
}
//CC
if (false !== (strpos( $textcc, ',' ))) {
$holdcc = explode( ',', $textcc );
if (false !== (strpos($textcc, ','))) {
$holdcc = explode(',', $textcc);
foreach ($holdcc as $valcc) {
if (strlen( $valcc ) > 0) {
if (strlen($valcc) > 0) {
$this->fileData['envelope_cc'][] = "$valcc";
}
}
} elseif ($textcc != '') {
$this->fileData['envelope_cc'][] = "$textcc";
} else {
$this->fileData['envelope_cc'] = Array ();
$this->fileData['envelope_cc'] = Array();
}
//BCC
if (false !== (strpos( $textbcc, ',' ))) {
$holdbcc = explode( ',', $textbcc );
if (false !== (strpos($textbcc, ','))) {
$holdbcc = explode(',', $textbcc);
foreach ($holdbcc as $valbcc) {
if (strlen( $valbcc ) > 0) {
if (strlen($valbcc) > 0) {
$this->fileData['envelope_bcc'][] = "$valbcc";
}
}
} elseif ($textbcc != '') {
$this->fileData['envelope_bcc'][] = "$textbcc";
} else {
$this->fileData['envelope_bcc'] = Array ();
$this->fileData['envelope_bcc'] = Array();
}
}
@@ -418,121 +378,121 @@ class spoolRun
* @param none
* @return none
*/
private function handleMail ()
private function handleMail()
{
if (count( $this->fileData['envelope_to'] ) > 0) {
if (array_key_exists('MESS_ENGINE',$this->config)) {
if (count($this->fileData['envelope_to']) > 0) {
if (array_key_exists('MESS_ENGINE', $this->config)) {
switch ($this->config['MESS_ENGINE']) {
case 'MAIL':
case 'PHPMAILER':
switch ($this->config['MESS_ENGINE']) {
case 'MAIL':
$oPHPMailer = new PHPMailer();
$oPHPMailer->Mailer = 'mail';
break;
case 'PHPMAILER':
$oPHPMailer = new PHPMailer( true );
$oPHPMailer = new PHPMailer(true);
$oPHPMailer->Mailer = 'smtp';
break;
}
$oPHPMailer->SMTPAuth = (isset( $this->config['SMTPAuth'] ) ? $this->config['SMTPAuth'] : '');
$oPHPMailer->SMTPAuth = (isset($this->config['SMTPAuth']) ? $this->config['SMTPAuth'] : '');
switch ($this->config['MESS_ENGINE']) {
case 'MAIL':
break;
case 'PHPMAILER':
//Posible Options for SMTPSecure are: "", "ssl" or "tls"
if (isset( $this->config['SMTPSecure'] ) && preg_match( '/^(ssl|tls)$/', $this->config['SMTPSecure'] )) {
if (isset($this->config['SMTPSecure']) && preg_match('/^(ssl|tls)$/', $this->config['SMTPSecure'])) {
$oPHPMailer->SMTPSecure = $this->config['SMTPSecure'];
}
break;
}
}
$oPHPMailer->CharSet = "UTF-8";
$oPHPMailer->Encoding = "8bit";
$oPHPMailer->Host = $this->config['MESS_SERVER'];
$oPHPMailer->Port = $this->config['MESS_PORT'];
$oPHPMailer->Username = $this->config['MESS_ACCOUNT'];
$oPHPMailer->Password = $this->config['MESS_PASSWORD'];
$oPHPMailer->SetFrom($this->fileData['from_email'], utf8_decode($this->fileData['from_name']));
$oPHPMailer->SetFrom($this->fileData['from_email'], utf8_decode($this->fileData['from_name']));
if (isset($this->fileData['reply_to'])) {
if ($this->fileData['reply_to'] != '') {
$oPHPMailer->AddReplyTo($this->fileData['reply_to'], $this->fileData['reply_to_name']);
}
}
$msSubject = $this->fileData['subject'];
if (! (mb_detect_encoding( $msSubject, "UTF-8" ) == "UTF-8")) {
$msSubject = utf8_encode( $msSubject );
if (!(mb_detect_encoding($msSubject, "UTF-8") == "UTF-8")) {
$msSubject = utf8_encode($msSubject);
}
$oPHPMailer->Subject = $msSubject;
$msBody = $this->fileData['body'];
if (! (mb_detect_encoding( $msBody, "UTF-8" ) == "UTF-8")) {
$msBody = utf8_encode( $msBody );
if (!(mb_detect_encoding($msBody, "UTF-8") == "UTF-8")) {
$msBody = utf8_encode($msBody);
}
$oPHPMailer->Body = $msBody;
$attachment = @unserialize($this->fileData['attachments']);
if ($attachment === false) {
$attachment = $this->fileData['attachments'];
}
if (is_array($attachment)) {
foreach ($attachment as $key => $fileAttach) {
if (file_exists( $fileAttach )) {
$oPHPMailer->AddAttachment( $fileAttach, is_int( $key ) ? '' : $key );
if (file_exists($fileAttach)) {
$oPHPMailer->AddAttachment($fileAttach, is_int($key) ? '' : $key);
}
}
}
foreach ($this->fileData['envelope_to'] as $sEmail) {
if (strpos( $sEmail, '<' ) !== false) {
preg_match( $this->longMailEreg, $sEmail, $matches );
$sTo = trim( $matches[3] );
$sToName = trim( $matches[1] );
$oPHPMailer->AddAddress( $sTo, $sToName );
if (strpos($sEmail, '<') !== false) {
preg_match($this->longMailEreg, $sEmail, $matches);
$sTo = trim($matches[3]);
$sToName = trim($matches[1]);
$oPHPMailer->AddAddress($sTo, $sToName);
} else {
$oPHPMailer->AddAddress( $sEmail );
$oPHPMailer->AddAddress($sEmail);
}
}
//CC
foreach ($this->fileData['envelope_cc'] as $sEmail) {
if (strpos( $sEmail, '<' ) !== false) {
preg_match( $this->longMailEreg, $sEmail, $matches );
$sTo = trim( $matches[3] );
$sToName = trim( $matches[1] );
$oPHPMailer->AddCC( $sTo, $sToName );
if (strpos($sEmail, '<') !== false) {
preg_match($this->longMailEreg, $sEmail, $matches);
$sTo = trim($matches[3]);
$sToName = trim($matches[1]);
$oPHPMailer->AddCC($sTo, $sToName);
} else {
$oPHPMailer->AddCC( $sEmail );
$oPHPMailer->AddCC($sEmail);
}
}
//BCC
foreach ($this->fileData['envelope_bcc'] as $sEmail) {
if (strpos( $sEmail, '<' ) !== false) {
preg_match( $this->longMailEreg, $sEmail, $matches );
$sTo = trim( $matches[3] );
$sToName = trim( $matches[1] );
$oPHPMailer->AddBCC( $sTo, $sToName );
if (strpos($sEmail, '<') !== false) {
preg_match($this->longMailEreg, $sEmail, $matches);
$sTo = trim($matches[3]);
$sToName = trim($matches[1]);
$oPHPMailer->AddBCC($sTo, $sToName);
} else {
$oPHPMailer->AddBCC( $sEmail );
$oPHPMailer->AddBCC($sEmail);
}
}
$oPHPMailer->IsHTML($this->fileData["contentTypeIsHtml"]);
if ( $this->config['MESS_ENGINE'] == 'MAIL') {
if ($this->config['MESS_ENGINE'] == 'MAIL') {
$oPHPMailer->WordWrap = 300;
}
if ($oPHPMailer->Send()) {
$this->error = '';
$this->status = 'sent';
@@ -542,38 +502,38 @@ class spoolRun
}
break;
case 'OPENMAIL':
$pack = new package( $this->fileData );
$pack = new package($this->fileData);
$header = $pack->returnHeader();
$body = $pack->returnBody();
$send = new smtp();
$send->setServer( $this->config['MESS_SERVER'] );
$send->setPort( $this->config['MESS_PORT'] );
$send->setUsername( $this->config['MESS_ACCOUNT'] );
$send->setServer($this->config['MESS_SERVER']);
$send->setPort($this->config['MESS_PORT']);
$send->setUsername($this->config['MESS_ACCOUNT']);
$passwd = $this->config['MESS_PASSWORD'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) {
if (count( $auxPass ) == 2) {
$passwdDec = G::decrypt($passwd, 'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift( $auxPass );
$passwd = implode( '', $auxPass );
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$this->config['MESS_PASSWORD'] = $passwd;
$send->setPassword( $this->config['MESS_PASSWORD'] );
$send->setReturnPath( $this->fileData['from_email'] );
$send->setHeaders( $header );
$send->setBody( $body );
$send->setEnvelopeTo( $this->fileData['envelope_to'] );
$send->setPassword($this->config['MESS_PASSWORD']);
$send->setReturnPath($this->fileData['from_email']);
$send->setHeaders($header);
$send->setBody($body);
$send->setEnvelopeTo($this->fileData['envelope_to']);
if ($send->sendMessage()) {
$this->error = '';
$this->status = 'sent';
} else {
$this->error = implode( ', ', $send->returnErrors() );
$this->error = implode(', ', $send->returnErrors());
$this->status = 'failed';
}
break;
@@ -588,34 +548,34 @@ class spoolRun
* @param string $dateResend
* @return none or exception
*/
public function resendEmails ($dateResend = null, $cron = 0)
public function resendEmails($dateResend = null, $cron = 0)
{
$aConfiguration = PmSystem::getEmailConfiguration();
$aConfiguration = System::getEmailConfiguration();
if (!isset($aConfiguration["MESS_ENABLED"])) {
$aConfiguration["MESS_ENABLED"] = '0';
}
if ($aConfiguration["MESS_ENABLED"] == "1") {
require_once ("classes/model/AppMessage.php");
require_once("classes/model/AppMessage.php");
$this->setConfig($aConfiguration);
$criteria = new Criteria( "workflow" );
$criteria->add( AppMessagePeer::APP_MSG_STATUS, "sent", Criteria::NOT_EQUAL );
$criteria = new Criteria("workflow");
$criteria->add(AppMessagePeer::APP_MSG_STATUS, "sent", Criteria::NOT_EQUAL);
if ($dateResend != null) {
$criteria->add( AppMessagePeer::APP_MSG_DATE, $dateResend, Criteria::GREATER_EQUAL );
$criteria->add(AppMessagePeer::APP_MSG_DATE, $dateResend, Criteria::GREATER_EQUAL);
}
$rsCriteria = AppMessagePeer::doSelectRS( $criteria );
$rsCriteria->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rsCriteria = AppMessagePeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
if ($cron == 1) {
$arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$arrayCron["processcTimeStart"] = time();
@file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) );
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
}
$row = $rsCriteria->getRow();
@@ -623,17 +583,17 @@ class spoolRun
try {
$sFrom = G::buildFrom($aConfiguration, $row["APP_MSG_FROM"]);
$this->setData( $row["APP_MSG_UID"], $row["APP_MSG_SUBJECT"], $sFrom, $row["APP_MSG_TO"], $row["APP_MSG_BODY"], date( "Y-m-d H:i:s" ), $row["APP_MSG_CC"], $row["APP_MSG_BCC"], $row["APP_MSG_TEMPLATE"], $row["APP_MSG_ATTACH"] );
$this->setData($row["APP_MSG_UID"], $row["APP_MSG_SUBJECT"], $sFrom, $row["APP_MSG_TO"], $row["APP_MSG_BODY"], date("Y-m-d H:i:s"), $row["APP_MSG_CC"], $row["APP_MSG_BCC"], $row["APP_MSG_TEMPLATE"], $row["APP_MSG_ATTACH"]);
$this->sendMail();
} catch (Exception $e) {
$strAux = "Spool::resendEmails(): Using " . $aConfiguration["MESS_ENGINE"] . " for APP_MGS_UID=" . $row["APP_MSG_UID"] . " -> With message: " . $e->getMessage();
if ($e->getCode() == $this->ExceptionCode["WARNING"]) {
array_push( $this->aWarnings, $strAux );
array_push($this->aWarnings, $strAux);
continue;
} else {
error_log('<400> '.$strAux);
error_log('<400> ' . $strAux);
continue;
}
}
@@ -647,9 +607,9 @@ class spoolRun
* @param none
* @return string $this->aWarnings
*/
public function getWarnings ()
public function getWarnings()
{
if (sizeof( $this->aWarnings ) != 0) {
if (sizeof($this->aWarnings) != 0) {
return $this->aWarnings;
}
@@ -662,36 +622,36 @@ class spoolRun
* @param array $db_spool
* @return string $sUID;
*/
public function db_insert ($db_spool)
public function db_insert($db_spool)
{
$sUID = G::generateUniqueID();
$spool = new AppMessage();
$spool->setAppMsgUid( $sUID );
$spool->setMsgUid( $db_spool['msg_uid'] );
$spool->setAppUid( $db_spool['app_uid'] );
$spool->setDelIndex( $db_spool['del_index'] );
$spool->setAppMsgType( $db_spool['app_msg_type'] );
$spool->setAppMsgSubject( $db_spool['app_msg_subject'] );
$spool->setAppMsgFrom( $db_spool['app_msg_from'] );
$spool->setAppMsgTo( $db_spool['app_msg_to'] );
$spool->setAppMsgBody( $db_spool['app_msg_body'] );
$spool->setAppMsgDate( date( 'Y-m-d H:i:s' ) );
$spool->setAppMsgCc( $db_spool['app_msg_cc'] );
$spool->setAppMsgBcc( $db_spool['app_msg_bcc'] );
$spool->setappMsgAttach( $db_spool['app_msg_attach'] );
$spool->setAppMsgTemplate( $db_spool['app_msg_template'] );
$spool->setAppMsgStatus( $db_spool['app_msg_status'] );
$spool->setAppMsgSendDate( date( 'Y-m-d H:i:s' ) ); // Add by Ankit
$spool->setAppMsgShowMessage( $db_spool['app_msg_show_message'] ); // Add by Ankit
$spool->setAppMsgError( $db_spool['app_msg_error'] );
$spool->setAppMsgUid($sUID);
$spool->setMsgUid($db_spool['msg_uid']);
$spool->setAppUid($db_spool['app_uid']);
$spool->setDelIndex($db_spool['del_index']);
$spool->setAppMsgType($db_spool['app_msg_type']);
$spool->setAppMsgSubject($db_spool['app_msg_subject']);
$spool->setAppMsgFrom($db_spool['app_msg_from']);
$spool->setAppMsgTo($db_spool['app_msg_to']);
$spool->setAppMsgBody($db_spool['app_msg_body']);
$spool->setAppMsgDate(date('Y-m-d H:i:s'));
$spool->setAppMsgCc($db_spool['app_msg_cc']);
$spool->setAppMsgBcc($db_spool['app_msg_bcc']);
$spool->setappMsgAttach($db_spool['app_msg_attach']);
$spool->setAppMsgTemplate($db_spool['app_msg_template']);
$spool->setAppMsgStatus($db_spool['app_msg_status']);
$spool->setAppMsgSendDate(date('Y-m-d H:i:s')); // Add by Ankit
$spool->setAppMsgShowMessage($db_spool['app_msg_show_message']); // Add by Ankit
$spool->setAppMsgError($db_spool['app_msg_error']);
if (! $spool->validate()) {
if (!$spool->validate()) {
$errors = $spool->getValidationFailures();
$this->status = 'error';
foreach ($errors as $key => $value) {
echo "Validation error - " . $value->getMessage( $key ) . "\n";
echo "Validation error - " . $value->getMessage($key) . "\n";
}
} else {
//echo "Saving - validation ok\n";
@@ -702,4 +662,3 @@ class spoolRun
return $sUID;
}
}

View File

@@ -0,0 +1,11 @@
<?php
class Stat
{
public $stutus;
public function __construct()
{
$this->status = false;
}
}

View File

@@ -0,0 +1,150 @@
<?php
/**
* This class is derived from the class archive, is imployed to use files .
* tar
*/
class TarFile extends Archive
{
/**
* This function is the constructor of the class tar_file
*
* @param string $name
*/
public function TarFile($name)
{
$this->archive($name);
$this->options['type'] = "tar";
}
/**
* This function create a file .
* tar
*
* @return boolean
*/
public function create_tar()
{
$pwd = getcwd();
chdir($this->options['basedir']);
foreach ($this->files as $current) {
if ($current['name'] == $this->options['name']) {
continue;
}
if (strlen($current['name2']) > 99) {
$path = substr($current['name2'], 0, strpos($current['name2'], "/", strlen($current['name2']) - 100) + 1);
$current['name2'] = substr($current['name2'], strlen($path));
if (strlen($path) > 154 || strlen($current['name2']) > 99) {
$this->error[] = "Could not add {$path}{$current['name2']} to archive because the filename is too long.";
continue;
}
}
$block = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf("%07o", $current['stat'][2]), sprintf("%07o", $current['stat'][4]), sprintf("%07o", $current['stat'][5]), sprintf("%011o", $current['type'] == 2 ? 0 : $current['stat'][7]), sprintf("%011o", $current['stat'][9]), " ", $current['type'], $current['type'] == 2 ? @readlink($current['name']) : "", "ustar ", " ", "Unknown", "Unknown", "", "", !empty($path) ? $path : "", "");
$checksum = 0;
for ($i = 0; $i < 512; $i++) {
$checksum += ord(substr($block, $i, 1));
}
$checksum = pack("a8", sprintf("%07o", $checksum));
$block = substr_replace($block, $checksum, 148, 8);
if ($current['type'] == 2 || $current['stat'][7] == 0) {
$this->add_data($block);
} elseif ($fp = @fopen($current['name'], "rb")) {
$this->add_data($block);
while ($temp = fread($fp, 1048576)) {
$this->add_data($temp);
}
if ($current['stat'][7] % 512 > 0) {
$temp = "";
for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i++) {
$temp .= "\0";
}
$this->add_data($temp);
}
fclose($fp);
} else {
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
}
}
$this->add_data(pack("a1024", ""));
chdir($pwd);
return 1;
}
/**
* This function is used for extract files of the class tar_file
*
* @return void
*/
public function extract_files()
{
$pwd = getcwd();
chdir($this->options['basedir']);
if ($fp = $this->open_archive()) {
if ($this->options['inmemory'] == 1) {
$this->files = array();
}
while ($block = fread($fp, 512)) {
$temp = unpack("a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block);
$file = array('name' => $this->options['basedir'] . '/' . $temp['prefix'] . $temp['name'], 'stat' => array(2 => $temp['mode'], 4 => octdec($temp['uid']), 5 => octdec($temp['gid']), 7 => octdec($temp['size']), 9 => octdec($temp['mtime'])
), 'checksum' => octdec($temp['checksum']), 'type' => $temp['type'], 'magic' => $temp['magic']
);
if ($file['checksum'] == 0x00000000) {
break;
} elseif (substr($file['magic'], 0, 5) != "ustar") {
$this->error[] = "This script does not support extracting this type of tar file.";
break;
}
$block = substr_replace($block, " ", 148, 8);
$checksum = 0;
for ($i = 0; $i < 512; $i++) {
$checksum += ord(substr($block, $i, 1));
}
if ($file['checksum'] != $checksum) {
$this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
}
if ($this->options['inmemory'] == 1) {
$file['data'] = fread($fp, $file['stat'][7]);
fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512));
unset($file['checksum'], $file['magic']);
$this->files[] = $file;
} elseif ($file['type'] == 5) {
if (!is_dir($file['name'])) {
mkdir($file['name'], 0775);
}
} elseif ($this->options['overwrite'] == 0 && file_exists($file['name'])) {
$this->error[] = "{$file['name']} already exist.";
continue;
} elseif ($file['type'] == 2) {
symlink($temp['symlink'], $file['name']);
} elseif ($new = @fopen($file['name'], "wb")) {
fwrite($new, fread($fp, $file['stat'][7]));
if ((512 - $file['stat'][7] % 512) != 512) {
fread($fp, (512 - $file['stat'][7] % 512));
}
fclose($new);
chmod($file['name'], 0777);
$this->files[] = $file['name'];
} else {
$this->error[] = "Could not open {$file['name']} for writing.";
continue;
}
@touch($file['name'], $file['stat'][9]);
unset($file);
}
} else {
$this->error[] = "Could not open file {$this->options['name']}";
}
chdir($pwd);
}
/**
* This function open a archive of the class tar_file
*
* @return void
*/
public function open_archive()
{
return @fopen($this->options['name'], "rb");
}
}

View File

@@ -1,49 +1,5 @@
<?php
/**
* class.tasks.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
require_once 'classes/model/GroupUser.php';
require_once 'classes/model/Groupwf.php';
require_once 'classes/model/ObjectPermission.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Route.php';
require_once 'classes/model/Event.php';
require_once 'classes/model/Step.php';
require_once 'classes/model/StepTrigger.php';
require_once 'classes/model/Task.php';
require_once 'classes/model/TaskUser.php';
require_once 'classes/model/Users.php';
require_once 'classes/model/Gateway.php';
/**
* Tasks - Tasks class
*
* @package workflow.engine.ProcessMaker
* @author Julio Cesar Laura Avenda<EFBFBD>o
* @copyright 2007 COLOSA
*/
class Tasks
{
@@ -88,7 +44,7 @@ class Tasks
try {
$aTasks = array();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
$oCriteria->addSelectColumn(TaskPeer::TAS_UID);
$oCriteria->add(TaskPeer::PRO_UID, $sProUid);
$oCriteria->addAscendingOrderByColumn(TaskPeer::TAS_TITLE);
$oDataset = TaskPeer::doSelectRS($oCriteria);
@@ -161,7 +117,6 @@ class Tasks
return;
}
/**
* Get all Routes for any Process
*
@@ -209,7 +164,7 @@ class Tasks
$oProcessMap = new ProcessMap();
$oTask = new Task();
$oEvent = new Event();
//unset ($row['ROU_UID']);
//Saving Gateway into the GATEWAY table
$idTask = $row['TAS_UID'];
$nextTask = $row['ROU_NEXT_TASK'];
@@ -305,7 +260,7 @@ class Tasks
{
foreach ($aRoutes as $key => $row) {
$oRoute = new Route();
//krumo ($row);
if (is_array($oRoute->load($row['ROU_UID']))) {
$oRoute->remove($row['ROU_UID']);
} else {
@@ -383,15 +338,6 @@ class Tasks
$oDataset1->next();
while ($aRow1 = $oDataset1->getRow()) {
//Delete the triggers assigned to step
/* $oCriteria = new Criteria('workflow');
$oCriteria->add(StepTriggerPeer::STEP_UID, $aRow1['STEP_UID']);
$oDataset2 = StepTriggerPeer::doSelectRS($oCriteria);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
while ($aRow2 = $oDataset2->getRow()) {
$oStepTrigger->remove($aRow2['STEP_UID'], $aRow2['TAS_UID'], $aRow2['TRI_UID'], $aRow2['ST_TYPE']);
$oDataset2->next();
} */
$oStep->remove($aRow1['STEP_UID']);
$oDataset1->next();
}
@@ -564,24 +510,6 @@ class Tasks
{
try {
$oTaskUser = new TaskUser();
/* $oCriteria = new Criteria('workflow');
$oCriteria->add(GroupUserPeer::GRP_UID, $sGroupUID);
$oDataset = GroupUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aGroupUser = $oDataset->getRow()) {
$oCriteria = new Criteria('workflow');
$oCriteria->add(TaskUserPeer::TAS_UID, $sTaskUID);
$oCriteria->add(TaskUserPeer::USR_UID, $aGroupUser['USR_UID']);
$oDataset2 = TaskUserPeer::doSelectRS($oCriteria);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow = $oDataset2->getRow();
if (!is_array($aRow)) {
$this->assignUser($sTaskUID, $aGroupUser['USR_UID'], $iType);
}
$oDataset->next();
} */
return $oTaskUser->create(array('TAS_UID' => $sTaskUID, 'USR_UID' => $sGroupUID, 'TU_TYPE' => $iType, 'TU_RELATION' => 2
));
} catch (Exception $oError) {
@@ -679,10 +607,6 @@ class Tasks
{
try {
$oCriteria = new Criteria('workflow');
//$oCriteria->add(StepPeer::PRO_UID, $sProcessUID);
//$oDataset = StepPeer::doSelectRS($oCriteria);
//$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//$oDataset->next();
return true;
} catch (Exception $oError) {
throw ($oError);
@@ -700,9 +624,8 @@ class Tasks
try {
$aTasks = array();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
$oCriteria->addSelectColumn(TaskPeer::TAS_UID);
$oCriteria->add(TaskPeer::PRO_UID, $sProUid);
//$oCriteria->add(TaskPeer::TAS_USER, $sUsrUid);
$oCriteria->add(TaskPeer::TAS_START, 'TRUE');
$oDataset = TaskPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
@@ -879,4 +802,3 @@ class Tasks
}
}
}

View File

@@ -0,0 +1,7 @@
<?php
class ToolBar extends Form
{
public $type = 'toolbar';
public $align = 'left';
}

View File

@@ -1,62 +1,45 @@
<?php
/**
*
* @author Hugo Loza <hugo@colosa.com>
*
* This class Helps registering and implementing Wizard for Triggers
*/
use ProcessMaker\Plugins\PluginRegistry;
/**
*
* @package workflow.engine.ProcessMaker
*/
class triggerLibrary
class TriggerLibrary
{
private $_aTriggerClasses_ = array ();
private static $instance = NULL;
private $_aTriggerClasses_ = array();
private static $instance = null;
/**
* __construct
*
* @return void
*/
function __construct ()
public function __construct()
{
//Initialize the Library and register the Default
$this->registerFunctionsFileToLibrary( PATH_CORE . "classes" . PATH_SEP . "class.pmFunctions.php", "ProcessMaker Functions" );
$this->registerFunctionsFileToLibrary(PATH_CORE . "classes" . PATH_SEP . "class.pmFunctions.php", "ProcessMaker Functions");
//Register all registered PLugin Functions
if (class_exists( 'folderData' )) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
if (class_exists('folderData')) {
$oPluginRegistry = PluginRegistry::loadSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
$oPluginRegistry->setupPlugins(); //Get and setup enabled plugins
foreach ($aAvailablePmFunctions as $key => $class) {
$filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php';
if (file_exists( $filePlugin ) && ! is_dir( $filePlugin )) {
$this->registerFunctionsFileToLibrary( $filePlugin, "ProcessMaker Functions" );
if (file_exists($filePlugin) && !is_dir($filePlugin)) {
$this->registerFunctionsFileToLibrary($filePlugin, "ProcessMaker Functions");
}
}
}
//Add External Triggers
$dir = G::ExpandPath( "classes" ) . 'triggers';
$filesArray = array ();
$dir = G::ExpandPath("classes") . 'triggers';
$filesArray = array();
if (file_exists( $dir )) {
if ($handle = opendir( $dir )) {
while (false !== ($file = readdir( $handle ))) {
if ($file != "." && $file != ".." && ! is_dir( $dir . PATH_SEP . $file )) {
$this->registerFunctionsFileToLibrary( $dir . PATH_SEP . $file, "ProcessMaker External Functions" );
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && !is_dir($dir . PATH_SEP . $file)) {
$this->registerFunctionsFileToLibrary($dir . PATH_SEP . $file, "ProcessMaker External Functions");
}
}
closedir( $handle );
closedir($handle);
}
}
}
@@ -66,10 +49,10 @@ class triggerLibrary
*
* @return self::$instance;
*/
function &getSingleton ()
public function &getSingleton()
{
if (self::$instance == NULL) {
self::$instance = new triggerLibrary();
if (self::$instance == null) {
self::$instance = new TriggerLibrary();
}
return self::$instance;
}
@@ -79,9 +62,9 @@ class triggerLibrary
*
* @return serialize ( self::$instance );
*/
function serializeInstance ()
public function serializeInstance()
{
return serialize( self::$instance );
return serialize(self::$instance);
}
/**
@@ -90,13 +73,13 @@ class triggerLibrary
* @param integer $serialized
* @return void
*/
function unSerializeInstance ($serialized)
public function unSerializeInstance($serialized)
{
if (self::$instance == NULL) {
if (self::$instance == null) {
self::$instance = new PluginRegistry();
}
$instance = unserialize( $serialized );
$instance = unserialize($serialized);
self::$instance = $instance;
}
@@ -107,15 +90,14 @@ class triggerLibrary
* @param string $libraryName
* @return void
*/
function registerFunctionsFileToLibrary ($filePath, $libraryName)
public function registerFunctionsFileToLibrary($filePath, $libraryName)
{
$aLibrary = $this->getMethodsFromLibraryFile( $filePath );
$aLibrary = $this->getMethodsFromLibraryFile($filePath);
$aLibrary->libraryFile = $filePath;
$aLibrary->libraryName = $libraryName;
if (isset( $aLibrary->info['className'] )) {
if (isset($aLibrary->info['className'])) {
$this->_aTriggerClasses_[$aLibrary->info['className']] = $aLibrary;
}
}
/**
@@ -124,12 +106,11 @@ class triggerLibrary
* @param string $file
* @return object(PHPClass) $parsedLibrary
*/
function getMethodsFromLibraryFile ($file)
public function getMethodsFromLibraryFile($file)
{
// parse class comments from file
$parsedLibrary = new PHPClass();
//$success = $parsedLibrary->parseFromFile ( PATH_CORE . "classes" . PATH_SEP . $file );
$success = $parsedLibrary->parseFromFile( $file );
$success = $parsedLibrary->parseFromFile($file);
return $parsedLibrary;
}
@@ -139,7 +120,7 @@ class triggerLibrary
*
* @return array ($this->_aTriggerClasses_)
*/
function getRegisteredClasses ()
public function getRegisteredClasses()
{
return ($this->_aTriggerClasses_);
}
@@ -150,7 +131,7 @@ class triggerLibrary
* @param string $libraryClassName
* @return array ($this->_aTriggerClasses_[$libraryClassName])
*/
function getLibraryDefinition ($libraryClassName)
public function getLibraryDefinition($libraryClassName)
{
return ($this->_aTriggerClasses_[$libraryClassName]);
}
@@ -160,11 +141,8 @@ class triggerLibrary
*
* @return void
*/
function __destruct ()
public function __destruct()
{
//TODO - Insert your code here
}
}
?>

View File

@@ -1,23 +1,7 @@
<?php
function ls_dir($dir, $basename = null)
{
$files = array();
//if (substr($dir, -1) != "/")
// $dir .= "/";
if ($basename == null) {
$basename = $dir;
}
foreach (glob("$dir/*") as $filename) {
//var_dump(substr($filename, strlen($basename) + 1));
if (is_dir($filename)) {
$files = array_merge($files, ls_dir($filename, $basename));
} else {
$files[] = substr($filename, strlen($basename) + 1);
}
}
return $files;
}
use ProcessMaker\Core\System;
class Upgrade
{
@@ -32,13 +16,11 @@ class Upgrade
{
$filter = new InputFilter();
//echo "Starting core installation...\n";
$start = microtime(1);
$filename = $this->addon->getDownloadFilename();
$time = microtime(1);
$archive = new Archive_Tar ($filename);
//printf("Time to open archive: %f\n", microtime(1) - $time);
$time = microtime(1);
$extractDir = dirname($this->addon->getDownloadFilename()) . "/extract";
$extractDir = $filter->xssFilterHard($extractDir);
@@ -53,34 +35,22 @@ class Upgrade
if (!is_dir($backupDir)) {
mkdir($backupDir);
}
//printf("Time to remove old directory: %f\n", microtime(1) - $time);
$time = microtime(1);
echo "Extracting files...\n";
$archive->extractModify($extractDir, 'processmaker');
//printf("Time to extract all files: %f\n", microtime(1) - $time);
//$time = microtime(1);
//$files = $archive->listContent();
//printf("Time to get list of contents: %f\n", microtime(1) - $time);
/*$time = microtime(1);
foreach ($files as $fileinfo)
if (basename($fileinfo['filename']) == 'checksum.txt') {
$checksumFile = $archive->extractInString($fileinfo['filename']);
break;
}
printf("Time to get checksum.txt: %f\n", microtime(1) - $time);
*/
$checksumFile = file_get_contents("$extractDir/checksum.txt");
$time = microtime(1);
$checksums = array();
foreach (explode("\n", $checksumFile) as $line) {
$checksums[trim(substr($line, 33))] = substr($line, 0, 32);
}
//printf("Time to assemble list of checksums: %f\n", microtime(1) - $time);
$checksum = array();
$changedFiles = array();
$time = microtime(1);
$files = ls_dir($extractDir);
//printf("Time to list files: %f\n", microtime(1) - $time);
$files = $this->ls_dir($extractDir);
echo "Updating ProcessMaker files...\n";
$time = microtime(1);
$checksumTime = 0;
@@ -115,15 +85,14 @@ class Upgrade
}
}
}
//printf("Time to create all checksums: %f\n", $checksumTime);
//printf("Time to copy files: %f\n", microtime(1) - $time);
printf("Updated %d files\n", count($changedFiles));
printf("Clearing cache...\n");
if (defined('PATH_C')) {
G::rm_dir(PATH_C);
mkdir(PATH_C, 0777, true);
}
$workspaces = PmSystem::listWorkspaces();
$workspaces = System::listWorkspaces();
$count = count($workspaces);
$first = true;
$num = 0;
@@ -136,9 +105,24 @@ class Upgrade
$first = false;
} catch (Exception $e) {
printf("Errors upgrading workspace {$workspace->name}: {$e->getMessage()}\n");
//$errors = true;
}
}
//printf("Time to install: %f\n", microtime(1) - $start);
}
private function ls_dir($dir, $basename = null)
{
$files = array();
if ($basename == null) {
$basename = $dir;
}
foreach (glob("$dir/*") as $filename) {
if (is_dir($filename)) {
$files = array_merge($files, $this->ls_dir($filename, $basename));
} else {
$files[] = substr($filename, strlen($basename) + 1);
}
}
return $files;
}
}

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Core\Installer;
use ProcessMaker\Core\System;
use ProcessMaker\Util\FixReferencePath;
use ProcessMaker\Plugins\Adapters\PluginAdapter;
@@ -10,7 +12,7 @@ use ProcessMaker\Plugins\Adapters\PluginAdapter;
*
* @package workflow.engine.classes
*/
class workspaceTools
class WorkspaceTools
{
public $name = null;
public $path = null;
@@ -498,7 +500,7 @@ class workspaceTools
$language = new Language();
foreach (PmSystem::listPoFiles() as $poFile) {
foreach (System::listPoFiles() as $poFile) {
$poName = basename($poFile);
$names = explode(".", basename($poFile));
$extension = array_pop($names);
@@ -849,8 +851,8 @@ class workspaceTools
*/
public function upgradePluginsDatabase()
{
foreach (PmSystem::getPlugins() as $pluginName) {
$pluginSchema = PmSystem::getPluginSchema($pluginName);
foreach (System::getPlugins() as $pluginName) {
$pluginSchema = System::getPluginSchema($pluginName);
if ($pluginSchema !== false) {
CLI::logging("Updating plugin " . CLI::info($pluginName) . "\n");
$this->upgradeSchema($pluginSchema);
@@ -867,10 +869,10 @@ class workspaceTools
public function upgradeDatabase($onedb = false, $checkOnly = false)
{
$this->initPropel(true);
p11835::$dbAdapter = $this->dbAdapter;
p11835::isApplicable();
$systemSchema = PmSystem::getSystemSchema($this->dbAdapter);
$systemSchemaRbac = PmSystem::getSystemSchemaRbac($this->dbAdapter);// get the Rbac Schema
P11835::$dbAdapter = $this->dbAdapter;
P11835::isApplicable();
$systemSchema = System::getSystemSchema($this->dbAdapter);
$systemSchemaRbac = System::getSystemSchemaRbac($this->dbAdapter);// get the Rbac Schema
$this->registerSystemTables(array_merge($systemSchema, $systemSchemaRbac));
$this->upgradeSchema($systemSchema);
$this->upgradeSchema($systemSchemaRbac, false, true, $onedb); // perform Upgrade to Rbac
@@ -898,7 +900,7 @@ class workspaceTools
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
$emailConfiguration = PmSystem::getEmailConfiguration();
$emailConfiguration = System::getEmailConfiguration();
if (!empty($emailConfiguration)) {
$arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"];
@@ -942,7 +944,7 @@ class workspaceTools
}
}
p11835::execute();
P11835::execute();
return true;
}
@@ -993,7 +995,7 @@ class workspaceTools
if (!$onedb) {
if ($rbac) {
$rename = PmSystem::verifyRbacSchema($workspaceSchema);
$rename = System::verifyRbacSchema($workspaceSchema);
if (count($rename) > 0) {
foreach ($rename as $tableName) {
$oDataBase->executeQuery($oDataBase->generateRenameTableSQL($tableName));
@@ -1002,7 +1004,7 @@ class workspaceTools
}
}
$workspaceSchema = $this->getSchema($rbac);
$changes = PmSystem::compareSchema($workspaceSchema, $schema);
$changes = System::compareSchema($workspaceSchema, $schema);
$changed = (count($changes['tablesToAdd']) > 0 || count($changes['tablesToAlter']) > 0 || count($changes['tablesWithNewIndex']) > 0 || count($changes['tablesToAlterIndex']) > 0);
@@ -1141,11 +1143,11 @@ class workspaceTools
*/
public function getMetadata()
{
$Fields = array_merge(PmSystem::getSysInfo(), $this->getDBInfo());
$Fields = array_merge(System::getSysInfo(), $this->getDBInfo());
$Fields['WORKSPACE_NAME'] = $this->name;
if (isset($this->dbHost)) {
$dbNetView = new NET($this->dbHost);
$dbNetView = new Net($this->dbHost);
$dbNetView->loginDbServer($this->dbUser, $this->dbPass);
try {
if (!defined('DB_ADAPTER')) {
@@ -1176,7 +1178,7 @@ class workspaceTools
*/
public static function printSysInfo()
{
$fields = PmSystem::getSysInfo();
$fields = System::getSysInfo();
$info = array(
'ProcessMaker Version' => $fields['PM_VERSION'],
@@ -1235,11 +1237,11 @@ class workspaceTools
public function printMetadata($printSysInfo = true)
{
if ($printSysInfo) {
workspaceTools::printSysInfo();
WorkspaceTools::printSysInfo();
CLI::logging("\n");
}
workspaceTools::printInfo($this->getMetadata());
WorkspaceTools::printInfo($this->getMetadata());
}
/**
@@ -1575,7 +1577,7 @@ class workspaceTools
$data = file_get_contents($metafile);
$workspaceData = G::json_decode($data);
CLI::logging("\n");
workspaceTools::printInfo((array)$workspaceData);
WorkspaceTools::printInfo((array)$workspaceData);
}
G::rm_dir($tempDirectory);
@@ -1599,7 +1601,7 @@ class workspaceTools
if (basename($item) == "." || basename($item) == "..") {
continue;
}
workspaceTools::dirPerms($item, $owner, $group, $perms);
WorkspaceTools::dirPerms($item, $owner, $group, $perms);
}
}
}
@@ -1638,7 +1640,7 @@ class workspaceTools
if (empty($metaFiles)) {
$metaFiles = glob($tempDirectory . "/*.txt");
if (!empty($metaFiles)) {
return workspaceTools::restoreLegacy($tempDirectory);
return WorkspaceTools::restoreLegacy($tempDirectory);
} else {
throw new Exception("No metadata found in backup");
}
@@ -1655,7 +1657,7 @@ class workspaceTools
throw new Exception("Workspace $srcWorkspace not found in backup");
}
$version = PmSystem::getVersion();
$version = System::getVersion();
$pmVersion = (preg_match("/^([\d\.]+).*$/", $version, $arrayMatch)) ? $arrayMatch[1] : ""; //Otherwise: Branch master
CLI::logging(CLI::warning("
@@ -1693,9 +1695,9 @@ class workspaceTools
} else {
CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n");
}
$workspace = new workspaceTools($workspaceName);
$workspace = new WorkspaceTools($workspaceName);
if (PmInstaller::isset_site($workspaceName)) {
if (Installer::isset_site($workspaceName)) {
if ($overwrite) {
if (!$workspace->workspaceExists()) {
throw new Exception('We can not overwrite this workspace because the workspace ' . $workspaceName . ' does not exist please check the lower case and upper case.');
@@ -1726,7 +1728,7 @@ class workspaceTools
$shared_stat = stat(PATH_DATA);
if ($shared_stat !== false) {
workspaceTools::dirPerms($workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
WorkspaceTools::dirPerms($workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
} else {
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
}
@@ -1919,7 +1921,7 @@ class workspaceTools
public function backupLogFiles()
{
$config = PmSystem::getSystemConfiguration();
$config = System::getSystemConfiguration();
clearstatcache();
$path = PATH_DATA . "log" . PATH_SEP;
@@ -1952,7 +1954,7 @@ class workspaceTools
$envFile = PATH_CONFIG . 'env.ini';
$skin ='neoclassic';
if (file_exists($envFile)) {
$sysConf = PmSystem::getSystemConfiguration($envFile);
$sysConf = System::getSystemConfiguration($envFile);
$lang = $sysConf['default_lang'];
$skin = $sysConf['default_skin'];
}
@@ -1985,7 +1987,7 @@ class workspaceTools
$licensedFeatures = & PMLicensedFeatures::getSingleton();
/*----------------------------------********---------------------------------*/
if ($licensedFeatures->verifyfeature('95OY24wcXpEMzIyRmlNSnF0STNFSHJzMG9wYTJKekpLNmY2ZmRCeGtuZk5oUDloaUNhUGVjTDJBPT0=')) {
enterpriseClass::setHashPassword($response);
EnterpriseClass::setHashPassword($response);
} else {
return false;
}
@@ -2018,7 +2020,7 @@ class workspaceTools
CLI::logging(" Copying Enterprise Directory to $pathNewFile...\n");
if ($shared_stat !== false) {
workspaceTools::dirPerms($pathDirectoryEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
WorkspaceTools::dirPerms($pathDirectoryEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
} else {
CLI::logging(CLI::error("Could not get shared folder permissions, workspace permissions couldn't be changed") . "\n");
}
@@ -2035,7 +2037,7 @@ class workspaceTools
if (file_exists($pathFileEnterprise)) {
CLI::logging(" Copying Enterprise.php file to $pathNewFile...\n");
if ($shared_stat !== false) {
workspaceTools::dirPerms($pathFileEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
WorkspaceTools::dirPerms($pathFileEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
} else {
CLI::logging(CLI::error("Could not get shared folder permissions, workspace permissions couldn't be changed") . "\n");
}
@@ -3525,7 +3527,7 @@ class workspaceTools
public function migrateIteeToDummytask($workspaceName)
{
$this->initPropel(true);
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', $workspaceName);
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspaceName);
$conf = new Configurations();
\G::$sysSys = $workspaceName;
\G::$pathDataSite = PATH_DATA . "sites" . PATH_SEP . \G::$sysSys . PATH_SEP;
@@ -3588,7 +3590,7 @@ class workspaceTools
$conf = new Configurations();
if (!$conf->exists('AUDIT_LOG', 'log')) {
CLI::logging("> Updating Auditlog Config \n");
$oServerConf = &serverConf::getSingleton();
$oServerConf = &ServerConf::getSingleton();
$sAudit = $oServerConf->getAuditLogProperty('AL_OPTION', $workspace);
$conf->aConfig = ($sAudit == 1) ? 'true' : 'false';
$conf->saveConfig('AUDIT_LOG', 'log');
@@ -3770,7 +3772,7 @@ class workspaceTools
CLI::logging("-> Populating PRO_ID, USR_ID at LIST_* \n");
$con->begin();
$stmt = $con->createStatement();
foreach (workspaceTools::$populateIdsQueries as $query) {
foreach (WorkspaceTools::$populateIdsQueries as $query) {
$stmt->executeQuery($query);
}
$con->commit();

View File

@@ -1,31 +1,7 @@
<?php
/**
* class.wsBase.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//It works with the table CONFIGURATION in a WF dataBase
use ProcessMaker\Core\System;
/**
* Copyright (C) 2009 COLOSA
@@ -36,8 +12,7 @@
*
* @package workflow.engine.classes
*/
class wsBase
class WsBase
{
public $stored_system_variables; //boolean
public $wsSessionId; //web service session id, if the wsbase function is used from a WS request
@@ -295,7 +270,7 @@ class wsBase
try {
$solrEnabled = 0;
if (($solrEnv = PmSystem::solrEnv()) !== false) {
if (($solrEnv = System::solrEnv()) !== false) {
$appSolr = new AppSolr(
$solrEnv["solr_enabled"],
@@ -333,7 +308,7 @@ class wsBase
//Add del_index dynamic fields to list of resulting columns
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
$solrRequestData = Entity_SolrRequestData::createForRequestPagination(
$solrRequestData = EntitySolrRequestData::createForRequestPagination(
array(
"workspace" => $solrEnv["solr_instance"],
"startAfter" => 0,
@@ -348,7 +323,7 @@ class wsBase
);
//Use search index to return list of cases
$searchIndex = new BpmnEngine_Services_SearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
$searchIndex = new BpmnEngineServicesSearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
//Execute query
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
@@ -898,7 +873,7 @@ class wsBase
}
}
$aSetup = (!empty($arrayConfigAux))? $arrayConfigAux : PmSystem::getEmailConfiguration();
$aSetup = (!empty($arrayConfigAux))? $arrayConfigAux : System::getEmailConfiguration();
if (!isset($aSetup['MESS_ENABLED'])) {
$aSetup['MESS_ENABLED'] = 1;
@@ -907,7 +882,7 @@ class wsBase
}
} else {
/*----------------------------------********---------------------------------*/
$aSetup = PmSystem::getEmailConfiguration();
$aSetup = System::getEmailConfiguration();
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
@@ -917,7 +892,7 @@ class wsBase
$msgError = "The default configuration wasn't defined";
}
$oSpool = new spoolRun();
$oSpool = new SpoolRun();
$oSpool->setConfig($aSetup);
@@ -1484,7 +1459,7 @@ class wsBase
{
try {
if (trim( $groupName ) == '') {
$result = new wsCreateGroupResponse( 25, G::loadTranslation( 'ID_GROUP_NAME_REQUIRED' ), '' );
$result = new WsCreateGroupResponse( 25, G::loadTranslation( 'ID_GROUP_NAME_REQUIRED' ), '' );
return $result;
}
@@ -1494,7 +1469,7 @@ class wsBase
$data['GROUP_NAME'] = $groupName;
$result = new wsCreateGroupResponse( 0, G::loadTranslation( 'ID_GROUP_CREATED_SUCCESSFULLY', SYS_LANG, $data ), $groupId );
$result = new WsCreateGroupResponse( 0, G::loadTranslation( 'ID_GROUP_CREATED_SUCCESSFULLY', SYS_LANG, $data ), $groupId );
return $result;
} catch (Exception $e) {
@@ -1515,7 +1490,7 @@ class wsBase
{
try {
if (trim( $departmentName ) == '') {
$result = new wsCreateDepartmentResponse( 25, G::loadTranslation( 'ID_DEPARTMENT_NAME_REQUIRED' ), '' );
$result = new WsCreateDepartmentResponse( 25, G::loadTranslation( 'ID_DEPARTMENT_NAME_REQUIRED' ), '' );
return $result;
}
@@ -1523,13 +1498,13 @@ class wsBase
$department = new Department();
if (($parentUID != '') && ! ($department->existsDepartment( $parentUID ))) {
$result = new wsCreateDepartmentResponse( 26, G::loadTranslation( 'ID_PARENT_DEPARTMENT_NOT_EXIST' ), $parentUID );
$result = new WsCreateDepartmentResponse( 26, G::loadTranslation( 'ID_PARENT_DEPARTMENT_NOT_EXIST' ), $parentUID );
return $result;
}
if ($department->checkDepartmentName( $departmentName, $parentUID )) {
$result = new wsCreateDepartmentResponse( 27, G::loadTranslation( 'ID_DEPARTMENT_EXISTS' ), '' );
$result = new WsCreateDepartmentResponse( 27, G::loadTranslation( 'ID_DEPARTMENT_EXISTS' ), '' );
return $result;
}
@@ -1543,7 +1518,7 @@ class wsBase
$data['PARENT_UID'] = $parentUID;
$data['DEPARTMENT_NAME'] = $departmentName;
$result = new wsCreateDepartmentResponse( 0, G::loadTranslation( 'ID_DEPARTMENT_CREATED_SUCCESSFULLY', SYS_LANG, $data ), $departmentId );
$result = new WsCreateDepartmentResponse( 0, G::loadTranslation( 'ID_DEPARTMENT_CREATED_SUCCESSFULLY', SYS_LANG, $data ), $departmentId );
return $result;
} catch (Exception $e) {
@@ -2851,7 +2826,7 @@ class wsBase
$result->status_code = 0;
$result->message = G::loadTranslation( 'ID_SUCESSFUL' );
$result->timestamp = date( 'Y-m-d H:i:s' );
$result->version = PmSystem::getVersion();
$result->version = System::getVersion();
$result->operatingSystem = $redhat;
$result->webServer = getenv( 'SERVER_SOFTWARE' );
$result->serverName = getenv( 'SERVER_NAME' );

View File

@@ -0,0 +1,32 @@
<?php
/**
* Class wsCreateDepartmentResponse
*
* @package workflow.engine.classes
*/
class WsCreateDepartmentResponse
{
public $status_code = 0;
public $message = '';
public $departmentUID = '';
public $timestamp = '';
/**
* Function __construct
* Constructor of the class
*
* @param string $status
* @param string $message
* @param string $departmentUID
* @return void
*/
function __construct ($status, $message, $departmentUID)
{
$this->status_code = $status;
$this->message = $message;
$this->departmentUID = $departmentUID;
$this->timestamp = date( 'Y-m-d H:i:s' );
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Class wsCreateGroupResponse
*
* @package workflow.engine.classes
*/
class WsCreateGroupResponse
{
public $status_code = 0;
public $message = '';
public $groupUID = '';
public $timestamp = '';
/**
* Function __construct
* Constructor of the class
*
* @param string $status
* @param string $message
* @param string $groupUID
* @return void
*/
function __construct ($status, $message, $groupUID)
{
$this->status_code = $status;
$this->message = $message;
$this->groupUID = $groupUID;
$this->timestamp = date( 'Y-m-d H:i:s' );
}
}

View File

@@ -0,0 +1,26 @@
<?php
class WsCreateUserResponse
{
public $status_code = 0;
public $message = '';
public $userUID = '';
public $timestamp = '';
/**
* Function __construct
* Constructor of the class
*
* @param string $status
* @param string $message
* @param string $userUID
* @return void
*/
function __construct ($status, $message, $userUID)
{
$this->status_code = $status;
$this->message = $message;
$this->userUID = $userUID;
$this->timestamp = date( 'Y-m-d H:i:s' );
}
}

View File

@@ -0,0 +1,26 @@
<?php
class WsGetCaseNotesResponse
{
public $status_code = 0;
public $message = '';
public $notes = null;
public $timestamp = '';
/**
* Function __construct
* Constructor of the class
*
* @param string $status
* @param string $message
* @param array|object|string $notes
* @return void
*/
function __construct ($status, $message, $notes)
{
$this->status_code = $status;
$this->message = $message;
$this->notes = $notes;
$this->timestamp = date( 'Y-m-d H:i:s' );
}
}

View File

@@ -0,0 +1,26 @@
<?php
class WsGetVariableResponse
{
public $status_code = 0;
public $message = '';
public $variables = null;
public $timestamp = '';
/**
* Function __construct
* Constructor of the class
*
* @param string $status
* @param string $message
* @param string $variables
* @return void
*/
function __construct ($status, $message, $variables)
{
$this->status_code = $status;
$this->message = $message;
$this->variables = $variables;
$this->timestamp = date( 'Y-m-d H:i:s' );
}
}

View File

@@ -0,0 +1,51 @@
<?php
class WsResponse
{
public $status_code = 0;
public $message = '';
public $timestamp = '';
/**
* Function __construct
* Constructor of the class
*
* @param string $status
* @param string $message
* @return void
*/
function __construct ($status, $message)
{
$this->status_code = $status;
$this->message = $message;
$this->timestamp = date( 'Y-m-d H:i:s' );
}
/**
* Function getPayloadString
*
* @param string $operation
* @return string
*/
function getPayloadString ($operation)
{
$res = "<$operation>\n";
$res .= "<status_code>" . $this->status_code . "</status_code>";
$res .= "<message>" . $this->message . "</message>";
$res .= "<timestamp>" . $this->timestamp . "</timestamp>";
// $res .= "<array>" . $this->timestamp . "</array>";
$res .= "<$operation>";
return $res;
}
/**
* Function getPayloadArray
*
* @return array
*/
function getPayloadArray ()
{
return array ("status_code" => $this->status_code,'message' => $this->message,'timestamp' => $this->timestamp
);
}
}

View File

@@ -1,83 +1,5 @@
<?php
/**
* class.xmlDb.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* XMLDB
*
* ProcessMaker Open Source Edition
*
* @copyright (C) 2004 - 2008 Colosa Inc.23
* @package workflow.engine.ProcessMaker
*
*/
class XMLDB
{
/**
* &connect
*
* @param string $dsn
* @return array $options
*/
public function &connect ($dsn, $options = array())
{
//Needed for $mysql_real_escape_string
$mresdbc = new DBConnection();
if (! file_exists( $dsn )) {
$err = new DB_Error( "File $dsn not found." );
return $err;
}
$dbc = new XMLConnection( $dsn );
return $dbc;
}
/**
* isError
*
* @param string $result
* @return boolean is_a($result, 'DB_Error')
*/
public function isError ($result)
{
return is_a( $result, 'DB_Error' );
}
}
/**
* XMLConnection
*
* ProcessMaker Open Source Edition
*
* @copyright (C) 2004 - 2008 Colosa Inc.23
* @package workflow.engine.ProcessMaker
*
*/
class XMLConnection
{
var $phptype = 'myxml';
@@ -555,73 +477,3 @@ class XMLConnection
}
}
}
/**
* XMLResult
*
* ProcessMaker Open Source Edition
*
* @copyright (C) 2004 - 2008 Colosa Inc.23
* @package workflow.engine.ProcessMaker
*
*/
class XMLResult
{
var $result = array ();
var $cursor = 0;
/**
* XMLResult
*
* @param array $result
* @return void
*/
public function XMLResult ($result = array())
{
$this->result = $result;
$this->cursor = 0;
}
/**
* numRows
*
* @return integer sizeof($this->result)
*/
public function numRows ()
{
return sizeof( $this->result );
}
/**
* fetchRow
*
* @param string $const
* @return integer $this->result[ $this->cursor-1 ];
*/
public function fetchRow ($const)
{
if ($this->cursor >= $this->numRows()) {
return null;
}
$this->cursor ++;
return $this->result[$this->cursor - 1];
}
}
/**
* getNames
*
* @param object $children
* @return array $names
*/
function getNames ($children)
{
$names = array ();
$r = 0;
foreach ($children as $child) {
$names[$r] = $child->name;
$r ++;
}
return $names;
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* XMLDB
*
*/
class XMLDB
{
/**
* &connect
*
* @param string $dsn
* @return array $options
*/
public function &connect ($dsn, $options = array())
{
//Needed for $mysql_real_escape_string
$mresdbc = new DBConnection();
if (! file_exists( $dsn )) {
$err = new DB_Error( "File $dsn not found." );
return $err;
}
$dbc = new XMLConnection( $dsn );
return $dbc;
}
/**
* isError
*
* @param string $result
* @return boolean is_a($result, 'DB_Error')
*/
public function isError ($result)
{
return is_a( $result, 'DB_Error' );
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* XMLResult
*
* @package workflow.engine.ProcessMaker
*/
class XMLResult
{
var $result = array ();
var $cursor = 0;
/**
* XMLResult
*
* @param array $result
* @return void
*/
public function XMLResult ($result = array())
{
$this->result = $result;
$this->cursor = 0;
}
/**
* numRows
*
* @return integer sizeof($this->result)
*/
public function numRows ()
{
return sizeof( $this->result );
}
/**
* fetchRow
*
* @param string $const
* @return integer $this->result[ $this->cursor-1 ];
*/
public function fetchRow ($const)
{
if ($this->cursor >= $this->numRows()) {
return null;
}
$this->cursor ++;
return $this->result[$this->cursor - 1];
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Class XmlFormFieldCheckBoxTable
*
*/
class XmlFormFieldCheckBoxTable extends XmlFormFieldCheckbox
{
/**
* Function render
*
* @author The Answer
* @access public
* @param eter string value
* @param eter string owner
* @return string
*/
public function render($value = null, $owner = null)
{
$optionName = $value;
$onclick = (($this->onclick) ? ' onclick="' . G::replaceDataField($this->onclick, $owner->values) . '" ' : '');
$html = '<input class="FormCheck" id="form[' . $this->name . '][' . $optionName . ']" name="form[' . $this->name . '][' . $optionName . ']" type=\'checkbox\' value="' . $value . '"' . $onclick . '> <span class="FormCheck"></span></input>';
return $html;
}
}

View File

@@ -0,0 +1,125 @@
<?php
/**
* Class XmlFormFieldHours
*
*/
class XmlFormFieldHours extends XmlFormFieldSimpleText
{
public $size = 15;
public $maxLength = 64;
public $validate = 'Any';
public $mask = '';
public $defaultValue = '';
public $required = false;
public $dependentFields = '';
public $linkField = '';
//Possible values:(-|UPPER|LOWER|CAPITALIZE)
public $strTo = '';
public $readOnly = false;
public $sqlConnection = 0;
public $sql = '';
public $sqlOption = array();
//Atributes only for grids
public $formula = '';
public $function = '';
public $replaceTags = 0;
public $showVars = 0;
public $process = '';
public $symbol = '@@';
/**
* Function render
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public
* @param eter string value
* @param eter string owner
* @return string
*/
public function render($value = null, $owner = null)
{
if ($this->strTo === 'UPPER') {
$value = strtoupper($value);
}
if ($this->strTo === 'LOWER') {
$value = strtolower($value);
}
//if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value);
$onkeypress = G::replaceDataField($this->onkeypress, $owner->values);
if ($this->replaceTags == 1) {
$value = G::replaceDataField($value, $owner->values);
}
if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values);
//$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>';
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} else {
$sShowVars = '';
}
if ($this->mode === 'edit') {
if ($this->readOnly) {
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars;
} else {
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars;
}
} elseif ($this->mode === 'view') {
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="display:none;' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $this->htmlentities($value, ENT_COMPAT, 'utf-8');
} else {
return $this->htmlentities($value, ENT_COMPAT, 'utf-8');
}
}
/**
* Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public
* @param eter array values
* @param eter string owner
* @return string
*/
public function renderGrid($values = array(), $owner)
{
$result = array();
$r = 1;
foreach ($values as $v) {
if ($this->replaceTags == 1) {
$v = G::replaceDataField($v, $owner->values);
}
if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values);
//$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>';
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $owner->name . '][' . $r . '][' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} else {
$sShowVars = '';
}
if ($this->mode === 'edit') {
if ($this->readOnly) {
$result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities($v, ENT_COMPAT, 'utf-8') . '" readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars;
} else {
$result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities($v, ENT_COMPAT, 'utf-8') . '" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars;
}
} elseif ($this->mode === 'view') {
$result[] = '<p align="' . $this->align . '">' . $this->htmlentities(number_format($v, 2), ENT_COMPAT, 'utf-8') . '</p>';
} else {
$result[] = '<p align="' . $this->align . '">' . $this->htmlentities(number_format($v, 2), ENT_COMPAT, 'utf-8') . '</p>';
}
$r ++;
}
return $result;
}
/**
* Function attachEvents
*
* @access public
* @param eter string $element
* @return string
*/
public function attachEvents($element)
{
return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}');
myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");";
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* XmlFormFieldpopupOption - XmlFormFieldPopupOption class
*
* @package workflow.engine.ProcessMaker
*/
class XmlFormFieldPopupOption extends XmlFormField
{
public $launch = '';
/**
* Get Events
*
* @return string
*/
public function getEvents()
{
$script = '{name:"' . $this->name . '",text:"' . addcslashes($this->label, '\\"') . '", launch:leimnud.closure({Function:function(target){' . $this->launch . '}, args:target})}';
return $script;
}
}

View File

@@ -0,0 +1,86 @@
<?php
/**
* Class XmlFormFieldTextareaPm
*/
class XmlFormFieldTextAreaPm extends XmlFormField
{
public $rows = 12;
public $cols = 40;
public $required = false;
public $readOnly = false;
public $wrap = 'OFF';
public $showVars = 0;
public $process = '';
public $symbol = '@@';
/**
* Function render
*
* @author Julio Cesar Laura Avendao <juliocesar@colosa.com>
* @access public
* @param eter string value
* @param eter string owner
* @return string
*/
public function render($value = null, $owner)
{
if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values);
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} else {
$sShowVars = '';
}
if ($this->mode === 'edit') {
if ($this->readOnly) {
return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities($this->wrap, ENT_QUOTES, 'UTF-8') . '" class="FormTextPM" readOnly>' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '</textarea>' . $sShowVars;
} else {
return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities($this->wrap, ENT_QUOTES, 'UTF-8') . '" class="FormTextPM" >' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '</textarea>' . $sShowVars;
}
} elseif ($this->mode === 'view') {
return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" cols="' . $this->cols . '" rows="' . $this->rows . '" readOnly style="border:0px;backgroud-color:inherit;' . $this->style . '" wrap="' . htmlentities($this->wrap, ENT_QUOTES, 'UTF-8') . '" class="FormTextPM" >' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '</textarea>';
} else {
return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities($this->wrap, ENT_QUOTES, 'UTF-8') . '" class="FormTextArea" >' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '</textarea>';
}
}
/**
* Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public
* @param eter string values
* @param eter string owner
* @return string
*/
public function renderGrid($owner, $values = null)
{
$result = array();
$r = 1;
foreach ($values as $v) {
if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values);
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $owner->name . '][' . $r . '][' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} else {
$sShowVars = '';
}
if ($this->mode === 'edit') {
if ($this->readOnly) {
$result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($v, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly"/>' . $sShowVars;
} else {
$result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($v, ENT_COMPAT, 'utf-8') . '\' />' . $sShowVars;
}
} elseif ($this->mode === 'view') {
if (stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
$result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8');
} else {
$result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8');
}
} else {
$result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8');
}
$r ++;
}
return $result;
}
}

View File

@@ -0,0 +1,120 @@
<?php
class XmlFormFieldTextPm extends XmlFormFieldSimpleText
{
public $size = 15;
public $maxLength = 64;
public $validate = 'Any';
public $mask = '';
public $defaultValue = '';
public $required = false;
public $dependentFields = '';
public $linkField = '';
//Possible values:(-|UPPER|LOWER|CAPITALIZE)
public $strTo = '';
public $readOnly = false;
public $sqlConnection = 0;
public $sql = '';
public $sqlOption = array();
//Atributes only for grids
public $formula = '';
public $function = '';
public $replaceTags = 0;
public $showVars = 0;
public $process = '';
public $symbol = '@@';
/**
* Function render
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public
* @param eter string value
* @param eter string owner
* @return string
*/
public function render($value = null, $owner = null)
{
//NOTE: string functions must be in G class
if ($this->strTo === 'UPPER') {
$value = strtoupper($value);
}
if ($this->strTo === 'LOWER') {
$value = strtolower($value);
}
$onkeypress = G::replaceDataField($this->onkeypress, $owner->values);
if ($this->replaceTags == 1) {
$value = G::replaceDataField($value, $owner->values);
}
if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values);
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} else {
$sShowVars = '';
}
if ($this->mode === 'edit') {
if ($this->readOnly) {
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars;
} else {
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars;
}
} elseif ($this->mode === 'view') {
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="display:none;' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $this->htmlentities($value, ENT_COMPAT, 'utf-8');
} else {
return $this->htmlentities($value, ENT_COMPAT, 'utf-8');
}
}
/**
* Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public
* @param eter array values
* @param eter string owner
* @return string
*/
public function renderGrid($values = array(), $owner)
{
$result = array();
$r = 1;
foreach ($values as $v) {
if ($this->replaceTags == 1) {
$v = G::replaceDataField($v, $owner->values);
}
if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values);
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $owner->name . '][' . $r . '][' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} else {
$sShowVars = '';
}
if ($this->mode === 'edit') {
if ($this->readOnly) {
$result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities($v, ENT_COMPAT, 'utf-8') . '" readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars;
} else {
$result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities($v, ENT_COMPAT, 'utf-8') . '" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars;
}
} elseif ($this->mode === 'view') {
$result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8');
} else {
$result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8');
}
$r ++;
}
return $result;
}
/**
* Function attachEvents
*
* @access public
* @param eter string $element
* @return string
*/
public function attachEvents($element)
{
return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}');
myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");";
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* ToolBar - ToolBar
* XmlFormFieldToolBar - XmlFormFieldToolBar class
*
* @package workflow.engine.ProcessMaker
*/
class XmlFormFieldToolBar extends XmlFormField
{
public $xmlfile = '';
public $type = 'toolbar';
public $toolBar;
public $home = '';
public $withoutLabel = true;
/**
* Constructor of the class XmlFormFieldToolBar
*
* @param string $xmlNode
* @param string $lang
* @param string $home
* @param string $owner
* @return void
*/
public function XmlFormFieldToolBar($xmlNode, $lang = 'en', $home = '', $owner = ' ')
{
parent::__construct($xmlNode, $lang, $home, $owner);
$this->home = $home;
}
/**
* Prints the ToolBar
*
* @param string $value
* @return string
*/
public function render($value)
{
$this->toolBar = new ToolBar($this->xmlfile, $this->home);
$template = PATH_CORE . 'templates/' . $this->type . '.html';
$out = $this->toolBar->render($template, $scriptCode);
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile($this->toolBar->scriptURL);
$oHeadPublisher->addScriptCode($scriptCode);
return $out;
}
}

View File

@@ -1,97 +1,13 @@
<?php
/**
* class.toolBar.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* ToolBar - ToolBar class
* ToolBar - ToolBar
* XmlFormFieldToolButton - XmlFormFieldToolButton class
*
* @package workflow.engine.ProcessMaker
*/
class ToolBar extends form
class XmlFormFieldToolButton extends XmlFormField
{
public $type = 'toolbar';
public $align = 'left';
}
/**
* XmlForm_Field_ToolBar - XmlForm_Field_ToolBar class
*
* @package workflow.engine.ProcessMaker
*/
class XmlForm_Field_ToolBar extends XmlForm_Field
{
public $xmlfile = '';
public $type = 'toolbar';
public $toolBar;
public $home = '';
public $withoutLabel = true;
/**
* Constructor of the class XmlForm_Field_ToolBar
*
* @param string $xmlNode
* @param string $lang
* @param string $home
* @param string $owner
* @return void
*/
public function XmlForm_Field_ToolBar($xmlNode, $lang = 'en', $home = '', $owner = ' ')
{
parent::XmlForm_Field($xmlNode, $lang, $home, $owner);
$this->home = $home;
}
/**
* Prints the ToolBar
*
* @param string $value
* @return string
*/
public function render($value)
{
$this->toolBar = new toolBar($this->xmlfile, $this->home);
$template = PATH_CORE . 'templates/' . $this->type . '.html';
$out = $this->toolBar->render($template, $scriptCode);
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile($this->toolBar->scriptURL);
$oHeadPublisher->addScriptCode($scriptCode);
return $out;
}
}
/**
* XmlForm_Field_toolButton - XmlForm_Field_toolButton class
*
* @package workflow.engine.ProcessMaker
*/
class XmlForm_Field_toolButton extends XmlForm_Field
{
public $file = '';
public $fileAlt = '';
public $url = '';
@@ -152,8 +68,6 @@ class XmlForm_Field_toolButton extends XmlForm_Field
break;
case 'html':
$html = '<div ' . ' onmouseover=\'backImage(this,"url(' . htmlentities($urlAlt, ENT_QUOTES, 'utf-8') . ') no-repeat")\' onmouseout=\'backImage(this,"")\' style="width:25px;height:25px;margin-bottom:3px">' . $this->label . '</div>';
//$html=$this->label;
break;
case 'image/text':
$html = '<img src="' . htmlentities($url, ENT_QUOTES, 'utf-8') . '"' . (($this->style) ? ' style="' . $this->style . '"' : '') . '/><br/>' . $this->htmlentities($this->label, ENT_QUOTES, 'utf-8');
@@ -164,7 +78,6 @@ class XmlForm_Field_toolButton extends XmlForm_Field
case 'dropdown':
$html = '';
if (isset($this->owner->values['PRO_UID'])) {
$criteria = ProcessMap::getDynaformsCriteria($this->owner->values['PRO_UID']);
$dataset = DynaformPeer::doSelectRS($criteria);
if ($dataset->getRecordCount() > 0) {

View File

@@ -0,0 +1,109 @@
<?php
/* --------------------------------------------------
* TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.1
* By Devin Doucette
* Copyright (c) 2005 Devin Doucette
* Email: darksnoopy@shaw.ca
* --------------------------------------------------
* Email bugs/suggestions to darksnoopy@shaw.ca
* --------------------------------------------------
* This script has been created and released under
* the GNU GPL and is free to use and redistribute
* only if this copyright statement is not removed
* -------------------------------------------------- */
/**
* This class is derived from the class archive, is imployed to use files .
* zip
*
* @package workflow.engine.classes
*/
class ZipFile extends Archive
{
public function ZipFile($name)
{
$this->archive($name);
$this->options['type'] = "zip";
}
/**
* This function is used to create archives .
* zip
*
* @return boolean
*/
public function create_zip()
{
$files = 0;
$offset = 0;
$central = "";
if (!empty($this->options['sfx'])) {
if ($fp = @fopen($this->options['sfx'], "rb")) {
$temp = fread($fp, filesize($this->options['sfx']));
fclose($fp);
$this->add_data($temp);
$offset += strlen($temp);
unset($temp);
} else {
$this->error[] = "Could not open sfx module from {$this->options['sfx']}.";
}
}
$pwd = getcwd();
chdir($this->options['basedir']);
foreach ($this->files as $current) {
if ($current['name'] == $this->options['name']) {
continue;
}
$timedate = explode(" ", date("Y n j G i s", $current['stat'][9]));
$timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) | ($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]);
$block = pack("VvvvV", 0x04034b50, 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate);
if ($current['stat'][7] == 0 && $current['type'] == 5) {
$block .= pack("VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']) + 1, 0x0000);
$block .= $current['name2'] . "/";
$this->add_data($block);
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']) + 1, 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset);
$central .= $current['name2'] . "/";
$files++;
$offset += (31 + strlen($current['name2']));
} elseif ($current['stat'][7] == 0) {
$block .= pack("VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']), 0x0000);
$block .= $current['name2'];
$this->add_data($block);
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']), 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset);
$central .= $current['name2'];
$files++;
$offset += (30 + strlen($current['name2']));
} elseif ($fp = @fopen($current['name'], "rb")) {
$temp = fread($fp, $current['stat'][7]);
fclose($fp);
$crc32 = G::encryptCrc32($temp);
if (!isset($current['method']) && $this->options['method'] == 1) {
$temp = gzcompress($temp, $this->options['level']);
$size = strlen($temp) - 6;
$temp = substr($temp, 2, $size);
} else {
$size = strlen($temp);
}
$block .= pack("VVVvv", $crc32, $size, $current['stat'][7], strlen($current['name2']), 0x0000);
$block .= $current['name2'];
$this->add_data($block);
$this->add_data($temp);
unset($temp);
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, $crc32, $size, $current['stat'][7], strlen($current['name2']), 0x0000, 0x0000, 0x0000, 0x0000, 0x00000000, $offset);
$central .= $current['name2'];
$files++;
$offset += (30 + strlen($current['name2']) + $size);
} else {
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
}
}
$this->add_data($central);
$this->add_data(pack("VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen($central), $offset, !empty($this->options['comment']) ? strlen($this->options['comment']) : 0x0000));
if (!empty($this->options['comment'])) {
$this->add_data($this->options['comment']);
}
chdir($pwd);
return 1;
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More