CODE STYLE, workflow/engine/methods/users/

FILES:
data_usersList.php
index.php
myInfo.php
myInfo_Ajax.php
myInfo_Edit.php
myInfo_Save.php
usersAjax.php
usersEdit.php
usersGroups.php
usersInit.php
usersNew.php
users_Ajax.php
users_AuthSource.php
users_AuthSourceSave.php
users_Delete.php
users_DeleteAssign.php
users_DeleteReassign.php
users_DeleteReassignEnd.php
users_Edit.php
users_Groups.php
users_List.php
users_New.php
users_Reassign.php
users_ReassignCases.php
users_Save.php
users_View.php
users_ViewPhoto.php
users_ViewPhotoGrid.php
users_ViewResume.php
This commit is contained in:
jennylee
2012-10-17 18:13:05 -04:00
parent e16048052d
commit 5485060c3f
29 changed files with 2665 additions and 2749 deletions

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);
?>