HOR-3670-RG-4 Files review:

workflow/engine/classes/Stat.php
workflow/engine/classes/Tar_File.php
workflow/engine/classes/Tasks.php
workflow/engine/classes/ToolBar.php
workflow/engine/classes/TriggerLibrary.php
This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-08-11 17:10:14 -04:00
parent 08b143a034
commit 5fe9a04c2d
13 changed files with 52 additions and 210 deletions

View File

@@ -3,7 +3,7 @@
/**
* This class is derived from the class archive, is employed to use files .bzip
*/
class BzipFile extends tar_file
class BzipFile extends TarFile
{
/**

View File

@@ -23,7 +23,7 @@
*
* @package workflow.engine.classes
*
*/class gzip_file extends tar_file
*/class gzip_file extends TarFile
{
/**

View File

@@ -1,23 +1,10 @@
<?php
/**
* LastModification 30/05/2008
*/
/**
*
* @package workflow.engine.classes
*/
/**
*
* @package workflow.engine.classes
*/class Stat
class Stat
{
public $stutus;
public function __construct ()
public function __construct()
{
$this->status = false;
}

View File

@@ -1,25 +1,10 @@
<?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 .
* tar
*
* @package workflow.engine.classes
*
*/
class tar_file extends Archive
class TarFile extends Archive
{
/**
@@ -27,7 +12,7 @@ class tar_file extends Archive
*
* @param string $name
*/
public function tar_file($name)
public function TarFile($name)
{
$this->archive($name);
$this->options['type'] = "tar";
@@ -102,7 +87,7 @@ class tar_file extends Archive
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']
), 'checksum' => octdec($temp['checksum']), 'type' => $temp['type'], 'magic' => $temp['magic']
);
if ($file['checksum'] == 0x00000000) {
break;
@@ -125,7 +110,6 @@ class tar_file extends Archive
$this->files[] = $file;
} elseif ($file['type'] == 5) {
if (!is_dir($file['name'])) {
//mkdir($file['name'], $file['stat'][2]);
mkdir($file['name'], 0775);
}
} elseif ($this->options['overwrite'] == 0 && file_exists($file['name'])) {
@@ -133,23 +117,18 @@ class tar_file extends Archive
continue;
} elseif ($file['type'] == 2) {
symlink($temp['symlink'], $file['name']);
//chmod($file['name'], $file['stat'][2]);
} 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));
}
//fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512));
fclose($new);
//chmod($file['name'], $file['stat'][2]);
chmod($file['name'], 0777);
$this->files[] = $file['name'];
} else {
$this->error[] = "Could not open {$file['name']} for writing.";
continue;
}
//chown($file['name'], $file['stat'][4]);
//chgrp($file['name'], $file['stat'][5]);
@touch($file['name'], $file['stat'][9]);
unset($file);
}

View File

@@ -1,51 +1,6 @@
<?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
/**
* Tasks - Tasks class
*
* @package workflow.engine.ProcessMaker
* @author Julio Cesar Laura Avenda<64>o
* @copyright 2007 COLOSA
*/class Tasks
class Tasks
{
/**
@@ -89,7 +44,7 @@ require_once 'classes/model/Gateway.php';
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);
@@ -162,7 +117,6 @@ require_once 'classes/model/Gateway.php';
return;
}
/**
* Get all Routes for any Process
*
@@ -210,7 +164,7 @@ require_once 'classes/model/Gateway.php';
$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'];
@@ -306,7 +260,7 @@ require_once 'classes/model/Gateway.php';
{
foreach ($aRoutes as $key => $row) {
$oRoute = new Route();
//krumo ($row);
if (is_array($oRoute->load($row['ROU_UID']))) {
$oRoute->remove($row['ROU_UID']);
} else {
@@ -384,15 +338,6 @@ require_once 'classes/model/Gateway.php';
$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();
}
@@ -565,24 +510,6 @@ require_once 'classes/model/Gateway.php';
{
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) {
@@ -680,10 +607,6 @@ require_once 'classes/model/Gateway.php';
{
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);
@@ -701,9 +624,8 @@ require_once 'classes/model/Gateway.php';
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);

View File

@@ -1,38 +1,6 @@
<?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
/**
* ToolBar - ToolBar class
*
* @package workflow.engine.ProcessMaker
*/class ToolBar extends form
class ToolBar extends form
{
public $type = 'toolbar';
public $align = 'left';

View File

@@ -1,56 +1,45 @@
<?php
/**
*
* @author Hugo Loza <hugo@colosa.com>
*
* This
/**
*
* @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);
}
}
}
@@ -60,10 +49,10 @@
*
* @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;
}
@@ -73,9 +62,9 @@
*
* @return serialize ( self::$instance );
*/
function serializeInstance ()
public function serializeInstance()
{
return serialize( self::$instance );
return serialize(self::$instance);
}
/**
@@ -84,13 +73,13 @@
* @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;
}
@@ -101,15 +90,14 @@
* @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;
}
}
/**
@@ -118,12 +106,11 @@
* @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;
}
@@ -133,7 +120,7 @@
*
* @return array ($this->_aTriggerClasses_)
*/
function getRegisteredClasses ()
public function getRegisteredClasses()
{
return ($this->_aTriggerClasses_);
}
@@ -144,7 +131,7 @@
* @param string $libraryClassName
* @return array ($this->_aTriggerClasses_[$libraryClassName])
*/
function getLibraryDefinition ($libraryClassName)
public function getLibraryDefinition($libraryClassName)
{
return ($this->_aTriggerClasses_[$libraryClassName]);
}
@@ -154,9 +141,8 @@
*
* @return void
*/
function __destruct ()
public function __destruct()
{
//TODO - Insert your code here
}
}

View File

@@ -64,7 +64,7 @@
*/
public function render($value)
{
$this->toolBar = new toolBar($this->xmlfile, $this->home);
$this->toolBar = new ToolBar($this->xmlfile, $this->home);
$template = PATH_CORE . 'templates/' . $this->type . '.html';
$out = $this->toolBar->render($template, $scriptCode);
$oHeadPublisher = & headPublisher::getSingleton();

View File

@@ -1617,7 +1617,7 @@ class Process
$triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
$triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException);
$triggerLibrary = \triggerLibrary::getSingleton();
$triggerLibrary = \TriggerLibrary::getSingleton();
$library = $triggerLibrary->getRegisteredClasses();
ksort($library);

View File

@@ -38,7 +38,7 @@ class TriggerWizard
//Library
$this->library = \triggerLibrary::getSingleton();
$this->library = \TriggerLibrary::getSingleton();
} catch (\Exception $e) {
throw $e;
}

View File

@@ -25,7 +25,7 @@
try {
$triggerLibrary = triggerLibrary::getSingleton();
$triggerLibrary = TriggerLibrary::getSingleton();
$triggerLibraryO = $triggerLibrary->getRegisteredClasses();
$oTree = new Tree();

View File

@@ -25,7 +25,7 @@
try {
$triggerLibrary = triggerLibrary::getSingleton ();
$triggerLibrary = TriggerLibrary::getSingleton ();
$libraryClassName = $_GET ['LIBRARY'];
$libraryMethod = $_GET ['NAME_FUN'];
$sProUid = $_GET ['PRO_UID'];

View File

@@ -25,7 +25,7 @@
try {
$triggerLibrary = triggerLibrary::getSingleton ();
$triggerLibrary = TriggerLibrary::getSingleton ();
$libraryClassName = $_GET ['LIBRARY_CLASS'];
$libraryMethod = $_GET ['PMFUNTION_NAME'];
$sProUid = $_GET ['PRO_UID'];