OD STYLE Formating workflow/engine/methods/login/

Change format files in workflow/engine/methods/login/
This commit is contained in:
norahmollo
2012-10-16 18:08:45 +00:00
parent c95a3f00b7
commit 8ebd27a064
9 changed files with 219 additions and 257 deletions

View File

@@ -154,9 +154,9 @@ try {
}
if (PHP_VERSION < 5.2) {
setcookie(session_name(), session_id(), null, '/', '; HttpOnly');
setcookie(session_name(), session_id(), null, '/', '; HttpOnly');
} else {
setcookie(session_name(), session_id(), null, '/', null, null, true);
setcookie(session_name(), session_id(), null, '/', null, null, true);
}
$aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
@@ -214,11 +214,11 @@ try {
//************** background processes, here we are putting some back office routines **********
$heartBeatNWIDate = $oServerConf->getHeartbeatProperty('HB_NEXT_GWI_DATE','HEART_BEAT_CONF');
if (is_null($heartBeatNWIDate)) {
$heartBeatNWIDate = time();
$heartBeatNWIDate = time();
}
if (time() >= $heartBeatNWIDate) {
$oServerConf->setWsInfo(SYS_SYS, $oServerConf->getWorkspaceInfo(SYS_SYS));
$oServerConf->setHeartbeatProperty('HB_NEXT_GWI_DATE', strtotime('+1 day'), 'HEART_BEAT_CONF');
$oServerConf->setWsInfo(SYS_SYS, $oServerConf->getWorkspaceInfo(SYS_SYS));
$oServerConf->setHeartbeatProperty('HB_NEXT_GWI_DATE', strtotime('+1 day'), 'HEART_BEAT_CONF');
}
//**** defining and saving server info, this file has the values of the global array $_SERVER ****

View File

@@ -24,63 +24,62 @@ require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->load($_SESSION['USER_LOGGED']);
$aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']);
if (!is_array($aHistory)) {
$aHistory = array();
$aHistory = array();
}
if (!defined('PPP_PASSWORD_HISTORY')) {
define('PPP_PASSWORD_HISTORY', 0);
define('PPP_PASSWORD_HISTORY', 0);
}
if (PPP_PASSWORD_HISTORY > 0) {
if (count($aHistory) >= PPP_PASSWORD_HISTORY) {
array_shift($aHistory);
}
$aHistory[] = $_POST['form']['USR_PASSWORD'];
if (count($aHistory) >= PPP_PASSWORD_HISTORY) {
array_shift($aHistory);
}
$aHistory[] = $_POST['form']['USR_PASSWORD'];
}
$aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s');
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 0;
$aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory);
$oUserProperty->update($aUserProperty);
if ( class_exists('redirectDetail')) {
//falta validar...
if(isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']))
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
$oPluginRegistry = &PMPluginRegistry::getSingleton();
//$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if(isset($aRedirectLogin))
{ if(is_array($aRedirectLogin))
{
foreach ( $aRedirectLogin as $key=>$detail ) {
if(isset($detail->sPathMethod))
{
if ( $detail->sRoleCode == $userRole ) {
G::header('location: /sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->sPathMethod );
die;
}
if (class_exists('redirectDetail')) {
//falta validar...
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
//$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if (isset($aRedirectLogin)) {
if (is_array($aRedirectLogin)) {
foreach ($aRedirectLogin as $key => $detail) {
if (isset($detail->sPathMethod)) {
if ($detail->sRoleCode == $userRole) {
G::header('location: /sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->sPathMethod );
die;
}
}
}
}
}
}
}
}
//end plugin
if (isset($frm['USER_LANG'])) {
if (isset($frm['USER_LANG'])) {
if ($frm['USER_LANG'] != '') {
$lang = $frm['USER_LANG'];
$lang = $frm['USER_LANG'];
}
}
else {
} else {
if (defined('SYS_LANG')) {
$lang = SYS_LANG;
$lang = SYS_LANG;
} else {
$lang = 'en';
}
else {
$lang = 'en';
}
}
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
G::header('Location: ' . $sLocation);
die;
}
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
G::header('Location: ' . $sLocation);
die;
?>

View File

@@ -24,82 +24,78 @@
*
*/
function lookup( $target ) {
global $ntarget;
$msg = $target . ' => ';
//if (eregi ( '[a-zA-Z]', $target ))
if (preg_match( '[a-zA-Z]', $target )) //Made compatible to PHP 5.3
$ntarget = gethostbyname ( $target );
else
$ntarget = gethostbyaddr ( $target );
$msg .= $ntarget;
return ($msg);
function lookup ($target)
{
global $ntarget;
$msg = $target . ' => ';
//if (eregi ( '[a-zA-Z]', $target ))
if (preg_match( '[a-zA-Z]', $target )) {
//Made compatible to PHP 5.3
$ntarget = gethostbyname ( $target );
} else {
$ntarget = gethostbyaddr ( $target );
}
$msg .= $ntarget;
return ($msg);
}
G::LoadClass("system");
if (getenv ( 'HTTP_CLIENT_IP' )) {
$ip = getenv ( 'HTTP_CLIENT_IP' );
}
else {
if (getenv ( 'HTTP_X_FORWARDED_FOR' )) {
$ip = getenv ( 'HTTP_X_FORWARDED_FOR' );
}
else {
$ip = getenv ( 'REMOTE_ADDR' );
}
$ip = getenv ( 'HTTP_CLIENT_IP' );
} else {
if (getenv ( 'HTTP_X_FORWARDED_FOR' )) {
$ip = getenv ( 'HTTP_X_FORWARDED_FOR' );
} else {
$ip = getenv ( 'REMOTE_ADDR' );
}
}
$redhat = '';
if (file_exists ( '/etc/redhat-release' )) {
$fnewsize = filesize ( '/etc/redhat-release' );
$fp = fopen ( '/etc/redhat-release', 'r' );
$redhat = trim ( fread ( $fp, $fnewsize ) );
fclose ( $fp );
$fnewsize = filesize ( '/etc/redhat-release' );
$fp = fopen ( '/etc/redhat-release', 'r' );
$redhat = trim ( fread ( $fp, $fnewsize ) );
fclose ( $fp );
}
$redhat .= " (" . PHP_OS . ")";
if (defined ( "DB_HOST" )) {
G::LoadClass ( 'net' );
G::LoadClass ( 'dbConnections' );
$dbNetView = new NET ( DB_HOST );
$dbNetView->loginDbServer ( DB_USER, DB_PASS );
$dbConns = new dbConnections ( '' );
$availdb = '';
foreach ( $dbConns->getDbServicesAvailables () as $key => $val ) {
if ($availdb != '')
$availdb .= ', ';
$availdb .= $val ['name'];
}
try {
$sMySQLVersion = $dbNetView->getDbServerVersion ( DB_ADAPTER );
}
catch ( Exception $oException ) {
$sMySQLVersion = '?????';
}
G::LoadClass ( 'net' );
G::LoadClass ( 'dbConnections' );
$dbNetView = new NET ( DB_HOST );
$dbNetView->loginDbServer ( DB_USER, DB_PASS );
$dbConns = new dbConnections ( '' );
$availdb = '';
foreach ($dbConns->getDbServicesAvailables () as $key => $val) {
if ($availdb != '') {
$availdb .= ', ';
}
$availdb .= $val ['name'];
}
try {
$sMySQLVersion = $dbNetView->getDbServerVersion ( DB_ADAPTER );
} catch (Exception $oException) {
$sMySQLVersion = '?????';
}
}
$Fields ['SYSTEM'] = $redhat;
if (defined ( "DB_HOST" )) {
$Fields ['DATABASE'] = $dbNetView->dbName ( DB_ADAPTER ) . ' (Version ' . $sMySQLVersion . ')';
$Fields ['DATABASE_SERVER'] = DB_HOST;
$Fields ['DATABASE_NAME'] = DB_NAME;
$Fields ['AVAILABLE_DB'] = $availdb;
}
else {
$Fields ['DATABASE'] = "Not defined";
$Fields ['DATABASE_SERVER'] = "Not defined";
$Fields ['DATABASE_NAME'] = "Not defined";
$Fields ['AVAILABLE_DB'] = "Not defined";
$Fields ['DATABASE'] = $dbNetView->dbName ( DB_ADAPTER ) . ' (Version ' . $sMySQLVersion . ')';
$Fields ['DATABASE_SERVER'] = DB_HOST;
$Fields ['DATABASE_NAME'] = DB_NAME;
$Fields ['AVAILABLE_DB'] = $availdb;
} else {
$Fields ['DATABASE'] = "Not defined";
$Fields ['DATABASE_SERVER'] = "Not defined";
$Fields ['DATABASE_NAME'] = "Not defined";
$Fields ['AVAILABLE_DB'] = "Not defined";
}
$eeT="";
if(class_exists('pmLicenseManager')){
if (class_exists('pmLicenseManager')) {
$eeT=" - Enterprise Edition";
}
}
$Fields ['PHP'] = phpversion ();
$Fields ['FLUID'] = System::getVersion() . $eeT;
$Fields ['IP'] = lookup ( $ip );
@@ -113,8 +109,9 @@ $Fields ['SERVER_ADDR'] = getenv ( 'SERVER_ADDR' );
$Fields ['HTTP_USER_AGENT'] = getenv ( 'HTTP_USER_AGENT' );
$Fields ['TIME_ZONE'] = (defined('TIME_ZONE')) ? TIME_ZONE : "Unknown";
if (! defined ( 'SKIP_RENDER_SYSTEM_INFORMATION' )) {
$G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/dbInfo', '', $Fields, 'appNew2' );
G::RenderPage ( 'publish', 'raw' );
if (!defined( 'SKIP_RENDER_SYSTEM_INFORMATION')) {
$G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/dbInfo', '', $Fields, 'appNew2' );
G::RenderPage ( 'publish', 'raw' );
}

View File

@@ -22,7 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$G_PUBLISH = new Publisher ();
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/forgotPassword', '', array(), 'retrivePassword.php');
G::RenderPage ( "publish" );
$G_PUBLISH = new Publisher ();
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/forgotPassword', '', array(), 'retrivePassword.php');
G::RenderPage ( "publish" );

View File

@@ -22,7 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$newFile = str_replace ( 'index.php', 'login.php' , __FILE__ ) ;
$newFile = str_replace ( 'index.php', 'login.php' , __FILE__ );
return $newFile;

View File

@@ -23,28 +23,25 @@
*
*/
try {
G::LoadInclude ( 'ajax' );
if (isset ( $_POST ['form'] )) {
$_POST = $_POST ['form'];
}
$_POST ['function'] = get_ajax_value ( 'function' );
switch ($_POST ['function']) {
case 'getStarted_save' :
require_once 'classes/model/Configuration.php';
$aData ['CFG_UID'] = 'getStarted';
$aData ['OBJ_UID'] = '';
$aData ['CFG_VALUE'] = '1';
$aData ['PRO_UID'] = '';
$aData ['USR_UID'] = '';
$aData ['APP_UID'] = '';
$oConfig = new Configuration ( );
$oConfig->create ( $aData );
break;
}
}
catch ( Exception $oException ) {
die ( $oException->getMessage () );
G::LoadInclude ( 'ajax' );
if (isset ( $_POST ['form'] )) {
$_POST = $_POST ['form'];
}
$_POST ['function'] = get_ajax_value ( 'function' );
switch ($_POST ['function']) {
case 'getStarted_save':
require_once 'classes/model/Configuration.php';
$aData ['CFG_UID'] = 'getStarted';
$aData ['OBJ_UID'] = '';
$aData ['CFG_VALUE'] = '1';
$aData ['PRO_UID'] = '';
$aData ['USR_UID'] = '';
$aData ['APP_UID'] = '';
$oConfig = new Configuration ( );
$oConfig->create ( $aData );
break;
}
} catch ( Exception $oException ) {
die ( $oException->getMessage () );
}

View File

@@ -30,7 +30,7 @@ $G_SUB_MENU = "empty";
$referer = $_SERVER ['HTTP_REFERER'];
$dbc = new DBConnection ( );
$G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( "xmlform", "xmlform", "login/noViewPage", "", NULL );
$G_PUBLISH->AddContent ( "xmlform", "xmlform", "login/noViewPage", "", null );
G::RenderPage ( "publish" );
?>

View File

@@ -11,40 +11,40 @@ $user = new Users();
$userData = $rbacUser->getByUsername($data['USR_USERNAME']);
if($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']) {
$aSetup = getEmailConfiguration();
if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
G::SendTemporalMessage ('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
G::header('location: forgotPassword');
die;
}
if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']) {
$aSetup = getEmailConfiguration();
if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
G::SendTemporalMessage ('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
G::header('location: forgotPassword');
die;
}
$newPass = G::generate_password();
$newPass = G::generate_password();
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = md5($newPass);
/* **Save after sending the mail
$rbacUser->update($aData);
$user->update($aData);
*/
$sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>';
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD').' - ProcessMaker' ;
$msg = '<h3>ProcessMaker Forgot password Service</h3>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_USERMANE_IS').' : <strong>'.$userData['USR_USERNAME'].'</strong></p>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_PASSWORD_IS').' : <strong>'.$newPass.'</strong></p>';
switch ($aSetup['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break;
case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break;
}
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = md5($newPass);
/* **Save after sending the mail
$rbacUser->update($aData);
$user->update($aData);
*/
$sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>';
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD').' - ProcessMaker' ;
$msg = '<h3>ProcessMaker Forgot password Service</h3>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_USERMANE_IS').' : <strong>'.$userData['USR_USERNAME'].'</strong></p>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_PASSWORD_IS').' : <strong>'.$newPass.'</strong></p>';
switch ($aSetup['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break;
case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break;
}
$sBody = "
$sBody = "
<table style=\"background-color: white; font-family: Arial,Helvetica,sans-serif; color: black; font-size: 11px; text-align: left;\" cellpadding='10' cellspacing='0' width='100%'>
<tbody><tr><td><img id='logo' src='http://".$_SERVER['SERVER_NAME']."/images/processmaker.logo.jpg' /></td></tr>
<tr><td style='font-size: 14px;'>$msg</td></tr>
@@ -53,99 +53,66 @@ if($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']
<a href='http://www.processmaker.com' style='color:#c40000;'>www.processmaker.com</a><br /></td>
</tr></tbody></table>";
G::LoadClass('spool');
$oSpool = new spoolRun();
G::LoadClass('spool');
$oSpool = new spoolRun();
$oSpool->setConfig( array(
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
'MESS_SERVER' => $aSetup['MESS_SERVER'],
'MESS_PORT' => $aSetup['MESS_PORT'],
'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],
'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],
'SMTPAuth' => $aSetup['MESS_RAUTH'],
'SMTPSecure' => $aSetup['SMTPSecure']
));
$oSpool->setConfig( array(
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
'MESS_SERVER' => $aSetup['MESS_SERVER'],
'MESS_PORT' => $aSetup['MESS_PORT'],
'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],
'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],
'SMTPAuth' => $aSetup['MESS_RAUTH'],
'SMTPSecure' => $aSetup['SMTPSecure']
));
$passwd = $oSpool->config['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
$passwd = $oSpool->config['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
}
$oSpool->config['MESS_PASSWORD'] = $passwd;
$oSpool->create(array(
'msg_uid' => '',
'app_uid' => '',
'del_index' => 0,
'app_msg_type' => 'TEST',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $data['USR_EMAIL'],
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_attach'=>''
));
$oSpool->config['MESS_PASSWORD'] = $passwd;
try {
$oSpool->sendMail();
$rbacUser->update($aData);
$user->update($aData);
G::header ("location: login.html");
G::SendTemporalMessage ('ID_NEW_PASSWORD_SENT', "info");
}
catch (phpmailerException $e) {
G::header ("location: login.html");
G::SendTemporalMessage (G::LoadTranslation('MISSING_OR_NOT_CONFIGURED_SMTP'), "warning", 'string');
}
catch (Exception $e) {
G::header ("location: login.html");
G::SendTemporalMessage ($e->getMessage(), "warning", 'string');
}
$oSpool->create(array(
'msg_uid' => '',
'app_uid' => '',
'del_index' => 0,
'app_msg_type' => 'TEST',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $data['USR_EMAIL'],
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_attach'=>''
));
try {
$oSpool->sendMail();
$rbacUser->update($aData);
$user->update($aData);
G::header ("location: login.html");
G::SendTemporalMessage ('ID_NEW_PASSWORD_SENT', "info");
} catch (phpmailerException $e) {
G::header ("location: login.html");
G::SendTemporalMessage (G::LoadTranslation('MISSING_OR_NOT_CONFIGURED_SMTP'), "warning", 'string');
} catch (Exception $e) {
G::header ("location: login.html");
G::SendTemporalMessage ($e->getMessage(), "warning", 'string');
}
} else {
$msg = G::LoadTranslation('ID_USER') . ' ' . $data['USR_USERNAME'] . ' '. G::LoadTranslation('ID_IS_NOT_REGISTERED');
G::SendTemporalMessage ($msg, "warning", 'string');
G::header('location: forgotPassword');
$msg = G::LoadTranslation('ID_USER') . ' ' . $data['USR_USERNAME'] . ' '. G::LoadTranslation('ID_IS_NOT_REGISTERED');
G::SendTemporalMessage ($msg, "warning", 'string');
G::header('location: forgotPassword');
}

View File

@@ -23,9 +23,11 @@
*
*/
if (! isset ( $_POST ))
G::header ( 'location: /sys/' . $lang . '/' . SYS_SKIN . '/' . 'login/login' );
if (! isset ( $_POST )) {
G::header ( 'location: /sys/' . $lang . '/' . SYS_SKIN . '/' . 'login/login' );
}
if (isset ( $_SESSION ['sysLogin'] )) {
$_POST ['form'] = $_SESSION ['sysLogin'];
}
require_once ('authentication.php');
if (isset ( $_SESSION ['sysLogin'] ))
$_POST ['form'] = $_SESSION ['sysLogin'];
require_once ('authentication.php');