Merge pull request #800 from Jennydmz/master

CODE STYLE, workflow/engine/methods/setup/ PART 3 (final)
This commit is contained in:
ferOnti
2012-10-17 15:24:05 -07:00
76 changed files with 6886 additions and 7022 deletions

View File

@@ -1,73 +1,84 @@
function abc(panel, txt) {
/*
* commonDialog ( '', 'saved' , 'saved', {}, '' ) ; setTimeout (
* leimnud.closure({instance:myDialog,method:function(panel){
*
* myDialog.remove(); panel.tabLastSelected=false; panel.tabSelected=1;
* panel.makeTab(); },args:panel}) , 1000 );
*/
var img = document.getElementById('workPeriodGraph');
img.src = 'workPeriodGraph?b=' + Math.random();
function abc( panel, txt ) { // panel.clearContent();
/* commonDialog ( '', 'saved' , 'saved', {}, '' ) ; // panel.addContent ( txt );
setTimeout ( leimnud.closure({instance:myDialog,method:function(panel){ return false;
myDialog.remove();
panel.tabLastSelected=false;
panel.tabSelected=1;
panel.makeTab();
},args:panel}) , 1000 );
*/
var img = document.getElementById( 'workPeriodGraph' );
img.src = 'workPeriodGraph?b=' + Math.random() ;
// panel.clearContent();
// panel.addContent ( txt );
return false;
} }
function showHideFilterForm( divName) function showHideFilterForm(divName) {
{ if (document.getElementById(divName).style.display === 'none')
if (document.getElementById( divName ).style.display==='none') document.getElementById(divName).style.display = '';
document.getElementById( divName).style.display = ''; else
else document.getElementById(divName).style.display = 'none';
document.getElementById( divName).style.display = 'none';
} }
function newHoliday(ev) { function newHoliday(ev) {
var coor = leimnud.dom.mouse(ev); var coor = leimnud.dom.mouse(ev);
var myPanel=new leimnud.module.panel(); var myPanel = new leimnud.module.panel();
myPanel.options={ myPanel.options = {
size:{w:500,h:200}, size : {
position:{x:coor.x-200,y:coor.y}, w : 500,
title:"New Holiday", h : 200
theme:"panel", },
control:{ position : {
close:true, x : coor.x - 200,
drag:true y : coor.y
}, },
fx: { modal:true } title : "New Holiday",
}; theme : "panel",
control : {
myPanel.make(); close : true,
drag : true
},
fx : {
modal : true
}
};
var r = new leimnud.module.rpc.xmlhttp({url:"holidayNew.php"}); myPanel.make();
r.callback=leimnud.closure({Function:function(rpc){
myPanel.addContent(rpc.xmlhttp.responseText); var r = new leimnud.module.rpc.xmlhttp({
},args:r}) url : "holidayNew.php"
r.make(); });
r.callback = leimnud.closure({
Function : function(rpc) {
myPanel.addContent(rpc.xmlhttp.responseText);
},
args : r
})
r.make();
} }
function deleteHoliday( uid ) { function deleteHoliday(uid) {
url = "setupAjax.php?action=deleteHoliday&uid=" + uid; url = "setupAjax.php?action=deleteHoliday&uid=" + uid;
var r = new leimnud.module.rpc.xmlhttp({url: url }); var r = new leimnud.module.rpc.xmlhttp({
r.callback=leimnud.closure({Function:function(rpc){ url : url
//myPanel.addContent(rpc.xmlhttp.responseText); });
myPanel = setupPanel.panels.control; r.callback = leimnud.closure({
myPanel.tabLastSelected=false; Function : function(rpc) {
myPanel.tabSelected=0; // myPanel.addContent(rpc.xmlhttp.responseText);
myPanel.makeTab(); myPanel = setupPanel.panels.control;
myPanel.tabLastSelected = false;
myPanel.tabSelected = 0;
myPanel.makeTab();
},
args : r
})
r.make();
// myPanel.clearContent();
// myPanel.addContent ( uid );
}
},args:r})
r.make();
// myPanel.clearContent();
// myPanel.addContent ( uid );
}

View File

@@ -12,76 +12,71 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
/** /**
* New Admin User interface * New Admin User interface
*
* @author Erik A. O. <erik@colosa.com, aortiz.erik@gmail.com> * @author Erik A. O. <erik@colosa.com, aortiz.erik@gmail.com>
* @date Apr 5th, 2010 * @date Apr 5th, 2010
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
$G_MAIN_MENU = "processmaker"; $G_MAIN_MENU = "processmaker";
$G_ID_MENU_SELECTED = "SETUP"; $G_ID_MENU_SELECTED = "SETUP";
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
global $G_TMP_MENU; global $G_TMP_MENU;
$oMenu = new Menu(); $oMenu = new Menu();
$oMenu->load('setup'); $oMenu->load( 'setup' );
$toolItems = Array(); $toolItems = Array ();
foreach( $oMenu->Options as $i=>$option) { foreach ($oMenu->Options as $i => $option) {
$toolItems[] = Array( $toolItems[] = Array ('id' => $oMenu->Id[$i],'link' => ($oMenu->Options[$i] != '') ? $oMenu->Options[$i] : '#','onclick' => ($oMenu->JS[$i] != '') ? $oMenu->JS[$i] : '','label' => $oMenu->Labels[$i],'icon' => ($oMenu->Icons[$i] != '') ? $oMenu->Icons[$i] : 'icon-pmlogo.png','target' => ($oMenu->JS[$i] != '') ? '' : 'admToolsContent'
'id' => $oMenu->Id[$i], );
'link' => ($oMenu->Options[$i]!='')? $oMenu->Options[$i]: '#',
'onclick' => ($oMenu->JS[$i]!='')? $oMenu->JS[$i]: '',
'label' => $oMenu->Labels[$i],
'icon' => ($oMenu->Icons[$i]!='')? $oMenu->Icons[$i]: 'icon-pmlogo.png',
'target'=> ($oMenu->JS[$i]!='')? '': 'admToolsContent'
);
} }
$template = new TemplatePower( PATH_TPL . 'setup' . PATH_SEP . 'tools.html' ); $template = new TemplatePower( PATH_TPL . 'setup' . PATH_SEP . 'tools.html' );
$template->prepare(); $template->prepare();
$template->assign ('LeftWidth', '230'); $template->assign( 'LeftWidth', '230' );
$template->assign ('contentHeight', '520'); $template->assign( 'contentHeight', '520' );
if( isset($_GET['i18']) ){ if (isset( $_GET['i18'] )) {
$_SESSION['TOOLS_VIEWTYPE'] = true; $_SESSION['TOOLS_VIEWTYPE'] = true;
$template->assign ('displayLanguageTool', 'block'); $template->assign( 'displayLanguageTool', 'block' );
} else { } else {
$template->assign ('displayLanguageTool', 'none'); $template->assign( 'displayLanguageTool', 'none' );
} }
if( isset($_GET['newSite']) ){ if (isset( $_GET['newSite'] )) {
$template->assign ('displayNewSiteTool', 'block'); $template->assign( 'displayNewSiteTool', 'block' );
} else { } else {
$template->assign ('displayNewSiteTool', 'none'); $template->assign( 'displayNewSiteTool', 'none' );
} }
foreach ($toolItems as $item) {
foreach($toolItems as $item) { $template->newBlock( 'tool_options' );
$template->newBlock( 'tool_options'); foreach ($item as $propertyName => $propertyValue)
foreach($item as $propertyName=>$propertyValue) $template->assign( $propertyName, $propertyValue );
$template->assign ($propertyName, $propertyValue);
} }
$G_PUBLISH->AddContent('template', '', '', '', $template ); $G_PUBLISH->AddContent( 'template', '', '', '', $template );
G::RenderPage('publish'); G::RenderPage( 'publish' );
if(isset($_GET['module'])){ if (isset( $_GET['module'] )) {
print " print "
<script> <script>
admToolsContent.location='".$_GET['module']."'; admToolsContent.location='" . $_GET['module'] . "';
</script> </script>
"; ";
} }

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* setupAjax.php * setupAjax.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,30 +12,30 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
//$oSMTPJSON = new Services_JSON(); return $RBAC_Response;
//$oSMTPData = $oSMTPJSON->decode(stripslashes($_POST['data'])); //$oSMTPJSON = new Services_JSON();
//$sOutput = ''; //$oSMTPData = $oSMTPJSON->decode(stripslashes($_POST['data']));
G::LoadClass('setup'); //$sOutput = '';
G::LoadClass( 'setup' );
$oSMTPSetup = new Setup(new DBConnection); $oSMTPSetup = new Setup( new DBConnection() );
$action = strtolower ( $_GET['action'] ); $action = strtolower( $_GET['action'] );
$data = $_GET; $data = $_GET;
$arr = get_class_methods( get_class( $oSMTPSetup ) );
foreach ($arr as $method) {
if ($method == $action)
$oSMTPSetup->{$action}( $_GET );
}
$arr = get_class_methods( get_class($oSMTPSetup) );
foreach ($arr as $method) {
if ( $method == $action )
$oSMTPSetup->{$action} ( $_GET );
}
?>

View File

@@ -12,105 +12,104 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
// if (($RBAC_Response = $RBAC->userCanAccess("PM_CASES"))!=1) return $RBAC_Response; // if (($RBAC_Response = $RBAC->userCanAccess("PM_CASES"))!=1) return $RBAC_Response;
$idDecode64 = base64_decode($_GET['id']);
$idExploded = explode( '/', $idDecode64 ); $idDecode64 = base64_decode( $_GET['id'] );
if ( $idExploded[0] == '' ) array_shift($idExploded); $idExploded = explode( '/', $idDecode64 );
if ( $idExploded[0] == 'plugin' ) { if ($idExploded[0] == '')
array_shift( $idExploded );
if ($idExploded[0] == 'plugin') {
//Get the Plugin Folder, always the first element //Get the Plugin Folder, always the first element
$pluginFolder = $idExploded[1]; $pluginFolder = $idExploded[1];
$pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html'. PATH_SEP . $idExploded[2]; $pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html' . PATH_SEP . $idExploded[2];
if ( file_exists ( $pluginFilename ) ) { if (file_exists( $pluginFilename )) {
G::streamFile ( $pluginFilename ); G::streamFile( $pluginFilename );
} }
die; die();
} }
$ainfoSite = explode("/",$_SERVER["REQUEST_URI"]); $ainfoSite = explode( "/", $_SERVER["REQUEST_URI"] );
//it was added to show the logo into management plugin add by krlos //it was added to show the logo into management plugin add by krlos
if(isset($_GET['wsName']) && $_GET['wsName']!=''){ if (isset( $_GET['wsName'] ) && $_GET['wsName'] != '') {
$ainfoSite[1] = $_GET['wsName']; $ainfoSite[1] = $_GET['wsName'];
} }
//end add //end add
$dir=PATH_DATA."sites".PATH_SEP.str_replace("sys","",$ainfoSite[1]).PATH_SEP."files/logos"; $dir = PATH_DATA . "sites" . PATH_SEP . str_replace( "sys", "", $ainfoSite[1] ) . PATH_SEP . "files/logos";
$imagen = $dir .PATH_SEP.$idDecode64; $imagen = $dir . PATH_SEP . $idDecode64;
if (is_file( $imagen )) {
showLogo( $imagen );
if (is_file($imagen)) } else {
{
showLogo($imagen);
} $newDir = PATH_DATA . "sites" . PATH_SEP . str_replace( "sys", "", $ainfoSite[1] ) . PATH_SEP . "files/logos";
else { $dir = PATH_HOME . "public_html/files/logos";
$newDir = PATH_DATA."sites".PATH_SEP.str_replace("sys","",$ainfoSite[1]).PATH_SEP."files/logos"; if (! is_dir( $newDir )) {
$dir = PATH_HOME . "public_html/files/logos"; G::mk_dir( $newDir );
if(!is_dir($newDir)){
G::mk_dir($newDir);
}
//this function does copy all logos from public_html/files/logos to /shared/site/yourSite/files/logos
//cpyMoreLogos($dir,$newDir);
$newDir .= PATH_SEP.$idDecode64;
$dir .= PATH_SEP.$idDecode64;
copy($dir,$newDir);
showLogo($newDir);
die;
}
function showLogo($imagen){
$info = @getimagesize($imagen);
$fp = fopen($imagen, "rb");
if ($info && $fp) {
header("Content-type: {$info['mime']}");
fpassthru($fp);
exit;
} else {
throw new Exception("Image format not valid");
} }
} //this function does copy all logos from public_html/files/logos to /shared/site/yourSite/files/logos
//cpyMoreLogos($dir,$newDir);
$newDir .= PATH_SEP . $idDecode64;
$dir .= PATH_SEP . $idDecode64;
copy( $dir, $newDir );
showLogo( $newDir );
die();
function cpyMoreLogos($dir,$newDir){ }
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if(($file!=".")&&($file!="..")) {
$extention=explode(".", $file);
$aImageProp=getimagesize($dir.'/'.$file, $info);
$sfileExtention = strtoupper($extention[count($extention)-1]);
if( in_array($sfileExtention, array('JPG','JPEG','PNG','GIF') ) ) {
$dir1 = $dir.PATH_SEP.$file; function showLogo ($imagen)
$dir2 = $newDir.PATH_SEP.$file; {
//print $dir1 ." *** ".$dir2."<br><br>"; $info = @getimagesize( $imagen );
copy($dir1,$dir2); $fp = fopen( $imagen, "rb" );
if ($info && $fp) {
header( "Content-type: {$info['mime']}" );
fpassthru( $fp );
exit();
} else {
throw new Exception( "Image format not valid" );
}
}
function cpyMoreLogos ($dir, $newDir)
{
if (file_exists( $dir )) {
if ($handle = opendir( $dir )) {
while (false !== ($file = readdir( $handle ))) {
if (($file != ".") && ($file != "..")) {
$extention = explode( ".", $file );
$aImageProp = getimagesize( $dir . '/' . $file, $info );
$sfileExtention = strtoupper( $extention[count( $extention ) - 1] );
if (in_array( $sfileExtention, array ('JPG','JPEG','PNG','GIF'
) )) {
} $dir1 = $dir . PATH_SEP . $file;
$dir2 = $newDir . PATH_SEP . $file;
//print $dir1 ." *** ".$dir2."<br><br>";
copy( $dir1, $dir2 );
}
}
} }
} closedir( $handle );
closedir($handle);
} }
} }
} }
die; die();
?> ?>
<script> <script>
</script> </script>

View File

@@ -1,255 +1,250 @@
<?php <?php
if (!isset($_REQUEST ['action'])) { if (! isset( $_REQUEST['action'] )) {
$res ['success'] = false; $res['success'] = false;
$res ['error']=$res ['message'] = 'You may request an action'; $res['error'] = $res['message'] = 'You may request an action';
print G::json_encode($res); print G::json_encode( $res );
die (); die();
} }
if (!function_exists($_REQUEST ['action'])) { if (! function_exists( $_REQUEST['action'] )) {
$res ['success'] = false; $res['success'] = false;
$res ['error']=$res ['message'] = 'The requested action does not exist'; $res['error'] = $res['message'] = 'The requested action does not exist';
print G::json_encode($res); print G::json_encode( $res );
die (); die();
} }
$restrictedFunctions=array('copy_skin_folder','addTarFolder'); $restrictedFunctions = array ('copy_skin_folder','addTarFolder'
if (in_array($_REQUEST ['action'],$restrictedFunctions)) { );
$res ['success'] = false; if (in_array( $_REQUEST['action'], $restrictedFunctions )) {
$res ['error']=$res ['message'] = 'The requested action does not exist *'; $res['success'] = false;
print G::json_encode($res); $res['error'] = $res['message'] = 'The requested action does not exist *';
die (); print G::json_encode( $res );
die();
} }
$functionName = $_REQUEST['action'];
$functionName = $_REQUEST ['action']; $functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array ();
$functionParams = isset($_REQUEST ['params']) ? $_REQUEST ['params'] : array();
$functionName(); $functionName();
function updatePageSize() function updatePageSize ()
{ {
G::LoadClass('configuration'); G::LoadClass( 'configuration' );
$c = new Configurations(); $c = new Configurations();
$arr['pageSize'] = $_REQUEST['size']; $arr['pageSize'] = $_REQUEST['size'];
$arr['dateSave'] = date('Y-m-d H:i:s'); $arr['dateSave'] = date( 'Y-m-d H:i:s' );
$config = Array(); $config = Array ();
$config[] = $arr; $config[] = $arr;
$c->aConfig = $config; $c->aConfig = $config;
$c->saveConfig('skinsList', 'pageSize', '', $_SESSION['USER_LOGGED']); $c->saveConfig( 'skinsList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
echo '{success: true}'; echo '{success: true}';
} }
function skinList() function skinList ()
{ {
G::loadClass('system'); G::loadClass( 'system' );
$skinList = System::getSkingList(); $skinList = System::getSkingList();
$wildcard = ''; $wildcard = '';
if(isset($_REQUEST['activeskin'])) if (isset( $_REQUEST['activeskin'] )) {
{
$wildcard = '@'; $wildcard = '@';
} }
foreach ($skinList['skins'] as $key => $value) { foreach ($skinList['skins'] as $key => $value) {
if ($value['SKIN_FOLDER_ID'] != 'simplified' && $value['SKIN_FOLDER_ID'] != 'uxs') { if ($value['SKIN_FOLDER_ID'] != 'simplified' && $value['SKIN_FOLDER_ID'] != 'uxs') {
if($skinList['currentSkin'] == $value['SKIN_FOLDER_ID']){ if ($skinList['currentSkin'] == $value['SKIN_FOLDER_ID']) {
$value['SKIN_STATUS'] = $wildcard . G::LoadTranslation('ID_ACTIVE'); $value['SKIN_STATUS'] = $wildcard . G::LoadTranslation( 'ID_ACTIVE' );
$value['SKIN_NAME'] = $wildcard . $value['SKIN_NAME']; $value['SKIN_NAME'] = $wildcard . $value['SKIN_NAME'];
$value['SKIN_DESCRIPTION'] = $wildcard . $value['SKIN_DESCRIPTION']; $value['SKIN_DESCRIPTION'] = $wildcard . $value['SKIN_DESCRIPTION'];
$value['SKIN_AUTHOR'] = $wildcard . $value['SKIN_AUTHOR']; $value['SKIN_AUTHOR'] = $wildcard . $value['SKIN_AUTHOR'];
$value['SKIN_CREATEDATE'] = $wildcard . $value['SKIN_CREATEDATE']; $value['SKIN_CREATEDATE'] = $wildcard . $value['SKIN_CREATEDATE'];
$value['SKIN_MODIFIEDDATE'] = $wildcard . $value['SKIN_MODIFIEDDATE']; $value['SKIN_MODIFIEDDATE'] = $wildcard . $value['SKIN_MODIFIEDDATE'];
} } else {
else{ $value['SKIN_STATUS'] = G::LoadTranslation( 'ID_INACTIVE' );
$value['SKIN_STATUS'] = G::LoadTranslation('ID_INACTIVE');
} }
$skinListArray['skins'][] = $value; $skinListArray['skins'][] = $value;
} }
} }
$skinListArray['currentSkin'] = $skinList['currentSkin']; $skinListArray['currentSkin'] = $skinList['currentSkin'];
echo G::json_encode($skinListArray); echo G::json_encode( $skinListArray );
} }
function newSkin($baseSkin='classic') function newSkin ($baseSkin = 'classic')
{ {
$skinBase = $baseSkin != "" ? strtolower($baseSkin) : 'classic'; $skinBase = $baseSkin != "" ? strtolower( $baseSkin ) : 'classic';
if ((isset($_REQUEST['skinBase'])) && ($_REQUEST['skinBase'] != "")) { if ((isset( $_REQUEST['skinBase'] )) && ($_REQUEST['skinBase'] != "")) {
$skinBase = strtolower($_REQUEST['skinBase']); $skinBase = strtolower( $_REQUEST['skinBase'] );
} }
try { try {
if (!(isset($_REQUEST['skinName']))) { if (! (isset( $_REQUEST['skinName'] ))) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_NAME_REQUIRED' ) ));
} }
if (!(isset($_REQUEST['skinFolder']))) { if (! (isset( $_REQUEST['skinFolder'] ))) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_REQUIRED' ) ));
} }
//Should validate skin folder name here //Should validate skin folder name here
//if.... //if....
$skinName = $_REQUEST['skinName']; $skinName = $_REQUEST['skinName'];
$skinFolder = $_REQUEST['skinFolder']; $skinFolder = $_REQUEST['skinFolder'];
$skinDescription = isset($_REQUEST['skinDescription']) ? $_REQUEST['skinDescription'] : ''; $skinDescription = isset( $_REQUEST['skinDescription'] ) ? $_REQUEST['skinDescription'] : '';
$skinAuthor = isset($_REQUEST['skinAuthor']) ? $_REQUEST['skinAuthor'] : 'ProcessMaker Team'; $skinAuthor = isset( $_REQUEST['skinAuthor'] ) ? $_REQUEST['skinAuthor'] : 'ProcessMaker Team';
if (is_dir(PATH_CUSTOM_SKINS . $skinFolder)) { if (is_dir( PATH_CUSTOM_SKINS . $skinFolder )) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
} }
if (strtolower($skinFolder) == 'classic') { if (strtolower( $skinFolder ) == 'classic') {
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
} }
//All validations OK then create skin //All validations OK then create skin
switch ($skinBase) { switch ($skinBase) {
//Validate skin base //Validate skin base
case 'uxmodern': case 'uxmodern':
copy_skin_folder(G::ExpandPath("skinEngine") . 'uxmodern' . PATH_SEP, PATH_CUSTOM_SKINS . copy_skin_folder( G::ExpandPath( "skinEngine" ) . 'uxmodern' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml"
$skinFolder,array("config.xml")); ) );
$pathBase=G::ExpandPath("skinEngine") . 'base' . PATH_SEP; $pathBase = G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP;
break; break;
case 'classic': case 'classic':
//Special Copy of this dir + xmlreplace //Special Copy of this dir + xmlreplace
copy_skin_folder(G::ExpandPath("skinEngine") . 'base' . PATH_SEP, PATH_CUSTOM_SKINS . copy_skin_folder( G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml","baseCss"
$skinFolder,array("config.xml","baseCss")); ) );
$pathBase=G::ExpandPath("skinEngine") . 'base' . PATH_SEP; $pathBase = G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP;
break; break;
default: default:
//Commmon copy/paste of a folder + xmlrepalce //Commmon copy/paste of a folder + xmlrepalce
copy_skin_folder(PATH_CUSTOM_SKINS . $skinBase, PATH_CUSTOM_SKINS . $skinFolder,array("config.xml")); copy_skin_folder( PATH_CUSTOM_SKINS . $skinBase, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml"
$pathBase=PATH_CUSTOM_SKINS.$skinBase; ) );
$pathBase = PATH_CUSTOM_SKINS . $skinBase;
break; break;
} }
//ReBuild config file //ReBuild config file
//TODO: Improve this pre_replace lines //TODO: Improve this pre_replace lines
$configFileOriginal = $pathBase . PATH_SEP . 'config.xml'; $configFileOriginal = $pathBase . PATH_SEP . 'config.xml';
$configFileFinal = PATH_CUSTOM_SKINS . $skinFolder . PATH_SEP . 'config.xml'; $configFileFinal = PATH_CUSTOM_SKINS . $skinFolder . PATH_SEP . 'config.xml';
$xmlConfiguration = file_get_contents($configFileOriginal); $xmlConfiguration = file_get_contents( $configFileOriginal );
$xmlConfiguration = preg_replace('/(<id>)(.+?)(<\/id>)/i', '<id>' . G::generateUniqueID() . $xmlConfiguration = preg_replace( '/(<id>)(.+?)(<\/id>)/i', '<id>' . G::generateUniqueID() . '</id><!-- $2 -->', $xmlConfiguration );
'</id><!-- $2 -->', $xmlConfiguration); $xmlConfiguration = preg_replace( "/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName . "</name><!-- $2 -->", $xmlConfiguration );
$xmlConfiguration = preg_replace("/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName . $xmlConfiguration = preg_replace( "/(<description>)(.+?)(<\/description>)/i", "<description>" . $skinDescription . "</description><!-- $2 -->", $xmlConfiguration );
"</name><!-- $2 -->", $xmlConfiguration); $xmlConfiguration = preg_replace( "/(<author>)(.+?)(<\/author>)/i", "<author>" . $skinAuthor . "</author><!-- $2 -->", $xmlConfiguration );
$xmlConfiguration = preg_replace("/(<description>)(.+?)(<\/description>)/i", "<description>" . $xmlConfiguration = preg_replace( "/(<createDate>)(.+?)(<\/createDate>)/i", "<createDate>" . date( "Y-m-d H:i:s" ) . "</createDate><!-- $2 -->", $xmlConfiguration );
$skinDescription . "</description><!-- $2 -->", $xmlConfiguration); $xmlConfiguration = preg_replace( "/(<modifiedDate>)(.+?)(<\/modifiedDate>)/i", "<modifiedDate>" . date( "Y-m-d H:i:s" ) . "</modifiedDate><!-- $2 -->", $xmlConfiguration );
$xmlConfiguration = preg_replace("/(<author>)(.+?)(<\/author>)/i", "<author>" . $skinAuthor . file_put_contents( $configFileFinal, $xmlConfiguration );
"</author><!-- $2 -->", $xmlConfiguration);
$xmlConfiguration = preg_replace("/(<createDate>)(.+?)(<\/createDate>)/i", "<createDate>" .
date("Y-m-d H:i:s") . "</createDate><!-- $2 -->", $xmlConfiguration);
$xmlConfiguration = preg_replace("/(<modifiedDate>)(.+?)(<\/modifiedDate>)/i", "<modifiedDate>" .
date("Y-m-d H:i:s") . "</modifiedDate><!-- $2 -->", $xmlConfiguration);
file_put_contents($configFileFinal, $xmlConfiguration);
$response['success'] = true; $response['success'] = true;
$response['message'] = G::LoadTranslation('ID_SKIN_SUCCESS_CREATE'); $response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESS_CREATE' );
print_r(G::json_encode($response)); print_r( G::json_encode( $response ) );
} catch (Exception $e) { } catch (Exception $e) {
$response['success'] = false; $response['success'] = false;
$response['message'] = $e->getMessage(); $response['message'] = $e->getMessage();
$response['error'] = $e->getMessage(); $response['error'] = $e->getMessage();
print_r(G::json_encode($response)); print_r( G::json_encode( $response ) );
} }
} }
function importSkin() function importSkin ()
{ {
try { try {
if (!isset($_FILES['uploadedFile'])) { if (! isset( $_FILES['uploadedFile'] )) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_FILE_REQUIRED' ) ));
} }
$uploadedInstances = count($_FILES['uploadedFile']['name']); $uploadedInstances = count( $_FILES['uploadedFile']['name'] );
$sw_error = false; $sw_error = false;
$sw_error_exists = isset($_FILES['uploadedFile']['error']); $sw_error_exists = isset( $_FILES['uploadedFile']['error'] );
$emptyInstances = 0; $emptyInstances = 0;
$quequeUpload = array(); $quequeUpload = array ();
// upload files & check for errors // upload files & check for errors
$tmp = $_FILES['uploadedFile']['tmp_name']; $tmp = $_FILES['uploadedFile']['tmp_name'];
$items = stripslashes($_FILES['uploadedFile']['name']); $items = stripslashes( $_FILES['uploadedFile']['name'] );
if ($sw_error_exists) { if ($sw_error_exists) {
$up_err = $_FILES['uploadedFile']['error']; $up_err = $_FILES['uploadedFile']['error'];
} else { } else {
$up_err= ( file_exists($tmp) ? 0 : 4); $up_err = (file_exists( $tmp ) ? 0 : 4);
} }
if ($items == "" || $up_err == 4) { if ($items == "" || $up_err == 4) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED'))); throw (new Exception( G::LoadTranslation( 'ID_SKIN_FILE_REQUIRED' ) ));
} }
if ($up_err == 1 || $up_err == 2) { if ($up_err == 1 || $up_err == 2) {
throw ( new Exception(G::LoadTranslation('ID_FILE_TOO_BIG'))); throw (new Exception( G::LoadTranslation( 'ID_FILE_TOO_BIG' ) ));
//$errors[$i]='miscfilesize'; //$errors[$i]='miscfilesize';
} }
if ($up_err == 3) { if ($up_err == 3) {
throw ( new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR'))); throw (new Exception( G::LoadTranslation( 'ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR' ) ));
//$errors[$i]='miscfilepart'; //$errors[$i]='miscfilepart';
} }
if (!@is_uploaded_file($tmp)) { if (! @is_uploaded_file( $tmp )) {
throw ( new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR'))); throw (new Exception( G::LoadTranslation( 'ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR' ) ));
//$errors[$i]='uploadfile'; //$errors[$i]='uploadfile';
} }
$fileInfo = pathinfo($items); $fileInfo = pathinfo( $items );
$validType = array('tar', 'gz'); $validType = array ('tar','gz'
);
if (!in_array($fileInfo['extension'], $validType)) { if (! in_array( $fileInfo['extension'], $validType )) {
throw ( new Exception(G::LoadTranslation('ID_FILE_UPLOAD_INCORRECT_EXTENSION'))); throw (new Exception( G::LoadTranslation( 'ID_FILE_UPLOAD_INCORRECT_EXTENSION' ) ));
//$errors[$i]='wrongtype'; //$errors[$i]='wrongtype';
} }
$filename = $items; $filename = $items;
$tempPath = PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP; $tempPath = PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP;
G::verifyPath($tempPath, true); G::verifyPath( $tempPath, true );
$tempName = $tmp; $tempName = $tmp;
G::uploadFile($tempName, $tempPath, $filename); G::uploadFile( $tempName, $tempPath, $filename );
G::LoadThirdParty('pear/Archive', 'Tar'); G::LoadThirdParty( 'pear/Archive', 'Tar' );
$tar = new Archive_Tar($tempPath . $filename); $tar = new Archive_Tar( $tempPath . $filename );
$aFiles = $tar->listContent(); $aFiles = $tar->listContent();
$swConfigFile = false; $swConfigFile = false;
foreach ($aFiles as $key => $val) { foreach ($aFiles as $key => $val) {
if (basename($val['filename']) == 'config.xml') { if (basename( $val['filename'] ) == 'config.xml') {
$skinName = dirname($val['filename']); $skinName = dirname( $val['filename'] );
$skinArray = explode("/", $skinName); $skinArray = explode( "/", $skinName );
if (count($skinArray) == 1) { if (count( $skinArray ) == 1) {
$swConfigFile = true; $swConfigFile = true;
} }
} }
} }
if (!$swConfigFile) { if (! $swConfigFile) {
@unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename); @unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING'))); throw (new Exception( G::LoadTranslation( 'ID_SKIN_CONFIGURATION_MISSING' ) ));
} }
if (is_dir(PATH_CUSTOM_SKINS . $skinName)) { if (is_dir( PATH_CUSTOM_SKINS . $skinName )) {
if ((isset($_REQUEST['overwrite_files'])) && ($_REQUEST['overwrite_files'] == 'on')) { if ((isset( $_REQUEST['overwrite_files'] )) && ($_REQUEST['overwrite_files'] == 'on')) {
G::rm_dir(PATH_CUSTOM_SKINS . $skinName, false); G::rm_dir( PATH_CUSTOM_SKINS . $skinName, false );
} else { } else {
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS'))); throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
} }
} }
$res = $tar->extract(PATH_CUSTOM_SKINS); $res = $tar->extract( PATH_CUSTOM_SKINS );
if (!$res) { if (! $res) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_ERROR_EXTRACTING'))); throw (new Exception( G::LoadTranslation( 'ID_SKIN_ERROR_EXTRACTING' ) ));
} }
//Delete Temporal //Delete Temporal
@unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename); @unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );
$response['success'] = true; $response['success'] = true;
$response['message'] = G::LoadTranslation('ID_SKIN_SUCCESSFUL_IMPORTED'); $response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESSFUL_IMPORTED' );
print_r(G::json_encode($response)); print_r( G::json_encode( $response ) );
} catch (Exception $e) { } catch (Exception $e) {
$response['success'] = false; $response['success'] = false;
$response['message'] = $e->getMessage(); $response['message'] = $e->getMessage();
$response['error'] = $e->getMessage(); $response['error'] = $e->getMessage();
print_r(G::json_encode($response)); print_r( G::json_encode( $response ) );
} }
} }
function exportSkin($skinToExport="") function exportSkin ($skinToExport = "")
{ {
try { try {
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) { if (! isset( $_REQUEST['SKIN_FOLDER_ID'] )) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_NAME_REQUIRED' ) ));
} }
$skinName = $_REQUEST['SKIN_FOLDER_ID']; $skinName = $_REQUEST['SKIN_FOLDER_ID'];
@@ -257,113 +252,116 @@ function exportSkin($skinToExport="")
$skinFolderBase = PATH_CUSTOM_SKINS . $skinName; $skinFolderBase = PATH_CUSTOM_SKINS . $skinName;
$skinFolder = $skinFolderBase . PATH_SEP; $skinFolder = $skinFolderBase . PATH_SEP;
$skinTar = PATH_CUSTOM_SKINS . $skinName . '.tar'; $skinTar = PATH_CUSTOM_SKINS . $skinName . '.tar';
if (!is_dir($skinFolder)) { if (! is_dir( $skinFolder )) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_DOESNT_EXIST')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_DOESNT_EXIST' ) ));
} }
if (!file_exists($skinFolder . "config.xml")) { if (! file_exists( $skinFolder . "config.xml" )) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_CONFIGURATION_MISSING' ) ));
} }
if (file_exists($skinTar)) { if (file_exists( $skinTar )) {
//try to delete //try to delete
if (!unlink($skinTar)) { if (! unlink( $skinTar )) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_PERMISSIONS')) ); throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_PERMISSIONS' ) ));
} }
} }
//Try to generate tar file //Try to generate tar file
G::LoadThirdParty('pear/Archive', 'Tar'); G::LoadThirdParty( 'pear/Archive', 'Tar' );
$tar = new Archive_Tar($skinTar); $tar = new Archive_Tar( $skinTar );
$tar->_compress = false; $tar->_compress = false;
addTarFolder($tar, $skinFolder, PATH_CUSTOM_SKINS); addTarFolder( $tar, $skinFolder, PATH_CUSTOM_SKINS );
$response['success'] = true; $response['success'] = true;
$response['message'] = $skinTar; $response['message'] = $skinTar;
print_r(G::json_encode($response)); print_r( G::json_encode( $response ) );
} catch (Exception $e) { } catch (Exception $e) {
$response['success'] = false; $response['success'] = false;
$response['message'] = $e->getMessage(); $response['message'] = $e->getMessage();
print_r(G::json_encode($response)); print_r( G::json_encode( $response ) );
} }
} }
function deleteSkin()
function deleteSkin ()
{ {
try { try {
if (!(isset($_REQUEST['SKIN_FOLDER_ID']))) { if (! (isset( $_REQUEST['SKIN_FOLDER_ID'] ))) {
throw (new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED'))); throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_REQUIRED' ) ));
} }
if (($_REQUEST['SKIN_FOLDER_ID'])=="classic") { if (($_REQUEST['SKIN_FOLDER_ID']) == "classic") {
throw (new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE'))); throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_NOT_DELETEABLE' ) ));
} }
$folderId=$_REQUEST['SKIN_FOLDER_ID']; $folderId = $_REQUEST['SKIN_FOLDER_ID'];
if (!is_dir(PATH_CUSTOM_SKINS.$folderId)) { if (! is_dir( PATH_CUSTOM_SKINS . $folderId )) {
throw (new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS'))); throw (new Exception( G::LoadTranslation( 'ID_SKIN_NOT_EXISTS' ) ));
} }
//Delete //Delete
G::rm_dir(PATH_CUSTOM_SKINS.$folderId); G::rm_dir( PATH_CUSTOM_SKINS . $folderId );
$response['success'] = true; $response['success'] = true;
$response['message'] = "$folderId deleted"; $response['message'] = "$folderId deleted";
} catch (Exception $e) { } catch (Exception $e) {
$response['success'] = false; $response['success'] = false;
$response['error']=$response['message'] = $e->getMessage(); $response['error'] = $response['message'] = $e->getMessage();
print_r(G::json_encode($response)); print_r( G::json_encode( $response ) );
} }
} }
function streamSkin()
function streamSkin ()
{ {
$skinTar = $_REQUEST['file']; $skinTar = $_REQUEST['file'];
$bDownload = true; $bDownload = true;
G::streamFile($skinTar, $bDownload, basename($skinTar)); G::streamFile( $skinTar, $bDownload, basename( $skinTar ) );
@unlink($fileTar); @unlink( $fileTar );
} }
function addTarFolder($tar, $pathBase, $pluginHome) function addTarFolder ($tar, $pathBase, $pluginHome)
{ {
$aux = explode(PATH_SEP, $pathBase); $aux = explode( PATH_SEP, $pathBase );
if ($aux[count($aux) - 2] == '.svn') { if ($aux[count( $aux ) - 2] == '.svn') {
return; return;
} }
if ($handle = opendir($pathBase)) { if ($handle = opendir( $pathBase )) {
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir( $handle ))) {
if (is_file($pathBase . $file)) { if (is_file( $pathBase . $file )) {
//print "file $file \n"; //print "file $file \n";
$tar->addModify($pathBase . $file, '', $pluginHome); $tar->addModify( $pathBase . $file, '', $pluginHome );
} }
if (is_dir($pathBase . $file) && $file != '..' && $file != '.') { if (is_dir( $pathBase . $file ) && $file != '..' && $file != '.') {
//print "dir $pathBase$file \n"; //print "dir $pathBase$file \n";
addTarFolder($tar, $pathBase . $file . PATH_SEP, $pluginHome); addTarFolder( $tar, $pathBase . $file . PATH_SEP, $pluginHome );
} }
} }
closedir($handle); closedir( $handle );
} }
} }
function copy_skin_folder($path, $dest, $exclude=array()) function copy_skin_folder ($path, $dest, $exclude = array())
{ {
$defaultExcluded=array(".",".."); $defaultExcluded = array (".",".."
$excludedItems=array_merge($defaultExcluded,$exclude); );
if (is_dir($path)) { $excludedItems = array_merge( $defaultExcluded, $exclude );
@mkdir($dest); if (is_dir( $path )) {
$objects = scandir($path); @mkdir( $dest );
if (sizeof($objects) > 0) { $objects = scandir( $path );
if (sizeof( $objects ) > 0) {
foreach ($objects as $file) { foreach ($objects as $file) {
if (in_array($file,$excludedItems)) { if (in_array( $file, $excludedItems )) {
continue; continue;
} }
// go on // go on
if (is_dir($path . PATH_SEP . $file)) { if (is_dir( $path . PATH_SEP . $file )) {
copy_skin_folder($path . PATH_SEP . $file, $dest . PATH_SEP . $file,$exclude); copy_skin_folder( $path . PATH_SEP . $file, $dest . PATH_SEP . $file, $exclude );
} else { } else {
copy($path . PATH_SEP . $file, $dest . PATH_SEP . $file); copy( $path . PATH_SEP . $file, $dest . PATH_SEP . $file );
} }
} }
} }
return true; return true;
} elseif (is_file($path)) { } elseif (is_file( $path )) {
return copy($path, $dest); return copy( $path, $dest );
} else { } else {
return false; return false;
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* skinsExport.php * skinsExport.php
* *
@@ -12,173 +13,175 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
function copyFile ( $input, $output ) {
$content = file_get_contents ( $input );
$filename = $output . PATH_SEP . basename ( $input );
return file_put_contents ( $filename, $content );
}
function savePluginFile ( $tplName, $fileName, $fields ) { function copyFile ($input, $output)
$pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' .PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; {
$content = file_get_contents( $input );
$filename = $output . PATH_SEP . basename( $input );
return file_put_contents( $filename, $content );
}
function savePluginFile ($tplName, $fileName, $fields)
{
$pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl';
$template = new TemplatePower( $pluginTpl ); $template = new TemplatePower( $pluginTpl );
$template->prepare(); $template->prepare();
if ( is_array ($fields) ) {
foreach ( $fields as $block => $data ) {
$template->gotoBlock( "_ROOT" );
if ( is_array( $data) )
foreach ( $data as $rowId => $row ) {
$template->newBlock( $block );
foreach ( $row as $key => $val )
$template->assign( $key, $val );
}
else
$template->assign( $block, $data );
}
}
$content = $template->getOutputContent();
$iSize = file_put_contents ( $fileName, $content );
return $iSize;
}
function addTarFolder ( $tar, $pathBase,$pluginHome ) { if (is_array( $fields )) {
$aux = explode( PATH_SEP, $pathBase); foreach ($fields as $block => $data) {
if ( $aux[count($aux) -2 ] == '.svn' ) return; $template->gotoBlock( "_ROOT" );
if (is_array( $data ))
if ($handle = opendir( $pathBase )) { foreach ($data as $rowId => $row) {
while ( false !== ($file = readdir($handle))) { $template->newBlock( $block );
if ( is_file ( $pathBase . $file ) ) { foreach ($row as $key => $val)
//print "file $file \n"; $template->assign( $key, $val );
$tar->addModify( $pathBase . $file,'', $pluginHome); }
else
$template->assign( $block, $data );
} }
if ( is_dir ( $pathBase . $file ) && $file != '..' && $file != '.' ) {
//print "dir $pathBase$file \n";
addTarFolder ( $tar, $pathBase . $file . PATH_SEP ,$pluginHome);
}
}
closedir($handle);
} }
}
function packPlugin ( $pluginName, $version ) { $content = $template->getOutputContent();
$iSize = file_put_contents( $fileName, $content );
return $iSize;
}
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $pluginName . PATH_SEP; function addTarFolder ($tar, $pathBase, $pluginHome)
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $pluginName ; {
$fileTar = PATH_DATA . 'skins' . PATH_SEP . $pluginName . '-' . $version . '.tar'; $aux = explode( PATH_SEP, $pathBase );
if ($aux[count( $aux ) - 2] == '.svn')
G::LoadSystem ('templatePower'); return;
/*
if ($handle = opendir( $pathBase )) {
while (false !== ($file = readdir( $handle ))) {
if (is_file( $pathBase . $file )) {
//print "file $file \n";
$tar->addModify( $pathBase . $file, '', $pluginHome );
}
if (is_dir( $pathBase . $file ) && $file != '..' && $file != '.') {
//print "dir $pathBase$file \n";
addTarFolder( $tar, $pathBase . $file . PATH_SEP, $pluginHome );
}
}
closedir( $handle );
}
}
function packPlugin ($pluginName, $version)
{
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $pluginName . PATH_SEP;
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $pluginName;
$fileTar = PATH_DATA . 'skins' . PATH_SEP . $pluginName . '-' . $version . '.tar';
G::LoadSystem( 'templatePower' );
/*
$pluginDirectory = PATH_PLUGINS . $pluginName; $pluginDirectory = PATH_PLUGINS . $pluginName;
$pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName; $pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
$pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName; $pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
//verify if plugin exists, //verify if plugin exists,
$pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php'; $pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php';
if ( !is_file ( $pluginClassFilename ) ) { if ( !is_file ( $pluginClassFilename ) ) {
printf("The plugin %s doesn't exist in this file %s \n", pakeColor::colorize( $pluginName, 'ERROR'), pakeColor::colorize( $pluginClassFilename, 'INFO') ); printf("The plugin %s doesn't exist in this file %s \n", pakeColor::colorize( $pluginName, 'ERROR'), pakeColor::colorize( $pluginClassFilename, 'INFO') );
die ; die ;
} }
*/ */
G::LoadThirdParty( 'pear/Archive','Tar'); G::LoadThirdParty( 'pear/Archive', 'Tar' );
$tar = new Archive_Tar ( $fileTar); $tar = new Archive_Tar( $fileTar );
$tar->_compress=false; $tar->_compress = false;
//$tar->createModify( $pathHome . PATH_SEP . $pluginName . '.php' ,'', $pathHome); //$tar->createModify( $pathHome . PATH_SEP . $pluginName . '.php' ,'', $pathHome);
addTarFolder ( $tar, $pathBase, $pathHome ); addTarFolder( $tar, $pathBase, $pathHome );
$aFiles = $tar->listContent(); $aFiles = $tar->listContent();
return $fileTar; return $fileTar;
}
global $RBAC;
switch ($RBAC->userCanAccess('PM_SETUP'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
} }
G::LoadClass("system"); global $RBAC;
switch ($RBAC->userCanAccess( 'PM_SETUP' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
$id = $_GET['id']; G::LoadClass( "system" );
$fileObj = PATH_SKINS . $id . '.cnf'; $id = $_GET['id'];
if ( !file_exists($fileObj) ) { $fileObj = PATH_SKINS . $id . '.cnf';
if (! file_exists( $fileObj )) {
$oConf = new stdClass(); $oConf = new stdClass();
$oConf->name = $id; $oConf->name = $id;
$oConf->description = "description of skin $id "; $oConf->description = "description of skin $id ";
$oConf->version = 1; $oConf->version = 1;
file_put_contents ( $fileObj, serialize ( $oConf) ); file_put_contents( $fileObj, serialize( $oConf ) );
} }
$oConf = unserialize( file_get_contents( $fileObj ) );
$oConf->version += 1;
file_put_contents( $fileObj, serialize( $oConf ) );
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $id . PATH_SEP;
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $id . PATH_SEP . $id . PATH_SEP;
$pathPublic = $pathBase . 'data' . PATH_SEP . 'public_html' . PATH_SEP;
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
G::mk_dir( $pathBase );
G::mk_dir( $pathBase . 'data' );
G::mk_dir( $pathPublic );
G::mk_dir( $pathPublic . 'images' );
$oConf = unserialize ( file_get_contents ( $fileObj ));
$oConf->version += 1;
file_put_contents ( $fileObj, serialize ( $oConf) );
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $id . PATH_SEP;
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $id . PATH_SEP . $id . PATH_SEP;
$pathPublic = $pathBase . 'data' . PATH_SEP . 'public_html' . PATH_SEP ;
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
G::mk_dir ( $pathBase );
G::mk_dir ( $pathBase . 'data' );
G::mk_dir ( $pathPublic );
G::mk_dir ( $pathPublic . 'images' );
// file_put_contents ( PATH_DATA . 'skins' . PATH_SEP . $id , "hello world" ); // file_put_contents ( PATH_DATA . 'skins' . PATH_SEP . $id , "hello world" );
$fields['className'] = $id; $fields['className'] = $id;
$fields['version'] = $oConf->version; $fields['version'] = $oConf->version;
$fields['description'] = $oConf->description; $fields['description'] = $oConf->description;
$fields['PMversion'] = System::getVersion(); $fields['PMversion'] = System::getVersion();
savePluginFile ( 'skinPluginMainClass' , $pathHome . $id . '.php', $fields ); savePluginFile( 'skinPluginMainClass', $pathHome . $id . '.php', $fields );
savePluginFile ( 'skinPluginClass' , $pathBase . 'class.' . $id . '.php', $fields ); savePluginFile( 'skinPluginClass', $pathBase . 'class.' . $id . '.php', $fields );
copyFile ( PATH_SKINS . $id . '.php' , $pathBase . 'data' );
copyFile ( PATH_SKINS . $id . '.html' , $pathBase . 'data' );
copyFile ( PATH_SKINS . $id . '.cnf' , $pathBase . 'data' );
copyFile ( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc' , $pathPublic );
copyFile ( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css' , $pathPublic );
copyFile( PATH_SKINS . $id . '.php', $pathBase . 'data' );
copyFile( PATH_SKINS . $id . '.html', $pathBase . 'data' );
copyFile( PATH_SKINS . $id . '.cnf', $pathBase . 'data' );
$aFiles = array (); copyFile( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc', $pathPublic );
if ($handle = opendir( $pathImages )) { copyFile( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css', $pathPublic );
while ( false !== ($file = readdir($handle))) {
if ( substr($file,0,1) != '.' ) { $aFiles = array ();
if ( isset($aFiles[ $file ]) ) $aFiles[$file] = 0; if ($handle = opendir( $pathImages )) {
copyFile ( $pathImages. $file , $pathPublic . 'images' . PATH_SEP ); while (false !== ($file = readdir( $handle ))) {
if (substr( $file, 0, 1 ) != '.') {
} if (isset( $aFiles[$file] ))
$aFiles[$file] = 0;
copyFile( $pathImages . $file, $pathPublic . 'images' . PATH_SEP );
}
} }
closedir($handle); closedir( $handle );
} }
$fileTar = packPlugin ( $id, $oConf->version ); $fileTar = packPlugin( $id, $oConf->version );
$bDownload = true;
G::streamFile( $fileTar, $bDownload, basename( $fileTar ) );
@G::rm_dir( $pathHome );
@unlink( $fileTar );
$bDownload = true;
G::streamFile ( $fileTar, $bDownload, basename($fileTar) );
@G::rm_dir ($pathHome);
@unlink ($fileTar);

View File

@@ -1,4 +1,4 @@
<?php <?php
/** /**
* pluginsList.php * pluginsList.php
* *
@@ -12,142 +12,138 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){ if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login'); //G::header('location: ../login/login');
die; die();
} }
$G_MAIN_MENU = 'processmaker'; $G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup'; $G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP'; $G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'CALENDAR'; $G_ID_SUB_MENU_SELECTED = 'CALENDAR';
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
G::LoadClass('configuration'); G::LoadClass( 'configuration' );
$c = new Configurations(); $c = new Configurations();
$configPage = $c->getConfiguration('skinList', 'pageSize','',$_SESSION['USER_LOGGED']); $configPage = $c->getConfiguration( 'skinList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20; $Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('setup/skinList', false); //adding a javascript file .js $oHeadPublisher->addExtJsScript( 'setup/skinList', false ); //adding a javascript file .js
$oHeadPublisher->addContent('setup/skinList'); //adding a html file .html. $oHeadPublisher->addContent( 'setup/skinList' ); //adding a html file .html.
$oHeadPublisher->assign('CONFIG', $Config); $oHeadPublisher->assign( 'CONFIG', $Config );
$oHeadPublisher->assign('SYS_SKIN', SYS_SKIN); $oHeadPublisher->assign( 'SYS_SKIN', SYS_SKIN );
$oHeadPublisher->assign('FORMATS',$c->getFormats()); $oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
G::RenderPage('publish', 'extJs'); G::RenderPage( 'publish', 'extJs' );
die; die();
global $RBAC; global $RBAC;
$access = $RBAC->userCanAccess('PM_SETUP'); $access = $RBAC->userCanAccess( 'PM_SETUP' );
if( $access != 1 ){ if ($access != 1) {
switch ($access) switch ($access) {
{ case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; default:
default: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
}
} }
// lets display the items // lets display the items
$items[] = array ( 'id' => 'char', 'title' => 'char', 'type' => 'char', 'creator' => 'char' , $items[] = array ('id' => 'char','title' => 'char','type' => 'char','creator' => 'char','modifiedBy' => 'char','filename' => 'char','size' => 'char','mime' => 'char'
'modifiedBy' => 'char', 'filename' => 'char', 'size' => 'char', 'mime' => 'char'); );
//***************** Skins ************************** //***************** Skins **************************
$aFiles = array (); $aFiles = array ();
if ($handle = opendir( PATH_SKINS )) { if ($handle = opendir( PATH_SKINS )) {
while ( false !== ($file = readdir($handle))) { while (false !== ($file = readdir( $handle ))) {
G::pr($file); G::pr( $file );
$filename = substr ( $file,0, strrpos($file, '.')); $filename = substr( $file, 0, strrpos( $file, '.' ) );
// list of no complete skins // list of no complete skins
$aFilterSkinsList = Array('blank', 'green', 'raw', 'tracker', 'iphone', 'green-submenu', 'extJsInitLoad', 'extJs' ); $aFilterSkinsList = Array ('blank','green','raw','tracker','iphone','green-submenu','extJsInitLoad','extJs'
);
if ( !is_dir(PATH_SKINS. $file) ) {
if ( !in_array($filename, $aFilterSkinsList) /*&& /*/ && !strpos($file, '.tar', 1) ) { if (! is_dir( PATH_SKINS . $file )) {
if ( !isset($aFiles[ $filename ]) ) $aFiles[$filename] = 0; if (! in_array( $filename, $aFilterSkinsList ) /*&& /*/ && ! strpos( $file, '.tar', 1 )) {
if ( strpos($file, '.php', 1) ) $aFiles[ $filename ] += 1; if (! isset( $aFiles[$filename] ))
if ( strpos($file, '.html',1) ) $aFiles[ $filename ] += 2; $aFiles[$filename] = 0;
if (strpos( $file, '.php', 1 ))
$aFiles[$filename] += 1;
if (strpos( $file, '.html', 1 ))
$aFiles[$filename] += 2;
}
} }
}
} }
closedir($handle); closedir( $handle );
//now walk in the array to get the .cnf file and display properties //now walk in the array to get the .cnf file and display properties
foreach ( $aFiles as $key => $val ) { foreach ($aFiles as $key => $val) {
$description = ''; $description = '';
$version = ''; $version = '';
if ( file_exists ( PATH_SKINS . $key . '.cnf' ) ) { if (file_exists( PATH_SKINS . $key . '.cnf' )) {
$serial = file_get_contents ( PATH_SKINS . $key . '.cnf' ); $serial = file_get_contents( PATH_SKINS . $key . '.cnf' );
$previousErrorRep = ini_get("error_reporting"); $previousErrorRep = ini_get( "error_reporting" );
error_reporting( E_ERROR ) ; error_reporting( E_ERROR );
$prop = unserialize ( $serial ); $prop = unserialize( $serial );
error_reporting( $previousErrorRep ); error_reporting( $previousErrorRep );
if ( !is_object( $prop ) ) { if (! is_object( $prop )) {
@unlink ( PATH_SKINS . $key . '.cnf'); @unlink( PATH_SKINS . $key . '.cnf' );
}
if (isset( $prop ) && isset( $prop->description ))
$description = $prop->description;
if (isset( $prop ) && isset( $prop->version ))
$version = $prop->version;
} }
if ( isset ( $prop) && isset($prop->description) ) $description = $prop->description;
if ( isset ( $prop) && isset($prop->version ) ) $version = $prop->version; $linkPackValue = G::LoadTranslation( 'ID_EXPORT' );
} $link = 'skinsExport?id=' . $key;
$items[] = array ('id' => count( $items ),'name' => $key,'filename' => $key,'description' => $description,'version' => $version,'url' => $link,'linkPackValue' => $linkPackValue
$linkPackValue = G::LoadTranslation('ID_EXPORT') ; );
$link = 'skinsExport?id=' . $key ;
$items[] = array (
'id' => count($items),
'name' => $key,
'filename' => $key,
'description' => $description,
'version' => $version,
'url' => $link,
'linkPackValue' => $linkPackValue
);
} }
$folders['items'] = $items; $folders['items'] = $items;
} }
$_DBArray['plugins'] = $items;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass( 'ArrayPeer'); $_DBArray['plugins'] = $items;
$c = new Criteria ('dbarray'); $_SESSION['_DBArray'] = $_DBArray;
$c->setDBArrayTable('plugins');
$c->addAscendingOrderByColumn ('id');
$G_MAIN_MENU = 'processmaker'; G::LoadClass( 'ArrayPeer' );
$G_ID_MENU_SELECTED = 'SETUP'; $c = new Criteria( 'dbarray' );
$G_SUB_MENU = 'setup'; $c->setDBArrayTable( 'plugins' );
$G_ID_SUB_MENU_SELECTED = 'SKINS'; $c->addAscendingOrderByColumn( 'id' );
$G_PUBLISH = new Publisher; $G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'SKINS';
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/skinsList', $c ); $G_PUBLISH = new Publisher();
G::RenderPage('publishBlank', 'blank'); $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/skinsList', $c );
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -1,58 +1,57 @@
<?php <?php
/** /**
* holidayNew.php * holidayNew.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/
$access = $RBAC->userCanAccess( 'PM_SETUP' );
$access = $RBAC->userCanAccess('PM_SETUP'); if ($access != 1) {
if( $access != 1 ){ switch ($access) {
switch ($access) case - 1:
{ G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
case -1: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; case - 2:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
case -2: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; default:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
default: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; }
break; }
} if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
} return $RBAC_Response;
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
$dbc = new DBConnection();
$dbc = new DBConnection; $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher; $G_MAIN_MENU = 'processmaker';
$G_MAIN_MENU = 'processmaker'; $G_ID_MENU_SELECTED = 'SETUP';
$G_ID_MENU_SELECTED = 'SETUP'; $G_SUB_MENU = 'setup';
$G_SUB_MENU = 'setup'; $G_ID_SUB_MENU_SELECTED = 'SKINS';
$G_ID_SUB_MENU_SELECTED = 'SKINS';
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/skinsNew", '', null, "skinsSave" );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/skinsNew", '', null, "skinsSave"); G::RenderPage( 'publishBlank', 'blank' );
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* skinsSave.php * skinsSave.php
* *
@@ -12,84 +13,76 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
function xcopy ( $pathSource, $pathTarget ) { function xcopy ($pathSource, $pathTarget)
G::mk_dir ($pathTarget);
if ($handle = opendir( $pathSource )) {
while ( false !== ($file = readdir($handle))) {
if ( substr($file,0,1) != '.' && !is_dir ($file) ) {
$content = file_get_contents ( $pathSource . $file );
$filename = $pathTarget . $file ;
file_put_contents ( $filename, $content );
}
}
closedir($handle);
}
}
global $RBAC;
switch ($RBAC->userCanAccess('PM_SETUP'))
{ {
case -2: G::mk_dir( $pathTarget );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); if ($handle = opendir( $pathSource )) {
G::header('location: ../login/login'); while (false !== ($file = readdir( $handle ))) {
die; if (substr( $file, 0, 1 ) != '.' && ! is_dir( $file )) {
break; $content = file_get_contents( $pathSource . $file );
case -1: $filename = $pathTarget . $file;
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); file_put_contents( $filename, $content );
G::header('location: ../login/login'); }
die; }
break; closedir( $handle );
}
} }
G::LoadClass("system"); global $RBAC;
switch ($RBAC->userCanAccess( 'PM_SETUP' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
$id = strip_tags ( str_replace ( ' ', '_', trim ($_POST['form']['NAME']) ) ); G::LoadClass( "system" );
$desc = $_POST['form']['DESCRIPTION'];
$id = strip_tags( str_replace( ' ', '_', trim( $_POST['form']['NAME'] ) ) );
$fileObj = PATH_SKINS . $id . '.cnf'; $desc = $_POST['form']['DESCRIPTION'];
if ( !file_exists($fileObj) ) { $fileObj = PATH_SKINS . $id . '.cnf';
if (! file_exists( $fileObj )) {
$oConf = new stdClass(); $oConf = new stdClass();
$oConf->name = $id; $oConf->name = $id;
$oConf->description = $desc; $oConf->description = $desc;
$oConf->version = 1; $oConf->version = 1;
file_put_contents ( $fileObj, serialize ( $oConf) ); file_put_contents( $fileObj, serialize( $oConf ) );
} }
$oConf = unserialize ( file_get_contents ( $fileObj )); $oConf = unserialize( file_get_contents( $fileObj ) );
$contentPHP = file_get_contents ( PATH_SKINS . 'green.php' ); $contentPHP = file_get_contents( PATH_SKINS . 'green.php' );
$contentPHP = str_replace ( 'green.html', $id.'.html', $contentPHP ); $contentPHP = str_replace( 'green.html', $id . '.html', $contentPHP );
file_put_contents ( PATH_SKINS . $id . '.php', $contentPHP ); file_put_contents( PATH_SKINS . $id . '.php', $contentPHP );
$contentHTML = file_get_contents ( PATH_SKINS . 'green.html' );
$contentHTML = str_replace ( 'green', $id , $contentHTML );
file_put_contents ( PATH_SKINS . $id . '.html', $contentHTML );
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP; $contentHTML = file_get_contents( PATH_SKINS . 'green.html' );
G::mk_dir ( $pathImages ); $contentHTML = str_replace( 'green', $id, $contentHTML );
file_put_contents( PATH_SKINS . $id . '.html', $contentHTML );
xcopy (
PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP ,
PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP
);
xcopy ( $pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images'. PATH_SEP, G::mk_dir( $pathImages );
PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images'. PATH_SEP
); xcopy( PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP, PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP );
xcopy( PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP, PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP );
G::Header( 'Location: ../../' . $id . '/setup/skinsList' );
G::Header ( 'Location: ../../' . $id . '/setup/skinsList' );

View File

@@ -1,74 +1,72 @@
<?php <?php
/** /**
* upgrade.php * upgrade.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ global $RBAC;
global $RBAC; $access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE'); if ($access != 1) {
if( $access != 1 ){ switch ($access) {
switch ($access) case - 1:
{ G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
case -1: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; case - 2:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
case -2: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; default:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
default: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; }
break; }
} //calculating the max upload file size;
} $POST_MAX_SIZE = ini_get( 'post_max_size' );
//calculating the max upload file size; $mul = substr( $POST_MAX_SIZE, - 1 );
$POST_MAX_SIZE = ini_get('post_max_size'); $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$mul = substr($POST_MAX_SIZE, -1); $postMaxSize = (int) $POST_MAX_SIZE * $mul;
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul; $UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize'); $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$mul = substr($UPLOAD_MAX_SIZE, -1); $uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul; if ($postMaxSize < $uploadMaxSize)
$uploadMaxSize = $postMaxSize;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_MAIN_MENU = 'processmaker'; $G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup'; $G_ID_SUB_MENU_SELECTED = 'UPGRADE';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'UPGRADE'; G::LoadClass( "system" );
G::LoadClass("system"); $Fields['PM_VERSION'] = System::getVersion();
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
$Fields['PM_VERSION'] = System::getVersion();
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") "; $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/upgrade', '', $Fields, 'upgrade_System' );
$G_PUBLISH = new Publisher; G::RenderPage( 'publishBlank', 'blank' );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/upgrade', '', $Fields, 'upgrade_System');
G::RenderPage('publishBlank', 'blank');

View File

@@ -39,4 +39,5 @@ $aRequiredPermissions = array('PM_LOGIN',
'PM_FOLDERS_VIEW', 'PM_FOLDERS_VIEW',
'PM_FOLDERS_ADD_FOLDER', 'PM_FOLDERS_ADD_FOLDER',
'PM_FOLDERS_ADD_FILE' 'PM_FOLDERS_ADD_FILE'
); );

View File

@@ -1,110 +1,108 @@
<?php <?php
/** /**
* upgrade_System.php * upgrade_System.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc. * Copyright (C) 2004 - 2008 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/
/**
/** * New System Upgrade controller
* New System Upgrade controller *
* * @author Erik A. O. <erik@colosa.com>
* @author Erik A. O. <erik@colosa.com> * @date May 12th, 2010
* @date May 12th, 2010 */
*/ global $RBAC;
global $RBAC; switch ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' )) {
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE')) case - 2:
{ G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
case -2: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; case - 1:
break; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
case -1: G::header( 'location: ../login/login' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); die();
G::header('location: ../login/login'); break;
die; }
break; set_time_limit( 0 );
}
set_time_limit(0); $G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_MAIN_MENU = 'processmaker'; $G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup'; $G_ID_SUB_MENU_SELECTED = 'UPGRADE';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'UPGRADE'; require_once "classes/class.system.php";
$oSystem = new System();
require_once "classes/class.system.php";
$oSystem = new System(); try {
if (! $oSystem->verifyFileForUpgrade()) {
try { throw (new Exception( "There was an error uploading the file, probably the file size if greater than upload_max_filesize parameter in php.ini, please check this parameter and try again." ));
if( ! $oSystem->verifyFileForUpgrade() ){ }
throw ( new Exception ("There was an error uploading the file, probably the file size if greater than upload_max_filesize parameter in php.ini, please check this parameter and try again." ) ); $oSystem->cleanupUpgradeDirectory();
} $oSystem->getUpgradedFilesList();
$oSystem->cleanupUpgradeDirectory();
$oSystem->getUpgradedFilesList(); $ver = $oSystem->upgrade();
$G_PUBLISH = new Publisher();
$ver = $oSystem->upgrade(); $aMessage['THEMESSAGE1'] = G::LoadTranslation( 'ID_UPGRADE_READY' ) . " <b>" . $ver[0] . "</b> " . G::LoadTranslation( 'ID_TO' ) . " <b>" . $ver[1] . "</b>";
$G_PUBLISH = new Publisher; $aMessage['THEMESSAGE2'] = file_get_contents( $oSystem->sUpgradeFileList );
$aMessage['THEMESSAGE1'] = G::LoadTranslation('ID_UPGRADE_READY') ." <b>". $ver[0] ."</b> ". G::LoadTranslation('ID_TO') ." <b>". $ver[1] ."</b>"; $aMessage['THEMESSAGE3'] = '';
$aMessage['THEMESSAGE2'] = file_get_contents($oSystem->sUpgradeFileList);
$aMessage['THEMESSAGE3'] = ''; if (! is_Array( $oSystem->aErrors ) || count( $oSystem->aErrors ) == 0)
$aMessage['THEMESSAGE4'] = G::LoadTranslation( 'ID_NONE' );
if ( !is_Array($oSystem->aErrors) || count($oSystem->aErrors) == 0 ) else
$aMessage['THEMESSAGE4'] = G::LoadTranslation('ID_NONE'); $aMessage['THEMESSAGE4'] = implode( "\n", $oSystem->aErrors );
else
$aMessage['THEMESSAGE4'] = implode( "\n", $oSystem->aErrors) ; $oHeadPublisher = & headPublisher::getSingleton();
if (file_exists( PATH_CORE . 'js' . PATH_SEP . 'setup' . PATH_SEP . 'upgrade_System.js' )) {
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addScriptFile( '/jscore/setup/upgrade_System.js' );
if( file_exists(PATH_CORE . 'js' . PATH_SEP . 'setup' . PATH_SEP . 'upgrade_System.js') ){ } else {
$oHeadPublisher->addScriptFile('/jscore/setup/upgrade_System.js'); $oHeadPublisher->addScriptCode( "function upgradeSystem(wsCount) {
} else { document.getElementById('form[THETITLE3]').innerHTML = wsCount + ' workspaces to update.';
$oHeadPublisher->addScriptCode("function upgradeSystem(wsCount) { document.getElementById('form[SUBTITLE4]').innerHTML = '&nbsp;&nbsp;<img src='/images/alert.gif' width='13' height='13' border='0'> Please wait...';
document.getElementById('form[THETITLE3]').innerHTML = wsCount + ' workspaces to update.'; updateWorkspace(wsCount);
document.getElementById('form[SUBTITLE4]').innerHTML = '&nbsp;&nbsp;<img src='/images/alert.gif' width='13' height='13' border='0'> Please wait...'; };
updateWorkspace(wsCount); function updateWorkspace(id) {
}; if(id < 0) return false;
function updateWorkspace(id) { var oRPC = new leimnud.module.rpc.xmlhttp({
if(id < 0) return false; async : true,
var oRPC = new leimnud.module.rpc.xmlhttp({ method: 'POST',
async : true, url: '../setup/upgrade_SystemAjax',
method: 'POST', args : 'id=' + id
url: '../setup/upgrade_SystemAjax', });
args : 'id=' + id oRPC.callback = function(rpc) {
}); document.getElementById('form[SUBTITLE4]').innerHTML = rpc.xmlhttp.responseText;
oRPC.callback = function(rpc) { updateWorkspace(id-1);
document.getElementById('form[SUBTITLE4]').innerHTML = rpc.xmlhttp.responseText; }.extend(this);
updateWorkspace(id-1); oRPC.make();
}.extend(this); };" );
oRPC.make(); }
};"); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showInfoUpdate', '', $aMessage );
}
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfoUpdate', '', $aMessage ); G::RenderPage( 'publishBlank', 'blank' );
G::evalJScript( 'upgradeSystem(' . count( $oSystem->aWorkspaces ) . ')' );
G::RenderPage( 'publishBlank', 'blank' ); exit( 0 );
G::evalJScript('upgradeSystem('.count($oSystem->aWorkspaces).')'); } catch (Exception $e) {
exit(0); $G_PUBLISH = new Publisher();
} $aMessage['MESSAGE'] = $e->getMessage();
catch (Exception $e) { $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
$G_PUBLISH = new Publisher; G::RenderPage( 'publishBlank', 'blank' );
$aMessage['MESSAGE'] = $e->getMessage(); exit( 0 );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); }
G::RenderPage( 'publishBlank', 'blank' );
exit(0);
}

View File

@@ -1,389 +1,396 @@
<?php <?php
/** /**
* upgrade_SystemAjax.php * upgrade_SystemAjax.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc. * Copyright (C) 2004 - 2010 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ global $DB_ADAPTER;
global $DB_ADAPTER; global $DB_HOST;
global $DB_HOST; global $DB_USER;
global $DB_USER; global $DB_PASS;
global $DB_PASS; global $DB_NAME;
global $DB_NAME; set_time_limit( 0 );
set_time_limit (0);
$id = '';
$id = ''; if (isset( $_POST['id'] ))
if ( isset($_POST['id'] ) ) $id = $_POST['id']; $id = $_POST['id'];
G::LoadClass('languages'); G::LoadClass( 'languages' );
G::LoadSystem('database_mysql'); G::LoadSystem( 'database_mysql' );
$aUpgradeData = unserialize( file_get_contents (PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin" )); $aUpgradeData = unserialize( file_get_contents( PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin" ) );
$aWorkspaces = $aUpgradeData['workspaces']; $aWorkspaces = $aUpgradeData['workspaces'];
if ( is_array ( $aWorkspaces ) && count($aWorkspaces) > 0 ) { if (is_array( $aWorkspaces ) && count( $aWorkspaces ) > 0) {
$workspace = array_shift ( $aUpgradeData['workspaces']); $workspace = array_shift( $aUpgradeData['workspaces'] );
eval ( getDatabaseCredentials(PATH_DB . $workspace . PATH_SEP . 'db.php')) ; eval( getDatabaseCredentials( PATH_DB . $workspace . PATH_SEP . 'db.php' ) );
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); $oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
$oDataBase->iFetchType = MYSQL_NUM; $oDataBase->iFetchType = MYSQL_NUM;
//processing .po file //processing .po file
if ( $aUpgradeData['sPoFile'] != '' ) { if ($aUpgradeData['sPoFile'] != '') {
$oLanguages = new languages(); $oLanguages = new languages();
$oLanguages->importLanguage($aUpgradeData['sPoFile'], $aUpgradeData['bForceXmlPoFile'] ); $oLanguages->importLanguage( $aUpgradeData['sPoFile'], $aUpgradeData['bForceXmlPoFile'] );
$aUpgradeData['bForceXmlPoFile'] = false; $aUpgradeData['bForceXmlPoFile'] = false;
} }
if ($aUpgradeData['sSchemaFile'] != '') if ($aUpgradeData['sSchemaFile'] != '')
processMasterSchemaFile( $aUpgradeData['sSchemaFile'] ); processMasterSchemaFile( $aUpgradeData['sSchemaFile'] );
//draw a gauge control indicating the progress in workspaces
//draw a gauge control indicating the progress in workspaces $gauge = intval( (($aUpgradeData['wsQuantity'] - count( $aWorkspaces ) + 1) / $aUpgradeData['wsQuantity']) * 301 );
$gauge = intval( (( $aUpgradeData['wsQuantity'] - count($aWorkspaces) + 1 ) / $aUpgradeData['wsQuantity'] ) * 301 ); print "<table cellpadding=0><tr><td><img src='/images/ajax-loader.gif' border=0/></td><td>";
print "<table cellpadding=0><tr><td><img src='/images/ajax-loader.gif' border=0/></td><td>"; print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >";
print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >"; print "<div style='color:#FFF; height:16px; text-align:center; padding-top:3px; background-image: url(/skins/green/images/bm.jpg); background-repeat: repeat-x; width: {$gauge}px' ></div> </div>";
print "<div style='color:#FFF; height:16px; text-align:center; padding-top:3px; background-image: url(/skins/green/images/bm.jpg); background-repeat: repeat-x; width: {$gauge}px' ></div> </div>"; print "</td><td width='40%'><font color=black> Upgrading the workspace </font><b><font color=green>$workspace</font></b></td><td width=250 align=right>| $id Remaining</td></tr></table>";
print "</td><td width='40%'><font color=black> Upgrading the workspace </font><b><font color=green>$workspace</font></b></td><td width=250 align=right>| $id Remaining</td></tr></table>"; file_put_contents( PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin", serialize( $aUpgradeData ) );
file_put_contents (PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin", serialize($aUpgradeData) ); } else {
} print "<table cellpadding=0><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>";
else { print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >";
print "<table cellpadding=0><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>"; print "<div style='color:#FFF; height:16px; text-align:center; padding-top:3px; background-image: url(/skins/green/images/bm.jpg); background-repeat: repeat-x; width: 301px' ></div> </div>";
print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >"; print "</td><td> Finished! All workspaces were upgraded successfully.</td></tr></table>";
print "<div style='color:#FFF; height:16px; text-align:center; padding-top:3px; background-image: url(/skins/green/images/bm.jpg); background-repeat: repeat-x; width: 301px' ></div> </div>"; }
print "</td><td> Finished! All workspaces were upgraded successfully.</td></tr></table>";
} die();
die; function getDatabaseCredentials ($dbFile)
{
function getDatabaseCredentials ( $dbFile ) { $sContent = file_get_contents( $dbFile );
$sContent = file_get_contents( $dbFile ); $sContent = str_replace( '<?php', '', $sContent );
$sContent = str_replace('<?php', '', $sContent); $sContent = str_replace( '<?', '', $sContent );
$sContent = str_replace('<?', '', $sContent); $sContent = str_replace( '?>', '', $sContent );
$sContent = str_replace('?>', '', $sContent); $sContent = str_replace( 'define', '', $sContent );
$sContent = str_replace('define', '', $sContent); $sContent = str_replace( "('", '$', $sContent );
$sContent = str_replace("('", '$', $sContent); $sContent = str_replace( "',", '=', $sContent );
$sContent = str_replace("',", '=', $sContent); $sContent = str_replace( ");", ';', $sContent );
$sContent = str_replace(");", ';', $sContent); return $sContent;
return $sContent; }
}
function processMasterSchemaFile ($sSchemaFile)
function processMasterSchemaFile ( $sSchemaFile ) { {
global $DB_ADAPTER; global $DB_ADAPTER;
global $DB_HOST; global $DB_HOST;
global $DB_USER; global $DB_USER;
global $DB_PASS; global $DB_PASS;
global $DB_NAME; global $DB_NAME;
global $aUpgradeData; global $aUpgradeData;
//convert newSchema to array //convert newSchema to array
if ( isset($aUpgradeData['aNewSchema']) ) { if (isset( $aUpgradeData['aNewSchema'] )) {
$aNewSchema = $aUpgradeData['aNewSchema']; $aNewSchema = $aUpgradeData['aNewSchema'];
} } else {
else { $aNewSchema = schemaToArray( $sSchemaFile );
$aNewSchema = schemaToArray($sSchemaFile); $aUpgradeData['aNewSchema'] = $aNewSchema;
$aUpgradeData['aNewSchema'] = $aNewSchema; }
} $aOldSchema = processSchemaFile();
$aOldSchema = processSchemaFile(); if (is_null( $aOldSchema )) {
if ( is_null($aOldSchema) ) { return;
return; }
} $aChanges = obtainChanges( $aOldSchema, $aNewSchema );
$aChanges = obtainChanges($aOldSchema, $aNewSchema);
$oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); if (! $oDataBase->isConnected()) {
if ( !$oDataBase->isConnected() ) { return;
return; }
} $oDataBase->iFetchType = MYSQL_NUM;
$oDataBase->iFetchType = MYSQL_NUM;
$oDataBase->logQuery( count( $aChanges ) );
$oDataBase->logQuery ( count ($aChanges ) );
foreach ($aChanges['tablesToAdd'] as $sTable => $aColumns) {
foreach ($aChanges['tablesToAdd'] as $sTable => $aColumns) { $oDataBase->executeQuery( $oDataBase->generateCreateTableSQL( $sTable, $aColumns ) );
$oDataBase->executeQuery($oDataBase->generateCreateTableSQL($sTable, $aColumns)); if (isset( $aChanges['tablesToAdd'][$sTable]['INDEXES'] )) {
if (isset($aChanges['tablesToAdd'][$sTable]['INDEXES'])) { foreach ($aChanges['tablesToAdd'][$sTable]['INDEXES'] as $indexName => $aIndex) {
foreach ($aChanges['tablesToAdd'][$sTable]['INDEXES'] as $indexName => $aIndex) { $oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $indexName, $aIndex ) );
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $indexName, $aIndex ) ); }
} }
} }
}
foreach ($aChanges['tablesToAlter'] as $sTable => $aActions) {
foreach ($aChanges['tablesToAlter'] as $sTable => $aActions) { foreach ($aActions as $sAction => $aAction) {
foreach ($aActions as $sAction => $aAction) { foreach ($aAction as $sColumn => $vData) {
foreach ($aAction as $sColumn => $vData) { switch ($sAction) {
switch ($sAction) { case 'DROP':
case 'DROP': $oDataBase->executeQuery( $oDataBase->generateDropColumnSQL( $sTable, $vData ) );
$oDataBase->executeQuery($oDataBase->generateDropColumnSQL($sTable, $vData)); break;
break; case 'ADD':
case 'ADD': $oDataBase->executeQuery( $oDataBase->generateAddColumnSQL( $sTable, $sColumn, $vData ) );
$oDataBase->executeQuery($oDataBase->generateAddColumnSQL($sTable, $sColumn, $vData)); break;
break; case 'CHANGE':
case 'CHANGE': $oDataBase->executeQuery( $oDataBase->generateChangeColumnSQL( $sTable, $sColumn, $vData ) );
$oDataBase->executeQuery($oDataBase->generateChangeColumnSQL($sTable, $sColumn, $vData)); break;
break; }
} }
} }
} }
}
foreach ($aChanges['tablesWithNewIndex'] as $sTable => $aIndexes) {
foreach ($aChanges['tablesWithNewIndex'] as $sTable => $aIndexes) { foreach ($aIndexes as $sIndexName => $aIndexFields) {
foreach ($aIndexes as $sIndexName => $aIndexFields ) { $oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $sIndexName, $aIndexFields ) );
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $sIndexName, $aIndexFields )); }
} }
}
foreach ($aChanges['tablesToAlterIndex'] as $sTable => $aIndexes) {
foreach ($aChanges['tablesToAlterIndex'] as $sTable => $aIndexes) { foreach ($aIndexes as $sIndexName => $aIndexFields) {
foreach ($aIndexes as $sIndexName => $aIndexFields ) { $oDataBase->executeQuery( $oDataBase->generateDropKeySQL( $sTable, $sIndexName ) );
$oDataBase->executeQuery($oDataBase->generateDropKeySQL($sTable, $sIndexName )); $oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $sIndexName, $aIndexFields ) );
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $sIndexName, $aIndexFields )); }
} }
} $oDataBase->close();
$oDataBase->close(); }
}
function processSchemaFile ()
{
function processSchemaFile( ) { global $DB_ADAPTER;
global $DB_ADAPTER; global $DB_HOST;
global $DB_HOST; global $DB_USER;
global $DB_USER; global $DB_PASS;
global $DB_PASS; global $DB_NAME;
global $DB_NAME;
try {
try { G::LoadSystem( 'database_' . strtolower( $DB_ADAPTER ) );
G::LoadSystem( 'database_' . strtolower($DB_ADAPTER));
$aOldSchema = array ();
$aOldSchema = array(); $oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if (! $oDataBase->isConnected()) {
if ( !$oDataBase->isConnected() ) { $oDataBase->logQuery( 'Does not exist an available connection!' );
$oDataBase->logQuery ('Does not exist an available connection!'); return null;
return NULL; }
}
$oDataBase->iFetchType = MYSQL_NUM;
$oDataBase->iFetchType = MYSQL_NUM; $oDataset1 = $oDataBase->executeQuery( $oDataBase->generateShowTablesSQL() );
$oDataset1 = $oDataBase->executeQuery($oDataBase->generateShowTablesSQL());
} catch (Exception $e) {
} catch ( Exception $e ) { $oDataBase->logQuery( $e->getmessage() );
$oDataBase->logQuery ( $e->getmessage() ); return null;
return NULL; }
}
//going thru all tables in current WF_ database
//going thru all tables in current WF_ database while ($aRow1 = $oDataBase->getRegistry( $oDataset1 )) {
while ($aRow1 = $oDataBase->getRegistry( $oDataset1) ) { $aPrimaryKeys = array ();
$aPrimaryKeys = array(); $sTable = strtoupper( $aRow1[0] );
$sTable = strtoupper($aRow1[0]);
//get description of each table, ( column and primary keys )
//get description of each table, ( column and primary keys ) //$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL($aRow1[0]) );
//$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL($aRow1[0]) ); $oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL( $sTable ) );
$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL($sTable ) ); $aOldSchema[$sTable] = array ();
$aOldSchema[ $sTable ] = array(); $oDataBase->iFetchType = MYSQL_ASSOC;
$oDataBase->iFetchType = MYSQL_ASSOC; while ($aRow2 = $oDataBase->getRegistry( $oDataset2 )) {
while ($aRow2 = $oDataBase->getRegistry($oDataset2)) { $aOldSchema[$sTable][$aRow2['Field']]['Field'] = $aRow2['Field'];
$aOldSchema[$sTable][$aRow2['Field']]['Field'] = $aRow2['Field']; $aOldSchema[$sTable][$aRow2['Field']]['Type'] = $aRow2['Type'];
$aOldSchema[$sTable][$aRow2['Field']]['Type'] = $aRow2['Type']; $aOldSchema[$sTable][$aRow2['Field']]['Null'] = $aRow2['Null'];
$aOldSchema[$sTable][$aRow2['Field']]['Null'] = $aRow2['Null']; $aOldSchema[$sTable][$aRow2['Field']]['Default'] = $aRow2['Default'];
$aOldSchema[$sTable][$aRow2['Field']]['Default'] = $aRow2['Default']; }
}
//get indexes of each table SHOW INDEX FROM `ADDITIONAL_TABLES`; -- WHERE Key_name <> 'PRIMARY'
//get indexes of each table SHOW INDEX FROM `ADDITIONAL_TABLES`; -- WHERE Key_name <> 'PRIMARY' $oDataset2 = $oDataBase->executeQuery( $oDataBase->generateTableIndexSQL( $aRow1[0] ) );
$oDataset2 = $oDataBase->executeQuery($oDataBase->generateTableIndexSQL($aRow1[0])); $oDataBase->iFetchType = MYSQL_ASSOC;
$oDataBase->iFetchType = MYSQL_ASSOC; while ($aRow2 = $oDataBase->getRegistry( $oDataset2 )) {
while ($aRow2 = $oDataBase->getRegistry($oDataset2)) { if (! isset( $aOldSchema[$sTable]['INDEXES'] )) {
if ( !isset($aOldSchema[$sTable]['INDEXES']) ) { $aOldSchema[$sTable]['INDEXES'] = array ();
$aOldSchema[$sTable]['INDEXES'] = array(); }
} if (! isset( $aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] )) {
if (!isset($aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] ) ) { $aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] = array ();
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] = array(); }
} $aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']][] = $aRow2['Column_name'];
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']][] = $aRow2['Column_name']; }
}
$oDataBase->iFetchType = MYSQL_NUM; //this line is neccesary because the next fetch needs to be with MYSQL_NUM
$oDataBase->iFetchType = MYSQL_NUM; //this line is neccesary because the next fetch needs to be with MYSQL_NUM }
} //finally return the array with old schema obtained from the Database
//finally return the array with old schema obtained from the Database if (count( $aOldSchema ) == 0)
if ( count($aOldSchema) == 0 ) $aOldSchema = null; $aOldSchema = null;
return $aOldSchema; return $aOldSchema;
} }
//process the schema file in the patch file, and obtain an array //process the schema file in the patch file, and obtain an array
function schemaToArray($sSchemaFile) { function schemaToArray ($sSchemaFile)
try { {
$aSchema = array(); try {
$oXml = new DomDocument(); $aSchema = array ();
$oXml->load($sSchemaFile); $oXml = new DomDocument();
$aTables = $oXml->getElementsByTagName('table'); $oXml->load( $sSchemaFile );
foreach ($aTables as $oTable) { $aTables = $oXml->getElementsByTagName( 'table' );
$aPrimaryKeys = array(); foreach ($aTables as $oTable) {
$sTableName = $oTable->getAttribute('name'); $aPrimaryKeys = array ();
$aSchema[$sTableName] = array(); $sTableName = $oTable->getAttribute( 'name' );
$aColumns = $oTable->getElementsByTagName('column'); $aSchema[$sTableName] = array ();
foreach ($aColumns as $oColumn) { $aColumns = $oTable->getElementsByTagName( 'column' );
$sColumName = $oColumn->getAttribute('name'); foreach ($aColumns as $oColumn) {
$aSchema[$sTableName][$sColumName] = array(); $sColumName = $oColumn->getAttribute( 'name' );
$aVendors = $oColumn->getElementsByTagName('vendor'); $aSchema[$sTableName][$sColumName] = array ();
foreach ($aVendors as $oVendor) { $aVendors = $oColumn->getElementsByTagName( 'vendor' );
if ($oVendor->getAttribute('type') == DB_ADAPTER) { foreach ($aVendors as $oVendor) {
break; if ($oVendor->getAttribute( 'type' ) == DB_ADAPTER) {
} break;
} }
$aParameters = $oColumn->getElementsByTagName('parameter'); }
foreach ($aParameters as $oParameter) { $aParameters = $oColumn->getElementsByTagName( 'parameter' );
$parameterName = ucwords($oParameter->getAttribute('name')); foreach ($aParameters as $oParameter) {
if ( $parameterName == 'Key' && strtoupper($oParameter->getAttribute('value')) == 'PRI' ) { $parameterName = ucwords( $oParameter->getAttribute( 'name' ) );
$aPrimaryKeys[] = $oColumn->getAttribute('name'); if ($parameterName == 'Key' && strtoupper( $oParameter->getAttribute( 'value' ) ) == 'PRI') {
} $aPrimaryKeys[] = $oColumn->getAttribute( 'name' );
}
if ( in_array ( $parameterName, array('Field','Type','Null','Default') ) ) {
$aSchema[$sTableName][$sColumName][$parameterName] = $oParameter->getAttribute('value'); if (in_array( $parameterName, array ('Field','Type','Null','Default'
} ) )) {
} $aSchema[$sTableName][$sColumName][$parameterName] = $oParameter->getAttribute( 'value' );
} }
}
if ( is_array($aPrimaryKeys) && count($aPrimaryKeys) > 0 ) { }
$aSchema[$sTableName]['INDEXES']['PRIMARY'] = $aPrimaryKeys;
} if (is_array( $aPrimaryKeys ) && count( $aPrimaryKeys ) > 0) {
$aIndexes = $oTable->getElementsByTagName('index'); $aSchema[$sTableName]['INDEXES']['PRIMARY'] = $aPrimaryKeys;
foreach ($aIndexes as $oIndex) { }
$aIndex = array(); $aIndexes = $oTable->getElementsByTagName( 'index' );
$aIndexesColumns = $oIndex->getElementsByTagName('index-column'); foreach ($aIndexes as $oIndex) {
foreach ($aIndexesColumns as $oIndexColumn) { $aIndex = array ();
$aIndex[] = $oIndexColumn->getAttribute('name'); $aIndexesColumns = $oIndex->getElementsByTagName( 'index-column' );
} foreach ($aIndexesColumns as $oIndexColumn) {
$aSchema[$sTableName]['INDEXES'][ $oIndex->getAttribute('name') ] = $aIndex; $aIndex[] = $oIndexColumn->getAttribute( 'name' );
} }
} $aSchema[$sTableName]['INDEXES'][$oIndex->getAttribute( 'name' )] = $aIndex;
return $aSchema; }
} }
catch (Exception $oError) { return $aSchema;
throw $oError; } catch (Exception $oError) {
} throw $oError;
} }
}
function obtainChanges($aOldSchema, $aNewSchema) {
//$aChanges = array('tablesToDelete' => array(), 'tablesToAdd' => array(), 'tablesToAlter' => array()); function obtainChanges ($aOldSchema, $aNewSchema)
//Tables to delete, but this is disabled {
//foreach ($aOldSchema as $sTableName => $aColumns) { //$aChanges = array('tablesToDelete' => array(), 'tablesToAdd' => array(), 'tablesToAlter' => array());
// if ( !isset($aNewSchema[$sTableName])) { //Tables to delete, but this is disabled
// if (!in_array($sTableName, array('KT_APPLICATION', 'KT_DOCUMENT', 'KT_PROCESS'))) { //foreach ($aOldSchema as $sTableName => $aColumns) {
// $aChanges['tablesToDelete'][] = $sTableName; // if ( !isset($aNewSchema[$sTableName])) {
// } // if (!in_array($sTableName, array('KT_APPLICATION', 'KT_DOCUMENT', 'KT_PROCESS'))) {
// } // $aChanges['tablesToDelete'][] = $sTableName;
//} // }
// }
$aChanges = array('tablesToAdd' => array(), 'tablesToAlter' => array(), 'tablesWithNewIndex' => array(), 'tablesToAlterIndex'=> array()); //}
//new tables to create and alter
foreach ($aNewSchema as $sTableName => $aColumns) { $aChanges = array ('tablesToAdd' => array (),'tablesToAlter' => array (),'tablesWithNewIndex' => array (),'tablesToAlterIndex' => array ()
if (!isset($aOldSchema[$sTableName])) { );
$aChanges['tablesToAdd'][$sTableName] = $aColumns;
} //new tables to create and alter
else { foreach ($aNewSchema as $sTableName => $aColumns) {
//drop old columns if (! isset( $aOldSchema[$sTableName] )) {
foreach ($aOldSchema[$sTableName] as $sColumName => $aParameters) { $aChanges['tablesToAdd'][$sTableName] = $aColumns;
if (!isset($aNewSchema[$sTableName][$sColumName])) { } else {
if (!isset($aChanges['tablesToAlter'][$sTableName])) { //drop old columns
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array()); foreach ($aOldSchema[$sTableName] as $sColumName => $aParameters) {
} if (! isset( $aNewSchema[$sTableName][$sColumName] )) {
$aChanges['tablesToAlter'][$sTableName]['DROP'][$sColumName] = $sColumName; if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
} $aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
} );
}
//create new columns $aChanges['tablesToAlter'][$sTableName]['DROP'][$sColumName] = $sColumName;
//foreach ($aNewSchema[$sTableName] as $sColumName => $aParameters) { }
foreach ($aColumns as $sColumName => $aParameters) { }
if ($sColumName != 'INDEXES') {
if (!isset($aOldSchema[$sTableName][$sColumName])) { //this column doesnt exist in oldschema //create new columns
if (!isset($aChanges['tablesToAlter'][$sTableName])) { //foreach ($aNewSchema[$sTableName] as $sColumName => $aParameters) {
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array()); foreach ($aColumns as $sColumName => $aParameters) {
} if ($sColumName != 'INDEXES') {
$aChanges['tablesToAlter'][$sTableName]['ADD'][$sColumName] = $aParameters; if (! isset( $aOldSchema[$sTableName][$sColumName] )) { //this column doesnt exist in oldschema
} if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
else { //the column exists $aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
$newField = $aNewSchema[$sTableName][$sColumName]; );
$oldField = $aOldSchema[$sTableName][$sColumName]; }
//both are null, no change is required $aChanges['tablesToAlter'][$sTableName]['ADD'][$sColumName] = $aParameters;
if ( !isset($newField['Default']) && !isset($oldField['Default'])) $changeDefaultAttr = false; } else { //the column exists
//one of them is null, change IS required $newField = $aNewSchema[$sTableName][$sColumName];
if ( !isset($newField['Default']) && isset($oldField['Default']) && $oldField['Default']!= '') $changeDefaultAttr = true; $oldField = $aOldSchema[$sTableName][$sColumName];
if ( isset($newField['Default']) && !isset($oldField['Default'])) $changeDefaultAttr = true; //both are null, no change is required
//both are defined and they are different. if (! isset( $newField['Default'] ) && ! isset( $oldField['Default'] ))
if ( isset($newField['Default']) && isset($oldField['Default']) ) { $changeDefaultAttr = false;
if ( $newField['Default'] != $oldField['Default'] ) //one of them is null, change IS required
$changeDefaultAttr = true; if (! isset( $newField['Default'] ) && isset( $oldField['Default'] ) && $oldField['Default'] != '')
else $changeDefaultAttr = true;
$changeDefaultAttr = false; if (isset( $newField['Default'] ) && ! isset( $oldField['Default'] ))
} $changeDefaultAttr = true;
//special cases //both are defined and they are different.
// BLOB and TEXT columns cannot have DEFAULT values. http://dev.mysql.com/doc/refman/5.0/en/blob.html if (isset( $newField['Default'] ) && isset( $oldField['Default'] )) {
if ( in_array(strtolower($newField['Type']), array('text','mediumtext') ) ) if ($newField['Default'] != $oldField['Default'])
$changeDefaultAttr = false; $changeDefaultAttr = true;
else
//#1067 - Invalid default value for datetime field $changeDefaultAttr = false;
if ( in_array($newField['Type'], array('datetime')) && isset($newField['Default']) && $newField['Default']== '' ) }
$changeDefaultAttr = false; //special cases
// BLOB and TEXT columns cannot have DEFAULT values. http://dev.mysql.com/doc/refman/5.0/en/blob.html
//#1067 - Invalid default value for int field if (in_array( strtolower( $newField['Type'] ), array ('text','mediumtext'
if ( substr($newField['Type'], 0, 3 ) && isset($newField['Default']) && $newField['Default']== '' ) ) ))
$changeDefaultAttr = false; $changeDefaultAttr = false;
//if any difference exists, then insert the difference in aChanges //#1067 - Invalid default value for datetime field
if ( $newField['Field'] != $oldField['Field'] || if (in_array( $newField['Type'], array ('datetime'
$newField['Type'] != $oldField['Type'] || ) ) && isset( $newField['Default'] ) && $newField['Default'] == '')
$newField['Null'] != $oldField['Null'] || $changeDefaultAttr = false;
$changeDefaultAttr ) {
if (!isset($aChanges['tablesToAlter'][$sTableName])) { //#1067 - Invalid default value for int field
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array()); if (substr( $newField['Type'], 0, 3 ) && isset( $newField['Default'] ) && $newField['Default'] == '')
} $changeDefaultAttr = false;
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Field'] = $newField['Field'];
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Type'] = $newField['Type']; //if any difference exists, then insert the difference in aChanges
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Null'] = $newField['Null']; if ($newField['Field'] != $oldField['Field'] || $newField['Type'] != $oldField['Type'] || $newField['Null'] != $oldField['Null'] || $changeDefaultAttr) {
if ( isset($newField['Default']) ) if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = $newField['Default']; $aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
else );
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = null; }
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Field'] = $newField['Field'];
} $aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Type'] = $newField['Type'];
} $aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Null'] = $newField['Null'];
} //only columns, no the indexes column if (isset( $newField['Default'] ))
}//foreach $aColumns $aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = $newField['Default'];
else
//now check the indexes of table $aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = null;
if ( isset($aNewSchema[$sTableName]['INDEXES']) ) {
foreach ( $aNewSchema[$sTableName]['INDEXES'] as $indexName => $indexFields ) { }
if (!isset( $aOldSchema[$sTableName]['INDEXES'][$indexName]) ) { }
if (!isset($aChanges['tablesWithNewIndex'][$sTableName])) { } //only columns, no the indexes column
$aChanges['tablesWithNewIndex'][$sTableName] = array(); } //foreach $aColumns
}
$aChanges['tablesWithNewIndex'][$sTableName][$indexName] = $indexFields;
} //now check the indexes of table
else { if (isset( $aNewSchema[$sTableName]['INDEXES'] )) {
if ( $aOldSchema[$sTableName]['INDEXES'][$indexName] != $indexFields ) { foreach ($aNewSchema[$sTableName]['INDEXES'] as $indexName => $indexFields) {
if (!isset($aChanges['tablesToAlterIndex'][$sTableName])) { if (! isset( $aOldSchema[$sTableName]['INDEXES'][$indexName] )) {
$aChanges['tablesToAlterIndex'][$sTableName] = array(); if (! isset( $aChanges['tablesWithNewIndex'][$sTableName] )) {
} $aChanges['tablesWithNewIndex'][$sTableName] = array ();
$aChanges['tablesToAlterIndex'][$sTableName][$indexName] = $indexFields; }
} $aChanges['tablesWithNewIndex'][$sTableName][$indexName] = $indexFields;
} } else {
} if ($aOldSchema[$sTableName]['INDEXES'][$indexName] != $indexFields) {
} if (! isset( $aChanges['tablesToAlterIndex'][$sTableName] )) {
} //for-else table exists $aChanges['tablesToAlterIndex'][$sTableName] = array ();
} //for new schema }
return $aChanges; $aChanges['tablesToAlterIndex'][$sTableName][$indexName] = $indexFields;
} }
}
}
}
} //for-else table exists
} //for new schema
return $aChanges;
}

View File

@@ -12,50 +12,50 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
global $RBAC;
G::LoadClass('replacementLogo');
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
die;
}
//calculating the max upload file size; global $RBAC;
$POST_MAX_SIZE = ini_get('post_max_size'); G::LoadClass( 'replacementLogo' );
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize; if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") "; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
die();
}
$G_MAIN_MENU = 'processmaker'; //calculating the max upload file size;
$G_SUB_MENU = 'setup'; $POST_MAX_SIZE = ini_get( 'post_max_size' );
$G_ID_MENU_SELECTED = 'SETUP'; $mul = substr( $POST_MAX_SIZE, - 1 );
$G_ID_SUB_MENU_SELECTED = 'LOGO'; $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
$G_PUBLISH = new Publisher;
$oHeadPublisher =& headPublisher::getSingleton(); $UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/uplogo', '', $Fields ); $mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$G_PUBLISH->AddContent('view', 'setup/uplogo' ); $uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
G::RenderPage( "publishBlank", "blank");
if ($postMaxSize < $uploadMaxSize)
$uploadMaxSize = $postMaxSize;
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'LOGO';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/uplogo', '', $Fields );
$G_PUBLISH->AddContent( 'view', 'setup/uplogo' );
G::RenderPage( "publishBlank", "blank" );
?> ?>
<script> <script>
@@ -63,22 +63,22 @@
* By krlos April 07, 2010 * By krlos April 07, 2010
* we're going to change to the logo choosed * we're going to change to the logo choosed
* parameter logo name * parameter logo name
*/ */
var changeLogo= function (nameLogo){ var changeLogo= function (nameLogo){
new leimnud.module.app.confirm().make({ new leimnud.module.app.confirm().make({
label:G_STRINGS.ID_APPLY_LOGO, label:G_STRINGS.ID_APPLY_LOGO,
action:function(){ action:function(){
ajax_function('replacementLogo','replacementLogo','NAMELOGO='+encodeURIComponent(nameLogo),'GET') ; ajax_function('replacementLogo','replacementLogo','NAMELOGO='+encodeURIComponent(nameLogo),'GET') ;
parent.parent.window.location = 'main?s=LOGO'; parent.parent.window.location = 'main?s=LOGO';
}}); }});
} }
/* /*
* By krlos April 07, 2010 * By krlos April 07, 2010
* to delete logo choosed * to delete logo choosed
* parameter logo name * parameter logo name
*/ */
function deleteLogo(nameLogo) { function deleteLogo(nameLogo) {
new leimnud.module.app.confirm().make({ new leimnud.module.app.confirm().make({
label:G_STRINGS.ID_REMOVE_LOGO, label:G_STRINGS.ID_REMOVE_LOGO,
@@ -95,8 +95,9 @@
* to put processmaker logo * to put processmaker logo
* parameters file db and user id * parameters file db and user id
*/ */
var restoreLogo = function (optfiledb, usrUid){ var restoreLogo = function (optfiledb, usrUid){
ajax_function('replacementLogo','restoreLogo','OPTFILEDB='+optfiledb+'&USRUID='+usrUid,'GET') ; ajax_function('replacementLogo','restoreLogo','OPTFILEDB='+optfiledb+'&USRUID='+usrUid,'GET') ;
window.location = 'uplogo'; window.location = 'uplogo';
} }
</script> </script>

View File

@@ -1,161 +1,158 @@
<?php <?php
/** /**
* control.php * control.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_FACTORY' ) != 1) {
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_FACTORY') != 1){ G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); //G::header('location: ../login/login');
//G::header('location: ../login/login'); die();
die; }
}
$G_MAIN_MENU = 'processmaker';
$G_MAIN_MENU = 'processmaker'; //$G_SUB_MENU = 'setup';
//$G_SUB_MENU = 'setup'; $G_ID_MENU_SELECTED = 'SETUP';
$G_ID_MENU_SELECTED = 'SETUP'; //$G_ID_SUB_MENU_SELECTED = 'WEBSERVICES';
//$G_ID_SUB_MENU_SELECTED = 'WEBSERVICES';
if (!extension_loaded('soap')) { if (! extension_loaded( 'soap' )) {
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/wsMessage'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/wsMessage' );
G::RenderPage( "publish" ); G::RenderPage( "publish" );
} } else {
else $G_PUBLISH = new Publisher();
{ $G_PUBLISH->AddContent( 'view', 'setup/webServicesTree' );
$G_PUBLISH = new Publisher; $G_PUBLISH->AddContent( 'smarty', 'groups/groups_usersList', '', '', array () );
$G_PUBLISH->AddContent('view', 'setup/webServicesTree' );
$G_PUBLISH->AddContent('smarty', 'groups/groups_usersList', '', '', array()); G::RenderPage( "publish-treeview", 'blank' );
}
G::RenderPage( "publish-treeview", 'blank');
} $link_Edit = G::encryptlink( 'webServicesSetup' );
$link_List = G::encryptlink( 'webServicesList' );
$link_Edit = G::encryptlink('webServicesSetup');
$link_List = G::encryptlink('webServicesList'); ?>
<script>
document.body.style.backgroundColor="#fff";
?> var oAux = document.getElementById("publisherContent[0]");
<script> oAux.id = "publisherContent[666]";
document.body.style.backgroundColor="#fff"; var currentGroup=false;
var oAux = document.getElementById("publisherContent[0]");
oAux.id = "publisherContent[666]"; function webServicesSetup(){
var currentGroup=false; popupWindow('' , '<?php echo $link_Edit ?>' , 500 , 225 );
}
function webServicesSetup(){
popupWindow('' , '<?php echo $link_Edit ?>' , 500 , 225 ); function showFormWS( uid, element ){
}
currentGroup = uid;
function showFormWS( uid, element ){ var oRPC = new leimnud.module.rpc.xmlhttp({
url : '../setup/webServicesAjax',
currentGroup = uid; async : false,
var oRPC = new leimnud.module.rpc.xmlhttp({ method: 'POST',
url : '../setup/webServicesAjax', args : 'action=showForm&wsID=' + uid
async : false, });
method: 'POST', oRPC.make();
args : 'action=showForm&wsID=' + uid document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
}); if ((uid == 'NewCase') || (uid == 'NewCaseImpersonate')) {
oRPC.make(); var scs=oRPC.xmlhttp.responseText.extractScript();scs.evalScript();
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText; }
if ((uid == 'NewCase') || (uid == 'NewCaseImpersonate')) { }
var scs=oRPC.xmlhttp.responseText.extractScript();scs.evalScript(); function execWebService( uid) {
} var oRPC = new leimnud.module.rpc.xmlhttp({
} url : '../setup/webServicesAjax',
function execWebService( uid) { async : true,
var oRPC = new leimnud.module.rpc.xmlhttp({ method: 'POST',
url : '../setup/webServicesAjax', args : 'action=execWebService&wsID=' + uid
async : true, });
method: 'POST',
args : 'action=execWebService&wsID=' + uid oRPC.callback = function(rpc) {
});
var scs = rpc.xmlhttp.responseText.extractScript();
oRPC.callback = function(rpc) { document.getElementById('spanUsersList').innerHTML = rpc.xmlhttp.responseText;
scs.evalScript();
var scs = rpc.xmlhttp.responseText.extractScript();
document.getElementById('spanUsersList').innerHTML = rpc.xmlhttp.responseText; }.extend(this);
scs.evalScript();
oRPC.make();
}.extend(this);
}
oRPC.make();
submitThisForm = function(oForm) {
} var oAux;
var bContinue = true;
submitThisForm = function(oForm) { if(bContinue) {
var oAux; result = ajax_post(oForm.action, oForm, 'POST', function(response){
var bContinue = true; var scs = response.extractScript();
if(bContinue) { document.getElementById('spanUsersList').innerHTML = response;
result = ajax_post(oForm.action, oForm, 'POST', function(response){ scs.evalScript();
var scs = response.extractScript(); });
document.getElementById('spanUsersList').innerHTML = response; refreshTree();
scs.evalScript(); }
}); };
refreshTree();
}
};
function callbackWebService( ) {
/*
var oRPC = new leimnud.module.rpc.xmlhttp({
function callbackWebService( ) { url : '../setup/webServicesAjax',
/* async : false,
var oRPC = new leimnud.module.rpc.xmlhttp({ method: 'POST',
url : '../setup/webServicesAjax', args : 'action=execWebService&wsID=' + uid
async : false, });
method: 'POST', oRPC.make();
args : 'action=execWebService&wsID=' + uid document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
}); */
oRPC.make(); document.getElementById('spanUsersList').innerHTML = 'hola';
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText; }
*/ function saveGroup( form ) {
document.getElementById('spanUsersList').innerHTML = 'hola'; ajax_post( form.action, form, 'POST' );
} currentPopupWindow.remove();
function saveGroup( form ) { refreshTree();
ajax_post( form.action, form, 'POST' ); }
currentPopupWindow.remove();
refreshTree(); function refreshTree(){
} tree.refresh( document.getElementById("publisherContent[666]") , '<?php echo $link_List ?>');
}
function refreshTree(){
tree.refresh( document.getElementById("publisherContent[666]") , '<?php echo $link_List ?>'); function showDetails(){
} var oRPC = new leimnud.module.rpc.xmlhttp({
url : '../setup/webServicesAjax',
function showDetails(){ async : false,
var oRPC = new leimnud.module.rpc.xmlhttp({ method: 'POST',
url : '../setup/webServicesAjax', args : 'action=showDetails'
async : false, });
method: 'POST', oRPC.make();
args : 'action=showDetails' document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
}); }
oRPC.make(); showDetails();
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
} function showUploadFilesForm(){
showDetails(); oIFrame = window.document.createElement('iframe');
oIFrame.style.border = '0';
function showUploadFilesForm(){ oIFrame.style.width = '700px';
oIFrame = window.document.createElement('iframe'); oIFrame.style.height = '400px';
oIFrame.style.border = '0'; oIFrame.src = 'webServicesAjax?action=showUploadFilesForm&';
oIFrame.style.width = '700px'; document.getElementById('spanUsersList').innerHTML = '';
oIFrame.style.height = '400px'; document.getElementById('spanUsersList').appendChild(oIFrame);
oIFrame.src = 'webServicesAjax?action=showUploadFilesForm&'; }
document.getElementById('spanUsersList').innerHTML = '';
document.getElementById('spanUsersList').appendChild(oIFrame);
}
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* webServicesList.php * webServicesList.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,25 +12,25 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_FACTORY') != 1){ if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_FACTORY' ) != 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login'); //G::header('location: ../login/login');
die; die();
} }
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_PUBLISH = new Publisher; //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_PUBLISH->AddContent('view', 'setup/webServicesTree' );
G::RenderPage( "publish-raw" , "raw" );
?> $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'setup/webServicesTree' );
G::RenderPage( "publish-raw", "raw" );

View File

@@ -12,52 +12,52 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1)
return $RBAC_Response;
G::LoadClass('groups'); G::LoadClass( 'groups' );
$dbc = new DBConnection(); $dbc = new DBConnection();
$ses = new DBSession($dbc); $ses = new DBSession( $dbc );
if (!isset($_SESSION['END_POINT'])) { if (! isset( $_SESSION['END_POINT'] )) {
$aFields['WS_HOST'] = $_SERVER['HTTP_HOST']; $aFields['WS_HOST'] = $_SERVER['HTTP_HOST'];
$aFields['WS_WORKSPACE'] = SYS_SYS; $aFields['WS_WORKSPACE'] = SYS_SYS;
} } else {
else { if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) {
if (strpos($_SESSION['END_POINT'], 'https') !== false) { preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias );
preg_match('@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias); } else {
preg_match( '@^(?:http://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias );
} }
else { $aAux = explode( ':', $coincidencias[1] );
preg_match('@^(?:http://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias); $aFields['WS_HOST'] = $aAux[0];
} $aFields['WS_PORT'] = (isset( $aAux[1] ) ? $aAux[1] : '');
$aAux = explode(':', $coincidencias[1]); $aAux = explode( $aAux[0] . (isset( $aAux[1] ) ? ':' . $aAux[1] : ''), $_SESSION['END_POINT'] );
$aFields['WS_HOST'] = $aAux[0]; $aAux = explode( '/', $aAux[1] );
$aFields['WS_PORT'] = (isset($aAux[1]) ? $aAux[1] : ''); $aFields['WS_WORKSPACE'] = substr( $aAux[1], 3 );
$aAux = explode($aAux[0] . (isset($aAux[1]) ? ':' . $aAux[1] : ''), $_SESSION['END_POINT']); }
$aAux = explode('/', $aAux[1]);
$aFields['WS_WORKSPACE'] = substr($aAux[1], 3);
}
$rows[] = array ( 'uid' => 'char', 'name' => 'char', 'age' => 'integer', 'balance' => 'float' ); $rows[] = array ('uid' => 'char','name' => 'char','age' => 'integer','balance' => 'float'
$rows[] = array ( 'uid' => 'http', 'name' => 'http' ); );
$rows[] = array ( 'uid' => 'https', 'name' => 'https' ); $rows[] = array ('uid' => 'http','name' => 'http'
);
$rows[] = array ('uid' => 'https','name' => 'https'
);
$_DBArray['protocol'] = $rows; $_DBArray['protocol'] = $rows;
$_SESSION['_DBArray'] = $_DBArray; $_SESSION['_DBArray'] = $_DBArray;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/webServicesSetup', '', $aFields , 'webServicesSetupSave'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/webServicesSetup', '', $aFields, 'webServicesSetupSave' );
G::RenderPage( "publish" , "raw" ); G::RenderPage( "publish", "raw" );
?>

View File

@@ -1,22 +1,16 @@
<?php <?php
unset($_SESSION['WS_SESSION_ID']); unset( $_SESSION['WS_SESSION_ID'] );
if($_POST['form']['WS_PROTOCOL']!='' && $_POST['form']['WS_WORKSPACE']!='') if ($_POST['form']['WS_PROTOCOL'] != '' && $_POST['form']['WS_WORKSPACE'] != '') {
{ if ($_POST['form']['WS_PORT'] != '') {
if($_POST['form']['WS_PORT']!='') $_SESSION['END_POINT'] = $_POST['form']['WS_PROTOCOL'] . '://' . $_POST['form']['WS_HOST'] . ':' . $_POST['form']['WS_PORT'] . '/sys' . $_POST['form']['WS_WORKSPACE'] . '/en/classic/services/wsdl2';
{ G::header( 'location: webServices?x=1' );
$_SESSION['END_POINT']=$_POST['form']['WS_PROTOCOL'].'://' .$_POST['form']['WS_HOST'] . ':' .$_POST['form']['WS_PORT'] .'/sys' .$_POST['form']['WS_WORKSPACE'].'/en/classic/services/wsdl2'; } else {
G::header('location: webServices?x=1'); $_SESSION['END_POINT'] = $_POST['form']['WS_PROTOCOL'] . '://' . $_POST['form']['WS_HOST'] . '/sys' . $_POST['form']['WS_WORKSPACE'] . '/en/classic/services/wsdl2';
} G::header( 'location: webServices?x=1' );
else }
{ $_SESSION['END_POINT']=$_POST['form']['WS_PROTOCOL'].'://' .$_POST['form']['WS_HOST'] .'/sys' .$_POST['form']['WS_WORKSPACE'].'/en/classic/services/wsdl2'; $_SESSION['WS_WORKSPACE'] = $_POST['form']['WS_WORKSPACE'];
G::header('location: webServices?x=1'); } else {
} G::header( 'location: webServices?x=0' );
$_SESSION['WS_WORKSPACE']=$_POST['form']['WS_WORKSPACE']; }
}
else
{
G::header('location: webServices?x=0');
}
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* weekend.php * weekend.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,40 +12,43 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
G::LoadInclude('ajax'); return $RBAC_Response;
G::LoadInclude( 'ajax' );
$G_ENABLE_BLANK_SKIN = true; $G_ENABLE_BLANK_SKIN = true;
$ARR_WEEKDAYS[0] = array('SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY'); $ARR_WEEKDAYS[0] = array ('SUNDAY','MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY'
$ARR_WEEKDAYS['es'] = array("Domingo?", "Lunes?", "Martes?", "Miércoles?", "Jueves?", "Viernes?", "Sábado?"); );
$ARR_WEEKDAYS['en'] = array("Sunday?", "Monday?", "Tuesday?", "Wednesday?", "Thursday?", "Friday?", "Saturday?"); $ARR_WEEKDAYS['es'] = array ("Domingo?","Lunes?","Martes?","Miércoles?","Jueves?","Viernes?","Sábado?"
$ARR_WEEKDAYS['fa'] = array('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه ','جمعه','آدینه'); );
$ARR_WEEKDAYS['en'] = array ("Sunday?","Monday?","Tuesday?","Wednesday?","Thursday?","Friday?","Saturday?"
);
$ARR_WEEKDAYS['fa'] = array ('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه ','جمعه','آدینه'
);
$dbc = new DBConnection; $dbc = new DBConnection();
$ses = new DBSession($dbc); $ses = new DBSession( $dbc );
$holidays=$ses->execute( "SELECT LEX_VALUE FROM LEXICO WHERE LEX_TOPIC ='NOWORKINGDAY' "); $holidays = $ses->execute( "SELECT LEX_VALUE FROM LEXICO WHERE LEX_TOPIC ='NOWORKINGDAY' " );
$config=array(); $config = array ();
for($id=0;$id<7;$id++) for ($id = 0; $id < 7; $id ++) {
{ $res = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '" . $ARR_WEEKDAYS[0][$id] . "' AND LEX_TOPIC ='HOLIDAY' " );
$res=$ses->execute(" SELECT * FROM LEXICO WHERE LEX_KEY = '".$ARR_WEEKDAYS[0][$id]."' AND LEX_TOPIC ='HOLIDAY' "); $res = $res->read();
$res=$res->read(); $config[$ARR_WEEKDAYS[0][$id]] = $res['LEX_VALUE'];
$config[$ARR_WEEKDAYS[0][$id]]=$res['LEX_VALUE'];
} }
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/weekend', '',$config ,'' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/weekend', '', $config, '' );
G::RenderPage( 'publish' ); G::RenderPage( 'publish' );
?> ?>
<script language="JavaScript"> <script language="JavaScript">
@@ -77,14 +80,14 @@ function on_submit(myForm)
} }
function ajax_function(ajax_server, funcion, parameters) function ajax_function(ajax_server, funcion, parameters)
{ {
objetus = get_xmlhttp(); objetus = get_xmlhttp();
var response; var response;
try try
{ {
if (parameters) parameters = '&' + encodeURI(parameters); if (parameters) parameters = '&' + encodeURI(parameters);
objetus.open("GET", ajax_server + "?function=" + funcion + parameters, false); objetus.open("GET", ajax_server + "?function=" + funcion + parameters, false);
}catch(ss) }catch(ss)
{ {
alert("error"+ss.message); alert("error"+ss.message);
} }
objetus.send(null); objetus.send(null);

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* weekendAjax.php * weekendAjax.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,19 +12,19 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
G::ForceLogin( 'WF_PROCESS' ); G::ForceLogin( 'WF_PROCESS' );
G::LoadInclude('ajax'); G::LoadInclude( 'ajax' );
$G_HELP_PAGE = "setup-environment-time-controls-weekend"; $G_HELP_PAGE = "setup-environment-time-controls-weekend";
@@ -36,35 +36,37 @@ $G_ID_MENU_SELECTED = "SETUP";
$G_ID_SUB_MENU_SELECTED = "ENVIRONMENT"; $G_ID_SUB_MENU_SELECTED = "ENVIRONMENT";
$G_ID_THIRD_MENU_SELECTED = "WEEKEND"; $G_ID_THIRD_MENU_SELECTED = "WEEKEND";
$dbc = new DBConnection; $dbc = new DBConnection();
$ses = new DBSession($dbc); $ses = new DBSession( $dbc );
$holidays=$ses->execute('SELECT LEX_VALUE FROM LEXICO WHERE LEX_TOPIC ="HOLIDAY"'); $holidays = $ses->execute( 'SELECT LEX_VALUE FROM LEXICO WHERE LEX_TOPIC ="HOLIDAY"' );
$funcion=strtolower(get_ajax_value('function')); $funcion = strtolower( get_ajax_value( 'function' ) );
$funcions=get_defined_functions(); $funcions = get_defined_functions();
if (in_array($funcion,$funcions['user'])) eval($funcion.'();'); if (in_array( $funcion, $funcions['user'] ))
eval( $funcion . '();' );
function setDays() function setDays ()
{ {
$days=get_ajax_value('days'); $days = get_ajax_value( 'days' );
$values=get_ajax_value('values'); $values = get_ajax_value( 'values' );
$days=explode(',',$days); $days = explode( ',', $days );
$values=explode(',',$values); $values = explode( ',', $values );
for($r=1;$r<sizeof($days);$r++) for ($r = 1; $r < sizeof( $days ); $r ++)
setDay($days[$r],$values[$r]); setDay( $days[$r], $values[$r] );
} }
function setDay($day,$dayValue)
function setDay ($day, $dayValue)
{ {
global $ses; global $ses;
$dayValue = (strcasecmp($dayValue,'true')==0)?1:0; $dayValue = (strcasecmp( $dayValue, 'true' ) == 0) ? 1 : 0;
$res=$ses->execute(" SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' "); $res = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' " );
if ($res->count()==0) if ($res->count() == 0)
$res=$ses->execute(" INSERT INTO LEXICO (LEX_TOPIC, LEX_KEY, LEX_VALUE) VALUES ('HOLIDAY', '$day', $dayValue) "); $res = $ses->execute( " INSERT INTO LEXICO (LEX_TOPIC, LEX_KEY, LEX_VALUE) VALUES ('HOLIDAY', '$day', $dayValue) " );
else else
$res=$ses->execute(" UPDATE LEXICO SET LEX_VALUE = $dayValue WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' "); $res = $ses->execute( " UPDATE LEXICO SET LEX_VALUE = $dayValue WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' " );
$res=$ses->execute(" SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' "); $res = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' " );
$res=$res->read(); $res = $res->read();
echo ($res['LEX_VALUE']=='1')?'true':'false'; echo ($res['LEX_VALUE'] == '1') ? 'true' : 'false';
} }
?>

View File

@@ -1,20 +1,16 @@
function abc(panel, txt) {
/*
* commonDialog ( '', 'saved' , 'saved', {}, '' ) ; setTimeout (
* leimnud.closure({instance:myDialog,method:function(panel){
*
* myDialog.remove(); panel.tabLastSelected=false; panel.tabSelected=1;
* panel.makeTab(); },args:panel}) , 1000 );
*/
var img = document.getElementById('workPeriodGraph');
img.src = 'workPeriodGraph?b=' + Math.random();
function abc( panel, txt ) { // panel.clearContent();
/* commonDialog ( '', 'saved' , 'saved', {}, '' ) ; // panel.addContent ( txt );
setTimeout ( leimnud.closure({instance:myDialog,method:function(panel){ return false;
myDialog.remove();
panel.tabLastSelected=false;
panel.tabSelected=1;
panel.makeTab();
},args:panel}) , 1000 );
*/
var img = document.getElementById( 'workPeriodGraph' );
img.src = 'workPeriodGraph?b=' + Math.random() ;
// panel.clearContent();
// panel.addContent ( txt );
return false;
} }

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* workPeriod.php * workPeriod.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,38 +12,38 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
$G_ENABLE_BLANK_SKIN = true; return $RBAC_Response;
$G_ENABLE_BLANK_SKIN = true;
G::LoadClass( "workPeriod" ); G::LoadClass( "workPeriod" );
$dbc = new DBConnection; $dbc = new DBConnection();
$ses = new DBSession( $dbc ); $ses = new DBSession( $dbc );
$obj = new workPeriod( $dbc ); $obj = new workPeriod( $dbc );
$row = $obj->Load ();
$row['SUNDAY'] = $row['noWorkingDays'][0]; $row = $obj->Load();
$row['MONDAY'] = $row['noWorkingDays'][1];
$row['TUESDAY'] = $row['noWorkingDays'][2];
$row['WEDNESDAY'] = $row['noWorkingDays'][3];
$row['THURSDAY'] = $row['noWorkingDays'][4];
$row['FRIDAY'] = $row['noWorkingDays'][5];
$row['SATURDAY'] = $row['noWorkingDays'][6];
$G_PUBLISH = new Publisher; $row['SUNDAY'] = $row['noWorkingDays'][0];
$G_PUBLISH->AddContent( "image", "image", "workPeriodGraph" ); $row['MONDAY'] = $row['noWorkingDays'][1];
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/workPeriod","", $row , "workPeriodSave" ); $row['TUESDAY'] = $row['noWorkingDays'][2];
$row['WEDNESDAY'] = $row['noWorkingDays'][3];
$row['THURSDAY'] = $row['noWorkingDays'][4];
$row['FRIDAY'] = $row['noWorkingDays'][5];
$row['SATURDAY'] = $row['noWorkingDays'][6];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( "image", "image", "workPeriodGraph" );
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/workPeriod", "", $row, "workPeriodSave" );
G::RenderPage( 'publish' );
G::RenderPage( 'publish' );
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* workPeriodGraph.php * workPeriodGraph.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,91 +12,93 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
Header("Content-type: image/jpeg"); return $RBAC_Response;
Header( "Content-type: image/jpeg" );
G::LoadClass( "workPeriod" ); G::LoadClass( "workPeriod" );
$dbc = new DBConnection; $dbc = new DBConnection();
$ses = new DBSession( $dbc ); $ses = new DBSession( $dbc );
$obj = new workPeriod( $dbc ); $obj = new workPeriod( $dbc );
$row = $obj->Load ();
$initPeriod1 = $row['initPeriod1']/ 60; $row = $obj->Load();
$endPeriod1 = $row['endPeriod1'] / 60;
$initPeriod2 = $row['initPeriod2']/ 60;
$endPeriod2 = $row['endPeriod2'] / 60;
$noWorkingDays = $row['noWorkingDays'];
$cant = 7; $initPeriod1 = $row['initPeriod1'] / 60;
$endPeriod1 = $row['endPeriod1'] / 60;
$initPeriod2 = $row['initPeriod2'] / 60;
$endPeriod2 = $row['endPeriod2'] / 60;
$noWorkingDays = $row['noWorkingDays'];
$w = 660; $cant = 7;
$h = $cant*18 + 20;
$im= ImageCreate($w, $h);
$width = $w;
$height = $h;
$center_x = intval($width / 2);
$center_y = intval($height / 2);
$bgcolor = ImageColorAllocate($im, 250, 250, 255);
$plomo = ImageColorAllocate($im, 220, 220, 220);
$orange = ImageColorAllocate($im, 255, 64, 64);
$gris = ImageColorAllocate($im, 150, 150, 155);
$white = ImageColorAllocate($im, 255, 255, 255);
$red = ImageColorAllocate($im, 255, 0, 0);
$brown = ImageColorAllocate($im, 160, 80, 0);
$black = ImageColorAllocate($im, 0,0,0);
ImageFilledRectangle($im, 0, 0, $width-1, $height-1, $bgcolor);
ImageRectangle ($im, 0, 0, $width-1, $height-1, $black);
$w = 660;
$h = $cant * 18 + 20;
$im = ImageCreate( $w, $h );
$width = $w;
$height = $h;
$center_x = intval( $width / 2 );
$center_y = intval( $height / 2 );
$x = 10; $y = 20; $bgcolor = ImageColorAllocate( $im, 250, 250, 255 );
$x1 = 78; $plomo = ImageColorAllocate( $im, 220, 220, 220 );
$x2 = $x1 + 2*6; $orange = ImageColorAllocate( $im, 255, 64, 64 );
$gris = ImageColorAllocate( $im, 150, 150, 155 );
$white = ImageColorAllocate( $im, 255, 255, 255 );
$red = ImageColorAllocate( $im, 255, 0, 0 );
$brown = ImageColorAllocate( $im, 160, 80, 0 );
$black = ImageColorAllocate( $im, 0, 0, 0 );
ImageFilledRectangle( $im, 0, 0, $width - 1, $height - 1, $bgcolor );
ImageRectangle( $im, 0, 0, $width - 1, $height - 1, $black );
$weekday[0] = 'Sunday'; $x = 10;
$weekday[1] = 'Monday'; $y = 20;
$weekday[2] = 'Tuesday'; $x1 = 78;
$weekday[3] = 'Wednesday'; $x2 = $x1 + 2 * 6;
$weekday[4] = 'Thursday';
$weekday[5] = 'Friday'; $weekday[0] = 'Sunday';
$weekday[6] = 'Saturday'; $weekday[1] = 'Monday';
$weekday[2] = 'Tuesday';
for ( $day = 0; $day < count ($weekday ); $day ++ ) { $weekday[3] = 'Wednesday';
ImageString($im, 2, $x, $y, $weekday[$day], $black); $weekday[4] = 'Thursday';
for ($i = 0; $i < 24*6; $i++) { $weekday[5] = 'Friday';
ImageRectangle($im, $x1+$i* 4, $y, $x1+ ($i+1)*4, $y+12, $plomo ); $weekday[6] = 'Saturday';
if ( $i >= $initPeriod1 * 6 && $i < $endPeriod2 * 6 && ( $i < $endPeriod1 * 6 || $i >= $initPeriod2 * 6 ) )
$color = $orange; for ($day = 0; $day < count( $weekday ); $day ++) {
else ImageString( $im, 2, $x, $y, $weekday[$day], $black );
$color = $white; for ($i = 0; $i < 24 * 6; $i ++) {
if ( isset ( $noWorkingDays[ $day ]) && $noWorkingDays[ $day ] ) $color = $white; ImageRectangle( $im, $x1 + $i * 4, $y, $x1 + ($i + 1) * 4, $y + 12, $plomo );
ImageFillToBorder($im, $x1+$i*4+1, $y+1, $plomo, $color ); if ($i >= $initPeriod1 * 6 && $i < $endPeriod2 * 6 && ($i < $endPeriod1 * 6 || $i >= $initPeriod2 * 6))
$color = $orange;
else
$color = $white;
if (isset( $noWorkingDays[$day] ) && $noWorkingDays[$day])
$color = $white;
ImageFillToBorder( $im, $x1 + $i * 4 + 1, $y + 1, $plomo, $color );
} }
$y+=18; $y += 18;
} }
$y = 20; $y = 20;
for ($i = 0; $i <= 24; $i++) { for ($i = 0; $i <= 24; $i ++) {
ImageLine($im, $x1+$i* 4*6, $y-5, $x1+ $i*4*6, $y-5+18*$cant, $gris); ImageLine( $im, $x1 + $i * 4 * 6, $y - 5, $x1 + $i * 4 * 6, $y - 5 + 18 * $cant, $gris );
if ( $i < 24 ) { if ($i < 24) {
ImageLine($im, $x2+$i* 4*6, $y-5, $x2+ $i*4*6, $y-5+18*$cant, $plomo); ImageLine( $im, $x2 + $i * 4 * 6, $y - 5, $x2 + $i * 4 * 6, $y - 5 + 18 * $cant, $plomo );
ImageString($im, 1, $x1+$i* 4*6, $y-10, $i, $black); ImageString( $im, 1, $x1 + $i * 4 * 6, $y - 10, $i, $black );
} }
} }
//ImageString($im, 2, 5, 5, $initPeriod1*6 . ", $endPeriod1, $initPeriod2, $endPeriod2 ", $black); //ImageString($im, 2, 5, 5, $initPeriod1*6 . ", $endPeriod1, $initPeriod2, $endPeriod2 ", $black);
ImageJpeg( $im );
ImageJpeg($im);
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* workPeriodSave.php * workPeriodSave.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,32 +12,32 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
G::LoadClass( "workPeriod" ); return $RBAC_Response;
G::LoadClass( "workPeriod" );
$frm = $_POST['form']; $frm = $_POST['form'];
$noWorkingDays[0] = isset ( $frm['SUNDAY'] ) && $frm['SUNDAY'] != ''; $noWorkingDays[0] = isset( $frm['SUNDAY'] ) && $frm['SUNDAY'] != '';
$noWorkingDays[1] = isset ( $frm['MONDAY'] ) && $frm['MONDAY'] != ''; $noWorkingDays[1] = isset( $frm['MONDAY'] ) && $frm['MONDAY'] != '';
$noWorkingDays[2] = isset ( $frm['TUESDAY'] ) && $frm['TUESDAY'] != ''; $noWorkingDays[2] = isset( $frm['TUESDAY'] ) && $frm['TUESDAY'] != '';
$noWorkingDays[3] = isset ( $frm['WEDNESDAY']) && $frm['WEDNESDAY'] != ''; $noWorkingDays[3] = isset( $frm['WEDNESDAY'] ) && $frm['WEDNESDAY'] != '';
$noWorkingDays[4] = isset ( $frm['THURSDAY'] ) && $frm['THURSDAY'] != ''; $noWorkingDays[4] = isset( $frm['THURSDAY'] ) && $frm['THURSDAY'] != '';
$noWorkingDays[5] = isset ( $frm['FRIDAY'] ) && $frm['FRIDAY'] != ''; $noWorkingDays[5] = isset( $frm['FRIDAY'] ) && $frm['FRIDAY'] != '';
$noWorkingDays[6] = isset ( $frm['SATURDAY'] ) && $frm['SATURDAY'] != ''; $noWorkingDays[6] = isset( $frm['SATURDAY'] ) && $frm['SATURDAY'] != '';
$dbc = new DBConnection();
$obj = new workPeriod( $dbc );
$obj->Save( $frm['initPeriod1'], $frm['endPeriod1'], $frm['initPeriod2'], $frm['endPeriod2'], $noWorkingDays );
print "ok";
die();
$dbc = new DBConnection();
$obj = new workPeriod( $dbc );
$obj->Save ( $frm['initPeriod1'], $frm['endPeriod1'], $frm['initPeriod2'], $frm['endPeriod2'], $noWorkingDays );
print "ok";
die;
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* conditions_Edit.php * conditions_Edit.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,39 +12,37 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
require_once 'classes/model/Step.php'; require_once 'classes/model/Step.php';
$oStep = new Step(); $oStep = new Step();
$aFields = $oStep->load($_GET['UID']); $aFields = $oStep->load( $_GET['UID'] );
G::LoadClass('xmlfield_InputPM'); G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'steps/conditions_Edit', '', $aFields, '../steps/conditions_Save'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'steps/conditions_Edit', '', $aFields, '../steps/conditions_Save' );
G::RenderPage('publish-raw' , 'raw'); G::RenderPage( 'publish-raw', 'raw' );
} catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* conditions_Save.php * conditions_Save.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,42 +12,41 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
require_once 'classes/model/Step.php'; require_once 'classes/model/Step.php';
$oStep = new Step(); $oStep = new Step();
if(isset ($_POST['form'])) if (isset( $_POST['form'] ))
$value=$_POST['form']; $value = $_POST['form'];
else else
$value=$_POST; $value = $_POST;
$oStep->update(array('STEP_UID' => $value['STEP_UID'], 'STEP_CONDITION' => $value['STEP_CONDITION'])); $oStep->update( array ('STEP_UID' => $value['STEP_UID'],'STEP_CONDITION' => $value['STEP_CONDITION']
G::LoadClass('processMap'); ) );
$oProcessMap = new ProcessMap(); G::LoadClass( 'processMap' );
$oProcessMap->getStepsCriteria($value['TAS_UID']); $oProcessMap = new ProcessMap();
$oProcessMap->getStepsCriteria( $value['TAS_UID'] );
} catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,171 +12,166 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
{ case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break;
}
require_once 'classes/model/StepTrigger.php';
require_once 'classes/model/Triggers.php';
G::LoadInclude('ajax');
if (!empty($_GET)) {
$aData = urldecode_values($_GET);
}
else {
if (!isset($_POST['form'])) {
$aData = urldecode_values($_POST);
} }
else {
$aData = urldecode_values($_POST['form']); require_once 'classes/model/StepTrigger.php';
require_once 'classes/model/Triggers.php';
G::LoadInclude( 'ajax' );
if (! empty( $_GET )) {
$aData = urldecode_values( $_GET );
} else {
if (! isset( $_POST['form'] )) {
$aData = urldecode_values( $_POST );
} else {
$aData = urldecode_values( $_POST['form'] );
}
} }
} switch ($aData['action']) {
switch ($aData['action']) { case 'showTriggers':
case 'showTriggers': G::LoadClass( 'processMap' );
G::LoadClass('processMap'); $oProcessMap = new ProcessMap();
$oProcessMap = new ProcessMap(); global $G_PUBLISH;
global $G_PUBLISH; $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher(); if ($aData['sType'] == 'BEFORE') {
if ($aData['sType'] == 'BEFORE') { $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'steps/triggersBefore_List', $oProcessMap->getStepTriggersCriteria( $aData['sStep'], $_SESSION['TASK'], $aData['sType'] ), array ('STEP' => $aData['sStep']
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'steps/triggersBefore_List', $oProcessMap->getStepTriggersCriteria($aData['sStep'], $_SESSION['TASK'], $aData['sType']), array('STEP' => $aData['sStep'])); ) );
} } else {
else { $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'steps/triggersAfter_List', $oProcessMap->getStepTriggersCriteria( $aData['sStep'], $_SESSION['TASK'], $aData['sType'] ), array ('STEP' => $aData['sStep']
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'steps/triggersAfter_List', $oProcessMap->getStepTriggersCriteria($aData['sStep'], $_SESSION['TASK'], $aData['sType']), array('STEP' => $aData['sStep'])); ) );
} }
G::RenderPage('publish-twocolumns', 'raw'); G::RenderPage( 'publish-twocolumns', 'raw' );
break; break;
case 'availableTriggers': case 'availableTriggers':
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn('TRI_UID'); $oCriteria->addSelectColumn( 'TRI_UID' );
$oCriteria->add(StepTriggerPeer::TAS_UID , $_SESSION['TASK']); $oCriteria->add( StepTriggerPeer::TAS_UID, $_SESSION['TASK'] );
$oCriteria->add(StepTriggerPeer::STEP_UID, $aData['sStep']); $oCriteria->add( StepTriggerPeer::STEP_UID, $aData['sStep'] );
$oCriteria->add(StepTriggerPeer::ST_TYPE , $aData['sType']); $oCriteria->add( StepTriggerPeer::ST_TYPE, $aData['sType'] );
$oDataset = StepTriggerPeer::doSelectRS($oCriteria); $oDataset = StepTriggerPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$sUIDs = "'0'"; $sUIDs = "'0'";
$aUIDs = array(); $aUIDs = array ();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$sUIDs .= ",'" . $aRow['TRI_UID'] . "'"; $sUIDs .= ",'" . $aRow['TRI_UID'] . "'";
$aUIDs[] = $aRow['TRI_UID']; $aUIDs[] = $aRow['TRI_UID'];
$oDataset->next(); $oDataset->next();
} }
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn('COUNT(TRI_UID) AS CANTITY'); $oCriteria->addSelectColumn( 'COUNT(TRI_UID) AS CANTITY' );
$oCriteria->add(TriggersPeer::TRI_UID, $aUIDs, Criteria::NOT_IN); $oCriteria->add( TriggersPeer::TRI_UID, $aUIDs, Criteria::NOT_IN );
$oCriteria->add(TriggersPeer::PRO_UID, $aData['sProcess']); $oCriteria->add( TriggersPeer::PRO_UID, $aData['sProcess'] );
$oDataset = TriggersPeer::doSelectRS($oCriteria); $oDataset = TriggersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
if ((int)$aRow['CANTITY'] > 0) { if ((int) $aRow['CANTITY'] > 0) {
$aFields['LANG'] = SYS_LANG; $aFields['LANG'] = SYS_LANG;
$aFields['UIDS'] = $sUIDs; $aFields['UIDS'] = $sUIDs;
$aFields['PROCESS'] = $aData['sProcess']; $aFields['PROCESS'] = $aData['sProcess'];
$aFields['action'] = 'assignTrigger'; $aFields['action'] = 'assignTrigger';
$aFields['STEP_UID'] = $aData['sStep']; $aFields['STEP_UID'] = $aData['sStep'];
$aFields['ST_TYPE'] = $aData['sType']; $aFields['ST_TYPE'] = $aData['sType'];
global $G_PUBLISH; global $G_PUBLISH;
G::LoadClass('xmlfield_InputPM'); G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'steps/triggers_Assign', '', $aFields, '../steps/steps_Ajax'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'steps/triggers_Assign', '', $aFields, '../steps/steps_Ajax' );
G::RenderPage('publish', 'raw'); G::RenderPage( 'publish', 'raw' );
} } else {
else { global $G_PUBLISH;
global $G_PUBLISH; $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'steps/triggers_NoAssign', '' );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'steps/triggers_NoAssign', ''); G::RenderPage( 'publish', 'raw' );
G::RenderPage('publish', 'raw'); }
} break;
break; case 'assignTrigger':
case 'assignTrigger': $aFields = array ('STEP_UID' => $aData['STEP_UID'],'TAS_UID' => $_SESSION['TASK'],'TRI_UID' => $aData['TRI_UID'],'ST_TYPE' => $aData['ST_TYPE']
$aFields = array('STEP_UID' => $aData['STEP_UID'], 'TAS_UID' => $_SESSION['TASK'], 'TRI_UID' => $aData['TRI_UID'], 'ST_TYPE' => $aData['ST_TYPE']); );
$oStepTrigger = new StepTrigger(); $oStepTrigger = new StepTrigger();
$oStepTrigger->create($aFields); $oStepTrigger->create( $aFields );
$aFields['ST_CONDITION'] = $aData['ST_CONDITION']; $aFields['ST_CONDITION'] = $aData['ST_CONDITION'];
$aFields['ST_POSITION'] = ($oStepTrigger->getNextPosition($aData['STEP_UID'], $aData['ST_TYPE']) - 1); $aFields['ST_POSITION'] = ($oStepTrigger->getNextPosition( $aData['STEP_UID'], $aData['ST_TYPE'] ) - 1);
$oStepTrigger->update($aFields); $oStepTrigger->update( $aFields );
break; break;
case 'editTriggerCondition': case 'editTriggerCondition':
require_once 'classes/model/Step.php'; require_once 'classes/model/Step.php';
require_once 'classes/model/Triggers.php'; require_once 'classes/model/Triggers.php';
$oStep = new Step(); $oStep = new Step();
$aFields['STEP_UID'] = $aData['sStep']; $aFields['STEP_UID'] = $aData['sStep'];
$aFields['TRI_UID'] = $aData['sTrigger']; $aFields['TRI_UID'] = $aData['sTrigger'];
$aFields['ST_TYPE'] = $aData['sType']; $aFields['ST_TYPE'] = $aData['sType'];
$Trigger = new Triggers(); $Trigger = new Triggers();
$aRow = $Trigger->load($aData['sTrigger']); $aRow = $Trigger->load( $aData['sTrigger'] );
$oStepTrigger = new StepTrigger(); $oStepTrigger = new StepTrigger();
$aFields = $oStepTrigger->load($aFields['STEP_UID'], $_SESSION['TASK'], $aFields['TRI_UID'], $aFields['ST_TYPE']); $aFields = $oStepTrigger->load( $aFields['STEP_UID'], $_SESSION['TASK'], $aFields['TRI_UID'], $aFields['ST_TYPE'] );
$aFields['action'] = 'saveTriggerCondition'; $aFields['action'] = 'saveTriggerCondition';
$aFields['PROCESS'] = $aRow['PRO_UID']; $aFields['PROCESS'] = $aRow['PRO_UID'];
global $G_PUBLISH; global $G_PUBLISH;
G::LoadClass('xmlfield_InputPM'); G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'steps/triggersCondition_Edit', '', $aFields, '../steps/steps_Ajax'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'steps/triggersCondition_Edit', '', $aFields, '../steps/steps_Ajax' );
G::RenderPage('publish', 'raw'); G::RenderPage( 'publish', 'raw' );
break; break;
case 'saveTriggerCondition': case 'saveTriggerCondition':
$oStepTrigger = new StepTrigger(); $oStepTrigger = new StepTrigger();
$oStepTrigger->update(array('STEP_UID' => $aData['STEP_UID'], 'TAS_UID' => $_SESSION['TASK'], 'TRI_UID' => $aData['TRI_UID'], 'ST_TYPE' => $aData['ST_TYPE'], 'ST_CONDITION' => $aData['ST_CONDITION'])); $oStepTrigger->update( array ('STEP_UID' => $aData['STEP_UID'],'TAS_UID' => $_SESSION['TASK'],'TRI_UID' => $aData['TRI_UID'],'ST_TYPE' => $aData['ST_TYPE'],'ST_CONDITION' => $aData['ST_CONDITION']
break; ) );
case 'upTrigger': break;
$aData['iPosition'] = (int)$aData['iPosition']; case 'upTrigger':
$oStepTrigger = new StepTrigger(); $aData['iPosition'] = (int) $aData['iPosition'];
$oStepTrigger->up($aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType'], $aData['iPosition']); $oStepTrigger = new StepTrigger();
break; $oStepTrigger->up( $aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType'], $aData['iPosition'] );
case 'downTrigger': break;
$aData['iPosition'] = (int)$aData['iPosition']; case 'downTrigger':
$oStepTrigger = new StepTrigger(); $aData['iPosition'] = (int) $aData['iPosition'];
$oStepTrigger->down($aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType'], $aData['iPosition']); $oStepTrigger = new StepTrigger();
break; $oStepTrigger->down( $aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType'], $aData['iPosition'] );
case 'ofToAssignTrigger': break;
$oStepTrigger = new StepTrigger(); case 'ofToAssignTrigger':
$oStepTrigger->reOrder($aData['sStep'], $_SESSION['TASK'], $aData['sType'], $aData['iPosition']); $oStepTrigger = new StepTrigger();
$oStepTrigger->remove($aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType']); $oStepTrigger->reOrder( $aData['sStep'], $_SESSION['TASK'], $aData['sType'], $aData['iPosition'] );
break; $oStepTrigger->remove( $aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType'] );
break;
case 'counterTriggers': case 'counterTriggers':
G::LoadClass('processMap'); G::LoadClass( 'processMap' );
$oProcessMap = new ProcessMap(); $oProcessMap = new ProcessMap();
$oCriteria1 = $oProcessMap->getStepTriggersCriteria($aData['sStep'], $_SESSION['TASK'], $aData['sType']); $oCriteria1 = $oProcessMap->getStepTriggersCriteria( $aData['sStep'], $_SESSION['TASK'], $aData['sType'] );
if ($aData['sType'] == 'BEFORE') { if ($aData['sType'] == 'BEFORE') {
$oCriteria2 = $oProcessMap->getStepTriggersCriteria($aData['sStep'], $_SESSION['TASK'], 'AFTER'); $oCriteria2 = $oProcessMap->getStepTriggersCriteria( $aData['sStep'], $_SESSION['TASK'], 'AFTER' );
} } else {
else { $oCriteria2 = $oProcessMap->getStepTriggersCriteria( $aData['sStep'], $_SESSION['TASK'], 'BEFORE' );
$oCriteria2 = $oProcessMap->getStepTriggersCriteria($aData['sStep'], $_SESSION['TASK'], 'BEFORE'); }
} $iCantity = StepTriggerPeer::doCount( $oCriteria1 );
$iCantity = StepTriggerPeer::doCount($oCriteria1); $iTotal = $iCantity + StepTriggerPeer::doCount( $oCriteria2 );
$iTotal = $iCantity + StepTriggerPeer::doCount($oCriteria2); echo $iTotal . '|' . $iCantity;
echo $iTotal . '|' . $iCantity; break;
break; }
} } catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* steps_Delete.php * steps_Delete.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,40 +12,37 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
{ case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} require_once 'classes/model/Step.php';
require_once 'classes/model/Step.php'; $oStep = new Step();
$oStep = new Step(); $oStep->reOrder( $_POST['STEP_UID'], $_POST['STEP_POSITION'] );
$oStep->reOrder($_POST['STEP_UID'], $_POST['STEP_POSITION']); $oStep->remove( $_POST['STEP_UID'] );
$oStep->remove($_POST['STEP_UID']); G::LoadClass( 'processMap' );
G::LoadClass('processMap'); $oProcessMap = new ProcessMap();
$oProcessMap = new ProcessMap(); $oProcessMap->getStepsCriteria( $_POST['TASK'] );
$oProcessMap->getStepsCriteria($_POST['TASK']); } catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* steps_Down.php * steps_Down.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,39 +12,36 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
{ case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} require_once 'classes/model/Step.php';
require_once 'classes/model/Step.php'; $oStep = new Step();
$oStep = new Step(); $oStep->down( $_POST['STEP_UID'], $_POST['TASK'], $_POST['STEP_POSITION'] );
$oStep->down($_POST['STEP_UID'], $_POST['TASK'] ,$_POST['STEP_POSITION']); G::LoadClass( 'processMap' );
G::LoadClass('processMap'); $oProcessMap = new ProcessMap();
$oProcessMap = new ProcessMap(); $oProcessMap->getStepsCriteria( $_POST['TASK'] );
$oProcessMap->getStepsCriteria($_POST['TASK']); } catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* steps_New.php * steps_New.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,38 +12,36 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
G::LoadClass('processMap'); G::LoadClass( 'processMap' );
$oProcessMap = new ProcessMap(); $oProcessMap = new ProcessMap();
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'steps/steps_availableBB', $oProcessMap->getAvailableBBCriteria($_GET['PROCESS'], $_GET['TASK']), $_GET); $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'steps/steps_availableBB', $oProcessMap->getAvailableBBCriteria( $_GET['PROCESS'], $_GET['TASK'] ), $_GET );
G::RenderPage('publish-raw', 'raw'); G::RenderPage( 'publish-raw', 'raw' );
} catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,43 +12,39 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
require_once 'classes/model/Step.php'; require_once 'classes/model/Step.php';
$oStep = new Step(); $oStep = new Step();
$sStepUID = $oStep->create(array('PRO_UID' => $_POST['sProcess'], 'TAS_UID' => $_POST['sTask'])); $sStepUID = $oStep->create( array ('PRO_UID' => $_POST['sProcess'],'TAS_UID' => $_POST['sTask']
$oStep->update(array('STEP_UID' => $sStepUID, ) );
'STEP_TYPE_OBJ' => $_POST['sType'], $oStep->update( array ('STEP_UID' => $sStepUID,'STEP_TYPE_OBJ' => $_POST['sType'],'STEP_UID_OBJ' => $_POST['sUID'],'STEP_POSITION' => ($oStep->getNextPosition( $_POST['sTask'] ) - 1),'STEP_MODE' => (isset( $_POST['sMode'] )) ? $_POST['sMode'] : 'EDIT'
'STEP_UID_OBJ' => $_POST['sUID'], ) );
'STEP_POSITION' => ($oStep->getNextPosition($_POST['sTask']) - 1), G::LoadClass( 'processMap' );
'STEP_MODE' => (isset($_POST['sMode'])) ? $_POST['sMode'] : 'EDIT')); $oProcessMap = new ProcessMap();
G::LoadClass('processMap'); $oProcessMap->getStepsCriteria( $_POST['sTask'] );
$oProcessMap = new ProcessMap(); } catch (Exception $oException) {
$oProcessMap->getStepsCriteria($_POST['sTask']); die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,59 +12,57 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
{ case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
}
//srequire_once 'classes/model/StepTrigger.php'; //srequire_once 'classes/model/StepTrigger.php';
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
switch ($_POST['action']) { G::LoadClass( 'processMap' );
case 'availableSupervisorDynaforms': $oProcessMap = new ProcessMap();
$oProcessMap->availableSupervisorDynaforms($_POST['PRO_UID']);
break; switch ($_POST['action']) {
case 'assignSupervisorDynaform': case 'availableSupervisorDynaforms':
$oProcessMap->assignSupervisorStep($_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID']); $oProcessMap->availableSupervisorDynaforms( $_POST['PRO_UID'] );
break; break;
case 'removeSupervisorDynaform': case 'assignSupervisorDynaform':
$oProcessMap->removeSupervisorStep($_POST['STEP_UID'], $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'], $_POST['STEP_POSITION']); $oProcessMap->assignSupervisorStep( $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'] );
break; break;
case 'availableSupervisorInputs': case 'removeSupervisorDynaform':
$oProcessMap->availableSupervisorInputs($_POST['PRO_UID']); $oProcessMap->removeSupervisorStep( $_POST['STEP_UID'], $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'], $_POST['STEP_POSITION'] );
break; break;
case 'assignSupervisorInput': case 'availableSupervisorInputs':
$oProcessMap->assignSupervisorStep($_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID']); $oProcessMap->availableSupervisorInputs( $_POST['PRO_UID'] );
break; break;
case 'removeSupervisorInput': case 'assignSupervisorInput':
$oProcessMap->removeSupervisorStep($_POST['STEP_UID'], $_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID'], $_POST['STEP_POSITION']); $oProcessMap->assignSupervisorStep( $_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID'] );
break; break;
} case 'removeSupervisorInput':
$oProcessMap->removeSupervisorStep( $_POST['STEP_UID'], $_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID'], $_POST['STEP_POSITION'] );
break;
}
} catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* steps_Up.php * steps_Up.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,39 +12,36 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
{ case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} require_once 'classes/model/Step.php';
require_once 'classes/model/Step.php'; $oStep = new Step();
$oStep = new Step(); $oStep->up( $_POST['STEP_UID'], $_POST['TASK'], $_POST['STEP_POSITION'] );
$oStep->up($_POST['STEP_UID'], $_POST['TASK'] ,$_POST['STEP_POSITION']); G::LoadClass( 'processMap' );
G::LoadClass('processMap'); $oProcessMap = new ProcessMap();
$oProcessMap = new ProcessMap(); $oProcessMap->getStepsCriteria( $_POST['TASK'] );
$oProcessMap->getStepsCriteria($_POST['TASK']); } catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,107 +12,108 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
/** /**
* @author Erik Amaru Ortiz <erik@colosa.com> *
* @date Jan 10th, 2010 * @author Erik Amaru Ortiz <erik@colosa.com>
*/ * @date Jan 10th, 2010
*/
require "classes/model/Translation.php"; require "classes/model/Translation.php";
$action = $_REQUEST['action']; $action = $_REQUEST['action'];
unset($_REQUEST['action']); unset( $_REQUEST['action'] );
$ajax = new Ajax(); $ajax = new Ajax();
$ajax->$action($_REQUEST); $ajax->$action( $_REQUEST );
class Ajax class Ajax
{ {
function getList($params)
{
$search = isset($params['search']) ? $params['search'] : null;
$params['dateFrom'] = str_replace('T00:00:00','',$params['dateFrom']);
$params['dateTo'] = str_replace('T00:00:00','',$params['dateTo']);
$result = Translation::getAll('en', $params['start'], $params['limit'], $search, $params['dateFrom'], $params['dateTo']);
//$result = Translation::getAll('en', $params['start'], $params['limit'], $search);
/*foreach($result->data as $i=>$row){
$result->data[$i]['TRN_VALUE'] = substr($row['TRN_VALUE'], 0, 15) . '...';
}*/
echo G::json_encode($result);
}
function save() function getList ($params)
{ {
try{ $search = isset( $params['search'] ) ? $params['search'] : null;
require_once ( "classes/model/Translation.php" ); $params['dateFrom'] = str_replace( 'T00:00:00', '', $params['dateFrom'] );
$id = $_POST['id']; $params['dateTo'] = str_replace( 'T00:00:00', '', $params['dateTo'] );
$label = preg_replace("[\n|\r|\n\r]", ' ', $_POST['label']); $result = Translation::getAll( 'en', $params['start'], $params['limit'], $search, $params['dateFrom'], $params['dateTo'] );
//$result = Translation::getAll('en', $params['start'], $params['limit'], $search);
$res = Translation::addTranslation('LABEL', $id, 'en', $label);
if ( $res['codError'] < 0 ) { /*foreach($result->data as $i=>$row){
$result->success = false; $result->data[$i]['TRN_VALUE'] = substr($row['TRN_VALUE'], 0, 15) . '...';
$result->msg = $res['message']; }*/
} else {
$result->success = true; echo G::json_encode( $result );
$result->msg = 'Label '.$id.' saved Successfully!';
}
} catch(Exception $e){
$result->success = false;
$result->msg = $e->getMessage();
} }
print G::json_encode($result);
}
function delete() function save ()
{ {
require_once ( "classes/model/Translation.php" ); try {
$ids = explode(',', $_POST['IDS']); require_once ("classes/model/Translation.php");
$category = 'LABEL'; $id = $_POST['id'];
$label = preg_replace( "[\n|\r|\n\r]", ' ', $_POST['label'] );
try{ $res = Translation::addTranslation( 'LABEL', $id, 'en', $label );
foreach($ids as $id){ if ($res['codError'] < 0) {
$tr = TranslationPeer::retrieveByPK( $category, $id, 'en' ); $result->success = false;
if ( ( is_object ( $tr ) && get_class ($tr) == 'Translation' ) ) { $result->msg = $res['message'];
$tr->delete(); } else {
$result->success = true;
$result->msg = 'Label ' . $id . ' saved Successfully!';
}
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
} }
} print G::json_encode( $result );
$result->success = true;
$result->msg = 'Deleted Successfully!';
} catch(Exception $e){
$result->success = false;
$result->msg = $e->getMessage();
} }
print G::json_encode($result);
}
function rebuild() function delete ()
{ {
try{ require_once ("classes/model/Translation.php");
require_once ( "classes/model/Translation.php" ); $ids = explode( ',', $_POST['IDS'] );
$t = new Translation; $category = 'LABEL';
$result = Translation::generateFileTranslation('en');
$result['success'] = true; try {
foreach ($ids as $id) {
} catch(Exception $e){ $tr = TranslationPeer::retrieveByPK( $category, $id, 'en' );
$result->success = false; if ((is_object( $tr ) && get_class( $tr ) == 'Translation')) {
$result->msg = $e->getMessage(); $tr->delete();
}
}
$result->success = true;
$result->msg = 'Deleted Successfully!';
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode( $result );
}
function rebuild ()
{
try {
require_once ("classes/model/Translation.php");
$t = new Translation();
$result = Translation::generateFileTranslation( 'en' );
$result['success'] = true;
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode( $result );
} }
print G::json_encode($result);
}
} }

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* dvServices.php * dvServices.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,72 +12,71 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
/* /*
* Created on 11-02-2008 * Created on 11-02-2008
* *
* @author David Callizaya <davidsantos@colosa.com> * @author David Callizaya <davidsantos@colosa.com>
*/ */
G::LoadSystem("webResource"); G::LoadSystem( "webResource" );
class dvServices extends WebResource class dvServices extends WebResource
{ {
function get_session_vars()
{ function get_session_vars ()
$cur=array_keys($_SESSION);
$res='';
foreach($cur as $key)
{ {
$res.='* '.$key.'<br/>'; $cur = array_keys( $_SESSION );
} $res = '';
return $res; foreach ($cur as $key) {
} $res .= '* ' . $key . '<br/>';
function get_session_xmlforms()
{
$cur=array_keys($_SESSION);
$res='';
$colors=array('white','#EEFFFF');
$colori=0;$count=0;
//Get xmlforms in session
foreach($cur as $key)
{
$res.='<div style="background-color:'.$colors[$colori].';">';
$xml=G::getUIDName($key,'');
if (strpos($xml,'.xml')!==false)
{
$res.='<i>FORM:</i> '.$xml;
$colori=$colori ^ 1;
$count++;
} }
$res.='</div>'; return $res;
} }
//Get pagedTable in session
foreach($cur as $key) function get_session_xmlforms ()
{ {
$res.='<div style="background-color:'.$colors[$colori].';">'; $cur = array_keys( $_SESSION );
if (substr($key,0,11)==="pagedTable[") $res = '';
{ $colors = array ('white','#EEFFFF'
$xml=G::getUIDName(substr($key,11,-1),''); );
$res.='<i>TABLE:</i> '.$xml; $colori = 0;
$colori=$colori ^ 1; $count = 0;
$count++; //Get xmlforms in session
} foreach ($cur as $key) {
$res.='</div>'; $res .= '<div style="background-color:' . $colors[$colori] . ';">';
$xml = G::getUIDName( $key, '' );
if (strpos( $xml, '.xml' ) !== false) {
$res .= '<i>FORM:</i> ' . $xml;
$colori = $colori ^ 1;
$count ++;
}
$res .= '</div>';
}
//Get pagedTable in session
foreach ($cur as $key) {
$res .= '<div style="background-color:' . $colors[$colori] . ';">';
if (substr( $key, 0, 11 ) === "pagedTable[") {
$xml = G::getUIDName( substr( $key, 11, - 1 ), '' );
$res .= '<i>TABLE:</i> ' . $xml;
$colori = $colori ^ 1;
$count ++;
}
$res .= '</div>';
}
return array ("count" => $count,"html" => $res
);
} }
return array("count"=>$count,"html"=>$res);
}
} }
$o=new dvServices($_SERVER['REQUEST_URI'],$_POST); $o = new dvServices( $_SERVER['REQUEST_URI'], $_POST );
//av.buenos aires maxparedes //av.buenos aires maxparedes
//tienda viva. //tienda viva.
//122 //122
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* index.php * index.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,18 +12,16 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
unset($_SESSION['TOOLS_VIEWTYPE']); unset( $_SESSION['TOOLS_VIEWTYPE'] );
$newFile = str_replace ( 'index.php', 'translations.php' , __FILE__ ) ; $newFile = str_replace( 'index.php', 'translations.php', __FILE__ );
return $newFile; return $newFile;

View File

@@ -1,8 +1,8 @@
<?php <?php
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript( 'tools/main', true );
$oHeadPublisher->addExtJsScript('tools/main', true);
//$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d'))); //$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d')));
G::RenderPage('publish', 'extJs'); G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* methodsPermissions.php * methodsPermissions.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,20 +12,18 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('view', 'tools/methodsPermissions' ); $G_PUBLISH->AddContent( 'view', 'tools/methodsPermissions' );
G::RenderPage( 'publish' ); G::RenderPage( 'publish' );
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* methodsPermissions_Ajax.php * methodsPermissions_Ajax.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,276 +12,228 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
G::LoadClass("webResource"); G::LoadClass( "webResource" );
define('GET_PERMISSION_REG_EXP','/(G::\\s*genericForceLogin\\s*\\(\\s*[\'"])(\\w+)([\'"]\\s*,\\s*[\'"].+[\'"],.+\\)\\s*)|(\\$RBAC->userCanAccess\\s*\\(\\s*[\'"])(\\w+)([\'"]\\s*\\))/i'); define( 'GET_PERMISSION_REG_EXP', '/(G::\\s*genericForceLogin\\s*\\(\\s*[\'"])(\\w+)([\'"]\\s*,\\s*[\'"].+[\'"],.+\\)\\s*)|(\\$RBAC->userCanAccess\\s*\\(\\s*[\'"])(\\w+)([\'"]\\s*\\))/i' );
define('GET_PERMISSION_REG_EXP2','/\\s*if\\s*\\(\\s*\\(\\s*\\$RBAC_Response\\s*=\\s*\\$RBAC->userCanAccess\\s*\\(\\s*[\'"]\\w+[\'"]\\s*\\)\\s*\\)\\s*!=1\\s*\\)\\s*return(?:.*)?;\\s*/i'); define( 'GET_PERMISSION_REG_EXP2', '/\\s*if\\s*\\(\\s*\\(\\s*\\$RBAC_Response\\s*=\\s*\\$RBAC->userCanAccess\\s*\\(\\s*[\'"]\\w+[\'"]\\s*\\)\\s*\\)\\s*!=1\\s*\\)\\s*return(?:.*)?;\\s*/i' );
class phpFile extends webResource
{
function _get_permissions($filename)
{
$aSource = file( $filename);
$aOutSource = array();
$source = implode( '', $aSource );
$regExp=GET_PERMISSION_REG_EXP;
$permissions=array();
$lines=array();
$len=preg_match_all($regExp,$source,$matches,PREG_OFFSET_CAPTURE);
for($r=0; $r < $len; $r++)
{
$match=$matches[0][$r][0];
$permission=($matches[2][$r][0]!='') ? $matches[2][$r][0]:$matches[5][$r][0];
$toPrint=($matches[2][$r][0]!='') ?
(
htmlentities($matches[1][$r][0],ENT_QUOTES,'utf-8').
'<b>'.htmlentities($matches[2][$r][0],ENT_QUOTES,'utf-8').'</b>'.
htmlentities($matches[3][$r][0],ENT_QUOTES,'utf-8')
)
:
(
htmlentities($matches[4][$r][0],ENT_QUOTES,'utf-8').
'<b>'.htmlentities($matches[5][$r][0],ENT_QUOTES,'utf-8').'</b>'.
htmlentities($matches[6][$r][0],ENT_QUOTES,'utf-8')
);
$row = $this->_getLine($aSource,$matches[0][$r][1]);
if (array_search($permission,$permissions)===FALSE)
{
$permissions[]=$permission;
$lines[]=$row;
}
//TODO: Need to htmlencode the rest of the line that is not in match. Ex. < ? php
if ($row>0) $aOutSource[$row-1]=str_replace($match,$toPrint,isset($aOutSource[$row-1])?$aOutSource[$row-1]:$aSource[$row-1]);
$aOutSource[$row]=str_replace($match,$toPrint,isset($aOutSource[$row])?$aOutSource[$row]:$aSource[$row]);
if ($row<(sizeof($aSource)-1)) $aOutSource[$row+1]=str_replace($match,$toPrint,isset($aOutSource[$row+1])?$aOutSource[$row+1]:$aSource[$row+1]);
}
ksort($aOutSource);
$row0=0;$html='';
foreach($aOutSource as $row => $line)
{
if (($row-1) > $row0) $html.=$this->_printLine($row,'...');
$html.=$this->_printLine($row+1,$line,true,$aSource[$row],$filename.'?'.$row);
$row0=$row;
}
return array (
($html==='')?'Dont have RBAC validation!':('<table>'.$html.'</table>'),
$permissions,
$lines
);
}
function get_permissions($filename)
{
$res=$this->_get_permissions($filename);
return $res[0];
}
function modify_line($filename,$row,$value)
{
$aSource = file( $filename);
$line=$aSource[$row];
$nl=(strlen($line)>=2)&&(substr($line,-2,2)=="\r\n")?
"\r\n":
((strlen($line)>=1)&&(substr($line,-1,1)=="\n")?"\n":"");
$aSource[$row]=$value.$nl;
/*Save change*/
$fp=fopen($filename,'w');
fwrite($fp,implode('',$aSource));
fclose($fp);
/*Format line*/
$regExp=GET_PERMISSION_REG_EXP;
$line=$aSource[$row];
$len=preg_match_all($regExp,$line,$matches,PREG_OFFSET_CAPTURE);
for($r=0; $r < $len; $r++)
{
$match=$matches[0][$r][0];
$toPrint=($matches[2][$r][0]!='') ?
(
htmlentities($matches[1][$r][0],ENT_QUOTES,'utf-8').
'<b>'.htmlentities($matches[2][$r][0],ENT_QUOTES,'utf-8').'</b>'.
htmlentities($matches[3][$r][0],ENT_QUOTES,'utf-8')
)
:
(
htmlentities($matches[4][$r][0],ENT_QUOTES,'utf-8').
'<b>'.htmlentities($matches[5][$r][0],ENT_QUOTES,'utf-8').'</b>'.
htmlentities($matches[6][$r][0],ENT_QUOTES,'utf-8')
);
$line=str_replace($match,$toPrint,$line);
}
return array($line,$aSource[$row]);
}
function set_header($filename,$value)
{
$aFields=array("_FILENAME_"=>basename( $filename ) );
$value = G::replaceDataField( $value , $aFields );
$aOrigin = file( $filename);
//It suposse that allway start with <?. or <?php
$line=$aOrigin[0];
$nl=(strlen($line)>=2)&&(substr($line,-2,2)=="\r\n")?
"\r\n":
((strlen($line)>=1)&&(substr($line,-1,1)=="\n")?"\n":"");
$codigo = implode('',$aOrigin); class phpFile extends webResource
$pattern='/\/\*[\w\W]+\* '.'ProcessMaker Open Source'.'[\w\W]+?\*\//i'; {
if (preg_match($pattern,$codigo))
{ function _get_permissions ($filename)
$codigo=preg_replace( $pattern, $value , $codigo ); {
} $aSource = file( $filename );
else $aOutSource = array ();
{ $source = implode( '', $aSource );
$aSource=array(); $regExp = GET_PERMISSION_REG_EXP;
$aSource[0]=$aOrigin[0]; $permissions = array ();
$aSource[1]=$value.$nl; $lines = array ();
for($r=1;$r<sizeof($aOrigin);$r++) $len = preg_match_all( $regExp, $source, $matches, PREG_OFFSET_CAPTURE );
{ for ($r = 0; $r < $len; $r ++) {
$aSource[]=$aOrigin[$r]; $match = $matches[0][$r][0];
$permission = ($matches[2][$r][0] != '') ? $matches[2][$r][0] : $matches[5][$r][0];
$toPrint = ($matches[2][$r][0] != '') ? (htmlentities( $matches[1][$r][0], ENT_QUOTES, 'utf-8' ) . '<b>' . htmlentities( $matches[2][$r][0], ENT_QUOTES, 'utf-8' ) . '</b>' . htmlentities( $matches[3][$r][0], ENT_QUOTES, 'utf-8' )) : (htmlentities( $matches[4][$r][0], ENT_QUOTES, 'utf-8' ) . '<b>' . htmlentities( $matches[5][$r][0], ENT_QUOTES, 'utf-8' ) . '</b>' . htmlentities( $matches[6][$r][0], ENT_QUOTES, 'utf-8' ));
$row = $this->_getLine( $aSource, $matches[0][$r][1] );
if (array_search( $permission, $permissions ) === false) {
$permissions[] = $permission;
$lines[] = $row;
}
//TODO: Need to htmlencode the rest of the line that is not in match. Ex. < ? php
if ($row > 0)
$aOutSource[$row - 1] = str_replace( $match, $toPrint, isset( $aOutSource[$row - 1] ) ? $aOutSource[$row - 1] : $aSource[$row - 1] );
$aOutSource[$row] = str_replace( $match, $toPrint, isset( $aOutSource[$row] ) ? $aOutSource[$row] : $aSource[$row] );
if ($row < (sizeof( $aSource ) - 1))
$aOutSource[$row + 1] = str_replace( $match, $toPrint, isset( $aOutSource[$row + 1] ) ? $aOutSource[$row + 1] : $aSource[$row + 1] );
} }
$codigo=implode('',$aSource); ksort( $aOutSource );
} $row0 = 0;
/*Save change*/ $html = '';
$fp=fopen($filename,'w'); foreach ($aOutSource as $row => $line) {
fwrite($fp,$codigo); if (($row - 1) > $row0)
fclose($fp); $html .= $this->_printLine( $row, '...' );
return $this->get_permissions($filename); $html .= $this->_printLine( $row + 1, $line, true, $aSource[$row], $filename . '?' . $row );
} $row0 = $row;
function add_permission($filename,$value)
{
$aOrigin = file( $filename);
//It suposse that allway start with <?. or <?php
$aSource[0]=$aOrigin[0];
$line=$aOrigin[0];
$nl=(strlen($line)>=2)&&(substr($line,-2,2)=="\r\n")?
"\r\n":
((strlen($line)>=1)&&(substr($line,-1,1)=="\n")?"\n":"");
$aSource[1]=$value.$nl;
for($r=1;$r<sizeof($aOrigin);$r++)
{
$aSource[]=$aOrigin[$r];
}
/*Save change*/
$fp=fopen($filename,'w');
fwrite($fp,implode('',$aSource));
fclose($fp);
return $this->get_permissions($filename);
}
function _getLine(&$aSource,$pos)
{
$i=1;
while ($pos>sizeof($aSource[$i]))
{
$pos-=strlen($aSource[$i]);
$i++;
}
return $i-1;
}
function _printLine($row,$txt,$editable=false,$editValue='',$name='')
{
if ($editable)
{
return '<tr><td><input value="X" type="button" style="width:100%;" '.
' name="'.htmlentities($name,ENT_QUOTES,'utf-8').'"'.
' onclick="removeLine(this);"/></td>'.
'<td class="treeContent" align="right">'.$row.'</td>
<td class="treeNode"><span onclick="switchViewEdit(this,this.nextSibling);">'.
$txt.'</span>'.
'<input class="treeNode"'.
' name="'.htmlentities($name,ENT_QUOTES,'utf-8').'"'.
' style="border:none;width:100%;display:none;"'.
' onblur="switchEditView(this.previousSibling,this);"'.
' value="'.htmlentities($editValue,ENT_QUOTES,'utf-8').'"/></td></tr>';
}
else
{
return '<tr><td></td>'.
'<td class="treeContent" align="right">'.$row.'</td>'.
'<td class="treeNode">'.$txt.'</td></tr>';
}
}
function set_permission($filename,$permission)
{
list($html,$permissions)=$this->_get_permissions($filename);
if (array_search($permission,$permissions)===FALSE)
{
$this->add_permission
(
$filename,
'if (($RBAC_Response=$RBAC->userCanAccess("'.$permission.'"))!=1) return $RBAC_Response;'
);
}
return $this->get_permissions($filename);
}
function set_path_permission($path,$permission)
{
$files=glob($path.'*.php');
foreach($files as $file)
{
$this->set_permission($file,$permission);
}
}
function set_path_header($path,$header)
{
$files=glob($path.'*.php');
$filesMod=array();
foreach($files as $file)
{
$filesMod[]=$file;
$this->set_header($file,$header);
}
$dirs=glob($path.'*', GLOB_MARK );
foreach($dirs as $dir)
{
if (substr( $dir , -1 , 1 )=='/') $this->set_path_header($dir,$header);
}
return $filesMod;
}
function remove_path_permission($path,$permission)
{
$files=glob($path.'*.php');
foreach($files as $file)
{
$this->remove_permission($file,$permission);
}
}
function remove_line($filename,$line)
{
$aSource = file($filename);
unset($aSource[$line]);
/*Save change*/
$fp=fopen($filename,'w');
fwrite($fp,implode('',$aSource));
fclose($fp);
return $this->get_permissions($filename);
}
function remove_permission($filename,$permission)
{
$aSource = file( $filename);
list($html,$permissions,$lines) = $this->_get_permissions($filename);
if (($row=array_search($permission,$permissions))!==FALSE)
{
$line=$lines[$row];
if (preg_match(GET_PERMISSION_REG_EXP2,$aSource[$line]))
{
unset($aSource[$line]);
$msg="Removed.";
} }
else return array (($html === '') ? 'Dont have RBAC validation!' : ('<table>' . $html . '</table>'),$permissions,$lines
{ );
$msg="Can not be removed!";
}
}
/*Save change*/
$fp=fopen($filename,'w');
fwrite($fp,implode('',$aSource));
fclose($fp);
return $this->get_permissions($filename);
} }
}
$phpFile=new phpFile('methodsPermissions_Ajax',$_POST); function get_permissions ($filename)
?> {
$res = $this->_get_permissions( $filename );
return $res[0];
}
function modify_line ($filename, $row, $value)
{
$aSource = file( $filename );
$line = $aSource[$row];
$nl = (strlen( $line ) >= 2) && (substr( $line, - 2, 2 ) == "\r\n") ? "\r\n" : ((strlen( $line ) >= 1) && (substr( $line, - 1, 1 ) == "\n") ? "\n" : "");
$aSource[$row] = $value . $nl;
/*Save change*/
$fp = fopen( $filename, 'w' );
fwrite( $fp, implode( '', $aSource ) );
fclose( $fp );
/*Format line*/
$regExp = GET_PERMISSION_REG_EXP;
$line = $aSource[$row];
$len = preg_match_all( $regExp, $line, $matches, PREG_OFFSET_CAPTURE );
for ($r = 0; $r < $len; $r ++) {
$match = $matches[0][$r][0];
$toPrint = ($matches[2][$r][0] != '') ? (htmlentities( $matches[1][$r][0], ENT_QUOTES, 'utf-8' ) . '<b>' . htmlentities( $matches[2][$r][0], ENT_QUOTES, 'utf-8' ) . '</b>' . htmlentities( $matches[3][$r][0], ENT_QUOTES, 'utf-8' )) : (htmlentities( $matches[4][$r][0], ENT_QUOTES, 'utf-8' ) . '<b>' . htmlentities( $matches[5][$r][0], ENT_QUOTES, 'utf-8' ) . '</b>' . htmlentities( $matches[6][$r][0], ENT_QUOTES, 'utf-8' ));
$line = str_replace( $match, $toPrint, $line );
}
return array ($line,$aSource[$row]
);
}
function set_header ($filename, $value)
{
$aFields = array ("_FILENAME_" => basename( $filename )
);
$value = G::replaceDataField( $value, $aFields );
$aOrigin = file( $filename );
//It suposse that allway start with <?. or <?php
$line = $aOrigin[0];
$nl = (strlen( $line ) >= 2) && (substr( $line, - 2, 2 ) == "\r\n") ? "\r\n" : ((strlen( $line ) >= 1) && (substr( $line, - 1, 1 ) == "\n") ? "\n" : "");
$codigo = implode( '', $aOrigin );
$pattern = '/\/\*[\w\W]+\* ' . 'ProcessMaker Open Source' . '[\w\W]+?\*\//i';
if (preg_match( $pattern, $codigo )) {
$codigo = preg_replace( $pattern, $value, $codigo );
} else {
$aSource = array ();
$aSource[0] = $aOrigin[0];
$aSource[1] = $value . $nl;
for ($r = 1; $r < sizeof( $aOrigin ); $r ++) {
$aSource[] = $aOrigin[$r];
}
$codigo = implode( '', $aSource );
}
/*Save change*/
$fp = fopen( $filename, 'w' );
fwrite( $fp, $codigo );
fclose( $fp );
return $this->get_permissions( $filename );
}
function add_permission ($filename, $value)
{
$aOrigin = file( $filename );
//It suposse that allway start with <?. or <?php
$aSource[0] = $aOrigin[0];
$line = $aOrigin[0];
$nl = (strlen( $line ) >= 2) && (substr( $line, - 2, 2 ) == "\r\n") ? "\r\n" : ((strlen( $line ) >= 1) && (substr( $line, - 1, 1 ) == "\n") ? "\n" : "");
$aSource[1] = $value . $nl;
for ($r = 1; $r < sizeof( $aOrigin ); $r ++) {
$aSource[] = $aOrigin[$r];
}
/*Save change*/
$fp = fopen( $filename, 'w' );
fwrite( $fp, implode( '', $aSource ) );
fclose( $fp );
return $this->get_permissions( $filename );
}
function _getLine (&$aSource, $pos)
{
$i = 1;
while ($pos > sizeof( $aSource[$i] )) {
$pos -= strlen( $aSource[$i] );
$i ++;
}
return $i - 1;
}
function _printLine ($row, $txt, $editable = false, $editValue = '', $name = '')
{
if ($editable) {
return '<tr><td><input value="X" type="button" style="width:100%;" ' . ' name="' . htmlentities( $name, ENT_QUOTES, 'utf-8' ) . '"' . ' onclick="removeLine(this);"/></td>' . '<td class="treeContent" align="right">' . $row . '</td>
<td class="treeNode"><span onclick="switchViewEdit(this,this.nextSibling);">' . $txt . '</span>' . '<input class="treeNode"' . ' name="' . htmlentities( $name, ENT_QUOTES, 'utf-8' ) . '"' . ' style="border:none;width:100%;display:none;"' . ' onblur="switchEditView(this.previousSibling,this);"' . ' value="' . htmlentities( $editValue, ENT_QUOTES, 'utf-8' ) . '"/></td></tr>';
} else {
return '<tr><td></td>' . '<td class="treeContent" align="right">' . $row . '</td>' . '<td class="treeNode">' . $txt . '</td></tr>';
}
}
function set_permission ($filename, $permission)
{
list ($html, $permissions) = $this->_get_permissions( $filename );
if (array_search( $permission, $permissions ) === false) {
$this->add_permission( $filename, 'if (($RBAC_Response=$RBAC->userCanAccess("' . $permission . '"))!=1) return $RBAC_Response;' );
}
return $this->get_permissions( $filename );
}
function set_path_permission ($path, $permission)
{
$files = glob( $path . '*.php' );
foreach ($files as $file) {
$this->set_permission( $file, $permission );
}
}
function set_path_header ($path, $header)
{
$files = glob( $path . '*.php' );
$filesMod = array ();
foreach ($files as $file) {
$filesMod[] = $file;
$this->set_header( $file, $header );
}
$dirs = glob( $path . '*', GLOB_MARK );
foreach ($dirs as $dir) {
if (substr( $dir, - 1, 1 ) == '/')
$this->set_path_header( $dir, $header );
}
return $filesMod;
}
function remove_path_permission ($path, $permission)
{
$files = glob( $path . '*.php' );
foreach ($files as $file) {
$this->remove_permission( $file, $permission );
}
}
function remove_line ($filename, $line)
{
$aSource = file( $filename );
unset( $aSource[$line] );
/*Save change*/
$fp = fopen( $filename, 'w' );
fwrite( $fp, implode( '', $aSource ) );
fclose( $fp );
return $this->get_permissions( $filename );
}
function remove_permission ($filename, $permission)
{
$aSource = file( $filename );
list ($html, $permissions, $lines) = $this->_get_permissions( $filename );
if (($row = array_search( $permission, $permissions )) !== false) {
$line = $lines[$row];
if (preg_match( GET_PERMISSION_REG_EXP2, $aSource[$line] )) {
unset( $aSource[$line] );
$msg = "Removed.";
} else {
$msg = "Can not be removed!";
}
}
/*Save change*/
$fp = fopen( $filename, 'w' );
fwrite( $fp, implode( '', $aSource ) );
fclose( $fp );
return $this->get_permissions( $filename );
}
}
$phpFile = new phpFile( 'methodsPermissions_Ajax', $_POST );

View File

@@ -1,6 +1,6 @@
<style> <style>
.tableOption { .tableOption {
color:#005791 !important; color: #005791 !important;
} }
</style> </style>
<?php <?php
@@ -17,29 +17,28 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
$G_MAIN_MENU = 'tools'; $G_MAIN_MENU = 'tools';
$G_SUB_MENU = 'toolsTranslations'; $G_SUB_MENU = 'toolsTranslations';
$G_ID_MENU_SELECTED = 'TRANSLATION'; $G_ID_MENU_SELECTED = 'TRANSLATION';
$G_ID_SUB_MENU_SELECTED = 'TRANSLATION_LIST'; $G_ID_SUB_MENU_SELECTED = 'TRANSLATION_LIST';
$table="TRANSLATION"; $table = "TRANSLATION";
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'tools/translationsList', '', array() , ''); $G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'tools/translationsList', '', array (), '' );
if( isset($_SESSION['TOOLS_VIEWTYPE']) ) { if (isset( $_SESSION['TOOLS_VIEWTYPE'] )) {
G::RenderPage('publishBlank', 'green-submenu'); G::RenderPage( 'publishBlank', 'green-submenu' );
} else { } else {
G::RenderPage('publish'); G::RenderPage( 'publish' );
} }

View File

@@ -12,27 +12,26 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
$G_MAIN_MENU = 'tools'; $G_MAIN_MENU = 'tools';
$G_SUB_MENU = 'toolsTranslations'; $G_SUB_MENU = 'toolsTranslations';
$G_ID_MENU_SELECTED = 'TRANSLATION'; $G_ID_MENU_SELECTED = 'TRANSLATION';
$G_ID_SUB_MENU_SELECTED = 'TRANSLATION_ADD'; $G_ID_SUB_MENU_SELECTED = 'TRANSLATION_ADD';
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'tools/translationAdd', '', null, 'translationsSave' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/translationAdd', '', null, 'translationsSave' );
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
G::RenderPage( 'publishBlank', 'green-submenu' );
} else {
G::RenderPage( 'publish' );
}
if( isset($_SESSION['TOOLS_VIEWTYPE']) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
G::RenderPage('publishBlank', 'green-submenu');
} else {
G::RenderPage('publish');
}
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* translationsAjax.php * translationsAjax.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,206 +12,194 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
ini_set('display_errors','off'); ini_set( 'display_errors', 'off' );
G::LoadInclude('ajax'); G::LoadInclude( 'ajax' );
$function = get_ajax_value('function'); $function = get_ajax_value( 'function' );
$cat = get_ajax_value('cat'); $cat = get_ajax_value( 'cat' );
$node = get_ajax_value('node'); $node = get_ajax_value( 'node' );
$lang = get_ajax_value('lang'); $lang = get_ajax_value( 'lang' );
$langLabel = get_ajax_value('langLabel'); $langLabel = get_ajax_value( 'langLabel' );
$text = get_ajax_value('text'); $text = get_ajax_value( 'text' );
$table="TRANSLATION"; $table = "TRANSLATION";
$dbc = new DBConnection; $dbc = new DBConnection();
$ses = new DBSession($dbc); $ses = new DBSession( $dbc );
switch($function) switch ($function) {
{ case "editLabel":
case "editLabel": case "changeLabel":
case "changeLabel": $query = $ses->execute( "select * from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
$query=$ses->execute("select * from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'",false); if ($query->count() === 0) {
if ($query->count()===0) {echo("Not found $cat:$node:$lang in table '$table'");return;} echo ("Not found $cat:$node:$lang in table '$table'");
if ($query->count()>1) {echo("The $cat:$node:$lang in table '$table' is not unique");return;} return;
$res=$query->read(); }
switch($function) if ($query->count() > 1) {
{ echo ("The $cat:$node:$lang in table '$table' is not unique");
case "editLabel": return;
$myID="input_".$cat."_".$node."_".$lang; }
$myID='aux'; $res = $query->read();
echo("<input id='$myID' type='text' value='".htmlspecialchars($res['TRN_VALUE'])."' ". switch ($function) {
ajax_event("onblur","translationsAjax.php", case "editLabel":
'lang_'.$cat.'_'.$node.'_'.$lang, $myID = "input_" . $cat . "_" . $node . "_" . $lang;
"'function=changeLabel&cat=".urlencode($cat). $myID = 'aux';
"&node=".urlencode($node). echo ("<input id='$myID' type='text' value='" . htmlspecialchars( $res['TRN_VALUE'] ) . "' " . ajax_event( "onblur", "translationsAjax.php", 'lang_' . $cat . '_' . $node . '_' . $lang, "'function=changeLabel&cat=" . urlencode( $cat ) . "&node=" . urlencode( $node ) . "&lang=" . urlencode( $lang ) . "&langLabel='+encodeURI(getElementById('$myID').value)", '' ) . "/>");
"&lang=".urlencode($lang). break;
"&langLabel='+encodeURI(getElementById('$myID').value)",'') case "changeLabel":
."/>"); $update = $ses->execute( "update $table set TRN_VALUE='$langLabel' where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
break; $query = $ses->execute( "select * from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
case "changeLabel": if ($query->count() === 0) {
$update=$ses->execute("update $table set TRN_VALUE='$langLabel' where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'",false); echo ("Not found $cat:$node:$lang in table '$table'");
$query=$ses->execute("select * from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'",false); return;
if ($query->count()===0) {echo("Not found $cat:$node:$lang in table '$table'");return;} }
if ($query->count()>1) {echo("The $cat:$node:$lang in table '$table' is not unique");return;} if ($query->count() > 1) {
$res=$query->read(); echo ("The $cat:$node:$lang in table '$table' is not unique");
echo(htmlspecialchars($res['TRN_VALUE'])); return;
break; }
break; $res = $query->read();
} echo (htmlspecialchars( $res['TRN_VALUE'] ));
G::LoadClass( "translation" ); break;
break;
}
G::LoadClass( "translation" );
$dbc = new DBConnection; $dbc = new DBConnection();
$obj = new Translation; $obj = new Translation();
$obj->SetTo($dbc ); $obj->SetTo( $dbc );
$translation2 = $obj->generateFileTranslation(); $translation2 = $obj->generateFileTranslation();
break; break;
case "listLanguage": case "listLanguage":
$query=$ses->execute("select distinct TRN_LANG from $table",false); $query = $ses->execute( "select distinct TRN_LANG from $table", false );
$template = new TemplatePower(PATH_CORE . 'templates/tools/translationsTP.html'); $template = new TemplatePower( PATH_CORE . 'templates/tools/translationsTP.html' );
$template->prepare(); $template->prepare();
$template->newBlock("languageList"); $template->newBlock( "languageList" );
$template->assign("ajaxDelLang",ajax_event("onclick","translationsAjax","showSpace", $template->assign( "ajaxDelLang", ajax_event( "onclick", "translationsAjax", "showSpace", "'function=delLanguage&lang='+encodeURI(getElementById('language').value)", 'hideLangBar' ) );
"'function=delLanguage&lang='+encodeURI(getElementById('language').value)",'hideLangBar'));
for($r=1;$r<=$query->count();$r++) for ($r = 1; $r <= $query->count(); $r ++) {
{ $res = $query->read();
$res=$query->read(); $template->newBlock( "languageItem" );
$template->newBlock("languageItem"); $template->assign( "langIdRadio", $res['TRN_LANG'] );
$template->assign("langIdRadio",$res['TRN_LANG']); }
} $template->printToScreen();
$template->printToScreen(); break;
break; case "show":
case "show": case "search":
case "search": case "addField":
case "addField": case "addLanguage":
case "addLanguage": case "delLanguage":
case "delLanguage": case "delField":
case "delField": switch ($function) {
switch($function) case "show":
{ $query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
case "show": break;
$query=$ses->execute("select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ",false); case "search":
break; $query = $ses->execute( "select * from $table where (TRN_CATEGORY like '%$text%') or (TRN_ID like '%$text%') or (TRN_LANG like '%$text%') or (TRN_VALUE like '%$text%') ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
case "search": break;
$query=$ses->execute("select * from $table where (TRN_CATEGORY like '%$text%') or (TRN_ID like '%$text%') or (TRN_LANG like '%$text%') or (TRN_VALUE like '%$text%') ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ",false); case "addField":
break; if (! defined( 'LANGUAGES' ))
case "addField": define( 'LANGUAGES', SYS_LANG );
if (!defined('LANGUAGES')) define('LANGUAGES',SYS_LANG); $languages = explode( ",", LANGUAGES );
$languages=explode(",",LANGUAGES); foreach ($languages as $lang) {
foreach($languages as $lang) //$langLabel=$cat;
{ /* $update=$ses->execute("insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE )
//$langLabel=$cat;
/* $update=$ses->execute("insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE )
values ('$cat','$node','$lang','$langLabel')",false);*/ values ('$cat','$node','$lang','$langLabel')",false);*/
$update=$ses->execute("insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE ) $update = $ses->execute( "insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE )
values ('LABEL','$node','$lang','$langLabel')",false); values ('LABEL','$node','$lang','$langLabel')", false );
} }
$query=$ses->execute("select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ",false); $query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
break; break;
case "addLanguage": case "addLanguage":
//SELECT distinct TRN_CATEGORY, TRN_ID, 'ne', 'new value' FROM TRANSLATION WHERE TRN_LANG<>'ne' //SELECT distinct TRN_CATEGORY, TRN_ID, 'ne', 'new value' FROM TRANSLATION WHERE TRN_LANG<>'ne'
//INSERT INTO TRANSLATION(TRN_CATEGORY, TRN_ID, TRN_LANG , TRN_VALUE ) SELECT distinct TRN_CATEGORY, TRN_ID, 'ne', TRN_VALUE FROM TRANSLATION WHERE TRN_LANG<>'ne' //INSERT INTO TRANSLATION(TRN_CATEGORY, TRN_ID, TRN_LANG , TRN_VALUE ) SELECT distinct TRN_CATEGORY, TRN_ID, 'ne', TRN_VALUE FROM TRANSLATION WHERE TRN_LANG<>'ne'
$query1=$ses->execute("select * from $table where TRN_LANG='$lang'",false); $query1 = $ses->execute( "select * from $table where TRN_LANG='$lang'", false );
$query2=$ses->execute("select distinct TRN_CATEGORY, TRN_ID from $table",false); $query2 = $ses->execute( "select distinct TRN_CATEGORY, TRN_ID from $table", false );
$existe=array(); $existe = array ();
for($r=1;$r<=$query1->count();$r++) for ($r = 1; $r <= $query1->count(); $r ++) {
{ $res = $query1->read();
$res=$query1->read(); $existe[$res['TRN_CATEGORY'] . "_" . $res['TRN_ID']] = $res;
$existe[$res['TRN_CATEGORY']."_".$res['TRN_ID']]=$res; }
} for ($r = 1; $r <= $query2->count(); $r ++) {
for($r=1;$r<=$query2->count();$r++) $res = $query2->read();
{ $cat = $res['TRN_CATEGORY'];
$res=$query2->read(); $node = $res['TRN_ID'];
$cat=$res['TRN_CATEGORY']; $langLabel = $res['TRN_CATEGORY'];
$node=$res['TRN_ID']; if (! array_key_exists( $cat . "_" . $node, $existe ))
$langLabel=$res['TRN_CATEGORY'];
if (!array_key_exists($cat."_".$node,$existe))
/* $update=$ses->execute("insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE ) /* $update=$ses->execute("insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE )
values ('$cat','$node','$lang','$langLabel')",false);*/ values ('$cat','$node','$lang','$langLabel')",false);*/
$update=$ses->execute("insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE ) $update = $ses->execute( "insert into $table(TRN_CATEGORY , TRN_ID , TRN_LANG , TRN_VALUE )
values ('LABELS','$node','en','$langLabel')",false); values ('LABELS','$node','en','$langLabel')", false );
unset($update); unset( $update );
} }
unset($existe); unset( $existe );
unset($query1);unset($query2); unset( $query1 );
$query=$ses->execute("select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ",false); unset( $query2 );
break; $query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
case "delLanguage": break;
$update=$ses->execute("delete from $table where TRN_LANG='$lang'",false); case "delLanguage":
$query=$ses->execute("select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ",false); $update = $ses->execute( "delete from $table where TRN_LANG='$lang'", false );
break; $query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
case "delField": break;
$update=$ses->execute("delete from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'",false); case "delField":
//echo("delete from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'"); $update = $ses->execute( "delete from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'", false );
$query=$ses->execute("select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ",false); //echo("delete from $table where TRN_CATEGORY='$cat' and TRN_ID='$node' and TRN_LANG='$lang'");
break; $query = $ses->execute( "select * from $table ORDER BY TRN_CATEGORY ASC , TRN_ID ASC , TRN_LANG ASC ", false );
} break;
$template = new TemplatePower(PATH_CORE . 'templates/tools/translationsTP.html'); }
$template->prepare(); $template = new TemplatePower( PATH_CORE . 'templates/tools/translationsTP.html' );
$template->newBlock("CONTENT"); $template->prepare();
$template->newBlock("table"); $template->newBlock( "CONTENT" );
$aCat="";$aNode=""; $template->newBlock( "table" );
for($i=1;$i<=$query->count();$i++) $aCat = "";
{ $aNode = "";
$template->newBlock("row"); for ($i = 1; $i <= $query->count(); $i ++) {
$res=$query->read(); $template->newBlock( "row" );
$cat=$res['TRN_CATEGORY']; $res = $query->read();
$node=$res['TRN_ID']; $cat = $res['TRN_CATEGORY'];
$lang=$res['TRN_LANG']; $node = $res['TRN_ID'];
$langLabel=$res['TRN_VALUE']; $lang = $res['TRN_LANG'];
if ($cat!=$aCat) $langLabel = $res['TRN_VALUE'];
{ if ($cat != $aCat) {
$template->newBlock("TDcat"); $template->newBlock( "TDcat" );
$template->assign("catId",$res['TRN_CATEGORY']); $template->assign( "catId", $res['TRN_CATEGORY'] );
$template->assign("ajaxDelField", $template->assign( "ajaxDelField", ajax_event( 'onclick', 'translationsAjax', 'showSpace', "'function=delField" . "&cat=" . urlencode( $cat ) . "&node=" . urlencode( $node ) . "&lang=" . urlencode( $lang ) . "'", '' ) );
ajax_event('onclick','translationsAjax','showSpace', }
"'function=delField". if (($cat != $aCat) || ($node != $aNode)) {
"&cat=".urlencode($cat). $template->newBlock( "TDnode" );
"&node=".urlencode($node). $template->assign( "nodeId", $res['TRN_ID'] );
"&lang=".urlencode($lang)."'",'')); }
} //$aCat=$cat;
if (($cat!=$aCat) || //$aNode=$node;
($node!=$aNode)) $template->goToBlock( "row" );
{ $template->assign( "catId", $res['TRN_CATEGORY'] );
$template->newBlock("TDnode"); $template->assign( "nodeId", $res['TRN_ID'] );
$template->assign("nodeId",$res['TRN_ID']); $template->assign( "langId", $lang );
} $template->assign( "langLabel", $langLabel );
//$aCat=$cat; $template->assign( "ajaxLabel", "onclick=\"if (!document.getElementById('aux'))" . ajax_init( 'translationsAjax.php', 'lang_' . $cat . '_' . $node . '_' . $lang, "'function=editLabel" . "&cat=" . urlencode( $cat ) . "&node=" . urlencode( $node ) . "&lang=" . urlencode( $lang ) . "'", 'focusInputLabel' ) . '"' );
//$aNode=$node; }
$template->goToBlock("row"); $template->printToScreen();
$template->assign("catId",$res['TRN_CATEGORY']); break;
$template->assign("nodeId",$res['TRN_ID']);
$template->assign("langId",$lang);
$template->assign("langLabel",$langLabel);
$template->assign("ajaxLabel","onclick=\"if (!document.getElementById('aux'))".
ajax_init('translationsAjax.php',
'lang_'.$cat.'_'.$node.'_'.$lang,
"'function=editLabel".
"&cat=".urlencode($cat).
"&node=".urlencode($node).
"&lang=".urlencode($lang)."'",'focusInputLabel')
.'"');
}
$template->printToScreen();
break;
} }
?> ?>
<?php <?php
function ajax_event($event="onclick",$page,$div,$param,$freturn="")
function ajax_event ($event = "onclick", $page, $div, $param, $freturn = "")
{ {
if ($freturn==='') $freturn="''"; if ($freturn === '')
return "$event=\"ajax_init('$page','$div',$param,$freturn)\""; $freturn = "''";
return "$event=\"ajax_init('$page','$div',$param,$freturn)\"";
} }
function ajax_init($page,$div,$param,$freturn="")
function ajax_init ($page, $div, $param, $freturn = "")
{ {
if ($freturn=='') $freturn="''"; if ($freturn == '')
return "ajax_init('$page','$div',$param,$freturn);"; $freturn = "''";
return "ajax_init('$page','$div',$param,$freturn);";
} }
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* translationsDelete.php * translationsDelete.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,32 +12,32 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
//to do: improve the way to pass two or more parameters in the paged-table ( link ) //to do: improve the way to pass two or more parameters in the paged-table ( link )
$aux = explode ( '|', $_GET['id'] );
$category = str_replace ( '"', '', $aux[0] );
$id = str_replace ( '"', '', $aux[1] );
require_once ( "classes/model/Translation.php" );
//if exists the row in the database propel will update it, otherwise will insert. $aux = explode( '|', $_GET['id'] );
$tr = TranslationPeer::retrieveByPK( $category, $id, 'en' ); $category = str_replace( '"', '', $aux[0] );
$id = str_replace( '"', '', $aux[1] );
if ( ( is_object ( $tr ) && get_class ($tr) == 'Translation' ) ) {
$tr->delete(); require_once ("classes/model/Translation.php");
} //if exists the row in the database propel will update it, otherwise will insert.
$tr = TranslationPeer::retrieveByPK( $category, $id, 'en' );
if ((is_object( $tr ) && get_class( $tr ) == 'Translation')) {
$tr->delete();
}
// else // else
G::Header('location: translations');
?> G::Header( 'location: translations' );

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* translationsEdit.php * translationsEdit.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,49 +12,47 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
//to do: improve the way to pass two or more parameters in the paged-table ( link ) //to do: improve the way to pass two or more parameters in the paged-table ( link )
$aux = explode ( '|', $_GET['id'] );
$category = str_replace ( '"', '', $aux[0] );
$id = str_replace ( '"', '', $aux[1] );
require_once ( "classes/model/Translation.php" );
//if exists the row in the database propel will update it, otherwise will insert.
$tr = TranslationPeer::retrieveByPK( $category, $id, 'en' );
if ( ( is_object ( $tr ) && get_class ($tr) == 'Translation' ) ) {
$fields['trn_category'] = $tr->getTrnCategory();
$fields['trn_id'] = $tr->getTrnId();
$fields['trn_value'] = $tr->getTrnValue();
}
else
$fields = array();
$G_MAIN_MENU = 'tools';
$G_SUB_MENU = 'toolsTranslations';
$G_ID_MENU_SELECTED = 'TOOLS';
$G_ID_SUB_MENU_SELECTED = 'ADD_TRANSLATION';
$G_PUBLISH = new Publisher; $aux = explode( '|', $_GET['id'] );
$dbc = new DBConnection; $category = str_replace( '"', '', $aux[0] );
$ses = new DBSession($dbc); $id = str_replace( '"', '', $aux[1] );
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'tools/translationAdd', '', $fields, 'translationsSave' ); require_once ("classes/model/Translation.php");
if( isset($_SESSION['TOOLS_VIEWTYPE']) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') { //if exists the row in the database propel will update it, otherwise will insert.
G::RenderPage('publishBlank', 'green-submenu'); $tr = TranslationPeer::retrieveByPK( $category, $id, 'en' );
} else {
G::RenderPage('publish'); if ((is_object( $tr ) && get_class( $tr ) == 'Translation')) {
} $fields['trn_category'] = $tr->getTrnCategory();
?> $fields['trn_id'] = $tr->getTrnId();
$fields['trn_value'] = $tr->getTrnValue();
} else
$fields = array ();
$G_MAIN_MENU = 'tools';
$G_SUB_MENU = 'toolsTranslations';
$G_ID_MENU_SELECTED = 'TOOLS';
$G_ID_SUB_MENU_SELECTED = 'ADD_TRANSLATION';
$G_PUBLISH = new Publisher();
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/translationAdd', '', $fields, 'translationsSave' );
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
G::RenderPage( 'publishBlank', 'green-submenu' );
} else {
G::RenderPage( 'publish' );
}

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* translationsSave.php * translationsSave.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,25 +12,24 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
$form = $_POST['form']; $form = $_POST['form'];
require_once ( "classes/model/Translation.php" ); require_once ("classes/model/Translation.php");
$form['trn_value'] = preg_replace("[\n|\r|\n\r]", ' ', $form['trn_value']); $form['trn_value'] = preg_replace( "[\n|\r|\n\r]", ' ', $form['trn_value'] );
//$t = new Translation; //$t = new Translation;
$res = Translation::addTranslation( $form['trn_category'], $form['trn_id'], 'en' , $form['trn_value'] ); $res = Translation::addTranslation( $form['trn_category'], $form['trn_id'], 'en', $form['trn_value'] );
if ( $res['codError'] < 0 ) { if ($res['codError'] < 0) {
G::SendMessageText ( $res['message'] , 'error' ); G::SendMessageText( $res['message'], 'error' );
} }
G::Header('location: translations'); G::Header( 'location: translations' );
?>

View File

@@ -12,32 +12,31 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
require_once ( "classes/model/Translation.php" ); require_once ("classes/model/Translation.php");
$t = new Translation; $t = new Translation();
$fields = Translation::generateFileTranslation('en'); $fields = Translation::generateFileTranslation( 'en' );
$G_MAIN_MENU = 'tools'; $G_MAIN_MENU = 'tools';
$G_SUB_MENU = 'toolsTranslations'; $G_SUB_MENU = 'toolsTranslations';
$G_ID_MENU_SELECTED = 'TRANSLATION'; $G_ID_MENU_SELECTED = 'TRANSLATION';
$G_ID_SUB_MENU_SELECTED = 'TRANSLATION_REBUILD'; $G_ID_SUB_MENU_SELECTED = 'TRANSLATION_REBUILD';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tools/updateTranslation', '', $fields );
if (isset( $_SESSION['TOOLS_VIEWTYPE'] ) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
G::RenderPage( 'publishBlank', 'green-submenu' );
} else {
G::RenderPage( 'publish' );
}
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'tools/updateTranslation', '', $fields);
if( isset($_SESSION['TOOLS_VIEWTYPE']) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
G::RenderPage('publishBlank', 'green-submenu');
} else {
G::RenderPage('publish');
}
?>

View File

@@ -12,63 +12,60 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
require_once (PATH_RBAC . "model/RolesPeer.php"); require_once (PATH_RBAC . "model/RolesPeer.php");
G::LoadClass('ArrayPeer'); G::LoadClass( 'ArrayPeer' );
isset($_POST['textFilter']) ? $filter = $_POST['textFilter'] : $filter = ''; isset( $_POST['textFilter'] ) ? $filter = $_POST['textFilter'] : $filter = '';
$sDelimiter = DBAdapter::getStringDelimiter(); $sDelimiter = DBAdapter::getStringDelimiter();
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addSelectColumn( UsersPeer::USR_UID );
$sDataBase = 'database_' . strtolower(DB_ADAPTER); $sDataBase = 'database_' . strtolower( DB_ADAPTER );
if(G::LoadSystemExist($sDataBase)){ if (G::LoadSystemExist( $sDataBase )) {
G::LoadSystem($sDataBase); G::LoadSystem( $sDataBase );
$oDataBase = new database(); $oDataBase = new database();
$oCriteria->addAsColumn('USR_COMPLETENAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME")); $oCriteria->addAsColumn( 'USR_COMPLETENAME', $oDataBase->concatString( "USR_LASTNAME", "' '", "USR_FIRSTNAME" ) );
//$oCriteria->addAsColumn('USR_PHOTO', $oDataBase->concatString("'".PATH_IMAGES_ENVIRONMENT_USERS."'", "USR_UID","'.gif'")); //$oCriteria->addAsColumn('USR_PHOTO', $oDataBase->concatString("'".PATH_IMAGES_ENVIRONMENT_USERS."'", "USR_UID","'.gif'"));
} }
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); $oCriteria->addSelectColumn( UsersPeer::USR_EMAIL );
$oCriteria->addSelectColumn(UsersPeer::USR_ROLE); $oCriteria->addSelectColumn( UsersPeer::USR_ROLE );
$oCriteria->addSelectColumn(UsersPeer::USR_DUE_DATE); $oCriteria->addSelectColumn( UsersPeer::USR_DUE_DATE );
//$oCriteria->addAsColumn('USR_VIEW', $sDelimiter . G::LoadTranslation('ID_DETAIL') . $sDelimiter); //$oCriteria->addAsColumn('USR_VIEW', $sDelimiter . G::LoadTranslation('ID_DETAIL') . $sDelimiter);
//$oCriteria->addAsColumn('USR_EDIT', $sDelimiter . G::LoadTranslation('ID_EDIT') . $sDelimiter); //$oCriteria->addAsColumn('USR_EDIT', $sDelimiter . G::LoadTranslation('ID_EDIT') . $sDelimiter);
//$oCriteria->addAsColumn('USR_DELETE', $sDelimiter . G::LoadTranslation('ID_DELETE') . $sDelimiter); //$oCriteria->addAsColumn('USR_DELETE', $sDelimiter . G::LoadTranslation('ID_DELETE') . $sDelimiter);
//$oCriteria->addAsColumn('USR_AUTH', $sDelimiter . G::LoadTranslation('ID_AUTHENTICATION') . $sDelimiter); //$oCriteria->addAsColumn('USR_AUTH', $sDelimiter . G::LoadTranslation('ID_AUTHENTICATION') . $sDelimiter);
//$oCriteria->addAsColumn('USR_REASSIGN', $sDelimiter . G::LoadTranslation('ID_REASSIGN_CASES') . $sDelimiter); //$oCriteria->addAsColumn('USR_REASSIGN', $sDelimiter . G::LoadTranslation('ID_REASSIGN_CASES') . $sDelimiter);
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN); $oCriteria->add( UsersPeer::USR_STATUS, array ('CLOSED'
), Criteria::NOT_IN );
if ($filter != ''){ if ($filter != '') {
$cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $cc = $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE ) ) );
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $oCriteria->add( $cc );
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)));
$oCriteria->add($cc);
//echo $oCriteria->toString(); //echo $oCriteria->toString();
} }
$rs = UsersPeer::DoSelectRs( $oCriteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rows = Array ();
$rs = UsersPeer::DoSelectRs ($oCriteria); while ($rs->next()) {
$rs->setFetchmode (ResultSet::FETCHMODE_ASSOC); $rows[] = $rs->getRow();
// if (!file_exists($aux['USR_PHOTO'])) $aux['USR_PHOTO'] = 'public_html/images/user.gif';
$rows = Array(); // $rows[] = $aux;
while($rs->next()){
$rows[] = $rs->getRow();
// if (!file_exists($aux['USR_PHOTO'])) $aux['USR_PHOTO'] = 'public_html/images/user.gif';
// $rows[] = $aux;
} }
echo '{users: '.G::json_encode($rows).'}'; echo '{users: ' . G::json_encode( $rows ) . '}';

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* index.php * index.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,17 +12,15 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
$newFile = str_replace ( 'index.php', 'users_List.php' , __FILE__ ) ; $newFile = str_replace( 'index.php', 'users_List.php', __FILE__ );
return $newFile; return $newFile;

View File

@@ -12,26 +12,25 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
$G_MAIN_MENU = 'processmaker'; $G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'MY_ACCOUNT'; $G_ID_MENU_SELECTED = 'MY_ACCOUNT';
$G_PUBLISH = new Publisher (); $G_PUBLISH = new Publisher();
if ( isset($_GET['type']) ){ if (isset( $_GET['type'] )) {
$G_PUBLISH->AddContent('view', 'users/usersReload'); $G_PUBLISH->AddContent( 'view', 'users/usersReload' );
G::RenderPage( "publishBlank", "blank"); G::RenderPage( "publishBlank", "blank" );
} } else {
else { $G_PUBLISH->AddContent( 'view', 'users/usersLoad' );
$G_PUBLISH->AddContent('view', 'users/usersLoad');
G::RenderPage( "publish" ); G::RenderPage( "publish" );
} }

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* myInfo_Ajax.php * myInfo_Ajax.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,21 +12,21 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1)
G::LoadClass("xmlMenu"); return $RBAC_Response;
$form = new Form ( 'myInfo/myInfoAEdit.xml' , PATH_XMLFORM ); G::LoadClass( "xmlMenu" );
$form->action = urlencode( G::encrypt( '' ,URL_KEY ) ); $form = new Form( 'myInfo/myInfoAEdit.xml', PATH_XMLFORM );
$form->ajaxServer = urlencode( G::encrypt( SYS_URI . '/gulliver/defaultAjax' ,URL_KEY ) ); $form->action = urlencode( G::encrypt( '', URL_KEY ) );
$form->ajaxServer = urlencode( G::encrypt( SYS_URI . '/gulliver/defaultAjax', URL_KEY ) );
$template = PATH_CORE . 'templates/xmlform.html'; $template = PATH_CORE . 'templates/xmlform.html';
print $G_FORM->render( $template , $scriptCode ); print $G_FORM->render( $template, $scriptCode );
?>

View File

@@ -12,157 +12,157 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
$RBAC->requirePermissions('PM_LOGIN'); $RBAC->requirePermissions( 'PM_LOGIN' );
// deprecated the class XmlForm_Field_Image is currently part of the class.xmlform.php package // deprecated the class XmlForm_Field_Image is currently part of the class.xmlform.php package
// the use of the external xmlfield_Image is highly discouraged // the use of the external xmlfield_Image is highly discouraged
if (!class_exists('XmlForm_Field_Image')){ if (! class_exists( 'XmlForm_Field_Image' )) {
G::LoadClass('xmlfield_Image'); G::LoadClass( 'xmlfield_Image' );
} }
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
require_once 'classes/model/Department.php'; require_once 'classes/model/Department.php';
unset($_SESSION['CURRENT_USER']); unset( $_SESSION['CURRENT_USER'] );
$oUser = new Users(); $oUser = new Users();
$aFields = $oUser->load($_SESSION['USER_LOGGED']); $aFields = $oUser->load( $_SESSION['USER_LOGGED'] );
$aFields['USR_PASSWORD'] = '********'; $aFields['USR_PASSWORD'] = '********';
$aFields['MESSAGE0'] = G::LoadTranslation('ID_USER_REGISTERED') . '!'; $aFields['MESSAGE0'] = G::LoadTranslation( 'ID_USER_REGISTERED' ) . '!';
$aFields['MESSAGE1'] = G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME'); $aFields['MESSAGE1'] = G::LoadTranslation( 'ID_MSG_ERROR_USR_USERNAME' );
$aFields['MESSAGE2'] = G::LoadTranslation('ID_MSG_ERROR_DUE_DATE'); $aFields['MESSAGE2'] = G::LoadTranslation( 'ID_MSG_ERROR_DUE_DATE' );
$aFields['MESSAGE3'] = G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS'); $aFields['MESSAGE3'] = G::LoadTranslation( 'ID_NEW_PASS_SAME_OLD_PASS' );
$aFields['MESSAGE4'] = G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME'); $aFields['MESSAGE4'] = G::LoadTranslation( 'ID_MSG_ERROR_USR_FIRSTNAME' );
$aFields['MESSAGE5'] = G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME'); $aFields['MESSAGE5'] = G::LoadTranslation( 'ID_MSG_ERROR_USR_LASTNAME' );
$aFields['NO_RESUME'] = G::LoadTranslation('ID_NO_RESUME'); $aFields['NO_RESUME'] = G::LoadTranslation( 'ID_NO_RESUME' );
$aFields['START_DATE'] = date('Y-m-d'); $aFields['START_DATE'] = date( 'Y-m-d' );
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); $aFields['END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) );
$aFields['RANDOM'] = rand(); $aFields['RANDOM'] = rand();
//getting the user and department
$oDepInfo = new Department();
$oUser = UsersPeer::retrieveByPk( $aFields['USR_REPORTS_TO'] );
if (is_object( $oUser ) && get_class( $oUser ) == 'Users') {
$userFields = $oUser->toArray( BasePeer::TYPE_FIELDNAME );
$aFields['USR_REPORTS_TO'] = $userFields['USR_FIRSTNAME'] . ' ' . $userFields['USR_LASTNAME'];
try {
$depFields = $oDepInfo->load( $userFields['DEP_UID'] . 'xy<' );
$aFields['USR_REPORTS_TO'] .= " (" . $depFields['DEPO_TITLE'] . ")";
} catch (Exception $e) {
}
} else {
$aFields['USR_REPORTS_TO'] = ' ';
}
//getting the user and department
$oDepInfo = new Department();
$oUser = UsersPeer::retrieveByPk( $aFields['USR_REPORTS_TO'] );
if (is_object($oUser) && get_class ($oUser) == 'Users' ) {
$userFields = $oUser->toArray(BasePeer::TYPE_FIELDNAME);
$aFields['USR_REPORTS_TO'] = $userFields['USR_FIRSTNAME'] . ' ' . $userFields['USR_LASTNAME'];
try { try {
$depFields = $oDepInfo->load($userFields['DEP_UID'] . 'xy<'); $depFields = $oDepInfo->load( $aFields['DEP_UID'] );
$aFields['USR_REPORTS_TO'] .= " (" . $depFields['DEPO_TITLE'] . ")"; $aFields['USR_DEPARTMENT'] = $depFields['DEPO_TITLE'];
} catch (Exception $e) {
$oUser = UsersPeer::retrieveByPk( $_SESSION['USER_LOGGED'] );
$oUser->setDepUid( '' );
$oUser->save();
$aFields['USR_DEPARTMENT'] = ' ';
} }
catch( Exception $e ) {
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'MY_ACCOUNT';
$G_PUBLISH = new Publisher();
//$RBAC->systemObj->loadByCode('PROCESSMAKER');//('PROCESSMAKER', $_SESSION['USER_LOGGED']);
#verifying if it has any preferences on the configurations table
G::loadClass( 'configuration' );
$oConf = new Configurations();
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
//echo $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
//G::pr($RBAC->userObj->load($_SESSION['USER_LOGGED']));
if (sizeof( $oConf->Fields ) > 0) { #this user has a configuration record
$aFields['PREF_DEFAULT_LANG'] = $oConf->aConfig['DEFAULT_LANG'];
$aFields['PREF_DEFAULT_MENUSELECTED'] = isset( $oConf->aConfig['DEFAULT_MENU'] ) ? $oConf->aConfig['DEFAULT_MENU'] : '';
$aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = isset( $oConf->aConfig['DEFAULT_CASES_MENU'] ) ? $oConf->aConfig['DEFAULT_CASES_MENU'] : '';
} else {
switch ($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']) {
case 'PROCESSMAKER_ADMIN':
$aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_USERS';
break;
case 'PROCESSMAKER_OPERATOR':
$aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_CASES';
break;
}
$aFields['PREF_DEFAULT_LANG'] = SYS_LANG;
} }
} //G::pr($RBAC->aUserInfo);
else{ $rows[] = Array ('id' => 'char','name' => 'char'
$aFields['USR_REPORTS_TO'] = ' '; );
}
try { foreach ($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission) {
$depFields = $oDepInfo->load($aFields['DEP_UID']);
$aFields['USR_DEPARTMENT'] = $depFields['DEPO_TITLE'];
}
catch( Exception $e ) {
$oUser = UsersPeer::retrieveByPk( $_SESSION['USER_LOGGED'] );
$oUser->setDepUid( '' );
$oUser->save();
$aFields['USR_DEPARTMENT'] = ' ';
}
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'MY_ACCOUNT';
$G_PUBLISH = new Publisher;
switch ($permission['PER_CODE']) {
//$RBAC->systemObj->loadByCode('PROCESSMAKER');//('PROCESSMAKER', $_SESSION['USER_LOGGED']); case 'PM_USERS':
case 'PM_SETUP':
#verifying if it has any preferences on the configurations table $rows[] = Array ('id' => 'PM_SETUP','name' => strtoupper( G::LoadTranslation( 'ID_SETUP' ) )
G::loadClass('configuration'); );
$oConf = new Configurations; break;
$oConf->loadConfig($x, 'USER_PREFERENCES','','',$_SESSION['USER_LOGGED'],''); case 'PM_CASES':
$rows[] = Array ('id' => 'PM_CASES','name' => strtoupper( G::LoadTranslation( 'ID_CASES' ) )
//echo $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']; );
//G::pr($RBAC->userObj->load($_SESSION['USER_LOGGED'])); break;
if( sizeof($oConf->Fields) > 0){ #this user has a configuration record case 'PM_FACTORY':
$aFields['PREF_DEFAULT_LANG'] = $oConf->aConfig['DEFAULT_LANG']; $rows[] = Array ('id' => 'PM_FACTORY','name' => strtoupper( G::LoadTranslation( 'ID_APPLICATIONS' ) )
$aFields['PREF_DEFAULT_MENUSELECTED'] = isset($oConf->aConfig['DEFAULT_MENU']) ? $oConf->aConfig['DEFAULT_MENU']: ''; );
$aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = isset($oConf->aConfig['DEFAULT_CASES_MENU']) ? $oConf->aConfig['DEFAULT_CASES_MENU']: ''; break;
} else { }
switch($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']){
case 'PROCESSMAKER_ADMIN':
$aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_USERS';
break;
case 'PROCESSMAKER_OPERATOR':
$aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_CASES';
break;
} }
$aFields['PREF_DEFAULT_LANG'] = SYS_LANG;
}
//G::pr($RBAC->aUserInfo);
$rows[] = Array('id'=>'char', 'name'=>'char');
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load( 'cases' );
foreach($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission){ $rowsCasesMenu[] = Array ('id' => 'char','name' => 'char'
);
switch($permission['PER_CODE']){
case 'PM_USERS': foreach ($oMenu->Id as $i => $item) {
case 'PM_SETUP': if ($oMenu->Types[$i] != 'blockHeader') {
$rows[] = Array('id'=>'PM_SETUP', 'name'=>strtoupper(G::LoadTranslation('ID_SETUP'))); $rowsCasesMenu[] = Array ('id' => $item,'name' => $oMenu->Labels[$i]
break; );
case 'PM_CASES': }
$rows[] = Array('id'=>'PM_CASES', 'name'=>strtoupper(G::LoadTranslation('ID_CASES')));
break;
case 'PM_FACTORY':
$rows[] = Array('id'=>'PM_FACTORY', 'name'=>strtoupper(G::LoadTranslation('ID_APPLICATIONS')));
break;
} }
}
//G::pr($rows); die;
global $G_TMP_MENU; global $_DBArray;
$oMenu = new Menu(); $_DBArray['menutab'] = $rows;
$oMenu->load('cases'); $_SESSION['_DBArray'] = $_DBArray;
$_DBArray['CASES_MENU'] = $rowsCasesMenu;
$rowsCasesMenu[] = Array('id'=>'char', 'name'=>'char'); $_SESSION['_DBArray'] = $_DBArray;
foreach($oMenu->Id as $i=>$item){ G::LoadClass( 'ArrayPeer' );
if( $oMenu->Types[$i] != 'blockHeader' ){ $oCriteria = new Criteria( 'dbarray' );
$rowsCasesMenu[] = Array('id'=>$item, 'name'=>$oMenu->Labels[$i]); $oCriteria->setDBArrayTable( 'menutab' );
$oCriteria2 = new Criteria( 'dbarray' );
$oCriteria2->setDBArrayTable( 'CASES_MENU' );
if ($RBAC->userCanAccess( 'PM_EDITPERSONALINFO' ) == 1) { //he has permitions for edit his profile
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/myInfo.xml', '', $aFields, 'myInfo_Save' );
} else { //he has not permitions for edit his profile, so just view mode will be displayed
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/myInfo2.xml', '', $aFields, '' );
} }
}
G::RenderPage( 'publish' );
//G::pr($rows); die; } catch (Exception $oException) {
global $_DBArray; die( $oException->getMessage() );
$_DBArray['menutab'] = $rows;
$_SESSION['_DBArray'] = $_DBArray;
$_DBArray['CASES_MENU'] = $rowsCasesMenu;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('menutab');
$oCriteria2 = new Criteria('dbarray');
$oCriteria2->setDBArrayTable('CASES_MENU');
if ($RBAC->userCanAccess('PM_EDITPERSONALINFO') == 1) { //he has permitions for edit his profile
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/myInfo.xml', '', $aFields, 'myInfo_Save');
} else { //he has not permitions for edit his profile, so just view mode will be displayed
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/myInfo2.xml', '', $aFields, '');
}
G::RenderPage('publish');
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,162 +12,158 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try {ini_set('display_errors','1'); try {
global $RBAC; ini_set( 'display_errors', '1' );
switch ($RBAC->userCanAccess('PM_LOGIN')) global $RBAC;
{ switch ($RBAC->userCanAccess( 'PM_LOGIN' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
}
if (isset($_FILES['form']['name']['USR_RESUME'])) {
$_POST['form']['USR_RESUME'] = $_FILES['form']['name']['USR_RESUME'];
}
if ($_POST['form']['USR_EMAIL'] != '') {
// The ereg function has been DEPRECATED as of PHP 5.3.0.
// if (!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", $_POST['form']['USR_EMAIL'])) {
if ( !preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/", $_POST['form']['USR_EMAIL'])) {
G::SendTemporalMessage ('ID_INCORRECT_EMAIL', 'error');
} }
} if (isset( $_FILES['form']['name']['USR_RESUME'] )) {
if (!isset($_POST['form']['USR_NEW_PASS'])) { $_POST['form']['USR_RESUME'] = $_FILES['form']['name']['USR_RESUME'];
$_POST['form']['USR_NEW_PASS'] = ''; }
} if ($_POST['form']['USR_EMAIL'] != '') {
if ($_POST['form']['USR_NEW_PASS'] != '') { // The ereg function has been DEPRECATED as of PHP 5.3.0.
$_POST['form']['USR_PASSWORD'] = md5($_POST['form']['USR_NEW_PASS']); // if (!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", $_POST['form']['USR_EMAIL'])) {
} if (! preg_match( "/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/", $_POST['form']['USR_EMAIL'] )) {
if (!isset($_POST['form']['USR_CITY'])) { G::SendTemporalMessage( 'ID_INCORRECT_EMAIL', 'error' );
$_POST['form']['USR_CITY'] = '';
}
if (!isset($_POST['form']['USR_LOCATION'])) {
$_POST['form']['USR_LOCATION'] = '';
}
if (!isset($_POST['form']['USR_ROLE'])) {
$_POST['form']['USR_ROLE'] = '';
}
$aData['USR_UID'] = $_POST['form']['USR_UID'];
$aData['USR_USERNAME'] = $_POST['form']['USR_USERNAME'];
if (isset($_POST['form']['USR_PASSWORD'])) {
if ($_POST['form']['USR_PASSWORD'] != '') {
$aData['USR_PASSWORD'] = $_POST['form']['USR_PASSWORD'];
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($_POST['form']['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($_POST['form']['USR_NEW_PASS'])))));
$aErrors = $oUserProperty->validatePassword($_POST['form']['USR_NEW_PASS'], $aUserProperty['USR_LAST_UPDATE_DATE'], $aUserProperty['USR_LOGGED_NEXT_TIME']);
if (count($aErrors) > 0) {
$sDescription = G::LoadTranslation('ID_POLICY_ALERT').':<br /><br />';
foreach ($aErrors as $sError) {
switch ($sError) {
case 'ID_PPP_MINIMUN_LENGTH':
$sDescription .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MINIMUN_LENGTH . '<br />';
break;
case 'ID_PPP_MAXIMUN_LENGTH':
$sDescription .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MAXIMUN_LENGTH . '<br />';
break;
case 'ID_PPP_EXPIRATION_IN':
$sDescription .= ' - ' . G::LoadTranslation($sError).' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation('ID_DAYS') . '<br />';
break;
default:
$sDescription .= ' - ' . G::LoadTranslation($sError).'<br />';
break;
}
} }
$sDescription .= '<br />' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY'); }
G::SendMessageText($sDescription, 'warning'); if (! isset( $_POST['form']['USR_NEW_PASS'] )) {
G::header('Location: ' . $_SERVER['HTTP_REFERER']); $_POST['form']['USR_NEW_PASS'] = '';
die; }
} if ($_POST['form']['USR_NEW_PASS'] != '') {
$aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']); $_POST['form']['USR_PASSWORD'] = md5( $_POST['form']['USR_NEW_PASS'] );
if (!is_array($aHistory)) { }
$aHistory = array(); if (! isset( $_POST['form']['USR_CITY'] )) {
} $_POST['form']['USR_CITY'] = '';
if (!defined('PPP_PASSWORD_HISTORY')) { }
define('PPP_PASSWORD_HISTORY', 0); if (! isset( $_POST['form']['USR_LOCATION'] )) {
} $_POST['form']['USR_LOCATION'] = '';
if (PPP_PASSWORD_HISTORY > 0) { }
if (count($aHistory) >= PPP_PASSWORD_HISTORY) { if (! isset( $_POST['form']['USR_ROLE'] )) {
array_shift($aHistory); $_POST['form']['USR_ROLE'] = '';
}
$aData['USR_UID'] = $_POST['form']['USR_UID'];
$aData['USR_USERNAME'] = $_POST['form']['USR_USERNAME'];
if (isset( $_POST['form']['USR_PASSWORD'] )) {
if ($_POST['form']['USR_PASSWORD'] != '') {
$aData['USR_PASSWORD'] = $_POST['form']['USR_PASSWORD'];
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists( $_POST['form']['USR_UID'], array ('USR_PASSWORD_HISTORY' => serialize( array (md5( $_POST['form']['USR_NEW_PASS'] )
) )
) );
$aErrors = $oUserProperty->validatePassword( $_POST['form']['USR_NEW_PASS'], $aUserProperty['USR_LAST_UPDATE_DATE'], $aUserProperty['USR_LOGGED_NEXT_TIME'] );
if (count( $aErrors ) > 0) {
$sDescription = G::LoadTranslation( 'ID_POLICY_ALERT' ) . ':<br /><br />';
foreach ($aErrors as $sError) {
switch ($sError) {
case 'ID_PPP_MINIMUN_LENGTH':
$sDescription .= ' - ' . G::LoadTranslation( $sError ) . ': ' . PPP_MINIMUN_LENGTH . '<br />';
break;
case 'ID_PPP_MAXIMUN_LENGTH':
$sDescription .= ' - ' . G::LoadTranslation( $sError ) . ': ' . PPP_MAXIMUN_LENGTH . '<br />';
break;
case 'ID_PPP_EXPIRATION_IN':
$sDescription .= ' - ' . G::LoadTranslation( $sError ) . ' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation( 'ID_DAYS' ) . '<br />';
break;
default:
$sDescription .= ' - ' . G::LoadTranslation( $sError ) . '<br />';
break;
}
}
$sDescription .= '<br />' . G::LoadTranslation( 'ID_PLEASE_CHANGE_PASSWORD_POLICY' );
G::SendMessageText( $sDescription, 'warning' );
G::header( 'Location: ' . $_SERVER['HTTP_REFERER'] );
die();
}
$aHistory = unserialize( $aUserProperty['USR_PASSWORD_HISTORY'] );
if (! is_array( $aHistory )) {
$aHistory = array ();
}
if (! defined( 'PPP_PASSWORD_HISTORY' )) {
define( 'PPP_PASSWORD_HISTORY', 0 );
}
if (PPP_PASSWORD_HISTORY > 0) {
if (count( $aHistory ) >= PPP_PASSWORD_HISTORY) {
array_shift( $aHistory );
}
$aHistory[] = $_POST['form']['USR_NEW_PASS'];
}
$aUserProperty['USR_LAST_UPDATE_DATE'] = date( 'Y-m-d H:i:s' );
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 1;
$aUserProperty['USR_PASSWORD_HISTORY'] = serialize( $aHistory );
$oUserProperty->update( $aUserProperty );
} }
$aHistory[] = $_POST['form']['USR_NEW_PASS']; }
} $aData['USR_FIRSTNAME'] = $_POST['form']['USR_FIRSTNAME'];
$aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aData['USR_LASTNAME'] = $_POST['form']['USR_LASTNAME'];
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 1; $aData['USR_EMAIL'] = $_POST['form']['USR_EMAIL'];
$aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory); $aData['USR_DUE_DATE'] = $_POST['form']['USR_DUE_DATE'];
$oUserProperty->update($aUserProperty); $aData['USR_UPDATE_DATE'] = date( 'Y-m-d H:i:s' );
} $RBAC->updateUser( $aData );
} $aData['USR_PASSWORD'] = md5( $_POST['form']['USR_USERNAME'] ); //fake :p
$aData['USR_FIRSTNAME'] = $_POST['form']['USR_FIRSTNAME']; $aData['USR_COUNTRY'] = $_POST['form']['USR_COUNTRY'];
$aData['USR_LASTNAME'] = $_POST['form']['USR_LASTNAME']; $aData['USR_CITY'] = $_POST['form']['USR_CITY'];
$aData['USR_EMAIL'] = $_POST['form']['USR_EMAIL']; $aData['USR_LOCATION'] = $_POST['form']['USR_LOCATION'];
$aData['USR_DUE_DATE'] = $_POST['form']['USR_DUE_DATE']; $aData['USR_ADDRESS'] = $_POST['form']['USR_ADDRESS'];
$aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aData['USR_PHONE'] = $_POST['form']['USR_PHONE'];
$RBAC->updateUser($aData); $aData['USR_ZIP_CODE'] = $_POST['form']['USR_ZIP_CODE'];
$aData['USR_PASSWORD'] = md5($_POST['form']['USR_USERNAME']);//fake :p $aData['USR_POSITION'] = $_POST['form']['USR_POSITION'];
$aData['USR_COUNTRY'] = $_POST['form']['USR_COUNTRY']; if ($_POST['form']['USR_RESUME'] != '') {
$aData['USR_CITY'] = $_POST['form']['USR_CITY']; $aData['USR_RESUME'] = $_POST['form']['USR_RESUME'];
$aData['USR_LOCATION'] = $_POST['form']['USR_LOCATION']; }
$aData['USR_ADDRESS'] = $_POST['form']['USR_ADDRESS']; require_once 'classes/model/Users.php';
$aData['USR_PHONE'] = $_POST['form']['USR_PHONE']; $oUser = new Users();
$aData['USR_ZIP_CODE'] = $_POST['form']['USR_ZIP_CODE']; $oUser->update( $aData );
$aData['USR_POSITION'] = $_POST['form']['USR_POSITION']; if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') {
if ($_POST['form']['USR_RESUME'] != '') { $aAux = explode( '.', $_FILES['form']['name']['USR_PHOTO'] );
$aData['USR_RESUME'] = $_POST['form']['USR_RESUME']; G::uploadFile( $_FILES['form']['tmp_name']['USR_PHOTO'], PATH_IMAGES_ENVIRONMENT_USERS, $aData['USR_UID'] . '.' . $aAux[1] );
} G::resizeImage( PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.' . $aAux[1], 96, 96, PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.gif' );
require_once 'classes/model/Users.php'; }
$oUser = new Users(); if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') {
$oUser->update($aData); G::uploadFile( $_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $aData['USR_UID'] . '/', $_FILES['form']['name']['USR_RESUME'] );
if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') { }
$aAux = explode('.', $_FILES['form']['name']['USR_PHOTO']);
G::uploadFile($_FILES['form']['tmp_name']['USR_PHOTO'], PATH_IMAGES_ENVIRONMENT_USERS, $aData['USR_UID'] . '.' . $aAux[1]); /* Saving preferences */
G::resizeImage(PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.' . $aAux[1], 96, 96, PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.gif'); $def_lang = $_POST['form']['PREF_DEFAULT_LANG'];
} $def_menu = $_POST['form']['PREF_DEFAULT_MENUSELECTED'];
if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') { $def_cases_menu = $_POST['form']['PREF_DEFAULT_CASES_MENUSELECTED'];
G::uploadFile($_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $aData['USR_UID'] . '/', $_FILES['form']['name']['USR_RESUME']);
} G::loadClass( 'configuration' );
/* Saving preferences */ $oConf = new Configurations();
$def_lang = $_POST['form']['PREF_DEFAULT_LANG']; $aConf = Array ('DEFAULT_LANG' => $def_lang,'DEFAULT_MENU' => $def_menu,'DEFAULT_CASES_MENU' => $def_cases_menu
$def_menu = $_POST['form']['PREF_DEFAULT_MENUSELECTED']; );
$def_cases_menu = $_POST['form']['PREF_DEFAULT_CASES_MENUSELECTED'];
/*UPDATING SESSION VARIABLES*/
G::loadClass('configuration'); $aUser = $RBAC->userObj->load( $_SESSION['USER_LOGGED'] );
$_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
$oConf = new Configurations;
$aConf = Array( $oConf->aConfig = $aConf;
'DEFAULT_LANG'=>$def_lang, $oConf->saveConfig( 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'] );
'DEFAULT_MENU'=>$def_menu,
'DEFAULT_CASES_MENU'=>$def_cases_menu G::SendTemporalMessage( 'ID_CHANGES_SAVED', 'info', 'labels' );
); G::header( 'location: myInfo' );
} catch (Exception $oException) {
/*UPDATING SESSION VARIABLES*/ die( $oException->getMessage() );
$aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
$_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
$oConf->aConfig = $aConf;
$oConf->saveConfig('USER_PREFERENCES', '', '',$_SESSION['USER_LOGGED']);
G::SendTemporalMessage('ID_CHANGES_SAVED', 'info', 'labels');
G::header('location: myInfo');
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +1 @@
<?php <?php
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('users/users', true ); //adding a javascript file .js
$oHeadPublisher->assign('USR_UID', $_GET['USR_UID']);
$oHeadPublisher->assign('MODE', $_GET['MODE']);
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ');
G::RenderPage('publish', 'extJs');

View File

@@ -13,38 +13,37 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response = $RBAC->userCanAccess("PM_LOGIN")) != 1) { if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1) {
return $RBAC_Response; return $RBAC_Response;
} }
global $RBAC; global $RBAC;
$access = $RBAC->userCanAccess('PM_USERS'); $access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) { if ($access != 1) {
switch ($access) { switch ($access) {
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
default: default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
} }
@@ -53,21 +52,21 @@ $G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS'; $G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'USERS'; $G_ID_SUB_MENU_SELECTED = 'USERS';
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
G::LoadClass('configuration'); G::LoadClass( 'configuration' );
$c = new Configurations(); $c = new Configurations();
$configEnv = $c->getConfiguration('ENVIRONMENT_SETTINGS', ''); $configEnv = $c->getConfiguration( 'ENVIRONMENT_SETTINGS', '' );
$Config['fullNameFormat'] = isset($configEnv['format']) ? $configEnv['format'] : '@firstName @lastName (@userName)'; $Config['fullNameFormat'] = isset( $configEnv['format'] ) ? $configEnv['format'] : '@firstName @lastName (@userName)';
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oCriteria = new Criteria(); $oCriteria = new Criteria();
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); $oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->add(UsersPeer::USR_UID, $_GET['uUID']); $oCriteria->add( UsersPeer::USR_UID, $_GET['uUID'] );
$oDataset = UsersPeer::doSelectRS($oCriteria); $oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
@@ -83,7 +82,7 @@ switch ($_REQUEST['type']) {
break; break;
} }
$users = Array(); $users = Array ();
$users['USR_UID'] = $_GET['uUID']; $users['USR_UID'] = $_GET['uUID'];
$users['USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME']; $users['USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
$users['USR_LASTNAME'] = $aRow['USR_LASTNAME']; $users['USR_LASTNAME'] = $aRow['USR_LASTNAME'];
@@ -92,11 +91,11 @@ $users['fullNameFormat'] = $Config['fullNameFormat'];
$users['CURRENT_TAB'] = $ctab; $users['CURRENT_TAB'] = $ctab;
$oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('users/usersGroups', false); //adding a javascript file .js $oHeadPublisher->addExtJsScript( 'users/usersGroups', false ); //adding a javascript file .js
// $oHeadPublisher->addContent('users/usersGroups'); //adding a html file .html. // $oHeadPublisher->addContent('users/usersGroups'); //adding a html file .html.
$oHeadPublisher->assign('USERS', $users); $oHeadPublisher->assign( 'USERS', $users );
$oHeadPublisher->assign('hasAuthPerm', ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1)); $oHeadPublisher->assign( 'hasAuthPerm', ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) == 1) );
G::RenderPage( 'publish', 'extJs' );
G::RenderPage('publish', 'extJs');

View File

@@ -1,36 +1,38 @@
<?php <?php
global $RBAC; global $RBAC;
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
unset($_SESSION['CURRENT_USER']); unset( $_SESSION['CURRENT_USER'] );
$oUser = new Users(); $oUser = new Users();
$aFields = $oUser->load($_SESSION['USER_LOGGED']); $aFields = $oUser->load( $_SESSION['USER_LOGGED'] );
if ($RBAC->userCanAccess('PM_EDITPERSONALINFO') == 1) { //he has permitions for edit his profile if ($RBAC->userCanAccess( 'PM_EDITPERSONALINFO' ) == 1) { //he has permitions for edit his profile
$canEdit = false; $canEdit = false;
} else { //he has not permitions for edit his profile, so just view mode will be displayed } else { //he has not permitions for edit his profile, so just view mode will be displayed
$canEdit = true; $canEdit = true;
} }
//calculating the max upload file size; //calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size'); $POST_MAX_SIZE = ini_get( 'post_max_size' );
$mul = substr($POST_MAX_SIZE, -1); $mul = substr( $POST_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul; $postMaxSize = (int) $POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize'); $UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr($UPLOAD_MAX_SIZE, -1); $mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul; $uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize; if ($postMaxSize < $uploadMaxSize)
$uploadMaxSize = $postMaxSize;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('users/users', true ); //adding a javascript file .js $oHeadPublisher = & headPublisher::getSingleton();
// $oHeadPublisher->addContent('users/users'); //adding a html file .html. $oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js
$oHeadPublisher->assign('USR_UID', $aFields['USR_UID']); // $oHeadPublisher->addContent('users/users'); //adding a html file .html.
$oHeadPublisher->assign('infoMode', true); $oHeadPublisher->assign( 'USR_UID', $aFields['USR_UID'] );
$oHeadPublisher->assign('canEdit', $canEdit); $oHeadPublisher->assign( 'infoMode', true );
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') '); $oHeadPublisher->assign( 'canEdit', $canEdit );
$oHeadPublisher->assign('MODE', ''); $oHeadPublisher->assign( 'MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ' );
G::RenderPage('publish', 'extJs'); $oHeadPublisher->assign( 'MODE', '' );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,21 +1,23 @@
<?php <?php
//calculating the max upload file size; //calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size'); $POST_MAX_SIZE = ini_get( 'post_max_size' );
$mul = substr($POST_MAX_SIZE, -1); $mul = substr( $POST_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul; $postMaxSize = (int) $POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ($postMaxSize < $uploadMaxSize)
$uploadMaxSize = $postMaxSize;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js
$oHeadPublisher->assign( 'USR_UID', '' );
$oHeadPublisher->assign( 'MODE', $_GET['MODE'] );
$oHeadPublisher->assign( 'MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ' );
G::RenderPage( 'publish', 'extJs' );
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('users/users', true ); //adding a javascript file .js
$oHeadPublisher->assign('USR_UID', '');
$oHeadPublisher->assign('MODE', $_GET['MODE']);
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ');
G::RenderPage('publish', 'extJs');

View File

@@ -12,511 +12,496 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_LOGIN')) switch ($RBAC->userCanAccess( 'PM_LOGIN' )) {
{ case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} G::LoadInclude( 'ajax' );
G::LoadInclude('ajax'); if (isset( $_POST['form'] )) {
if (isset($_POST['form'])) $_POST = $_POST['form'];
{ }
$_POST = $_POST['form']; if (isset( $_REQUEST['function'] )) {
} //$value= $_POST['function'];
if(isset($_REQUEST['function'])){ $value = get_ajax_value( 'function' );
//$value= $_POST['function']; } else {
$value = get_ajax_value('function'); //$value= $_POST['functions'];
}else{ $value = get_ajax_value( 'functions' );
//$value= $_POST['functions']; }
$value = get_ajax_value('functions'); switch ($value) {
} case 'verifyUsername':
switch ($value){ //print_r($_POST); die;
case 'verifyUsername': $_POST['sOriginalUsername'] = get_ajax_value( 'sOriginalUsername' );
//print_r($_POST); die; $_POST['sUsername'] = get_ajax_value( 'sUsername' );
$_POST['sOriginalUsername'] = get_ajax_value('sOriginalUsername'); if ($_POST['sOriginalUsername'] == $_POST['sUsername']) {
$_POST['sUsername'] = get_ajax_value('sUsername'); echo '0';
if ($_POST['sOriginalUsername'] == $_POST['sUsername']) } else {
{ require_once 'classes/model/Users.php';
echo '0'; G::LoadClass( 'Users' );
} $oUser = new Users();
else $oCriteria = $oUser->loadByUsername( $_POST['sUsername'] );
{ $oDataset = UsersPeer::doSelectRS( $oCriteria );
require_once 'classes/model/Users.php'; $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
G::LoadClass('Users'); $oDataset->next();
$oUser = new Users(); $aRow = $oDataset->getRow();
$oCriteria=$oUser->loadByUsername($_POST['sUsername']); //print_r($aRow); die;
$oDataset = UsersPeer::doSelectRS($oCriteria); //if (!$aRow)
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); if (! is_array( $aRow )) {
$oDataset->next(); echo '0';
$aRow = $oDataset->getRow(); } else {
//print_r($aRow); die; echo '1';
//if (!$aRow) }
if (!is_array($aRow))
{
echo '0';
} }
else break;
{ case 'availableUsers':
echo '1'; G::LoadClass( 'processMap' );
$oProcessMap = new ProcessMap();
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'users/users_AvailableUsers', $oProcessMap->getAvailableUsersCriteria( $_GET['sTask'], $_GET['iType'] ) );
G::RenderPage( 'publish', 'raw' );
break;
case 'assign':
G::LoadClass( 'tasks' );
$oTasks = new Tasks();
switch ((int) $_POST['TU_RELATION']) {
case 1:
echo $oTasks->assignUser( $_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE'] );
break;
case 2:
echo $oTasks->assignGroup( $_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE'] );
break;
} }
} break;
break; case 'ofToAssign':
case 'availableUsers': G::LoadClass( 'tasks' );
G::LoadClass('processMap'); $oTasks = new Tasks();
$oProcessMap = new ProcessMap(); switch ((int) $_POST['TU_RELATION']) {
global $G_PUBLISH; case 1:
$G_PUBLISH = new Publisher(); echo $oTasks->ofToAssignUser( $_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE'] );
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'users/users_AvailableUsers', $oProcessMap->getAvailableUsersCriteria($_GET['sTask'], $_GET['iType'])); break;
G::RenderPage('publish', 'raw'); case 2:
break; echo $oTasks->ofToAssignGroup( $_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE'] );
case 'assign': break;
G::LoadClass('tasks'); }
$oTasks = new Tasks(); break;
switch ((int)$_POST['TU_RELATION']) { case 'changeView':
case 1: $_SESSION['iType'] = $_POST['TU_TYPE'];
echo $oTasks->assignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']); break;
break; case 'deleteGroup':
case 2: G::LoadClass( 'groups' );
echo $oTasks->assignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']); $oGroup = new Groups();
break; $oGroup->removeUserOfGroup( $_POST['GRP_UID'], $_POST['USR_UID'] );
} $_GET['sUserUID'] = $_POST['USR_UID'];
break; $G_PUBLISH = new Publisher();
case 'ofToAssign': $G_PUBLISH->AddContent( 'view', 'users/users_Tree' );
G::LoadClass('tasks'); G::RenderPage( 'publish', 'raw' );
$oTasks = new Tasks(); break;
switch ((int)$_POST['TU_RELATION']) { case 'showUserGroupInterface':
case 1: $_GET['sUserUID'] = $_POST['sUserUID'];
echo $oTasks->ofToAssignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']); $G_PUBLISH = new Publisher();
break; $G_PUBLISH->AddContent( 'view', 'users/users_AssignGroup' );
case 2: G::RenderPage( 'publish', 'raw' );
echo $oTasks->ofToAssignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']); break;
break; case 'showUserGroups':
} $_GET['sUserUID'] = $_POST['sUserUID'];
break; $G_PUBLISH = new Publisher();
case 'changeView': $G_PUBLISH->AddContent( 'view', 'users/users_Tree' );
$_SESSION['iType'] = $_POST['TU_TYPE']; G::RenderPage( 'publish', 'raw' );
break; break;
case 'deleteGroup': case 'assignUserToGroup':
G::LoadClass('groups'); G::LoadClass( 'groups' );
$oGroup = new Groups(); $oGroup = new Groups();
$oGroup->removeUserOfGroup($_POST['GRP_UID'], $_POST['USR_UID']); $oGroup->addUserToGroup( $_POST['GRP_UID'], $_POST['USR_UID'] );
$_GET['sUserUID'] = $_POST['USR_UID']; echo '<div align="center"><h2><font color="blue">' . G::LoadTranslation( 'ID_MSG_ASSIGN_DONE' ) . '</font></h2></div>';
$G_PUBLISH = new Publisher; break;
$G_PUBLISH->AddContent('view', 'users/users_Tree' ); case 'usersGroup':
G::RenderPage('publish', 'raw'); G::LoadClass( 'groups' );
break; $oGroup = new Groups();
case 'showUserGroupInterface': $aGroup = $oGroup->getUsersOfGroup( $_POST['GRP_UID'] );
$_GET['sUserUID'] = $_POST['sUserUID']; foreach ($aGroup as $iIndex => $aValues) {
$G_PUBLISH = new Publisher; echo $aValues['USR_FIRSTNAME'] . ' ' . $aValues['USR_LASTNAME'] . '<br>';
$G_PUBLISH->AddContent('view', 'users/users_AssignGroup' ); }
G::RenderPage('publish', 'raw'); break;
break;
case 'showUserGroups':
$_GET['sUserUID'] = $_POST['sUserUID'];
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('view', 'users/users_Tree' );
G::RenderPage('publish', 'raw');
break;
case 'assignUserToGroup':
G::LoadClass('groups');
$oGroup = new Groups();
$oGroup->addUserToGroup($_POST['GRP_UID'], $_POST['USR_UID']);
echo '<div align="center"><h2><font color="blue">'.G::LoadTranslation('ID_MSG_ASSIGN_DONE').'</font></h2></div>';
break;
case 'usersGroup':
G::LoadClass('groups');
$oGroup = new Groups();
$aGroup = $oGroup->getUsersOfGroup($_POST['GRP_UID']);
foreach ($aGroup as $iIndex => $aValues) {
echo $aValues['USR_FIRSTNAME'] . ' ' . $aValues['USR_LASTNAME'] . '<br>';
}
break;
//This case is used to check if any of the user group has as role 'PROCESSMAKER_ADMIN', //This case is used to check if any of the user group has as role 'PROCESSMAKER_ADMIN',
case 'usersAdminGroupExtJS': case 'usersAdminGroupExtJS':
G::LoadClass('groups'); G::LoadClass( 'groups' );
$oGroup = new Groups(); $oGroup = new Groups();
$aGroup = $oGroup->getUsersOfGroup($_POST['GRP_UID']); $aGroup = $oGroup->getUsersOfGroup( $_POST['GRP_UID'] );
$responseUser = 'false'; $responseUser = 'false';
$usersAdmin = ''; $usersAdmin = '';
foreach ($aGroup as $iIndex => $aValues) { foreach ($aGroup as $iIndex => $aValues) {
if ($aValues['USR_ROLE'] == 'PROCESSMAKER_ADMIN') { if ($aValues['USR_ROLE'] == 'PROCESSMAKER_ADMIN') {
$responseUser = 'true'; $responseUser = 'true';
$usersAdmin .= $aValues['USR_FIRSTNAME'] . ' ' . $aValues['USR_LASTNAME'].', '; $usersAdmin .= $aValues['USR_FIRSTNAME'] . ' ' . $aValues['USR_LASTNAME'] . ', ';
} }
} }
$usersAdmin = substr($usersAdmin, 0, -2); $usersAdmin = substr( $usersAdmin, 0, - 2 );
$result = new stdClass(); $result = new stdClass();
$result->reponse = $responseUser; $result->reponse = $responseUser;
$result->users = $usersAdmin; $result->users = $usersAdmin;
echo G::json_encode($result); echo G::json_encode( $result );
break; break;
case 'canDeleteUser': case 'canDeleteUser':
G::LoadClass('case'); G::LoadClass( 'case' );
$oProcessMap = new Cases(); $oProcessMap = new Cases();
$USR_UID = $_POST['uUID']; $USR_UID = $_POST['uUID'];
$total = 0; $total = 0;
$history = 0; $history = 0;
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases( 'TO_DO', $USR_UID );
$total += ApplicationPeer::doCount($c); $total += ApplicationPeer::doCount( $c );
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases( 'DRAFT', $USR_UID );
$total += ApplicationPeer::doCount($c); $total += ApplicationPeer::doCount( $c );
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases( 'COMPLETED', $USR_UID );
$history += ApplicationPeer::doCount($c); $history += ApplicationPeer::doCount( $c );
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases( 'CANCELLED', $USR_UID );
$history += ApplicationPeer::doCount($c); $history += ApplicationPeer::doCount( $c );
$response = '{success: true, candelete: '; $response = '{success: true, candelete: ';
$response .= ($total > 0) ? 'false' : 'true'; $response .= ($total > 0) ? 'false' : 'true';
$response .= ', hashistory: '; $response .= ', hashistory: ';
$response .= ($history > 0) ? 'true' : 'false'; $response .= ($history > 0) ? 'true' : 'false';
$response .= '}'; $response .= '}';
echo $response; echo $response;
break; break;
case 'deleteUser': case 'deleteUser':
$UID = $_POST['USR_UID']; $UID = $_POST['USR_UID'];
G::LoadClass('tasks'); G::LoadClass( 'tasks' );
$oTasks = new Tasks(); $oTasks = new Tasks();
$oTasks->ofToAssignUserOfAllTasks($UID); $oTasks->ofToAssignUserOfAllTasks( $UID );
G::LoadClass('groups'); G::LoadClass( 'groups' );
$oGroups = new Groups(); $oGroups = new Groups();
$oGroups->removeUserOfAllGroups($UID); $oGroups->removeUserOfAllGroups( $UID );
$RBAC->changeUserStatus($UID, 'CLOSED'); $RBAC->changeUserStatus( $UID, 'CLOSED' );
$_GET['USR_USERNAME']=''; $_GET['USR_USERNAME'] = '';
$RBAC->updateUser(array('USR_UID' => $UID, 'USR_USERNAME' => $_GET['USR_USERNAME']),''); $RBAC->updateUser( array ('USR_UID' => $UID,'USR_USERNAME' => $_GET['USR_USERNAME']
require_once 'classes/model/Users.php'; ), '' );
$oUser = new Users(); require_once 'classes/model/Users.php';
$aFields = $oUser->load($UID); $oUser = new Users();
$aFields['USR_STATUS'] = 'CLOSED'; $aFields = $oUser->load( $UID );
$aFields['USR_USERNAME'] = ''; $aFields['USR_STATUS'] = 'CLOSED';
$oUser->update($aFields); $aFields['USR_USERNAME'] = '';
break; $oUser->update( $aFields );
case 'changeUserStatus': break;
$response = new stdclass(); case 'changeUserStatus':
if (isset($_REQUEST['USR_UID']) && isset($_REQUEST['NEW_USR_STATUS'])) { $response = new stdclass();
$RBAC->changeUserStatus($_REQUEST['USR_UID'], ($_REQUEST['NEW_USR_STATUS'] == 'ACTIVE' ? 1 : 0)); if (isset( $_REQUEST['USR_UID'] ) && isset( $_REQUEST['NEW_USR_STATUS'] )) {
require_once 'classes/model/Users.php'; $RBAC->changeUserStatus( $_REQUEST['USR_UID'], ($_REQUEST['NEW_USR_STATUS'] == 'ACTIVE' ? 1 : 0) );
$userInstance = new Users(); require_once 'classes/model/Users.php';
$userData = $userInstance->load($_REQUEST['USR_UID']); $userInstance = new Users();
$userData['USR_STATUS'] = $_REQUEST['NEW_USR_STATUS']; $userData = $userInstance->load( $_REQUEST['USR_UID'] );
$userInstance->update($userData); $userData['USR_STATUS'] = $_REQUEST['NEW_USR_STATUS'];
$response->status = 'OK'; $userInstance->update( $userData );
} $response->status = 'OK';
else { } else {
$response->status = 'ERROR'; $response->status = 'ERROR';
$response->message = 'USR_UID and NEW_USR_STATUS parameters are required.'; $response->message = 'USR_UID and NEW_USR_STATUS parameters are required.';
} }
die(G::json_encode($response)); die( G::json_encode( $response ) );
break; break;
case 'availableGroups': case 'availableGroups':
G::LoadClass('groups'); G::LoadClass( 'groups' );
$filter = (isset($_POST['textFilter']))? $_POST['textFilter'] : ''; $filter = (isset( $_POST['textFilter'] )) ? $_POST['textFilter'] : '';
$groups = new Groups(); $groups = new Groups();
$criteria = $groups->getAvailableGroupsCriteria($_REQUEST['uUID'],$filter); $criteria = $groups->getAvailableGroupsCriteria( $_REQUEST['uUID'], $filter );
$objects = GroupwfPeer::doSelectRS($criteria); $objects = GroupwfPeer::doSelectRS( $criteria );
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $objects->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$arr = Array(); $arr = Array ();
while ($objects->next()){ while ($objects->next()) {
$arr[] = $objects->getRow(); $arr[] = $objects->getRow();
} }
echo '{groups: '.G::json_encode($arr).'}'; echo '{groups: ' . G::json_encode( $arr ) . '}';
break; break;
case 'assignedGroups': case 'assignedGroups':
G::LoadClass('groups'); G::LoadClass( 'groups' );
$filter = (isset($_POST['textFilter']))? $_POST['textFilter'] : ''; $filter = (isset( $_POST['textFilter'] )) ? $_POST['textFilter'] : '';
$groups = new Groups(); $groups = new Groups();
$criteria = $groups->getAssignedGroupsCriteria($_REQUEST['uUID'],$filter); $criteria = $groups->getAssignedGroupsCriteria( $_REQUEST['uUID'], $filter );
$objects = GroupwfPeer::doSelectRS($criteria); $objects = GroupwfPeer::doSelectRS( $criteria );
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $objects->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$arr = Array(); $arr = Array ();
while ($objects->next()){ while ($objects->next()) {
$arr[] = $objects->getRow(); $arr[] = $objects->getRow();
} }
echo '{groups: '.G::json_encode($arr).'}'; echo '{groups: ' . G::json_encode( $arr ) . '}';
break; break;
case 'assignGroupsToUserMultiple': case 'assignGroupsToUserMultiple':
$USR_UID = $_POST['USR_UID']; $USR_UID = $_POST['USR_UID'];
$gUIDs = explode(',',$_POST['GRP_UID']); $gUIDs = explode( ',', $_POST['GRP_UID'] );
G::LoadClass('groups'); G::LoadClass( 'groups' );
$oGroup = new Groups(); $oGroup = new Groups();
foreach ($gUIDs as $GRP_UID){ foreach ($gUIDs as $GRP_UID) {
$oGroup->addUserToGroup($GRP_UID, $USR_UID); $oGroup->addUserToGroup( $GRP_UID, $USR_UID );
} }
break; break;
case 'deleteGroupsToUserMultiple': case 'deleteGroupsToUserMultiple':
$USR_UID = $_POST['USR_UID']; $USR_UID = $_POST['USR_UID'];
$gUIDs = explode(',',$_POST['GRP_UID']); $gUIDs = explode( ',', $_POST['GRP_UID'] );
G::LoadClass('groups'); G::LoadClass( 'groups' );
$oGroup = new Groups(); $oGroup = new Groups();
foreach ($gUIDs as $GRP_UID){ foreach ($gUIDs as $GRP_UID) {
$oGroup->removeUserOfGroup($GRP_UID, $USR_UID); $oGroup->removeUserOfGroup( $GRP_UID, $USR_UID );
} }
break; break;
case 'authSources': case 'authSources':
$criteria = $RBAC->getAllAuthSources(); $criteria = $RBAC->getAllAuthSources();
$objects = AuthenticationSourcePeer::doSelectRS($criteria); $objects = AuthenticationSourcePeer::doSelectRS( $criteria );
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $objects->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$arr = Array(); $arr = Array ();
if (isset($_REQUEST['cmb'])){ if (isset( $_REQUEST['cmb'] )) {
if ($_REQUEST['cmb'] == 'yes'){ if ($_REQUEST['cmb'] == 'yes') {
$started = Array(); $started = Array ();
$started['AUTH_SOURCE_UID'] = ''; $started['AUTH_SOURCE_UID'] = '';
$started['AUTH_SOURCE_SHOW'] = G::LoadTranslation('ID_ALL'); $started['AUTH_SOURCE_SHOW'] = G::LoadTranslation( 'ID_ALL' );
$arr[] = $started; $arr[] = $started;
} }
} }
$started = Array(); $started = Array ();
$started['AUTH_SOURCE_UID'] = '00000000000000000000000000000000'; $started['AUTH_SOURCE_UID'] = '00000000000000000000000000000000';
//$started['AUTH_SOURCE_NAME'] = 'ProcessMaker'; //$started['AUTH_SOURCE_NAME'] = 'ProcessMaker';
//$started['AUTH_SOURCE_TYPE'] = 'MYSQL'; //$started['AUTH_SOURCE_TYPE'] = 'MYSQL';
$started['AUTH_SOURCE_SHOW'] = 'ProcessMaker (MYSQL)'; $started['AUTH_SOURCE_SHOW'] = 'ProcessMaker (MYSQL)';
$arr[] = $started; $arr[] = $started;
while ($objects->next()){ while ($objects->next()) {
$row = $objects->getRow(); $row = $objects->getRow();
$aux = Array(); $aux = Array ();
$aux['AUTH_SOURCE_UID'] = $row['AUTH_SOURCE_UID']; $aux['AUTH_SOURCE_UID'] = $row['AUTH_SOURCE_UID'];
//$aux['AUTH_SOURCE_NAME'] = $row['AUTH_SOURCE_NAME']; //$aux['AUTH_SOURCE_NAME'] = $row['AUTH_SOURCE_NAME'];
//$aux['AUTH_SOURCE_TYPE'] = $row['AUTH_SOURCE_TYPE']; //$aux['AUTH_SOURCE_TYPE'] = $row['AUTH_SOURCE_TYPE'];
$aux['AUTH_SOURCE_SHOW'] = $row['AUTH_SOURCE_NAME'].' ('.$row['AUTH_SOURCE_PROVIDER'].')'; $aux['AUTH_SOURCE_SHOW'] = $row['AUTH_SOURCE_NAME'] . ' (' . $row['AUTH_SOURCE_PROVIDER'] . ')';
$arr[] = $aux; $arr[] = $aux;
} }
echo '{sources: '.G::json_encode($arr).'}'; echo '{sources: ' . G::json_encode( $arr ) . '}';
break; break;
case 'loadAuthSourceByUID': case 'loadAuthSourceByUID':
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oCriteria=$RBAC->load($_POST['uUID']); $oCriteria = $RBAC->load( $_POST['uUID'] );
$UID_AUTH = $oCriteria['UID_AUTH_SOURCE']; $UID_AUTH = $oCriteria['UID_AUTH_SOURCE'];
if (($UID_AUTH!='00000000000000000000000000000000')&&($UID_AUTH!='')){ if (($UID_AUTH != '00000000000000000000000000000000') && ($UID_AUTH != '')) {
$aux = $RBAC->getAuthSource($UID_AUTH); $aux = $RBAC->getAuthSource( $UID_AUTH );
$arr = Array(); $arr = Array ();
$arr['AUTH_SOURCE_NAME'] = $aux['AUTH_SOURCE_NAME'].' ('.$aux['AUTH_SOURCE_PROVIDER'].')'; $arr['AUTH_SOURCE_NAME'] = $aux['AUTH_SOURCE_NAME'] . ' (' . $aux['AUTH_SOURCE_PROVIDER'] . ')';
$arr['AUTH_SOURCE_PROVIDER'] = $aux['AUTH_SOURCE_PROVIDER']; $arr['AUTH_SOURCE_PROVIDER'] = $aux['AUTH_SOURCE_PROVIDER'];
$aFields = $arr; $aFields = $arr;
}else{ } else {
$arr = Array(); $arr = Array ();
$arr['AUTH_SOURCE_NAME'] = 'ProcessMaker (MYSQL)'; $arr['AUTH_SOURCE_NAME'] = 'ProcessMaker (MYSQL)';
$arr['AUTH_SOURCE_PROVIDER'] = 'MYSQL'; $arr['AUTH_SOURCE_PROVIDER'] = 'MYSQL';
$aFields = $arr; $aFields = $arr;
} }
$res = Array(); $res = Array ();
$res['data'] = $oCriteria; $res['data'] = $oCriteria;
$res['auth'] = $aFields; $res['auth'] = $aFields;
echo G::json_encode($res); echo G::json_encode( $res );
break; break;
case 'updateAuthServices': case 'updateAuthServices':
$aData = $RBAC->load($_POST['usr_uid']); $aData = $RBAC->load( $_POST['usr_uid'] );
unset($aData['USR_ROLE']); unset( $aData['USR_ROLE'] );
$auth_uid = $_POST['auth_source']; $auth_uid = $_POST['auth_source'];
$auth_uid2 = $_POST['auth_source_uid']; $auth_uid2 = $_POST['auth_source_uid'];
if ($auth_uid == $auth_uid2){ if ($auth_uid == $auth_uid2) {
$auth_uid = $aData['UID_AUTH_SOURCE']; $auth_uid = $aData['UID_AUTH_SOURCE'];
} }
if (($auth_uid=='00000000000000000000000000000000')||($auth_uid=='')){ if (($auth_uid == '00000000000000000000000000000000') || ($auth_uid == '')) {
$aData['USR_AUTH_TYPE'] = 'MYSQL'; $aData['USR_AUTH_TYPE'] = 'MYSQL';
$aData['UID_AUTH_SOURCE'] = ''; $aData['UID_AUTH_SOURCE'] = '';
}else{ } else {
$aFields = $RBAC->getAuthSource($auth_uid); $aFields = $RBAC->getAuthSource( $auth_uid );
$aData['USR_AUTH_TYPE'] = $aFields['AUTH_SOURCE_PROVIDER']; $aData['USR_AUTH_TYPE'] = $aFields['AUTH_SOURCE_PROVIDER'];
$aData['UID_AUTH_SOURCE'] = $auth_uid; $aData['UID_AUTH_SOURCE'] = $auth_uid;
} }
if (isset($_POST['auth_dn'])){ if (isset( $_POST['auth_dn'] )) {
$auth_dn = $_POST['auth_dn']; $auth_dn = $_POST['auth_dn'];
}else{ } else {
$auth_dn = ""; $auth_dn = "";
} }
$aData['USR_AUTH_USER_DN'] = $auth_dn; $aData['USR_AUTH_USER_DN'] = $auth_dn;
$RBAC->updateUser($aData); $RBAC->updateUser( $aData );
echo '{success: true}'; echo '{success: true}';
break; break;
case 'usersList': case 'usersList':
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
require_once 'classes/model/LoginLog.php'; require_once 'classes/model/LoginLog.php';
require_once 'classes/model/Department.php'; require_once 'classes/model/Department.php';
require_once 'classes/model/AppCacheView.php'; require_once 'classes/model/AppCacheView.php';
global $RBAC; global $RBAC;
G::LoadClass('configuration'); G::LoadClass( 'configuration' );
$co = new Configurations(); $co = new Configurations();
$config = $co->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']); $config = $co->getConfiguration( 'usersList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; $limit_size = isset( $config['pageSize'] ) ? $config['pageSize'] : 20;
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; $start = isset( $_REQUEST['start'] ) ? $_REQUEST['start'] : 0;
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size; $limit = isset( $_REQUEST['limit'] ) ? $_REQUEST['limit'] : $limit_size;
$filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : ''; $filter = isset( $_REQUEST['textFilter'] ) ? $_REQUEST['textFilter'] : '';
$auths = isset($_REQUEST['auths']) ? $_REQUEST['auths'] : ''; $auths = isset( $_REQUEST['auths'] ) ? $_REQUEST['auths'] : '';
$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : ''; $sort = isset( $_REQUEST['sort'] ) ? $_REQUEST['sort'] : '';
$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : 'ASC'; $dir = isset( $_REQUEST['dir'] ) ? $_REQUEST['dir'] : 'ASC';
$aUsers = Array(); $aUsers = Array ();
if ($auths != ''){ if ($auths != '') {
$aUsers = $RBAC->getListUsersByAuthSource($auths); $aUsers = $RBAC->getListUsersByAuthSource( $auths );
} }
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn('COUNT(*) AS CNT'); $oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
if ($filter != ''){ if ($filter != '') {
$cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $cc = $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_EMAIL, '%' . $filter . '%', Criteria::LIKE ) ) ) );
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $oCriteria->add( $cc );
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( }
$oCriteria->getNewCriterion(UsersPeer::USR_EMAIL,'%'.$filter.'%',Criteria::LIKE)))); $oCriteria->add( UsersPeer::USR_STATUS, array ('CLOSED'
$oCriteria->add($cc); ), Criteria::NOT_IN );
} if ($auths != '') {
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN); $totalRows = sizeof( $aUsers );
if ($auths != ''){ } else {
$totalRows = sizeof($aUsers); $oDataset = UsersPeer::DoSelectRs( $oCriteria );
}else{ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset = UsersPeer::DoSelectRs ($oCriteria); $oDataset->next();
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC); $row = $oDataset->getRow();
$oDataset->next(); $totalRows = $row['CNT'];
$row = $oDataset->getRow(); }
$totalRows = $row['CNT']; $oCriteria->clearSelectColumns();
} $oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->clearSelectColumns(); $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); $oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $oCriteria->addSelectColumn( UsersPeer::USR_EMAIL );
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); $oCriteria->addSelectColumn( UsersPeer::USR_ROLE );
$oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); $oCriteria->addSelectColumn( UsersPeer::USR_DUE_DATE );
$oCriteria->addSelectColumn(UsersPeer::USR_ROLE); $oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->addSelectColumn(UsersPeer::USR_DUE_DATE); $oCriteria->addSelectColumn( UsersPeer::USR_UX );
$oCriteria->addSelectColumn(UsersPeer::USR_STATUS); $oCriteria->addSelectColumn( UsersPeer::DEP_UID );
$oCriteria->addSelectColumn(UsersPeer::USR_UX); $oCriteria->addAsColumn( 'LAST_LOGIN', 0 );
$oCriteria->addSelectColumn(UsersPeer::DEP_UID); $oCriteria->addAsColumn( 'DEP_TITLE', 0 );
$oCriteria->addAsColumn('LAST_LOGIN', 0); $oCriteria->addAsColumn( 'TOTAL_CASES', 0 );
$oCriteria->addAsColumn('DEP_TITLE', 0); $oCriteria->addAsColumn( 'DUE_DATE_OK', 1 );
$oCriteria->addAsColumn('TOTAL_CASES', 0); $sep = "'";
$oCriteria->addAsColumn('DUE_DATE_OK', 1); $oCriteria->add( UsersPeer::USR_STATUS, array ('CLOSED'
$sep = "'"; ), Criteria::NOT_IN );
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN); if ($filter != '') {
if ($filter != ''){ $cc = $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_EMAIL, '%' . $filter . '%', Criteria::LIKE ) ) ) );
$cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( $oCriteria->add( $cc );
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( }
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr( // $sw_add = false;
$oCriteria->getNewCriterion(UsersPeer::USR_EMAIL,'%'.$filter.'%',Criteria::LIKE)))); // for ($i=0; $i < sizeof($aUsers); $i++){
$oCriteria->add($cc); // if ($i>0){
} // $tmpL = $tmpL->addOr($oCriteria->getNewCriterion(UsersPeer::USR_UID, $aUsers[$i],Criteria::EQUAL));
// $sw_add = false; // }else{
// for ($i=0; $i < sizeof($aUsers); $i++){ // $uList = $oCriteria->getNewCriterion(UsersPeer::USR_UID, $aUsers[$i],Criteria::EQUAL);
// if ($i>0){ // $tmpL = $uList;
// $tmpL = $tmpL->addOr($oCriteria->getNewCriterion(UsersPeer::USR_UID, $aUsers[$i],Criteria::EQUAL)); // $sw_add = true;
// }else{ // }
// $uList = $oCriteria->getNewCriterion(UsersPeer::USR_UID, $aUsers[$i],Criteria::EQUAL); // }
// $tmpL = $uList; // if ($sw_add) $oCriteria->add($uList);
// $sw_add = true; if (sizeof( $aUsers ) > 0) {
// } $oCriteria->add( UsersPeer::USR_UID, $aUsers, Criteria::IN );
// } } else if ($totalRows == 0 && $auths != '') {
// if ($sw_add) $oCriteria->add($uList); $oCriteria->add( UsersPeer::USR_UID, '', Criteria::IN );
if (sizeof($aUsers) > 0){ }
$oCriteria->add(UsersPeer::USR_UID, $aUsers, Criteria::IN); if ($sort != '') {
}else if ($totalRows==0 && $auths != ''){ if ($dir == 'ASC') {
$oCriteria->add(UsersPeer::USR_UID,'',Criteria::IN); $oCriteria->addAscendingOrderByColumn( $sort );
} } else {
if ($sort != '') { $oCriteria->addDescendingOrderByColumn( $sort );
if ($dir == 'ASC') { }
$oCriteria->addAscendingOrderByColumn($sort); }
} $oCriteria->setOffset( $start );
else { $oCriteria->setLimit( $limit );
$oCriteria->addDescendingOrderByColumn($sort); $oDataset = UsersPeer::DoSelectRs( $oCriteria );
} $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
}
$oCriteria->setOffset($start);
$oCriteria->setLimit($limit);
$oDataset = UsersPeer::DoSelectRs ($oCriteria);
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
$Login = new LoginLog(); $Login = new LoginLog();
$aLogin = $Login->getLastLoginAllUsers(); $aLogin = $Login->getLastLoginAllUsers();
$Cases = new AppCacheView(); $Cases = new AppCacheView();
$aCases = $Cases->getTotalCasesByAllUsers(); $aCases = $Cases->getTotalCasesByAllUsers();
$Department = new Department(); $Department = new Department();
$aDepart = $Department->getAllDepartmentsByUser(); $aDepart = $Department->getAllDepartmentsByUser();
$aAuthSources = $RBAC->getAllAuthSourcesByUser(); $aAuthSources = $RBAC->getAllAuthSourcesByUser();
require_once PATH_CONTROLLERS . 'adminProxy.php'; require_once PATH_CONTROLLERS . 'adminProxy.php';
$uxList = adminProxy::getUxTypesList(); $uxList = adminProxy::getUxTypesList();
$rows = Array(); $rows = Array ();
while($oDataset->next()){ while ($oDataset->next()) {
$row = $oDataset->getRow(); $row = $oDataset->getRow();
$row['DUE_DATE_OK'] = (date('Y-m-d')>date('Y-m-d',strtotime($row['USR_DUE_DATE'])))? 0 : 1; $row['DUE_DATE_OK'] = (date( 'Y-m-d' ) > date( 'Y-m-d', strtotime( $row['USR_DUE_DATE'] ) )) ? 0 : 1;
$row['LAST_LOGIN'] = isset($aLogin[$row['USR_UID']]) ? $aLogin[$row['USR_UID']] : ''; $row['LAST_LOGIN'] = isset( $aLogin[$row['USR_UID']] ) ? $aLogin[$row['USR_UID']] : '';
$row['TOTAL_CASES'] = isset($aCases[$row['USR_UID']]) ? $aCases[$row['USR_UID']] : 0; $row['TOTAL_CASES'] = isset( $aCases[$row['USR_UID']] ) ? $aCases[$row['USR_UID']] : 0;
$row['DEP_TITLE'] = isset($aDepart[$row['USR_UID']]) ? $aDepart[$row['USR_UID']] : ''; $row['DEP_TITLE'] = isset( $aDepart[$row['USR_UID']] ) ? $aDepart[$row['USR_UID']] : '';
$row['USR_UX'] = isset($uxList[$row['USR_UX']]) ? $uxList[$row['USR_UX']] : $uxList['NORMAL']; $row['USR_UX'] = isset( $uxList[$row['USR_UX']] ) ? $uxList[$row['USR_UX']] : $uxList['NORMAL'];
$row['USR_AUTH_SOURCE'] = isset($aAuthSources[$row['USR_UID']]) ? $aAuthSources[$row['USR_UID']] : 'ProcessMaker (MYSQL)'; $row['USR_AUTH_SOURCE'] = isset( $aAuthSources[$row['USR_UID']] ) ? $aAuthSources[$row['USR_UID']] : 'ProcessMaker (MYSQL)';
$rows[] = $row; $rows[] = $row;
} }
echo '{users: '.G::json_encode($rows).', total_users: '.$totalRows.'}'; echo '{users: ' . G::json_encode( $rows ) . ', total_users: ' . $totalRows . '}';
break; break;
case 'updatePageSize': case 'updatePageSize':
G::LoadClass('configuration'); G::LoadClass( 'configuration' );
$c = new Configurations(); $c = new Configurations();
$arr['pageSize'] = $_REQUEST['size']; $arr['pageSize'] = $_REQUEST['size'];
$arr['dateSave'] = date('Y-m-d H:i:s'); $arr['dateSave'] = date( 'Y-m-d H:i:s' );
$config = Array(); $config = Array ();
$config[] = $arr; $config[] = $arr;
$c->aConfig = $config; $c->aConfig = $config;
$c->saveConfig('usersList', 'pageSize','',$_SESSION['USER_LOGGED']); $c->saveConfig( 'usersList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
echo '{success: true}'; echo '{success: true}';
break; break;
case 'summaryUserData': case 'summaryUserData':
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
require_once 'classes/model/Department.php'; require_once 'classes/model/Department.php';
require_once 'classes/model/AppCacheView.php'; require_once 'classes/model/AppCacheView.php';
G::LoadClass('configuration'); G::LoadClass( 'configuration' );
$oUser = new Users(); $oUser = new Users();
$data = $oUser->loadDetailed($_REQUEST['USR_UID']); $data = $oUser->loadDetailed( $_REQUEST['USR_UID'] );
$data['USR_STATUS'] = G::LoadTranslation('ID_' . $data['USR_STATUS']); $data['USR_STATUS'] = G::LoadTranslation( 'ID_' . $data['USR_STATUS'] );
$oAppCache = new AppCacheView(); $oAppCache = new AppCacheView();
$aTypes = Array(); $aTypes = Array ();
$aTypes['to_do'] = 'CASES_INBOX'; $aTypes['to_do'] = 'CASES_INBOX';
$aTypes['draft'] = 'CASES_DRAFT'; $aTypes['draft'] = 'CASES_DRAFT';
$aTypes['cancelled'] = 'CASES_CANCELLED'; $aTypes['cancelled'] = 'CASES_CANCELLED';
$aTypes['sent'] = 'CASES_SENT'; $aTypes['sent'] = 'CASES_SENT';
$aTypes['paused'] = 'CASES_PAUSED'; $aTypes['paused'] = 'CASES_PAUSED';
$aTypes['completed'] = 'CASES_COMPLETED'; $aTypes['completed'] = 'CASES_COMPLETED';
$aTypes['selfservice'] = 'CASES_SELFSERVICE'; $aTypes['selfservice'] = 'CASES_SELFSERVICE';
$aCount = $oAppCache->getAllCounters( array_keys($aTypes), $_REQUEST['USR_UID']); $aCount = $oAppCache->getAllCounters( array_keys( $aTypes ), $_REQUEST['USR_UID'] );
$dep = new Department(); $dep = new Department();
if ($dep->existsDepartment($data['DEP_UID'])){ if ($dep->existsDepartment( $data['DEP_UID'] )) {
$dep->Load($data['DEP_UID']); $dep->Load( $data['DEP_UID'] );
$dep_name = $dep->getDepTitle(); $dep_name = $dep->getDepTitle();
}else{ } else {
$dep_name = ''; $dep_name = '';
} }
if ($data['USR_REPLACED_BY']!=''){ if ($data['USR_REPLACED_BY'] != '') {
$user = new Users(); $user = new Users();
$u = $user->load($data['USR_REPLACED_BY']); $u = $user->load( $data['USR_REPLACED_BY'] );
$c = new Configurations(); $c = new Configurations();
$replaced_by = $c->usersNameFormat($u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME']); $replaced_by = $c->usersNameFormat( $u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME'] );
}else{ } else {
$replaced_by = ''; $replaced_by = '';
} }
$misc = Array(); $misc = Array ();
$misc['DEP_TITLE'] = $dep_name; $misc['DEP_TITLE'] = $dep_name;
$misc['REPLACED_NAME'] = $replaced_by; $misc['REPLACED_NAME'] = $replaced_by;
echo '{success: true, userdata: '.G::json_encode($data).', cases: '.G::json_encode($aCount).', misc: '.G::json_encode($misc).'}'; echo '{success: true, userdata: ' . G::json_encode( $data ) . ', cases: ' . G::json_encode( $aCount ) . ', misc: ' . G::json_encode( $misc ) . '}';
break; break;
} }
} catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,28 +12,29 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
global $RBAC; global $RBAC;
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
} }
$G_MAIN_MENU = 'processmaker'; $G_MAIN_MENU = 'processmaker';
//$G_SUB_MENU = 'users'; //$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS'; $G_ID_MENU_SELECTED = 'USERS';
//$G_ID_SUB_MENU_SELECTED = '-'; //$G_ID_SUB_MENU_SELECTED = '-';
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_AuthSource', '', $RBAC->load($_GET['USR_UID']), '../users/users_AuthSourceSave'); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_AuthSource', '', $RBAC->load( $_GET['USR_UID'] ), '../users/users_AuthSourceSave' );
G::RenderPage('publish','blank'); G::RenderPage( 'publish', 'blank' );

View File

@@ -12,35 +12,34 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
global $RBAC; global $RBAC;
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
} }
$aData = $RBAC->load($_POST['form']['USR_UID']); $aData = $RBAC->load( $_POST['form']['USR_UID'] );
unset($aData['USR_ROLE']); unset( $aData['USR_ROLE'] );
if ($_POST['form']['UID_AUTH_SOURCE'] == 'MYSQL') { if ($_POST['form']['UID_AUTH_SOURCE'] == 'MYSQL') {
$aData['USR_AUTH_TYPE'] = 'MYSQL'; $aData['USR_AUTH_TYPE'] = 'MYSQL';
$aData['UID_AUTH_SOURCE'] = ''; $aData['UID_AUTH_SOURCE'] = '';
} } else {
else { $aFields = $RBAC->getAuthSource( $_POST['form']['UID_AUTH_SOURCE'] );
$aFields = $RBAC->getAuthSource($_POST['form']['UID_AUTH_SOURCE']); $aData['USR_AUTH_TYPE'] = $aFields['AUTH_SOURCE_PROVIDER'];
$aData['USR_AUTH_TYPE'] = $aFields['AUTH_SOURCE_PROVIDER']; $aData['UID_AUTH_SOURCE'] = $_POST['form']['UID_AUTH_SOURCE'];
$aData['UID_AUTH_SOURCE'] = $_POST['form']['UID_AUTH_SOURCE'];
} }
$aData['USR_AUTH_USER_DN'] = $_POST['form']['USR_AUTH_USER_DN']; $aData['USR_AUTH_USER_DN'] = $_POST['form']['USR_AUTH_USER_DN'];
$RBAC->updateUser($aData); $RBAC->updateUser( $aData );
G::header( 'location: users_List' );
G::header('location: users_List');

View File

@@ -1,5 +1,5 @@
<?php <?php
/** /**
* users_Delete.php * users_Delete.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
@@ -12,62 +12,59 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
{ case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} if ($_GET['USR_UID'] == '00000000000000000000000000000001') {
if ($_GET['USR_UID'] == '00000000000000000000000000000001') { G::SendTemporalMessage( 'ID_CANNOT_CHANGE_STATUS_ADMIN_USER', 'error', 'usersLabels' );
G::SendTemporalMessage('ID_CANNOT_CHANGE_STATUS_ADMIN_USER', 'error', 'usersLabels'); G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );
G::header('location: ' . $_SERVER['HTTP_REFERER']); die();
die; }
} /*$RBAC->removeUser($_GET['USR_UID']);
/*$RBAC->removeUser($_GET['USR_UID']);
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oUser = new Users(); $oUser = new Users();
$oUser->remove($_GET['USR_UID']);*/ $oUser->remove($_GET['USR_UID']);*/
//print_r($_GET['USR_UID']); die
G::LoadClass('tasks');
$oTasks = new Tasks();
$oTasks->ofToAssignUserOfAllTasks($_GET['USR_UID']);
G::LoadClass('groups');
$oGroups = new Groups();
$oGroups->removeUserOfAllGroups($_GET['USR_UID']);
$RBAC->changeUserStatus($_GET['USR_UID'], 'CLOSED');
$_GET['USR_USERNAME']='';
$RBAC->updateUser(array('USR_UID' => $_GET['USR_UID'], 'USR_USERNAME' => $_GET['USR_USERNAME']),'');
//print_r($_GET['USR_UID']); die
G::LoadClass( 'tasks' );
$oTasks = new Tasks();
$oTasks->ofToAssignUserOfAllTasks( $_GET['USR_UID'] );
G::LoadClass( 'groups' );
$oGroups = new Groups();
$oGroups->removeUserOfAllGroups( $_GET['USR_UID'] );
$RBAC->changeUserStatus( $_GET['USR_UID'], 'CLOSED' );
$_GET['USR_USERNAME'] = '';
$RBAC->updateUser( array ('USR_UID' => $_GET['USR_UID'],'USR_USERNAME' => $_GET['USR_USERNAME']
), '' );
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oUser = new Users(); $oUser = new Users();
$aFields = $oUser->load($_GET['USR_UID']); $aFields = $oUser->load( $_GET['USR_UID'] );
$aFields['USR_STATUS'] = 'CLOSED'; $aFields['USR_STATUS'] = 'CLOSED';
$aFields['USR_USERNAME'] = ''; $aFields['USR_USERNAME'] = '';
$oUser->update($aFields); $oUser->update( $aFields );
G::header('location: users_List'); G::header( 'location: users_List' );
} catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,38 +12,36 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
$USR_UID=$_GET['USR_UID'];
G::LoadClass('case');
$oProcessMap = new Cases();
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID); $USR_UID = $_GET['USR_UID'];
$array["TO_DO"] = ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID); G::LoadClass( 'case' );
$array["COMPLETED"] = ApplicationPeer::doCount($c); $oProcessMap = new Cases();
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases( 'TO_DO', $USR_UID );
$array["DRAFT"] = ApplicationPeer::doCount($c); $array["TO_DO"] = ApplicationPeer::doCount( $c );
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases( 'COMPLETED', $USR_UID );
$array["CANCELLED"] = ApplicationPeer::doCount($c); $array["COMPLETED"] = ApplicationPeer::doCount( $c );
$array["USR_UID"]=$USR_UID; $c = $oProcessMap->getCriteriaUsersCases( 'DRAFT', $USR_UID );
$array["DRAFT"] = ApplicationPeer::doCount( $c );
$G_PUBLISH = new Publisher; $c = $oProcessMap->getCriteriaUsersCases( 'CANCELLED', $USR_UID );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_DeleteAssign', '', $array, ''); $array["CANCELLED"] = ApplicationPeer::doCount( $c );
G::RenderPage('publish', 'raw');
$array["USR_UID"] = $USR_UID;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_DeleteAssign', '', $array, '' );
G::RenderPage( 'publish', 'raw' );
?>

View File

@@ -12,153 +12,154 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_REASSIGNCASE')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
if (!isset($_GET['USR_UID'])) { try {
$_GET['USR_UID'] = ''; global $RBAC;
} switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) {
case - 2:
$G_MAIN_MENU = 'processmaker'; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
$G_SUB_MENU = 'users'; G::header( 'location: ../login/login' );
$G_ID_MENU_SELECTED = 'USERS'; die();
$G_ID_SUB_MENU_SELECTED = 'USERS'; break;
$G_PUBLISH = new Publisher; case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
if ($_GET['USR_UID'] != '') { G::header( 'location: ../login/login' );
$c=0; die();
$oTemplatePower = new TemplatePower(PATH_TPL . 'users/users_DeleteReassign.html'); break;
$oTemplatePower->prepare();
G::LoadClass('tasks');
G::LoadClass('groups');
$oTasks = new Tasks();
$oGroups = new Groups();
$oUser = new Users();
G::LoadClass('case');
$oCases = new Cases();
$USR_UID=$_GET['USR_UID'];
list($oCriteriaToDo,$sXMLFile) = $oCases->getConditionCasesList('to_do', $_GET['USR_UID']);
list($oCriteriaDraft,$sXMLFile) = $oCases->getConditionCasesList('draft', $_GET['USR_UID']);
if(ApplicationPeer::doCount($oCriteriaToDo)==0 && ApplicationPeer::doCount($oCriteriaDraft)==0);
G::header('location: users_Delete?USR_UID='.$USR_UID);
$oDataset = ApplicationPeer::doSelectRS($oCriteriaToDo);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$c++;
$oTemplatePower->newBlock('cases');
$aKeys = array_keys($aRow);
foreach ($aKeys as $sKey) {
$oTemplatePower->assign($sKey, $aRow[$sKey]);
}
$aUsers = array($_GET['USR_UID']);
$aAux1 = $oTasks->getGroupsOfTask($aRow['TAS_UID'], 1);
foreach ($aAux1 as $aGroup) {
$aAux2 = $oGroups->getUsersOfGroup($aGroup['GRP_UID']);
foreach ($aAux2 as $aUser) {
if (!in_array($aUser['USR_UID'], $aUsers)) {
$aUsers[] = $aUser['USR_UID'];
$aData = $oUser->load($aUser['USR_UID']);
$oTemplatePower->newBlock('users');
$oTemplatePower->assign('USR_UID', $aUser['USR_UID']);
$oTemplatePower->assign('USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')');
}
}
}
$aAux1 = $oTasks->getUsersOfTask($aRow['TAS_UID'], 1);
foreach ($aAux1 as $aUser) {
if (!in_array($aUser['USR_UID'], $aUsers)) {
$aUsers[] = $aUser['USR_UID'];
$aData = $oUser->load($aUser['USR_UID']);
$oTemplatePower->newBlock('users');
$oTemplatePower->assign('USR_UID', $aUser['USR_UID']);
$oTemplatePower->assign('USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')');
}
}
$oTemplatePower->gotoBlock('cases');
$oTemplatePower->assign('ID_STATUS', G::LoadTranslation('ID_TO_DO'));
$oTemplatePower->assign('ID_NO_REASSIGN', G::LoadTranslation('ID_NO_REASSIGN'));
$oDataset->next();
}
$oDataset = ApplicationPeer::doSelectRS($oCriteriaDraft);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$c++;
$oTemplatePower->newBlock('cases');
$aKeys = array_keys($aRow);
foreach ($aKeys as $sKey) {
$oTemplatePower->assign($sKey, $aRow[$sKey]);
}
$aUsers = array($_GET['USR_UID']);
$aAux1 = $oTasks->getGroupsOfTask($aRow['TAS_UID'], 1);
foreach ($aAux1 as $aGroup) {
$aAux2 = $oGroups->getUsersOfGroup($aGroup['GRP_UID']);
foreach ($aAux2 as $aUser) {
if (!in_array($aUser['USR_UID'], $aUsers)) {
$aUsers[] = $aUser['USR_UID'];
$aData = $oUser->load($aUser['USR_UID']);
$oTemplatePower->newBlock('users');
$oTemplatePower->assign('USR_UID', $aUser['USR_UID']);
$oTemplatePower->assign('USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')');
}
}
}
$aAux1 = $oTasks->getUsersOfTask($aRow['TAS_UID'], 1);
foreach ($aAux1 as $aUser) {
if (!in_array($aUser['USR_UID'], $aUsers)) {
$aUsers[] = $aUser['USR_UID'];
$aData = $oUser->load($aUser['USR_UID']);
$oTemplatePower->newBlock('users');
$oTemplatePower->assign('USR_UID', $aUser['USR_UID']);
$oTemplatePower->assign('USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')');
}
}
$oTemplatePower->gotoBlock('cases');
$oTemplatePower->assign('ID_STATUS', G::LoadTranslation('ID_DRAFT'));
$oTemplatePower->assign('ID_NO_REASSIGN', G::LoadTranslation('ID_NO_REASSIGN'));
$oDataset->next();
} }
$oTemplatePower->gotoBlock('_ROOT');
$oTemplatePower->assign('ID_NUMBER', '#'); if (! isset( $_GET['USR_UID'] )) {
$oTemplatePower->assign('ID_CASE', G::LoadTranslation('ID_CASE')); $_GET['USR_UID'] = '';
$oTemplatePower->assign('ID_TASK', G::LoadTranslation('ID_TASK')); }
$oTemplatePower->assign('ID_PROCESS', G::LoadTranslation('ID_PROCESS'));
$oTemplatePower->assign('ID_STATUS', G::LoadTranslation('ID_STATUS')); $G_MAIN_MENU = 'processmaker';
$oTemplatePower->assign('ID_REASSIGN_TO', G::LoadTranslation('ID_REASSIGN_TO')); $G_SUB_MENU = 'users';
$oTemplatePower->assign('ID_REASSIGN', G::LoadTranslation('ID_REASSIGN')); $G_ID_MENU_SELECTED = 'USERS';
$oTemplatePower->assign('USR_UID', $_GET['USR_UID']); $G_ID_SUB_MENU_SELECTED = 'USERS';
$oTemplatePower->assign('CONT', $c); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower);
} if ($_GET['USR_UID'] != '') {
G::RenderPage('publish'); $c = 0;
$oTemplatePower = new TemplatePower( PATH_TPL . 'users/users_DeleteReassign.html' );
$oTemplatePower->prepare();
G::LoadClass( 'tasks' );
G::LoadClass( 'groups' );
$oTasks = new Tasks();
$oGroups = new Groups();
$oUser = new Users();
G::LoadClass( 'case' );
$oCases = new Cases();
$USR_UID = $_GET['USR_UID'];
list ($oCriteriaToDo, $sXMLFile) = $oCases->getConditionCasesList( 'to_do', $_GET['USR_UID'] );
list ($oCriteriaDraft, $sXMLFile) = $oCases->getConditionCasesList( 'draft', $_GET['USR_UID'] );
if (ApplicationPeer::doCount( $oCriteriaToDo ) == 0 && ApplicationPeer::doCount( $oCriteriaDraft ) == 0)
;
G::header( 'location: users_Delete?USR_UID=' . $USR_UID );
$oDataset = ApplicationPeer::doSelectRS( $oCriteriaToDo );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$c ++;
$oTemplatePower->newBlock( 'cases' );
$aKeys = array_keys( $aRow );
foreach ($aKeys as $sKey) {
$oTemplatePower->assign( $sKey, $aRow[$sKey] );
}
$aUsers = array ($_GET['USR_UID']
);
$aAux1 = $oTasks->getGroupsOfTask( $aRow['TAS_UID'], 1 );
foreach ($aAux1 as $aGroup) {
$aAux2 = $oGroups->getUsersOfGroup( $aGroup['GRP_UID'] );
foreach ($aAux2 as $aUser) {
if (! in_array( $aUser['USR_UID'], $aUsers )) {
$aUsers[] = $aUser['USR_UID'];
$aData = $oUser->load( $aUser['USR_UID'] );
$oTemplatePower->newBlock( 'users' );
$oTemplatePower->assign( 'USR_UID', $aUser['USR_UID'] );
$oTemplatePower->assign( 'USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')' );
}
}
}
$aAux1 = $oTasks->getUsersOfTask( $aRow['TAS_UID'], 1 );
foreach ($aAux1 as $aUser) {
if (! in_array( $aUser['USR_UID'], $aUsers )) {
$aUsers[] = $aUser['USR_UID'];
$aData = $oUser->load( $aUser['USR_UID'] );
$oTemplatePower->newBlock( 'users' );
$oTemplatePower->assign( 'USR_UID', $aUser['USR_UID'] );
$oTemplatePower->assign( 'USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')' );
}
}
$oTemplatePower->gotoBlock( 'cases' );
$oTemplatePower->assign( 'ID_STATUS', G::LoadTranslation( 'ID_TO_DO' ) );
$oTemplatePower->assign( 'ID_NO_REASSIGN', G::LoadTranslation( 'ID_NO_REASSIGN' ) );
$oDataset->next();
}
$oDataset = ApplicationPeer::doSelectRS( $oCriteriaDraft );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$c ++;
$oTemplatePower->newBlock( 'cases' );
$aKeys = array_keys( $aRow );
foreach ($aKeys as $sKey) {
$oTemplatePower->assign( $sKey, $aRow[$sKey] );
}
$aUsers = array ($_GET['USR_UID']
);
$aAux1 = $oTasks->getGroupsOfTask( $aRow['TAS_UID'], 1 );
foreach ($aAux1 as $aGroup) {
$aAux2 = $oGroups->getUsersOfGroup( $aGroup['GRP_UID'] );
foreach ($aAux2 as $aUser) {
if (! in_array( $aUser['USR_UID'], $aUsers )) {
$aUsers[] = $aUser['USR_UID'];
$aData = $oUser->load( $aUser['USR_UID'] );
$oTemplatePower->newBlock( 'users' );
$oTemplatePower->assign( 'USR_UID', $aUser['USR_UID'] );
$oTemplatePower->assign( 'USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')' );
}
}
}
$aAux1 = $oTasks->getUsersOfTask( $aRow['TAS_UID'], 1 );
foreach ($aAux1 as $aUser) {
if (! in_array( $aUser['USR_UID'], $aUsers )) {
$aUsers[] = $aUser['USR_UID'];
$aData = $oUser->load( $aUser['USR_UID'] );
$oTemplatePower->newBlock( 'users' );
$oTemplatePower->assign( 'USR_UID', $aUser['USR_UID'] );
$oTemplatePower->assign( 'USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')' );
}
}
$oTemplatePower->gotoBlock( 'cases' );
$oTemplatePower->assign( 'ID_STATUS', G::LoadTranslation( 'ID_DRAFT' ) );
$oTemplatePower->assign( 'ID_NO_REASSIGN', G::LoadTranslation( 'ID_NO_REASSIGN' ) );
$oDataset->next();
}
$oTemplatePower->gotoBlock( '_ROOT' );
$oTemplatePower->assign( 'ID_NUMBER', '#' );
$oTemplatePower->assign( 'ID_CASE', G::LoadTranslation( 'ID_CASE' ) );
$oTemplatePower->assign( 'ID_TASK', G::LoadTranslation( 'ID_TASK' ) );
$oTemplatePower->assign( 'ID_PROCESS', G::LoadTranslation( 'ID_PROCESS' ) );
$oTemplatePower->assign( 'ID_STATUS', G::LoadTranslation( 'ID_STATUS' ) );
$oTemplatePower->assign( 'ID_REASSIGN_TO', G::LoadTranslation( 'ID_REASSIGN_TO' ) );
$oTemplatePower->assign( 'ID_REASSIGN', G::LoadTranslation( 'ID_REASSIGN' ) );
$oTemplatePower->assign( 'USR_UID', $_GET['USR_UID'] );
$oTemplatePower->assign( 'CONT', $c );
$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
}
G::RenderPage( 'publish' );
} catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -13,78 +13,75 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_REASSIGNCASE')) { switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) {
case -2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case -1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
G::LoadClass('case'); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
$aCases = array(); $aCases = array ();
$aUsers = array(); $aUsers = array ();
$c=0; $c = 0;
if(isset($_POST['USERS'])) if (isset( $_POST['USERS'] )) {
{ if (is_array($_POST['USERS'])) { if (is_array( $_POST['USERS'] )) {
foreach ($_POST['USERS'] as $sKey => $sUser) { foreach ($_POST['USERS'] as $sKey => $sUser) {
if ($sUser != '') { if ($sUser != '') {
$c++; $c ++;
$oCase->reassignCase($_POST['APPLICATIONS'][$sKey], $_POST['INDEXES'][$sKey], $_POST['USR_UID'], $sUser); $oCase->reassignCase( $_POST['APPLICATIONS'][$sKey], $_POST['INDEXES'][$sKey], $_POST['USR_UID'], $sUser );
$aCases[] = $_POST['APPLICATIONS'][$sKey]; $aCases[] = $_POST['APPLICATIONS'][$sKey];
$aUsers[] = $sUser; $aUsers[] = $sUser;
} }
} }
} }
} }
G::LoadClass('case'); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oUser = new Users(); $oUser = new Users();
$sText = ''; $sText = '';
foreach ($aCases as $sKey => $sCase) { foreach ($aCases as $sKey => $sCase) {
$aCase = $oCase->loadCase($sCase); $aCase = $oCase->loadCase( $sCase );
$aUser = $oUser->load($aUsers[$sKey]); $aUser = $oUser->load( $aUsers[$sKey] );
$sText .= $aCase['TITLE'] . ' => ' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' (' . $aUser['USR_USERNAME'] . ')' . '<br />'; $sText .= $aCase['TITLE'] . ' => ' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' (' . $aUser['USR_USERNAME'] . ')' . '<br />';
} }
$G_MAIN_MENU = 'processmaker';
$G_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'users';
$G_SUB_MENU = 'users'; $G_ID_MENU_SELECTED = 'USERS';
$G_ID_MENU_SELECTED = 'USERS'; $G_ID_SUB_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'USERS'; $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher;
$aMessage['USR_UID'] = $_POST['USR_UID'];
$aMessage['USR_UID'] = $_POST['USR_UID'];
$aMessage['MESSAGE'] = $sText;
$aMessage['MESSAGE'] = $sText; if ($_POST['CONT'] != $c)
if($_POST['CONT']!=$c) $aMessage['EVA'] = G::LoadTranslation( 'ID_CASESREASSIGN' ); //
$aMessage['EVA']=G::LoadTranslation('ID_CASESREASSIGN');// else
else $aMessage['EVA'] = '';
$aMessage['EVA']='';
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_ReassignShowInfo', '', $aMessage );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_ReassignShowInfo', '', $aMessage); G::RenderPage( 'publish' );
G::RenderPage('publish'); } catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,162 +1,155 @@
<?php <?php
/** /**
* users_Edit.php * users_Edit.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ try {
try { global $RBAC;
global $RBAC; $RBAC->requirePermissions( 'PM_USERS' );
$RBAC->requirePermissions('PM_USERS');
// deprecated the class XmlForm_Field_Image is currently part of the class.xmlform.php package
// deprecated the class XmlForm_Field_Image is currently part of the class.xmlform.php package // the use of the external xmlfield_Image is highly discouraged
// the use of the external xmlfield_Image is highly discouraged if (! class_exists( 'XmlForm_Field_Image' )) {
if (!class_exists('XmlForm_Field_Image')){ G::LoadClass( 'xmlfield_Image' );
G::LoadClass('xmlfield_Image'); }
} require_once 'classes/model/Users.php';
require_once 'classes/model/Users.php'; require_once 'classes/model/Department.php';
require_once 'classes/model/Department.php';
$_SESSION['CURRENT_USER'] = $_GET['USR_UID'];
$_SESSION['CURRENT_USER'] = $_GET['USR_UID']; $oUser = new Users();
$oUser = new Users(); $aFields = $oUser->load( $_GET['USR_UID'] );
$aFields = $oUser->load($_GET['USR_UID']); $aFields['USR_PASSWORD'] = '********';
$aFields['USR_PASSWORD'] = '********'; $aFields['MESSAGE0'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_USER_REGISTERED' ) ) . '!';
$aFields['MESSAGE0'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; $aFields['MESSAGE1'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_USERNAME' ) );
$aFields['MESSAGE1'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); $aFields['MESSAGE2'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_DUE_DATE' ) );
$aFields['MESSAGE2'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE')); $aFields['MESSAGE3'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_NEW_PASS_SAME_OLD_PASS' ) );
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS')); $aFields['MESSAGE4'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_FIRSTNAME' ) );
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME')); $aFields['MESSAGE5'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_LASTNAME' ) );
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME')); $aFields['MESSAGE6'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_ERROR_UPLOADING_IMAGE_TYPE' ) );
$aFields['MESSAGE6'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_ERROR_UPLOADING_IMAGE_TYPE')); $aFields['START_DATE'] = date( 'Y-m-d' );
$aFields['START_DATE'] = date('Y-m-d'); $aFields['END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) );
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5));
$G_MAIN_MENU = 'processmaker';
$G_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'users';
$G_SUB_MENU = 'users'; $G_ID_MENU_SELECTED = 'USERS';
$G_ID_MENU_SELECTED = 'USERS'; $G_ID_SUB_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'USERS';
$G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher;
//getting the user and department
//getting the user and department $oDepInfo = new Department();
$oDepInfo = new Department(); $oUser = UsersPeer::retrieveByPk( $aFields['USR_REPORTS_TO'] );
$oUser = UsersPeer::retrieveByPk( $aFields['USR_REPORTS_TO'] ); if ($oUser != '')
if ($oUser != '') if (get_class( $oUser ) == 'Users') {
if ( get_class ($oUser) == 'Users' ) { $userFields = $oUser->toArray( BasePeer::TYPE_FIELDNAME );
$userFields = $oUser->toArray(BasePeer::TYPE_FIELDNAME); $aFields['USR_REPORTS_TO'] = $userFields['USR_FIRSTNAME'] . ' ' . $userFields['USR_LASTNAME'];
$aFields['USR_REPORTS_TO'] = $userFields['USR_FIRSTNAME'] . ' ' . $userFields['USR_LASTNAME']; try {
try { $depFields = $oDepInfo->load( $userFields['DEP_UID'] );
$depFields = $oDepInfo->load($userFields['DEP_UID'] ); $aFields['USR_REPORTS_TO'] .= " (" . $depFields['DEPO_TITLE'] . ")";
$aFields['USR_REPORTS_TO'] .= " (" . $depFields['DEPO_TITLE'] . ")"; } catch (Exception $e) {
} }
catch( Exception $e ) { } else {
} $aFields['USR_REPORTS_TO'] = ' ';
} }
else{
$aFields['USR_REPORTS_TO'] = ' '; try {
} $depFields = $oDepInfo->load( $aFields['DEP_UID'] );
$aFields['USR_DEPARTMENT'] = $depFields['DEPO_TITLE'];
try { } catch (Exception $e) {
$depFields = $oDepInfo->load($aFields['DEP_UID']); $oUser = UsersPeer::retrieveByPk( $_GET['USR_UID'] );
$aFields['USR_DEPARTMENT'] = $depFields['DEPO_TITLE']; $oUser->setDepUid( '' );
} $oUser->save();
catch( Exception $e ) { }
$oUser = UsersPeer::retrieveByPk( $_GET['USR_UID'] );
$oUser->setDepUid( '' ); //Load Calendar options and falue for this user
$oUser->save(); G::LoadClass( 'calendar' );
} $calendar = new Calendar();
$calendarObj = $calendar->getCalendarList( true, true );
//Load Calendar options and falue for this user global $_DBArray;
G::LoadClass ( 'calendar' ); $_DBArray['availableCalendars'] = $calendarObj['array'];
$calendar = new Calendar ( ); $_SESSION['_DBArray'] = $_DBArray;
$calendarObj = $calendar->getCalendarList ( true, true ); $calendarInfo = $calendar->getCalendarFor( $_GET['USR_UID'], $_GET['USR_UID'], $_GET['USR_UID'] );
global $_DBArray; //If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
$_DBArray ['availableCalendars'] = $calendarObj ['array']; $aFields['USR_CALENDAR'] = $calendarInfo['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo['CALENDAR_UID'] : "";
$_SESSION ['_DBArray'] = $_DBArray; $aFields['RANDOM'] = rand();
$calendarInfo = $calendar->getCalendarFor ( $_GET['USR_UID'], $_GET['USR_UID'], $_GET['USR_UID'] );
//If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar /////////////////////////
$aFields ['USR_CALENDAR'] = $calendarInfo ['CALENDAR_APPLIED']!='DEFAULT'? $calendarInfo ['CALENDAR_UID']:""; //SELECT USR_UID, CONCAT(USR_LASTNAME, " ", USR_FIRSTNAME) FROM USERS WHERE USR_STATUS = 1 AND USR_UID!= "@#USR_UID" ORDER BY USR_LASTNAME
$aFields['RANDOM'] = rand(); require_once 'classes/model/Users.php';
$oCriteria = new Criteria();
///////////////////////// $oCriteria->addSelectColumn( UsersPeer::USR_UID );
//SELECT USR_UID, CONCAT(USR_LASTNAME, " ", USR_FIRSTNAME) FROM USERS WHERE USR_STATUS = 1 AND USR_UID!= "@#USR_UID" ORDER BY USR_LASTNAME $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
require_once 'classes/model/Users.php'; $oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria=new Criteria(); $oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addSelectColumn( UsersPeer::USR_EMAIL );
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); $oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $oCriteria->add( UsersPeer::USR_UID, $_GET['USR_UID'], Criteria::NOT_EQUAL );
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); $oDataset = UsersPeer::doSelectRS( $oCriteria );
$oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oCriteria->add(UsersPeer::USR_STATUS,'ACTIVE'); ///////////////////////
$oCriteria->add(UsersPeer::USR_UID,$_GET['USR_UID'], Criteria::NOT_EQUAL); G::loadClass( 'configuration' );
$oDataset=UsersPeer::doSelectRS($oCriteria); $oConf = new Configurations();
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
///////////////////////
G::loadClass('configuration'); $defaultOption = isset( $oConf->aConfig['format'] ) ? $oConf->aConfig['format'] : '';
$oConf = new Configurations;
$oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS',''); $aUserInfo = array ();
$aUserInfo[] = array ('USR_UID' => 'char','USER_FULLNAME' => 'char'
$defaultOption = isset($oConf->aConfig['format'])? $oConf->aConfig['format']: ''; );
while ($oDataset->next()) {
$aUserInfo = array(); $aRow1 = $oDataset->getRow();
$aUserInfo[] = array('USR_UID' => 'char','USER_FULLNAME' => 'char');
while( $oDataset->next()){ $infoUser = G::getFormatUserList( $defaultOption, $aRow1 );
$aRow1 = $oDataset->getRow(); $aUserInfo[] = array ('USR_UID' => $aRow1['USR_UID'],'USER_FULLNAME' => $infoUser
);
$infoUser = G::getFormatUserList($defaultOption,$aRow1); }
$aUserInfo[]=array(
'USR_UID' => $aRow1['USR_UID'], //calculating the max upload file size;
'USER_FULLNAME' => $infoUser $POST_MAX_SIZE = ini_get( 'post_max_size' );
); $mul = substr( $POST_MAX_SIZE, - 1 );
} $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size'); $UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr($POST_MAX_SIZE, -1); $mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul; $uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize'); if ($postMaxSize < $uploadMaxSize)
$mul = substr($UPLOAD_MAX_SIZE, -1); $uploadMaxSize = $postMaxSize;
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); $aFields['MAX_FILES_SIZE'] = " (" . $UPLOAD_MAX_SIZE . ") ";
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
global $_DBArray;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize; $_DBArray['aUserInfo'] = $aUserInfo;
$aFields['MAX_FILES_SIZE'] = " (" . $UPLOAD_MAX_SIZE . ") "; $_SESSION['_DBArray'] = $_DBArray;
if ($_GET['USR_AUTH_SOURCE'] == 'ProcessMaker (MYSQL)') {
//always show this form users_EditRT.xml.
global $_DBArray; $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_EditRT.xml', '', $aFields, 'users_Save?USR_UID=' . $_SESSION['CURRENT_USER'] );
$_DBArray['aUserInfo'] = $aUserInfo; } else {
$_SESSION['_DBArray'] = $_DBArray; //for users ldap always show this form users_EditLDAP.xml.
if ($_GET['USR_AUTH_SOURCE'] == 'ProcessMaker (MYSQL)') { $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_EditLDAP.xml', '', $aFields, 'users_Save?USR_UID=' . $_SESSION['CURRENT_USER'] );
//always show this form users_EditRT.xml. }
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_EditRT.xml', '', $aFields, 'users_Save?USR_UID=' . $_SESSION['CURRENT_USER']);
} G::RenderPage( 'publish', 'blank' );
else { } catch (Exception $oException) {
//for users ldap always show this form users_EditLDAP.xml. die( $oException->getMessage() );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_EditLDAP.xml', '', $aFields, 'users_Save?USR_UID=' . $_SESSION['CURRENT_USER']);
}
G::RenderPage('publish','blank');
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,44 +12,42 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
/** /**
* @Description This is a callback for the View of all groups from a determinated user * ription This is a callback for the View of all groups from a determinated user
* @author Erik Amaru Ortiz <erik@colosa.com> *
* @Date 24/04/2008 * @author Erik Amaru Ortiz <erik@colosa.com>
* @LastModification none * @Date 24/04/2008
*/ * @LastModification none
*/
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case - 2: case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
case - 1: case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header('location: ../login/login'); G::header( 'location: ../login/login' );
die; die();
break; break;
} }
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('view', 'users/users_Tree' ); $G_PUBLISH->AddContent( 'view', 'users/users_Tree' );
G::RenderPage('publish', 'raw'); G::RenderPage( 'publish', 'raw' );
} catch (exception $oException) {
die( $oException->getMessage() );
} }
catch (exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,68 +1,68 @@
<?php <?php
/** /**
* users_List.php * users_List.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/ if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1)
if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response; return $RBAC_Response;
global $RBAC; global $RBAC;
$access = $RBAC->userCanAccess('PM_USERS'); $access = $RBAC->userCanAccess( 'PM_USERS' );
if( $access != 1 ){ if ($access != 1) {
switch ($access) switch ($access) {
{ case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; default:
default: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} }
}
$G_MAIN_MENU = 'processmaker';
$G_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'users';
$G_SUB_MENU = 'users'; $G_ID_MENU_SELECTED = 'USERS';
$G_ID_MENU_SELECTED = 'USERS'; $G_ID_SUB_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'USERS';
$G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher;
G::LoadClass( 'configuration' );
G::LoadClass('configuration'); $c = new Configurations();
$c = new Configurations(); $configPage = $c->getConfiguration( 'usersList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$configPage = $c->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']); $Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript( 'users/usersList', false ); //adding a javascript file .js
$oHeadPublisher->addExtJsScript('users/usersList', false); //adding a javascript file .js $oHeadPublisher->addContent( 'users/usersList' ); //adding a html file .html.
$oHeadPublisher->addContent('users/usersList'); //adding a html file .html. $oHeadPublisher->assign( 'CONFIG', $Config );
$oHeadPublisher->assign('CONFIG', $Config); $oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
$oHeadPublisher->assign('FORMATS',$c->getFormats());
G::RenderPage( 'publish', 'extJs' );
G::RenderPage('publish', 'extJs');

View File

@@ -12,106 +12,106 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
$RBAC->requirePermissions('PM_USERS'); $RBAC->requirePermissions( 'PM_USERS' );
$aFields['MESSAGE0'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; $aFields['MESSAGE0'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_USER_REGISTERED' ) ) . '!';
$aFields['MESSAGE1'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); $aFields['MESSAGE1'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_USERNAME' ) );
$aFields['MESSAGE2'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE')); $aFields['MESSAGE2'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_DUE_DATE' ) );
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS')); $aFields['MESSAGE3'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_NEW_PASS_SAME_OLD_PASS' ) );
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME')); $aFields['MESSAGE4'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_FIRSTNAME' ) );
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME')); $aFields['MESSAGE5'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_LASTNAME' ) );
$aFields['MESSAGE6'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_ERROR_UPLOADING_IMAGE_TYPE')); $aFields['MESSAGE6'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_ERROR_UPLOADING_IMAGE_TYPE' ) );
// the default role variable sets the value that will be showed as the default for the role field. // the default role variable sets the value that will be showed as the default for the role field.
$aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR'; $aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR';
$aFields['START_DATE'] = date('Y-m-d'); $aFields['START_DATE'] = date( 'Y-m-d' );
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); $aFields['END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) );
$aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)); $aFields['USR_DUE_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 1 ) );
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize'); //calculating the max upload file size;
$mul = substr($UPLOAD_MAX_SIZE, -1); $POST_MAX_SIZE = ini_get( 'post_max_size' );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); $mul = substr( $POST_MAX_SIZE, - 1 );
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul; $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize; $UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$aFields['MAX_FILES_SIZE'] = " (" . $UPLOAD_MAX_SIZE . ") "; $mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
//Load Calendar options and falue for this user if ($postMaxSize < $uploadMaxSize)
G::LoadClass ( 'calendar' ); $uploadMaxSize = $postMaxSize;
$calendar = new Calendar ( ); $aFields['MAX_FILES_SIZE'] = " (" . $UPLOAD_MAX_SIZE . ") ";
$calendarObj = $calendar->getCalendarList ( true, true );
global $_DBArray;
$_DBArray ['availableCalendars'] = $calendarObj ['array'];
$_SESSION ['_DBArray'] = $_DBArray;
// $G_MAIN_MENU = 'processmaker'; //Load Calendar options and falue for this user
// $G_ID_MENU_SELECTED = 'USERS'; G::LoadClass( 'calendar' );
$calendar = new Calendar();
$calendarObj = $calendar->getCalendarList( true, true );
global $_DBArray;
$_DBArray['availableCalendars'] = $calendarObj['array'];
$_SESSION['_DBArray'] = $_DBArray;
$G_MAIN_MENU = 'processmaker'; // $G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users'; // $G_ID_MENU_SELECTED = 'USERS';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'USERS';
/////////////////////////////
//SELECT USR_UID, CONCAT(USR_LASTNAME, " ", USR_FIRSTNAME) FROM USERS WHERE USR_STATUS = 1 ORDER BY USR_LASTNAME
require_once 'classes/model/Users.php';
$oCriteria=new Criteria();
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);
$oCriteria->add(UsersPeer::USR_STATUS,'ACTIVE');
//$oCriteria->add(UsersPeer::USR_UID,$_GET['USR_UID'], Criteria::NOT_EQUAL);
$oDataset=UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
///////////////////////
G::loadClass('configuration');
$oConf = new Configurations;
$oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS','');
$defaultOption = isset($oConf->aConfig['format'])? $oConf->aConfig['format']: ''; $G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$aUserInfo = array(); $G_ID_MENU_SELECTED = 'USERS';
$aUserInfo[] = array('USR_UID' => 'char','USER_FULLNAME' => 'char'); $G_ID_SUB_MENU_SELECTED = 'USERS';
while( $oDataset->next()){
$aRow1 = $oDataset->getRow();
$infoUser = G::getFormatUserList($defaultOption,$aRow1);
$aUserInfo[]=array(
'USR_UID' => $aRow1['USR_UID'],
'USER_FULLNAME' => $infoUser
);
}
//print_r($aUserInfo);
global $_DBArray;
$_DBArray['aUserInfo'] = $aUserInfo;
$_SESSION['_DBArray'] = $_DBArray;
/////////////////////////////
//var_dump($aFields); /////////////////////////////
$G_PUBLISH = new Publisher; //SELECT USR_UID, CONCAT(USR_LASTNAME, " ", USR_FIRSTNAME) FROM USERS WHERE USR_STATUS = 1 ORDER BY USR_LASTNAME
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_New.xml', '', $aFields, 'users_Save'); require_once 'classes/model/Users.php';
G::RenderPage('publish','blank'); $oCriteria = new Criteria();
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_EMAIL );
$oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
//$oCriteria->add(UsersPeer::USR_UID,$_GET['USR_UID'], Criteria::NOT_EQUAL);
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
///////////////////////
G::loadClass( 'configuration' );
$oConf = new Configurations();
$oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
$defaultOption = isset( $oConf->aConfig['format'] ) ? $oConf->aConfig['format'] : '';
$aUserInfo = array ();
$aUserInfo[] = array ('USR_UID' => 'char','USER_FULLNAME' => 'char'
);
while ($oDataset->next()) {
$aRow1 = $oDataset->getRow();
$infoUser = G::getFormatUserList( $defaultOption, $aRow1 );
$aUserInfo[] = array ('USR_UID' => $aRow1['USR_UID'],'USER_FULLNAME' => $infoUser
);
}
//print_r($aUserInfo);
global $_DBArray;
$_DBArray['aUserInfo'] = $aUserInfo;
$_SESSION['_DBArray'] = $_DBArray;
/////////////////////////////
//var_dump($aFields);
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_New.xml', '', $aFields, 'users_Save' );
G::RenderPage( 'publish', 'blank' );
} catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,38 +12,36 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
G::LoadClass('case'); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
foreach($_POST['USER'] as $sProcessUID => $sUserUID) { foreach ($_POST['USER'] as $sProcessUID => $sUserUID) {
if ($sUserUID != '') { if ($sUserUID != '') {
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn(AppDelegationPeer::APP_UID); $oCriteria->addSelectColumn( AppDelegationPeer::APP_UID );
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );
$oCriteria->add(AppDelegationPeer::PRO_UID, $sProcessUID); $oCriteria->add( AppDelegationPeer::PRO_UID, $sProcessUID );
$oCriteria->add(AppDelegationPeer::USR_UID, $_POST['USR_UID']); $oCriteria->add( AppDelegationPeer::USR_UID, $_POST['USR_UID'] );
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); $oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
$oDataset = AppDelegationPeer::doSelectRS($oCriteria); $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$oCase->reassignCase($aRow['APP_UID'], $aRow['DEL_INDEX'], $_SESSION['USER_LOGGED'], $sUserUID); $oCase->reassignCase( $aRow['APP_UID'], $aRow['DEL_INDEX'], $_SESSION['USER_LOGGED'], $sUserUID );
$oDataset->next(); $oDataset->next();
} }
}
} }
} } catch (Exception $oException) {
die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -12,108 +12,107 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$_GET['iStep'] = (int)$_GET['iStep']; $_GET['iStep'] = (int) $_GET['iStep'];
switch ($_GET['iStep']) { switch ($_GET['iStep']) {
case 1: case 1:
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_ReassignSelectType', '', array('USR_UID' => $_GET['USR_UID']), ''); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_ReassignSelectType', '', array ('USR_UID' => $_GET['USR_UID']
break; ), '' );
case 2: break;
switch ($_POST['TYPE']) { case 2:
case 'ANY_USER': switch ($_POST['TYPE']) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_ReassignSelectSubType', '', $_POST, ''); case 'ANY_USER':
break; $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_ReassignSelectSubType', '', $_POST, '' );
} break;
break; }
case 3: break;
switch ($_POST['SUB_TYPE']) { case 3:
case 'PROCESS': switch ($_POST['SUB_TYPE']) {
require_once 'classes/model/Users.php'; case 'PROCESS':
$oCriteria = new Criteria('workflow'); require_once 'classes/model/Users.php';
$oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria = new Criteria( 'workflow' );
/* $oCriteria->addSelectColumn( UsersPeer::USR_UID );
/*
$usr_completename_col = "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME, ' (', USR_USERNAME, ')')"; $usr_completename_col = "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME, ' (', USR_USERNAME, ')')";
*/ */
$sDataBase = 'database_' . strtolower(DB_ADAPTER); $sDataBase = 'database_' . strtolower( DB_ADAPTER );
if(G::LoadSystemExist($sDataBase)){ if (G::LoadSystemExist( $sDataBase )) {
G::LoadSystem($sDataBase); G::LoadSystem( $sDataBase );
$oDataBase = new database(); $oDataBase = new database();
$usr_completename_col = $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME", " '('", "USR_USERNAME", "')'"); $usr_completename_col = $oDataBase->concatString( "USR_LASTNAME", "' '", "USR_FIRSTNAME", " '('", "USR_USERNAME", "')'" );
} }
$oCriteria->addAsColumn('USR_COMPLETENAME', $usr_completename_col);
$oCriteria->add(UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL);
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$sUsers = '<option value=""> - ' . G::LoadTranslation('ID_NO_REASSIGN') . ' - </option>';
while ($aRow = $oDataset->getRow()) {
$sUsers .= '<option value="' . $aRow['USR_UID'] . '">' . $aRow['USR_COMPLETENAME'] . '</option>';
$oDataset->next();
}
$aProcesses = array();
$aProcesses[] = array('CHECKBOX' => 'char',
'PROCESS' => 'char',
'CANTITY' => 'char',
'USERS' => 'char');
$del = DBAdapter::getStringDelimiter();
require_once 'classes/model/AppDelegation.php';
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDelegationPeer::PRO_UID);
$oCriteria->addSelectColumn('COUNT(' . AppDelegationPeer::PRO_UID . ') AS CANTITY');
$oCriteria->addAsColumn('PRO_TITLE', ContentPeer::CON_VALUE);
$aConditions = array();
$aConditions[] = array(AppDelegationPeer::PRO_UID, ContentPeer::CON_ID);
$aConditions[] = array(ContentPeer::CON_CATEGORY, $del . 'PRO_TITLE' . $del);
$aConditions[] = array(ContentPeer::CON_LANG, $del . SYS_LANG . $del);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$oCriteria->add(AppDelegationPeer::USR_UID, $_POST['USR_UID']);
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
$oCriteria->addGroupByColumn(AppDelegationPeer::PRO_UID);
/* $oCriteria->addAsColumn( 'USR_COMPLETENAME', $usr_completename_col );
$oCriteria->add( UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL );
$oCriteria->add( UsersPeer::USR_STATUS, array ('CLOSED'
), Criteria::NOT_IN );
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$sUsers = '<option value=""> - ' . G::LoadTranslation( 'ID_NO_REASSIGN' ) . ' - </option>';
while ($aRow = $oDataset->getRow()) {
$sUsers .= '<option value="' . $aRow['USR_UID'] . '">' . $aRow['USR_COMPLETENAME'] . '</option>';
$oDataset->next();
}
$aProcesses = array ();
$aProcesses[] = array ('CHECKBOX' => 'char','PROCESS' => 'char','CANTITY' => 'char','USERS' => 'char'
);
$del = DBAdapter::getStringDelimiter();
require_once 'classes/model/AppDelegation.php';
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( AppDelegationPeer::PRO_UID );
$oCriteria->addSelectColumn( 'COUNT(' . AppDelegationPeer::PRO_UID . ') AS CANTITY' );
$oCriteria->addAsColumn( 'PRO_TITLE', ContentPeer::CON_VALUE );
$aConditions = array ();
$aConditions[] = array (AppDelegationPeer::PRO_UID,ContentPeer::CON_ID
);
$aConditions[] = array (ContentPeer::CON_CATEGORY,$del . 'PRO_TITLE' . $del
);
$aConditions[] = array (ContentPeer::CON_LANG,$del . SYS_LANG . $del
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$oCriteria->add( AppDelegationPeer::USR_UID, $_POST['USR_UID'] );
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
$oCriteria->addGroupByColumn( AppDelegationPeer::PRO_UID );
/*
* Adding grouped by standardization. * Adding grouped by standardization.
*/ */
$oCriteria->addGroupByColumn(ContentPeer::CON_VALUE); $oCriteria->addGroupByColumn( ContentPeer::CON_VALUE );
$oDataset = AppDelegationPeer::doSelectRS($oCriteria); $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$aProcesses[] = array('CHECKBOX' => '<input type="checkbox" name="PROCESS[' . $aRow['PRO_UID'] . ']" id="PROCESS[' . $aRow['PRO_UID'] . ']" />', $aProcesses[] = array ('CHECKBOX' => '<input type="checkbox" name="PROCESS[' . $aRow['PRO_UID'] . ']" id="PROCESS[' . $aRow['PRO_UID'] . ']" />','PROCESS' => $aRow['PRO_TITLE'],'CANTITY' => $aRow['CANTITY'],'USERS' => '<select name="USER[' . $aRow['PRO_UID'] . ']" id="USER[' . $aRow['PRO_UID'] . ']">' . $sUsers . '</select>'
'PROCESS' => $aRow['PRO_TITLE'], );
'CANTITY' => $aRow['CANTITY'], $oDataset->next();
'USERS' => '<select name="USER[' . $aRow['PRO_UID'] . ']" id="USER[' . $aRow['PRO_UID'] . ']">' . $sUsers . '</select>'); }
$oDataset->next(); global $_DBArray;
} $_DBArray['processesToReassign'] = $aProcesses;
global $_DBArray; $_SESSION['_DBArray'] = $_DBArray;
$_DBArray['processesToReassign'] = $aProcesses; G::LoadClass( 'ArrayPeer' );
$_SESSION['_DBArray'] = $_DBArray; $oCriteria = new Criteria( 'dbarray' );
G::LoadClass('ArrayPeer'); $oCriteria->setDBArrayTable( 'processesToReassign' );
$oCriteria = new Criteria('dbarray'); $G_PUBLISH->AddContent( 'propeltable', 'cases/paged-table-reassign', 'users/users_ReassignCases', $oCriteria, $_POST );
$oCriteria->setDBArrayTable('processesToReassign'); break;
$G_PUBLISH->AddContent('propeltable', 'cases/paged-table-reassign', 'users/users_ReassignCases', $oCriteria, $_POST); }
break; break;
} }
break; G::RenderPage( 'publish', 'raw' );
} } catch (Exception $oException) {
G::RenderPage('publish', 'raw'); die( $oException->getMessage() );
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,311 +1,297 @@
<?php <?php
/** /**
* users_Save.php * users_Save.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* */
*/
try {
global $RBAC;
try { switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
global $RBAC; case - 2:
switch ($RBAC->userCanAccess('PM_FACTORY')) G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
{ G::header( 'location: ../login/login' );
case -2: die();
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); break;
G::header('location: ../login/login'); case - 1:
die; G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
break; G::header( 'location: ../login/login' );
case -1: die();
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); break;
G::header('location: ../login/login'); }
die; if (empty( $_POST ) || ! isset( $_POST['form'] )) {
break; if (empty( $_FILES ))
} throw (new Exception( G::loadTranslation( 'ID_ERROR_UPLOADING_FILENAME' ) ));
if ( empty($_POST) || !isset($_POST['form'])) { else
if( empty($_FILES) ) throw (new Exception( G::loadTranslation( 'ID_POSTED_DATA_EMPTY' ) ));
throw ( new Exception (G::loadTranslation('ID_ERROR_UPLOADING_FILENAME') ) ); }
else
throw ( new Exception (G::loadTranslation('ID_POSTED_DATA_EMPTY') ) ); $form = $_POST['form'];
}
if (isset( $_GET['USR_UID'] )) {
$form = $_POST['form']; $form['USR_UID'] = $_GET['USR_UID'];
} else {
if ( isset($_GET['USR_UID'])) { $form['USR_UID'] = '';
$form['USR_UID'] = $_GET['USR_UID']; }
}
else { if (isset( $_FILES['form']['name']['USR_RESUME'] )) {
$form['USR_UID'] = ''; if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') {
} $form['USR_RESUME'] = $_FILES['form']['name']['USR_RESUME'];
} else {
if ( isset($_FILES['form']['name']['USR_RESUME']) ) { $form['USR_RESUME'] = '';
if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') { }
$form['USR_RESUME'] = $_FILES['form']['name']['USR_RESUME']; }
}
else { if (! isset( $form['USR_NEW_PASS'] )) {
$form['USR_RESUME'] = ''; $form['USR_NEW_PASS'] = '';
} }
} if ($form['USR_NEW_PASS'] != '') {
$form['USR_PASSWORD'] = md5( $form['USR_NEW_PASS'] );
if (!isset($form['USR_NEW_PASS'])) { }
$form['USR_NEW_PASS'] = ''; if (! isset( $form['USR_CITY'] )) {
} $form['USR_CITY'] = '';
if ($form['USR_NEW_PASS'] != '') { }
$form['USR_PASSWORD'] = md5($form['USR_NEW_PASS']); if (! isset( $form['USR_LOCATION'] )) {
} $form['USR_LOCATION'] = '';
if (!isset($form['USR_CITY'])) { }
$form['USR_CITY'] = ''; if (! isset( $form['USR_AUTH_USER_DN'] )) {
} $form['USR_AUTH_USER_DN'] = '';
if (!isset($form['USR_LOCATION'])) { }
$form['USR_LOCATION'] = ''; if ($form['USR_UID'] == '') {
} $aData['USR_USERNAME'] = $form['USR_USERNAME'];
if (!isset($form['USR_AUTH_USER_DN'])) { $aData['USR_PASSWORD'] = $form['USR_PASSWORD'];
$form['USR_AUTH_USER_DN'] = ''; $aData['USR_FIRSTNAME'] = $form['USR_FIRSTNAME'];
} $aData['USR_LASTNAME'] = $form['USR_LASTNAME'];
if ($form['USR_UID'] == '') { $aData['USR_EMAIL'] = $form['USR_EMAIL'];
$aData['USR_USERNAME'] = $form['USR_USERNAME']; $aData['USR_DUE_DATE'] = $form['USR_DUE_DATE'];
$aData['USR_PASSWORD'] = $form['USR_PASSWORD']; $aData['USR_CREATE_DATE'] = date( 'Y-m-d H:i:s' );
$aData['USR_FIRSTNAME'] = $form['USR_FIRSTNAME']; $aData['USR_UPDATE_DATE'] = date( 'Y-m-d H:i:s' );
$aData['USR_LASTNAME'] = $form['USR_LASTNAME']; $aData['USR_BIRTHDAY'] = date( 'Y-m-d' );
$aData['USR_EMAIL'] = $form['USR_EMAIL']; $aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN'];
$aData['USR_DUE_DATE'] = $form['USR_DUE_DATE']; //fixing bug in inactive user when the admin create a new user.
$aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s'); $statusWF = $form['USR_STATUS'];
$aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aData['USR_STATUS'] = $form['USR_STATUS'] == 'ACTIVE' ? 1 : 0;
$aData['USR_BIRTHDAY'] = date('Y-m-d'); $sUserUID = $RBAC->createUser( $aData, $form['USR_ROLE'] );
$aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN']; $aData['USR_STATUS'] = $statusWF;
//fixing bug in inactive user when the admin create a new user. $aData['USR_UID'] = $sUserUID;
$statusWF = $form['USR_STATUS']; $aData['USR_PASSWORD'] = md5( $sUserUID ); //fake :p
$aData['USR_STATUS'] = $form['USR_STATUS'] == 'ACTIVE' ? 1 : 0; $aData['USR_COUNTRY'] = $form['USR_COUNTRY'];
$sUserUID = $RBAC->createUser($aData, $form['USR_ROLE'] ); $aData['USR_CITY'] = $form['USR_CITY'];
$aData['USR_STATUS'] = $statusWF; $aData['USR_LOCATION'] = $form['USR_LOCATION'];
$aData['USR_UID'] = $sUserUID; $aData['USR_ADDRESS'] = $form['USR_ADDRESS'];
$aData['USR_PASSWORD'] = md5($sUserUID);//fake :p $aData['USR_PHONE'] = $form['USR_PHONE'];
$aData['USR_COUNTRY'] = $form['USR_COUNTRY']; $aData['USR_ZIP_CODE'] = $form['USR_ZIP_CODE'];
$aData['USR_CITY'] = $form['USR_CITY']; $aData['USR_POSITION'] = $form['USR_POSITION'];
$aData['USR_LOCATION'] = $form['USR_LOCATION']; // Commented by removal of resume in the addition and modification of user.
$aData['USR_ADDRESS'] = $form['USR_ADDRESS']; // $aData['USR_RESUME'] = $form['USR_RESUME'];
$aData['USR_PHONE'] = $form['USR_PHONE']; $aData['USR_ROLE'] = $form['USR_ROLE'];
$aData['USR_ZIP_CODE'] = $form['USR_ZIP_CODE']; $aData['USR_REPLACED_BY'] = $form['USR_REPLACED_BY'];
$aData['USR_POSITION'] = $form['USR_POSITION'];
// Commented by removal of resume in the addition and modification of user. require_once 'classes/model/Users.php';
// $aData['USR_RESUME'] = $form['USR_RESUME']; $oUser = new Users();
$aData['USR_ROLE'] = $form['USR_ROLE']; $oUser->create( $aData );
$aData['USR_REPLACED_BY'] = $form['USR_REPLACED_BY']; if ($_FILES['form']['error']['USR_PHOTO'] != 1) {
if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') {
G::uploadFile( $_FILES['form']['tmp_name']['USR_PHOTO'], PATH_IMAGES_ENVIRONMENT_USERS, $sUserUID . '.gif' );
require_once 'classes/model/Users.php'; }
$oUser = new Users(); } else {
$oUser->create($aData); G::SendTemporalMessage( 'ID_FILE_TOO_BIG', 'error' );
if ($_FILES['form']['error']['USR_PHOTO'] != 1) { }
if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') { if ($_FILES['form']['error']['USR_RESUME'] != 1) {
G::uploadFile($_FILES['form']['tmp_name']['USR_PHOTO'], PATH_IMAGES_ENVIRONMENT_USERS, $sUserUID . '.gif'); if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') {
} G::uploadFile( $_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $sUserUID . '/', $_FILES['form']['name']['USR_RESUME'] );
} }
else { } else {
G::SendTemporalMessage ('ID_FILE_TOO_BIG', 'error'); G::SendTemporalMessage( 'ID_FILE_TOO_BIG', 'error' );
} }
if ($_FILES['form']['error']['USR_RESUME'] != 1) { } else {
if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') { $aData['USR_UID'] = $form['USR_UID'];
G::uploadFile($_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $sUserUID . '/', $_FILES['form']['name']['USR_RESUME']); $aData['USR_USERNAME'] = $form['USR_USERNAME'];
}
} if (isset( $form['USR_PASSWORD'] )) {
else { if ($form['USR_PASSWORD'] != '') {
G::SendTemporalMessage ('ID_FILE_TOO_BIG', 'error'); $aData['USR_PASSWORD'] = $form['USR_PASSWORD'];
} require_once 'classes/model/UsersProperties.php';
} $oUserProperty = new UsersProperties();
else { $aUserProperty = $oUserProperty->loadOrCreateIfNotExists( $form['USR_UID'], array ('USR_PASSWORD_HISTORY' => serialize( array (md5( $form['USR_PASSWORD'] )
$aData['USR_UID'] = $form['USR_UID']; ) )
$aData['USR_USERNAME'] = $form['USR_USERNAME']; ) );
if (isset($form['USR_PASSWORD'])) { $RBAC->loadUserRolePermission( 'PROCESSMAKER', $_SESSION['USER_LOGGED'] );
if ($form['USR_PASSWORD'] != '') { if ($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'] == 'PROCESSMAKER_ADMIN') {
$aData['USR_PASSWORD'] = $form['USR_PASSWORD']; $aUserProperty['USR_LAST_UPDATE_DATE'] = date( 'Y-m-d H:i:s' );
require_once 'classes/model/UsersProperties.php'; $aUserProperty['USR_LOGGED_NEXT_TIME'] = 1;
$oUserProperty = new UsersProperties(); $oUserProperty->update( $aUserProperty );
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($form['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($form['USR_PASSWORD']))))); }
$RBAC->loadUserRolePermission( 'PROCESSMAKER', $_SESSION['USER_LOGGED'] ); $aErrors = $oUserProperty->validatePassword( $form['USR_NEW_PASS'], $aUserProperty['USR_LAST_UPDATE_DATE'], 0 );
if( $RBAC->aUserInfo[ 'PROCESSMAKER' ]['ROLE']['ROL_CODE']=='PROCESSMAKER_ADMIN'){ if (count( $aErrors ) > 0) {
$aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s'); $sDescription = G::LoadTranslation( 'ID_POLICY_ALERT' ) . ':<br /><br />';
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 1; foreach ($aErrors as $sError) {
$oUserProperty->update($aUserProperty); switch ($sError) {
} case 'ID_PPP_MINIMUN_LENGTH':
$sDescription .= ' - ' . G::LoadTranslation( $sError ) . ': ' . PPP_MINIMUN_LENGTH . '<br />';
$aErrors = $oUserProperty->validatePassword($form['USR_NEW_PASS'], $aUserProperty['USR_LAST_UPDATE_DATE'], 0); break;
if (count($aErrors) > 0) { case 'ID_PPP_MAXIMUN_LENGTH':
$sDescription = G::LoadTranslation('ID_POLICY_ALERT').':<br /><br />'; $sDescription .= ' - ' . G::LoadTranslation( $sError ) . ': ' . PPP_MAXIMUN_LENGTH . '<br />';
foreach ($aErrors as $sError) { break;
switch ($sError) { case 'ID_PPP_EXPIRATION_IN':
case 'ID_PPP_MINIMUN_LENGTH': $sDescription .= ' - ' . G::LoadTranslation( $sError ) . ' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation( 'ID_DAYS' ) . '<br />';
$sDescription .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MINIMUN_LENGTH . '<br />'; break;
break; default:
case 'ID_PPP_MAXIMUN_LENGTH': $sDescription .= ' - ' . G::LoadTranslation( $sError ) . '<br />';
$sDescription .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MAXIMUN_LENGTH . '<br />'; break;
break; }
case 'ID_PPP_EXPIRATION_IN': }
$sDescription .= ' - ' . G::LoadTranslation($sError).' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation('ID_DAYS') . '<br />'; $sDescription .= '<br />' . G::LoadTranslation( 'ID_PLEASE_CHANGE_PASSWORD_POLICY' );
break; G::SendMessageText( $sDescription, 'warning' );
default: G::header( 'Location: ' . $_SERVER['HTTP_REFERER'] );
$sDescription .= ' - ' . G::LoadTranslation($sError).'<br />'; die();
break; }
} $aHistory = unserialize( $aUserProperty['USR_PASSWORD_HISTORY'] );
} if (! is_array( $aHistory )) {
$sDescription .= '<br />' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY'); $aHistory = array ();
G::SendMessageText($sDescription, 'warning'); }
G::header('Location: ' . $_SERVER['HTTP_REFERER']); if (! defined( 'PPP_PASSWORD_HISTORY' )) {
die; define( 'PPP_PASSWORD_HISTORY', 0 );
} }
$aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']); if (PPP_PASSWORD_HISTORY > 0) {
if (!is_array($aHistory)) { //it's looking a password igual into aHistory array that was send for post in md5 way
$aHistory = array(); $c = 0;
} $sw = 1;
if (!defined('PPP_PASSWORD_HISTORY')) { while (count( $aHistory ) >= 1 && count( $aHistory ) > $c && $sw) {
define('PPP_PASSWORD_HISTORY', 0); if (strcmp( trim( $aHistory[$c] ), trim( $form['USR_PASSWORD'] ) ) == 0) {
} $sw = 0;
if (PPP_PASSWORD_HISTORY > 0) { }
//it's looking a password igual into aHistory array that was send for post in md5 way $c ++;
$c=0;$sw=1; }
while(count($aHistory) >= 1 && count($aHistory)>$c && $sw ){ if ($sw == 0) {
if(strcmp(trim($aHistory[$c]),trim($form['USR_PASSWORD'])) == 0){ $sDescription = G::LoadTranslation( 'ID_POLICY_ALERT' ) . ':<br /><br />';
$sw=0; $sDescription .= ' - ' . G::LoadTranslation( 'PASSWORD_HISTORY' ) . ': ' . PPP_PASSWORD_HISTORY . '<br />';
} $sDescription .= '<br />' . G::LoadTranslation( 'ID_PLEASE_CHANGE_PASSWORD_POLICY' ) . '';
$c++; G::SendMessageText( $sDescription, 'warning' );
} G::header( 'Location: ' . $_SERVER['HTTP_REFERER'] );
if($sw == 0){ die();
$sDescription = G::LoadTranslation('ID_POLICY_ALERT').':<br /><br />'; }
$sDescription .= ' - ' . G::LoadTranslation('PASSWORD_HISTORY').': ' . PPP_PASSWORD_HISTORY . '<br />'; //
$sDescription .= '<br />' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY').''; if (count( $aHistory ) >= PPP_PASSWORD_HISTORY) {
G::SendMessageText($sDescription, 'warning'); $sLastPassw = array_shift( $aHistory );
G::header('Location: ' . $_SERVER['HTTP_REFERER']); }
die; $aHistory[] = $form['USR_PASSWORD'];
} }
// $aUserProperty['USR_LAST_UPDATE_DATE'] = date( 'Y-m-d H:i:s' );
if (count($aHistory) >= PPP_PASSWORD_HISTORY) { $aUserProperty['USR_LOGGED_NEXT_TIME'] = 1;
$sLastPassw=array_shift($aHistory); $aUserProperty['USR_PASSWORD_HISTORY'] = serialize( $aHistory );
} $oUserProperty->update( $aUserProperty );
$aHistory[] = $form['USR_PASSWORD']; }
} }
$aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aData['USR_FIRSTNAME'] = $form['USR_FIRSTNAME'];
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 1; $aData['USR_LASTNAME'] = $form['USR_LASTNAME'];
$aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory); $aData['USR_EMAIL'] = $form['USR_EMAIL'];
$oUserProperty->update($aUserProperty); $aData['USR_DUE_DATE'] = $form['USR_DUE_DATE'];
} $aData['USR_UPDATE_DATE'] = date( 'Y-m-d H:i:s' );
} if (isset( $form['USR_STATUS'] )) {
$aData['USR_FIRSTNAME'] = $form['USR_FIRSTNAME']; $aData['USR_STATUS'] = $form['USR_STATUS'];
$aData['USR_LASTNAME'] = $form['USR_LASTNAME']; }
$aData['USR_EMAIL'] = $form['USR_EMAIL']; if (isset( $form['USR_ROLE'] )) {
$aData['USR_DUE_DATE'] = $form['USR_DUE_DATE']; $RBAC->updateUser( $aData, $form['USR_ROLE'] );
$aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); } else {
if (isset($form['USR_STATUS'])) { $RBAC->updateUser( $aData );
$aData['USR_STATUS'] = $form['USR_STATUS']; }
} $aData['USR_COUNTRY'] = $form['USR_COUNTRY'];
if (isset($form['USR_ROLE'])) { $aData['USR_CITY'] = $form['USR_CITY'];
$RBAC->updateUser($aData, $form['USR_ROLE']); $aData['USR_LOCATION'] = $form['USR_LOCATION'];
} $aData['USR_ADDRESS'] = $form['USR_ADDRESS'];
else { $aData['USR_PHONE'] = $form['USR_PHONE'];
$RBAC->updateUser($aData); $aData['USR_ZIP_CODE'] = $form['USR_ZIP_CODE'];
} $aData['USR_POSITION'] = $form['USR_POSITION'];
$aData['USR_COUNTRY'] = $form['USR_COUNTRY'];
$aData['USR_CITY'] = $form['USR_CITY']; if ($form['USR_RESUME'] != '') {
$aData['USR_LOCATION'] = $form['USR_LOCATION']; $aData['USR_RESUME'] = $form['USR_RESUME'];
$aData['USR_ADDRESS'] = $form['USR_ADDRESS']; }
$aData['USR_PHONE'] = $form['USR_PHONE']; if (isset( $form['USR_ROLE'] )) {
$aData['USR_ZIP_CODE'] = $form['USR_ZIP_CODE']; $aData['USR_ROLE'] = $form['USR_ROLE'];
$aData['USR_POSITION'] = $form['USR_POSITION']; }
if ($form['USR_RESUME'] != '') { if (isset( $form['USR_REPLACED_BY'] )) {
$aData['USR_RESUME'] = $form['USR_RESUME']; $aData['USR_REPLACED_BY'] = $form['USR_REPLACED_BY'];
} }
if (isset($form['USR_ROLE'])) { if (isset( $form['USR_AUTH_USER_DN'] )) {
$aData['USR_ROLE'] = $form['USR_ROLE']; $aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN'];
} }
if(isset($form['USR_REPLACED_BY'])){ require_once 'classes/model/Users.php';
$aData['USR_REPLACED_BY'] = $form['USR_REPLACED_BY']; $oUser = new Users();
} $oUser->update( $aData );
if(isset($form['USR_AUTH_USER_DN'])){ $aExtensions = array ("AIS","BMP","BW","CDR","CDT","CGM","CMX","CPT","DCX","DIB","EMF","GBR","GIF","GIH","ICO","IFF","ILBM","JFIF","JIF","JPE","JPEG","JPG","KDC","LBM","MAC","PAT","PCD","PCT","PCX","PIC","PICT","PNG","PNTG","PIX","PSD","PSP","QTI","QTIF","RGB","RGBA","RIF","RLE","SGI","TGA","TIF","TIFF","WMF","XCF"
$aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN']; );
}
$sPhotoFile = $_FILES['form']['name']['USR_PHOTO'];
require_once 'classes/model/Users.php'; $aPhotoFile = explode( '.', $sPhotoFile );
$oUser = new Users(); $sExtension = strtoupper( $aPhotoFile[sizeof( $aPhotoFile ) - 1] );
$oUser->update($aData); if ((strlen( $sPhotoFile ) > 0) && (! in_array( $sExtension, $aExtensions ))) {
$aExtensions = array ( "AIS", "BMP", "BW", "CDR", "CDT", "CGM", "CMX", "CPT", "DCX", "DIB", throw (new Exception( G::LoadTranslation( 'ID_ERROR_UPLOADING_IMAGE_TYPE' ) ));
"EMF", "GBR", "GIF", "GIH", "ICO", "IFF", "ILBM", "JFIF", "JIF", "JPE", }
"JPEG", "JPG", "KDC", "LBM", "MAC", "PAT", "PCD", "PCT", "PCX", "PIC", if ($_FILES['form']['error']['USR_PHOTO'] != 1) {
"PICT", "PNG", "PNTG", "PIX", "PSD", "PSP", "QTI", "QTIF", "RGB", "RGBA", if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') {
"RIF", "RLE", "SGI", "TGA", "TIF", "TIFF", "WMF", "XCF" $aAux = explode( '.', $_FILES['form']['name']['USR_PHOTO'] );
); G::uploadFile( $_FILES['form']['tmp_name']['USR_PHOTO'], PATH_IMAGES_ENVIRONMENT_USERS, $aData['USR_UID'] . '.' . $aAux[1] );
G::resizeImage( PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.' . $aAux[1], 96, 96, PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.gif' );
$sPhotoFile = $_FILES['form']['name']['USR_PHOTO']; }
$aPhotoFile = explode('.', $sPhotoFile); } else {
$sExtension = strtoupper ($aPhotoFile[sizeof($aPhotoFile)-1]); G::SendTemporalMessage( 'ID_FILE_TOO_BIG', 'error' );
if ((strlen($sPhotoFile) > 0) && (! in_array($sExtension, $aExtensions)) ) { }
throw ( new Exception ( G::LoadTranslation( 'ID_ERROR_UPLOADING_IMAGE_TYPE' )) ); if ($_FILES['form']['error']['USR_RESUME'] != 1) {
} if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') {
if ($_FILES['form']['error']['USR_PHOTO'] != 1) { G::uploadFile( $_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $aData['USR_UID'] . '/', $_FILES['form']['name']['USR_RESUME'] );
if ($_FILES['form']['tmp_name']['USR_PHOTO'] != '') { }
$aAux = explode('.', $_FILES['form']['name']['USR_PHOTO']); } else {
G::uploadFile($_FILES['form']['tmp_name']['USR_PHOTO'], PATH_IMAGES_ENVIRONMENT_USERS, $aData['USR_UID'] . '.' . $aAux[1]); G::SendTemporalMessage( 'ID_FILE_TOO_BIG', 'error' );
G::resizeImage(PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.' . $aAux[1], 96, 96, PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.gif'); }
} }
}
else { if ($_SESSION['USER_LOGGED'] == $form['USR_UID']) {
G::SendTemporalMessage ('ID_FILE_TOO_BIG', 'error'); /*UPDATING SESSION VARIABLES*/
} $aUser = $RBAC->userObj->load( $_SESSION['USER_LOGGED'] );
if ($_FILES['form']['error']['USR_RESUME'] != 1) { $_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
if ($_FILES['form']['tmp_name']['USR_RESUME'] != '') { }
G::uploadFile($_FILES['form']['tmp_name']['USR_RESUME'], PATH_IMAGES_ENVIRONMENT_FILES . $aData['USR_UID'] . '/', $_FILES['form']['name']['USR_RESUME']);
} //Save Calendar assigment
} if ((isset( $form['USR_CALENDAR'] ))) {
else { //Save Calendar ID for this user
G::SendTemporalMessage ('ID_FILE_TOO_BIG', 'error'); G::LoadClass( "calendar" );
} $calendarObj = new Calendar();
} $calendarObj->assignCalendarTo( $aData['USR_UID'], $form['USR_CALENDAR'], 'USER' );
}
if($_SESSION['USER_LOGGED'] == $form['USR_UID']){
/*UPDATING SESSION VARIABLES*/ G::header( 'location: users_List' );
$aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']); } catch (Exception $e) {
$_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME']; $G_MAIN_MENU = 'processmaker';
} $G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = '';
//Save Calendar assigment
if((isset($form['USR_CALENDAR']))){ $aMessage = array ();
//Save Calendar ID for this user $aMessage['MESSAGE'] = $e->getMessage();
G::LoadClass("calendar"); $G_PUBLISH = new Publisher();
$calendarObj=new Calendar(); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
$calendarObj->assignCalendarTo($aData['USR_UID'],$form['USR_CALENDAR'],'USER'); G::RenderPage( 'publish', 'blank' );
}
G::header('location: users_List');
}
catch (Exception $e) {
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = '';
$aMessage = array();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank');
} }

View File

@@ -12,70 +12,64 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
{ case - 2:
case -2: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; case - 1:
case -1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header( 'location: ../login/login' );
G::header('location: ../login/login'); die();
die; break;
break; }
} // deprecated the class XmlForm_Field_Image is currently part of the class.xmlform.php package
// deprecated the class XmlForm_Field_Image is currently part of the class.xmlform.php package // the use of the external xmlfield_Image is highly discouraged
// the use of the external xmlfield_Image is highly discouraged if (! class_exists( 'XmlForm_Field_Image' )) {
if (!class_exists('XmlForm_Field_Image')){ G::LoadClass( 'xmlfield_Image' );
G::LoadClass('xmlfield_Image'); }
} require_once 'classes/model/Users.php';
require_once 'classes/model/Users.php'; $_SESSION['CURRENT_USER'] = $_GET['USR_UID'];
$_SESSION['CURRENT_USER'] = $_GET['USR_UID']; $oUser = new Users();
$oUser = new Users(); $aFields = $oUser->load( $_GET['USR_UID'] );
$aFields = $oUser->load($_GET['USR_UID']); $aFields['USR_PASSWORD'] = '********';
$aFields['USR_PASSWORD'] = '********'; $aFields['MESSAGE0'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_USER_REGISTERED' ) ) . '!';
$aFields['MESSAGE0'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; $aFields['MESSAGE1'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_USERNAME' ) );
$aFields['MESSAGE1'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); $aFields['MESSAGE2'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_DUE_DATE' ) );
$aFields['MESSAGE2'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE')); $aFields['MESSAGE3'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_NEW_PASS_SAME_OLD_PASS' ) );
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS')); $aFields['MESSAGE4'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_FIRSTNAME' ) );
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME')); $aFields['MESSAGE5'] = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_ERROR_USR_LASTNAME' ) );
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME')); $aFields['NO_RESUME'] = G::LoadTranslation( 'ID_NO_RESUME' );
$aFields['NO_RESUME'] = G::LoadTranslation('ID_NO_RESUME'); $aFields['START_DATE'] = date( 'Y-m-d' );
$aFields['START_DATE'] = date('Y-m-d'); $aFields['END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) );
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); $aFields['RANDOM'] = rand();
$aFields['RANDOM'] = rand(); $G_MAIN_MENU = 'processmaker';
$G_MAIN_MENU = 'processmaker'; $G_ID_MENU_SELECTED = 'USERS';
$G_ID_MENU_SELECTED = 'USERS'; $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher; $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_View.xml', '', $aFields );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_View.xml', '', $aFields); krumo( $_SESSION );
krumo($_SESSION); if ($_GET['USR_UID'] == '00000000000000000000000000000001') { //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_ViewAdmin.xml', '', $aFields);
if($_GET['USR_UID']=='00000000000000000000000000000001') // administrator due date must have a longer range
{ //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_ViewAdmin.xml', '', $aFields); $aFields['END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 10 ) );
// administrator due date must have a longer range krumo( "asdasd" );
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 10)); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_EditAdmin.xml', 'display:none', $aFields, 'users_Save?USR_UID=' . $_SESSION['CURRENT_USER'] );
krumo("asdasd"); } else {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_EditAdmin.xml', 'display:none', $aFields, 'users_Save?USR_UID=' . $_SESSION['CURRENT_USER']); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'users/users_Edit.xml', 'display:none', $aFields, 'users_Save?USR_UID=' . $_SESSION['CURRENT_USER'] );
} }
else G::RenderPage( 'publish' );
{ } catch (Exception $oException) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'users/users_Edit.xml', 'display:none', $aFields, 'users_Save?USR_UID=' . $_SESSION['CURRENT_USER']); die( $oException->getMessage() );
}
G::RenderPage('publish');
} }
catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* users_ViewPhoto.php * users_ViewPhoto.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,89 +12,87 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1)
return $RBAC_Response;
$direction = PATH_IMAGES_ENVIRONMENT_USERS . $uid = (isset($_SESSION['CURRENT_USER']) ? $_SESSION['CURRENT_USER'] : $_SESSION['USER_LOGGED']).".gif"; $direction = PATH_IMAGES_ENVIRONMENT_USERS . $uid = (isset( $_SESSION['CURRENT_USER'] ) ? $_SESSION['CURRENT_USER'] : $_SESSION['USER_LOGGED']) . ".gif";
// header('Pragma: '); // header('Pragma: ');
// header('Cache-Control: cache'); // header('Cache-Control: cache');
if (!file_exists($direction))
{ if (! file_exists( $direction )) {
$direction = PATH_HOME . 'public_html/images/user.gif'; $direction = PATH_HOME . 'public_html/images/user.gif';
} }
G::sendHeaders( $direction ); G::sendHeaders( $direction );
DumpHeaders($direction);
DumpHeaders( $direction );
/* /*
* This function is verified to work with Netscape and the *very latest* * This function is verified to work with Netscape and the *very latest*
* version of IE. I don't know if it works with Opera, but it should now. * version of IE. I don't know if it works with Opera, but it should now.
*/ */
function DumpHeaders($filename) function DumpHeaders ($filename)
{ {
global $root_path; global $root_path;
if (!$filename) return; if (! $filename)
return;
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
$isIE = 0; $isIE = 0;
if (strstr( $HTTP_USER_AGENT, 'compatible; MSIE ' ) !== false && strstr( $HTTP_USER_AGENT, 'Opera' ) === false) {
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false &&
strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE = 1; $isIE = 1;
} }
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE 6') !== false && if (strstr( $HTTP_USER_AGENT, 'compatible; MSIE 6' ) !== false && strstr( $HTTP_USER_AGENT, 'Opera' ) === false) {
strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE6 = 1; $isIE6 = 1;
} }
$aux = preg_replace('[^-a-zA-Z0-9\.]', '_', $filename); $aux = preg_replace( '[^-a-zA-Z0-9\.]', '_', $filename );
$aux = explode ('_', $aux); $aux = explode( '_', $aux );
$downloadName = $aux[ count($aux)-1 ]; $downloadName = $aux[count( $aux ) - 1];
// $downloadName = $filename; // $downloadName = $filename;
//$downloadName = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename); //$downloadName = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename);
if ($isIE && !isset($isIE6)) {
// http://support.microsoft.com/support/kb/articles/Q182/3/15.asp
// Do not have quotes around filename, but that applied to
// "attachment"... does it apply to inline too?
// This combination seems to work mostly. IE 5.5 SP 1 has if ($isIE && ! isset( $isIE6 )) {
// known issues (see the Microsoft Knowledge Base) // http://support.microsoft.com/support/kb/articles/Q182/3/15.asp
header("Content-Disposition: inline; filename=$downloadName"); // Do not have quotes around filename, but that applied to
// "attachment"... does it apply to inline too?
// This works for most types, but doesn't work with Word files
header("Content-Type: application/download; name=\"$downloadName\"");
//header("Content-Type: $type0/$type1; name=\"$downloadName\""); // This combination seems to work mostly. IE 5.5 SP 1 has
//header("Content-Type: application/x-msdownload; name=\"$downloadName\""); // known issues (see the Microsoft Knowledge Base)
//header("Content-Type: application/octet-stream; name=\"$downloadName\""); header( "Content-Disposition: inline; filename=$downloadName" );
}
else { // This works for most types, but doesn't work with Word files
header("Content-Disposition: attachment; filename=\"$downloadName\""); header( "Content-Type: application/download; name=\"$downloadName\"" );
header("Content-Type: application/octet-stream; name=\"$downloadName\"");
//header("Content-Type: $type0/$type1; name=\"$downloadName\"");
//header("Content-Type: application/x-msdownload; name=\"$downloadName\"");
//header("Content-Type: application/octet-stream; name=\"$downloadName\"");
} else {
header( "Content-Disposition: attachment; filename=\"$downloadName\"" );
header( "Content-Type: application/octet-stream; name=\"$downloadName\"" );
} }
//$filename = PATH_UPLOAD . "$filename"; //$filename = PATH_UPLOAD . "$filename";
readfile($filename); readfile( $filename );
} }
//G::header2( "location: /files/" .$_SESSION['ENVIRONMENT']. "/" .$appid, $filename); //G::header2( "location: /files/" .$_SESSION['ENVIRONMENT']. "/" .$appid, $filename);
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* users_ViewPhoto.php * users_ViewPhoto.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,87 +12,82 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1)
return $RBAC_Response;
$direction = PATH_IMAGES_ENVIRONMENT_USERS . $_REQUEST['pUID'] . ".gif"; $direction = PATH_IMAGES_ENVIRONMENT_USERS . $_REQUEST['pUID'] . ".gif";
// header('Pragma: '); // header('Pragma: ');
// header('Cache-Control: cache'); // header('Cache-Control: cache');
if (!file_exists($direction))
{ if (! file_exists( $direction )) {
$direction = PATH_HOME . 'public_html/images/user.gif'; $direction = PATH_HOME . 'public_html/images/user.gif';
} }
G::sendHeaders( $direction ); G::sendHeaders( $direction );
DumpHeaders($direction);
DumpHeaders( $direction );
/* /*
* This function is verified to work with Netscape and the *very latest* * This function is verified to work with Netscape and the *very latest*
* version of IE. I don't know if it works with Opera, but it should now. * version of IE. I don't know if it works with Opera, but it should now.
*/ */
function DumpHeaders($filename) function DumpHeaders ($filename)
{ {
global $root_path; global $root_path;
if (!$filename) return; if (! $filename)
return;
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
$isIE = 0; $isIE = 0;
if (strstr( $HTTP_USER_AGENT, 'compatible; MSIE ' ) !== false && strstr( $HTTP_USER_AGENT, 'Opera' ) === false) {
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false &&
strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE = 1; $isIE = 1;
} }
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE 6') !== false && if (strstr( $HTTP_USER_AGENT, 'compatible; MSIE 6' ) !== false && strstr( $HTTP_USER_AGENT, 'Opera' ) === false) {
strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE6 = 1; $isIE6 = 1;
} }
$aux = preg_replace('[^-a-zA-Z0-9\.]', '_', $filename); $aux = preg_replace( '[^-a-zA-Z0-9\.]', '_', $filename );
$aux = explode ('_', $aux); $aux = explode( '_', $aux );
$downloadName = $aux[ count($aux)-1 ]; $downloadName = $aux[count( $aux ) - 1];
if ($isIE && ! isset( $isIE6 )) {
// http://support.microsoft.com/support/kb/articles/Q182/3/15.asp
// Do not have quotes around filename, but that applied to
// "attachment"... does it apply to inline too?
if ($isIE && !isset($isIE6)) { // This combination seems to work mostly. IE 5.5 SP 1 has
// http://support.microsoft.com/support/kb/articles/Q182/3/15.asp // known issues (see the Microsoft Knowledge Base)
// Do not have quotes around filename, but that applied to header( "Content-Disposition: inline; filename=$downloadName" );
// "attachment"... does it apply to inline too?
// This combination seems to work mostly. IE 5.5 SP 1 has // This works for most types, but doesn't work with Word files
// known issues (see the Microsoft Knowledge Base) header( "Content-Type: application/download; name=\"$downloadName\"" );
header("Content-Disposition: inline; filename=$downloadName");
// This works for most types, but doesn't work with Word files //header("Content-Type: $type0/$type1; name=\"$downloadName\"");
header("Content-Type: application/download; name=\"$downloadName\""); //header("Content-Type: application/x-msdownload; name=\"$downloadName\"");
//header("Content-Type: application/octet-stream; name=\"$downloadName\"");
//header("Content-Type: $type0/$type1; name=\"$downloadName\""); } else {
//header("Content-Type: application/x-msdownload; name=\"$downloadName\""); header( "Content-Disposition: attachment; filename=\"$downloadName\"" );
//header("Content-Type: application/octet-stream; name=\"$downloadName\""); header( "Content-Type: application/octet-stream; name=\"$downloadName\"" );
}
else {
header("Content-Disposition: attachment; filename=\"$downloadName\"");
header("Content-Type: application/octet-stream; name=\"$downloadName\"");
} }
//$filename = PATH_UPLOAD . "$filename"; //$filename = PATH_UPLOAD . "$filename";
readfile($filename); readfile( $filename );
} }
//G::header2( "location: /files/" .$_SESSION['ENVIRONMENT']. "/" .$appid, $filename); //G::header2( "location: /files/" .$_SESSION['ENVIRONMENT']. "/" .$appid, $filename);
?>

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* users_ViewResume.php * users_ViewResume.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -12,97 +12,97 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response; if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1)
return $RBAC_Response;
G::LoadClass( "user" ); G::LoadClass( "user" );
$uid = (isset($_SESSION['CURRENT_USER']) ? $_SESSION['CURRENT_USER'] : $_SESSION['USER_LOGGED']); $uid = (isset( $_SESSION['CURRENT_USER'] ) ? $_SESSION['CURRENT_USER'] : $_SESSION['USER_LOGGED']);
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oUser = new Users(); $oUser = new Users();
$form = $oUser->load($uid); $form = $oUser->load( $uid );
if (!isset($form['USR_RESUME']) || $form['USR_RESUME']==='') die(G::LoadTranslation('ID_WITHOUT_RESUME')); if (! isset( $form['USR_RESUME'] ) || $form['USR_RESUME'] === '')
$direction = PATH_IMAGES_ENVIRONMENT_FILES.$uid."/".$form['USR_RESUME']; die( G::LoadTranslation( 'ID_WITHOUT_RESUME' ) );
if (!file_exists($direction)) { $direction = PATH_IMAGES_ENVIRONMENT_FILES . $uid . "/" . $form['USR_RESUME'];
die('The file "' . $direction . '"doesn\'t exist in the server!'); if (! file_exists( $direction )) {
die( 'The file "' . $direction . '"doesn\'t exist in the server!' );
} }
// echo $direction ; // echo $direction ;
header('Pragma: '); header( 'Pragma: ' );
header('Cache-Control: cache'); header( 'Cache-Control: cache' );
G::sendHeaders( $direction );
G::sendHeaders($direction); readfile( $direction );
readfile($direction);
//DumpHeaders($direction); //DumpHeaders($direction);
/* /*
* This function is verified to work with Netscape and the *very latest* * This function is verified to work with Netscape and the *very latest*
* version of IE. I don't know if it works with Opera, but it should now. * version of IE. I don't know if it works with Opera, but it should now.
*/ */
function DumpHeaders($filename) function DumpHeaders ($filename)
{ {
global $root_path; global $root_path;
if (!$filename) return; if (! $filename)
return;
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
$isIE = 0; $isIE = 0;
if (strstr( $HTTP_USER_AGENT, 'compatible; MSIE ' ) !== false && strstr( $HTTP_USER_AGENT, 'Opera' ) === false) {
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false &&
strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE = 1; $isIE = 1;
} }
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE 6') !== false && if (strstr( $HTTP_USER_AGENT, 'compatible; MSIE 6' ) !== false && strstr( $HTTP_USER_AGENT, 'Opera' ) === false) {
strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE6 = 1; $isIE6 = 1;
} }
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0. // The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
// $aux = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename); // $aux = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename);
$aux = preg_replace('/[^-a-zA-Z0-9\.]/', '_', $filename); $aux = preg_replace( '/[^-a-zA-Z0-9\.]/', '_', $filename );
$aux = explode ('_', $aux); $aux = explode( '_', $aux );
$downloadName = $aux[ count($aux)-1 ]; $downloadName = $aux[count( $aux ) - 1];
// $downloadName = $filename; // $downloadName = $filename;
//$downloadName = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename); //$downloadName = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename);
if ($isIE && !isset($isIE6)) {
// http://support.microsoft.com/support/kb/articles/Q182/3/15.asp
// Do not have quotes around filename, but that applied to
// "attachment"... does it apply to inline too?
// This combination seems to work mostly. IE 5.5 SP 1 has if ($isIE && ! isset( $isIE6 )) {
// known issues (see the Microsoft Knowledge Base) // http://support.microsoft.com/support/kb/articles/Q182/3/15.asp
header("Content-Disposition: inline; filename=$downloadName"); // Do not have quotes around filename, but that applied to
// "attachment"... does it apply to inline too?
// This works for most types, but doesn't work with Word files
header("Content-Type: application/download; name=\"$downloadName\"");
//header("Content-Type: $type0/$type1; name=\"$downloadName\""); // This combination seems to work mostly. IE 5.5 SP 1 has
//header("Content-Type: application/x-msdownload; name=\"$downloadName\""); // known issues (see the Microsoft Knowledge Base)
//header("Content-Type: application/octet-stream; name=\"$downloadName\""); header( "Content-Disposition: inline; filename=$downloadName" );
}
else { // This works for most types, but doesn't work with Word files
header("Content-Disposition: attachment; filename=\"$downloadName\""); header( "Content-Type: application/download; name=\"$downloadName\"" );
header("Content-Type: application/octet-stream; name=\"$downloadName\"");
//header("Content-Type: $type0/$type1; name=\"$downloadName\"");
//header("Content-Type: application/x-msdownload; name=\"$downloadName\"");
//header("Content-Type: application/octet-stream; name=\"$downloadName\"");
} else {
header( "Content-Disposition: attachment; filename=\"$downloadName\"" );
header( "Content-Type: application/octet-stream; name=\"$downloadName\"" );
} }
//$filename = PATH_UPLOAD . "$filename"; //$filename = PATH_UPLOAD . "$filename";
readfile($filename); readfile( $filename );
} }
//G::header2( "location: /files/" .$_SESSION['ENVIRONMENT']. "/" .$appid, $filename); //G::header2( "location: /files/" .$_SESSION['ENVIRONMENT']. "/" .$appid, $filename);
?>