HOR-3670-RG-2 Files review:

workflow/engine/classes/LdapAdvanced.php
workflow/engine/classes/License_Application.php
workflow/engine/classes/MultipleFilesBackup.php
workflow/engine/classes/NET.php
workflow/engine/classes/ObjectCellection.php
This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-08-11 15:54:49 -04:00
parent 231fed51d2
commit 24770dbd92
23 changed files with 822 additions and 919 deletions

View File

@@ -1500,7 +1500,7 @@ function get_infoOnPM($workspace) {
if( defined("DB_HOST") ) {
$dbNetView = new NET(DB_HOST);
$dbNetView = new Net(DB_HOST);
$dbNetView->loginDbServer(DB_USER, DB_PASS);
$dbConns = new DbConnections('');

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,10 @@
<?php
/**
* class.ldapAdvanced.php
* LDAP plugin for the RBAC class. This
class ldapAdvanced
* LDAP plugin for the RBAC class. This
*/
class LdapAdvanced
{
/**
* The authsource id
@@ -38,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)",
@@ -457,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;
}
@@ -474,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 ");
}
}
@@ -505,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"]);
}
}
@@ -1045,11 +1047,11 @@ class ldapAdvanced
$strUser = trim($strUser);
}
if ( $strUser == "" ) {
if ($strUser == "") {
return -1;
}
if ( strlen( $strPass ) == 0) {
if (strlen($strPass) == 0) {
return -2;
}
@@ -1140,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;
@@ -1195,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");
@@ -1295,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;
@@ -1546,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 {
@@ -1583,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';
@@ -1595,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
@@ -1768,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);
@@ -1888,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');
@@ -2045,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();
@@ -2054,7 +2056,7 @@ class ldapAdvanced
$result[] = $node;
}
if ( count($result) >= 1 ) {
if (count($result) >= 1) {
$result[ count($result) -1 ]['DEP_LAST'] = 1;
}
@@ -2108,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);
}
/**
@@ -2142,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');
@@ -2152,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');
@@ -2360,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,57 +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
*/
/**
* 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

View File

@@ -1,236 +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
* 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.
*/
static public 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" );
}
}
<?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,19 +1,6 @@
<?php
/**
* LastModification 30/05/2008
*/
/**
*
* @package workflow.engine.classes
*/
/**
*
* @package workflow.engine.classes
*/class NET
class Net
{
public $hostname;
public $ip;
@@ -62,9 +49,9 @@
$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 == "") {
@@ -72,7 +59,7 @@
$this->errstr = "NET::You must specify a host";
//$this->showMsg();
}
$this->resolv( $pHost );
$this->resolv($pHost);
}
/**
@@ -81,31 +68,31 @@
* @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;
}
}
@@ -117,14 +104,14 @@
* @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";
@@ -139,16 +126,16 @@
* @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;
}
@@ -165,12 +152,12 @@
* @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;
@@ -183,7 +170,7 @@
* @param string $pPasswd
* @return void
*/
public function loginDbServer ($pUser, $pPasswd)
public function loginDbServer($pUser, $pPasswd)
{
$this->db_user = $pUser;
$this->db_passwd = $pPasswd;
@@ -196,7 +183,7 @@
* @param string $pPort
* @return void
*/
public function setDataBase ($pDb, $pPort = '')
public function setDataBase($pDb, $pPort = '')
{
$this->db_sourcename = $pDb;
$this->db_port = $pPort;
@@ -212,10 +199,9 @@
*/
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);
@@ -227,10 +213,10 @@
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;
}
@@ -238,12 +224,12 @@
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;
@@ -260,7 +246,7 @@
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 = "";
@@ -274,10 +260,10 @@
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) {
@@ -310,7 +296,7 @@
$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':
@@ -319,7 +305,7 @@
break;
}
} else {
throw new Exception( "CLASS::NET::ERROR: No connections param." );
throw new Exception("CLASS::NET::ERROR: No connections param.");
}
return $stat;
@@ -335,10 +321,9 @@
*/
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);
@@ -346,32 +331,32 @@
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";
@@ -390,9 +375,9 @@
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;
@@ -412,13 +397,13 @@
// $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 = "";
@@ -445,7 +430,7 @@
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 = "";
@@ -468,7 +453,7 @@
break;
}
} else {
throw new Exception( "CLASS::NET::ERROR: No connections param." );
throw new Exception("CLASS::NET::ERROR: No connections param.");
}
return $stat;
}
@@ -479,30 +464,29 @@
* @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!');
}
}
@@ -512,7 +496,7 @@
* @param string $pAdapter
* @return void
*/
public function dbName ($pAdapter)
public function dbName($pAdapter)
{
switch ($pAdapter) {
case 'mysql':
@@ -542,7 +526,7 @@
* @param string $pAdapter
* @return void
*/
public function showMsg ()
public function showMsg()
{
if ($this->errno != 0) {
$msg = "
@@ -556,7 +540,7 @@
</div>
</fieldset>
<center>";
print ($msg) ;
print($msg) ;
}
}
@@ -566,7 +550,7 @@
*
* @return string
*/
public function getErrno ()
public function getErrno()
{
return $this->errno;
}
@@ -577,7 +561,7 @@
*
* @return string
*/
public function getErrmsg ()
public function getErrmsg()
{
return $this->errstr;
}

View File

@@ -1,35 +1,11 @@
<?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.
*/
/**
* ObjectDocument Collection
*
* @package workflow.engine.ProcessMaker
*/class ObjectCellection
*/
class ObjectCollection
{
public $num;
public $swapc;
@@ -40,7 +16,7 @@
*/
public function __construct()
{
$this->objects = Array();
$this->objects = array();
$this->num = 0;
$this->swapc = $this->num;
array_push($this->objects, 'void');

View File

@@ -347,7 +347,7 @@
{
$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

@@ -1145,7 +1145,7 @@ class WorkspaceTools
$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')) {

View File

@@ -230,7 +230,7 @@ class Admin extends Controller
$redhat .= " (" . PHP_OS . ")";
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

@@ -433,7 +433,7 @@ class adminProxy extends HttpProxyController
$Mailto = $_POST['eMailto'];
$SMTPSecure = $_POST['UseSecureCon'];
$Server = new NET($server);
$Server = new Net($server);
$smtp = new SMTP;
$timeout = 10;

View File

@@ -695,7 +695,7 @@ class Main extends Controller
$redhat .= " (" . PHP_OS . ")";
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

@@ -918,7 +918,7 @@ class pmTablesProxy extends HttpProxyController
try {
$result = new stdClass();
$net = new NET( G::getIpAddress() );
$net = new Net( G::getIpAddress() );
$META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . PmSystem::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date( "l jS \of F Y h:i:s A" ) . "\n" . " @Server address: " . getenv( 'SERVER_NAME' ) . " (" . getenv( 'SERVER_ADDR' ) . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . SYS_SYS . "\n" . " @Export trace back:\n\n";

View File

@@ -235,7 +235,7 @@ try {
function getLDAPAdvanceInstance($authUid)
{
$RBAC = &RBAC::getSingleton();
$ldapAdvanced = new ldapAdvanced();
$ldapAdvanced = new LdapAdvanced();
$ldapAdvanced->sAuthSource = $authUid;
$ldapAdvanced->sSystem = $RBAC->sSystem;

View File

@@ -152,7 +152,7 @@ switch ($function) {
$aFields['AUTH_SOURCE_DATA'] = $aData;
//LDAP_PAGE_SIZE_LIMIT
$ldapAdvanced = new ldapAdvanced();
$ldapAdvanced = new LdapAdvanced();
try {
$arrayAuthenticationSourceData = $aFields;
@@ -205,7 +205,7 @@ switch ($function) {
//Get data
$arrayData = array();
$ldapAdvanced = new ldapAdvanced();
$ldapAdvanced = new LdapAdvanced();
$ldapAdvanced->sAuthSource = $authenticationSourceUid;
$result = $ldapAdvanced->searchUsers($keyword, $start, $limit);
@@ -345,7 +345,7 @@ switch ($function) {
$arrayAuthenticationSourceData['AUTH_SOURCE_VERSION'] = 3;
//Test connection
$ldapAdvanced = new ldapAdvanced();
$ldapAdvanced = new LdapAdvanced();
$ldapcnn = $ldapAdvanced->ldapConnection($arrayAuthenticationSourceData);

View File

@@ -240,7 +240,7 @@ switch ($action) {
}
}
$Server = new NET($server);
$Server = new Net($server);
switch ($step) {
case 1:
@@ -305,7 +305,7 @@ switch ($action) {
$connectionType = $_POST["connectionType"];
$tns = $_POST["tns"];
$net = new NET();
$net = new Net();
switch ($step) {
case 1:

View File

@@ -48,7 +48,7 @@ class ldapadvancedClassCron
$rbac->authSourcesObj = new AuthenticationSource();
}
$plugin = new ldapAdvanced();
$plugin = new LdapAdvanced();
$plugin->sSystem = $rbac->sSystem;
$plugin->setFrontEnd(true);

View File

@@ -26,7 +26,7 @@ function testConnection($type, $server, $user, $passwd, $port = 'none', $dbName
}
}
$Server = new NET($server);
$Server = new Net($server);
$filter = new InputFilter();
if ($Server->getErrno() == 0) {

View File

@@ -92,7 +92,7 @@ switch ($request) {
$SMTPSecure = $_POST['SMTPSecure'];
$timeout = 10;
$Server = new NET( $srv );
$Server = new Net( $srv );
$smtp = new SMTP();
switch ($step) {

View File

@@ -271,7 +271,7 @@ class DataBaseConnection
$flagTns = ($dataCon["DBS_TYPE"] == "oracle" && $dataCon["DBS_CONNECTION_TYPE"] == "TNS")? 1 : 0;
if ($flagTns == 0) {
$Server = new \NET($dataCon['DBS_SERVER']);
$Server = new \Net($dataCon['DBS_SERVER']);
// STEP 1 : Resolving Host Name
$respTest['0'] = array();
@@ -356,7 +356,7 @@ class DataBaseConnection
}
}
} else {
$net = new \NET();
$net = new \Net();
//STEP 0: Trying to open database type TNS
$respTest["0"] = array();

View File

@@ -316,7 +316,7 @@ class EmailServer
$mailTo = $arrayData["MAIL_TO"];
$smtpSecure = $arrayData["SMTPSECURE"];
$serverNet = new \NET($server);
$serverNet = new \Net($server);
$smtp = new \SMTP();
$timeout = 10;

View File

@@ -47,7 +47,7 @@ $html = '
$flagTns = ($_POST["type"] == "oracle" && $_POST["connectionType"] == "TNS")? 1 : 0;
if ($flagTns == 0) {
$host = new NET($_POST["server"]);
$host = new Net($_POST["server"]);
$port = $_POST["port"];

View File

@@ -1,98 +1,98 @@
<?php
/**
* groups_Tree.php
*
* 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.
*
*/
/**
* @Description This is the View of all groups from a determinated user
* @author Erik Amaru Ortiz <erik@colosa.com>
* @Date 24/04/2008
* @LastModification 30/05/2008
* @Updated Nov 6th, 2009 bye Eriknyk
*/
$host = new net($_POST['srv']);
$host = $filter->xssFilterHard($host);
$width_content = '550px';
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$ID_SETUP_MAILCONF_TITLE = $filter->xssFilterHard(G::loadTranslation('ID_SETUP_MAILCONF_TITLE'));
$html = '
<div class="boxTopBlue"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="boxContentBlue">
<table style="margin:0px;" cellspacing="0" cellpadding="0">
<tr>
<td class="userGroupTitle"><center>'.$ID_SETUP_MAILCONF_TITLE.'</center></td>
</tr>
</table>
</div>
<div class="boxBottomBlue"><div class="a"></div><div class="b"></div><div class="c"></div></div>';
$tests = Array(
'',
'Resolve host name '.$_POST['srv'],
'Checking port <b>'.$_POST['port'].'</b>',
'Establishing connection to host <b>'.$host->hostname.'</b>'
);
$tests[] = 'Login as <b>'.$_POST['account'].'</b> on '.$host->hostname.' SMTP Server';
if($_POST['send_test_mail'] == 'yes'){
$tests[] = 'Sending a test mail from <b>'.$_POST['account'].'</b> to '.$_POST['mail_to'].'...';
}
$tree->showSign = false;
$n = Array('','uno','dos','tres','cuatro','cinco');
for($i=1; $i<count($tests);$i++)
{
$html .= "
<div id='test_$i' style='display:none'>
<table width='100%' cellspacing='0' cellpadding='0' border='1' style='border:0px;'>
<tr>
<td width=10 class='treeNode' style='border:0px;background-color:transparent;'><span id='status_$i'></span></td>
<td width='*' class='treeNode' style='border:0px;background-color:transparent;'>
&nbsp;<span id='action_$i'>$tests[$i]</span>
</td>
</tr>
<tr>
<td width='*' class='treeNode' style='border:0px;background-color:transparent;' colspan='2'>
<span id='status2_$i'></span>
</td>
</tr>
</table>
</div>";
}
echo '<div class="grid" style="width:'.$width_content.'">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="">
<table width="90%">
<tbody><tr>
<td valign="top">
'.$html.'
</td>
</tr>
</tbody></table>
</div>
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
</div>';
print ("<div id='bnt_ok' style='display:none'><input type=button class='module_app_button___gray' onclick='jvascript:cancelTestConnection()' value='DONE'></div>");
<?php
/**
* groups_Tree.php
*
* 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.
*
*/
/**
* @Description This is the View of all groups from a determinated user
* @author Erik Amaru Ortiz <erik@colosa.com>
* @Date 24/04/2008
* @LastModification 30/05/2008
* @Updated Nov 6th, 2009 bye Eriknyk
*/
$host = new Net($_POST['srv']);
$host = $filter->xssFilterHard($host);
$width_content = '550px';
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$ID_SETUP_MAILCONF_TITLE = $filter->xssFilterHard(G::loadTranslation('ID_SETUP_MAILCONF_TITLE'));
$html = '
<div class="boxTopBlue"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="boxContentBlue">
<table style="margin:0px;" cellspacing="0" cellpadding="0">
<tr>
<td class="userGroupTitle"><center>'.$ID_SETUP_MAILCONF_TITLE.'</center></td>
</tr>
</table>
</div>
<div class="boxBottomBlue"><div class="a"></div><div class="b"></div><div class="c"></div></div>';
$tests = Array(
'',
'Resolve host name '.$_POST['srv'],
'Checking port <b>'.$_POST['port'].'</b>',
'Establishing connection to host <b>'.$host->hostname.'</b>'
);
$tests[] = 'Login as <b>'.$_POST['account'].'</b> on '.$host->hostname.' SMTP Server';
if($_POST['send_test_mail'] == 'yes'){
$tests[] = 'Sending a test mail from <b>'.$_POST['account'].'</b> to '.$_POST['mail_to'].'...';
}
$tree->showSign = false;
$n = Array('','uno','dos','tres','cuatro','cinco');
for($i=1; $i<count($tests);$i++)
{
$html .= "
<div id='test_$i' style='display:none'>
<table width='100%' cellspacing='0' cellpadding='0' border='1' style='border:0px;'>
<tr>
<td width=10 class='treeNode' style='border:0px;background-color:transparent;'><span id='status_$i'></span></td>
<td width='*' class='treeNode' style='border:0px;background-color:transparent;'>
&nbsp;<span id='action_$i'>$tests[$i]</span>
</td>
</tr>
<tr>
<td width='*' class='treeNode' style='border:0px;background-color:transparent;' colspan='2'>
<span id='status2_$i'></span>
</td>
</tr>
</table>
</div>";
}
echo '<div class="grid" style="width:'.$width_content.'">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="">
<table width="90%">
<tbody><tr>
<td valign="top">
'.$html.'
</td>
</tr>
</tbody></table>
</div>
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
</div>';
print ("<div id='bnt_ok' style='display:none'><input type=button class='module_app_button___gray' onclick='jvascript:cancelTestConnection()' value='DONE'></div>");