2012-03-29 16:42:09 -04:00
|
|
|
<?php
|
2012-10-18 11:32:36 -04:00
|
|
|
|
2012-03-29 16:42:09 -04:00
|
|
|
/**
|
|
|
|
|
* Main Controller for processMaker v2.1
|
|
|
|
|
* @date Jul 17, 2011
|
2012-10-18 11:32:36 -04:00
|
|
|
*
|
2012-03-29 16:42:09 -04:00
|
|
|
* @author Erik Amaru Ortiz <erik@colosa.com>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class Main extends Controller
|
|
|
|
|
{
|
2012-07-10 19:01:57 -04:00
|
|
|
private $memcache;
|
|
|
|
|
private $conf;
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
public function __construct ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
G::LoadClass( 'memcached' );
|
|
|
|
|
$this->memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? SYS_SYS : '' );
|
2012-07-10 19:01:57 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
define( 'ERROR_EXCEPTION', 1 );
|
|
|
|
|
define( 'INFO_EXCEPTION', 3 );
|
|
|
|
|
define( 'WARNING_EXCEPTION', 2 );
|
2012-07-10 19:01:57 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
//$this->setDebug(true);
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
function index ($httpData)
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
|
|
|
|
global $RBAC;
|
2012-10-18 11:32:36 -04:00
|
|
|
$RBAC->requirePermissions( 'PM_LOGIN' );
|
|
|
|
|
$meta = new stdClass();
|
|
|
|
|
$showSystemInfo = $RBAC->userCanAccess( 'PM_SETUP' ) == 1;
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
// setting variables for template
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setVar( 'logo_company', $this->getCompanyLogo() );
|
|
|
|
|
$this->setVar( 'userfullname', htmlentities( $this->getUserFullName(), ENT_QUOTES, 'UTF-8' ) );
|
|
|
|
|
$this->setVar( 'user', isset( $_SESSION['USR_USERNAME'] ) ? $_SESSION['USR_USERNAME'] : '' );
|
|
|
|
|
$this->setVar( 'pipe', isset( $_SESSION['USR_USERNAME'] ) ? ' | ' : '' );
|
|
|
|
|
$this->setVar( 'rolename', $this->getUserRole() );
|
|
|
|
|
$this->setVar( 'logout', G::LoadTranslation( 'ID_LOGOUT' ) );
|
|
|
|
|
$this->setVar( 'workspace', defined( 'SYS_SYS' ) ? ucfirst( SYS_SYS ) : '' );
|
|
|
|
|
$this->setVar( 'user_avatar', 'users/users_ViewPhotoGrid?pUID=' . $_SESSION['USER_LOGGED'] . '&h=' . rand() );
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
// license notification
|
|
|
|
|
$expireInLabel = '';
|
2014-10-08 10:07:39 -04:00
|
|
|
|
|
|
|
|
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
|
|
|
|
|
$pmLicenseManager = &pmLicenseManager::getSingleton();
|
|
|
|
|
$expireIn = $pmLicenseManager->getExpireIn();
|
|
|
|
|
$expireInLabel = $pmLicenseManager->getExpireInLabel();
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setVar( 'licenseNotification', $expireInLabel );
|
2012-05-10 18:28:25 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
// setting variables on javascript env.
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'meta', array ('menu' => $this->getMenu()
|
|
|
|
|
) );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$activeTab = 0;
|
2012-10-18 11:32:36 -04:00
|
|
|
if (isset( $_SESSION['_defaultUserLocation'] )) {
|
|
|
|
|
$activeTab = $this->resolveUrlToTabIndex( $_SESSION['_defaultUserLocation'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (isset( $_GET['st'] )) {
|
|
|
|
|
$activeTab = $this->getActiveTab( $_GET['st'] );
|
|
|
|
|
unset( $_GET['st'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'activeTab', $activeTab );
|
|
|
|
|
$this->setJSVar( 'urlAddGetParams', $this->getUrlGetParams() );
|
|
|
|
|
$this->setJSVar( 'showSystemInfo', $showSystemInfo );
|
2012-04-05 12:52:33 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$switchInterface = isset( $_SESSION['user_experience'] ) && $_SESSION['user_experience'] == 'SWITCHABLE';
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
if (($flyNotify = $this->getFlyNotify()) !== false) {
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'flyNotify', $flyNotify );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'switchInterface', $switchInterface );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->includeExtJSLib( 'ux/ux.menu' );
|
|
|
|
|
$this->includeExtJS( 'main/index' );
|
|
|
|
|
$this->setLayout( 'pm-modern' );
|
|
|
|
|
$this->afterLoad( $httpData );
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
$this->render();
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
2012-07-10 19:01:57 -04:00
|
|
|
|
2013-02-20 10:11:03 -04:00
|
|
|
function screamFileUpgrades () {
|
|
|
|
|
G::streamFile( PATH_DATA . 'log/upgrades.log', true );
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
function getSystemInfo ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setResponseType( 'json' );
|
2012-07-10 19:01:57 -04:00
|
|
|
$infoList = $this->_getSystemInfo();
|
2012-10-18 11:32:36 -04:00
|
|
|
$data = array ();
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
foreach ($infoList as $row) {
|
2012-10-18 11:32:36 -04:00
|
|
|
$data[] = array ('label' => $row[0],'value' => $row[1],'section' => $row[2]
|
2012-07-10 19:01:57 -04:00
|
|
|
);
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
2012-07-10 19:01:57 -04:00
|
|
|
return $data;
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
/**
|
|
|
|
|
* Login
|
|
|
|
|
*/
|
2012-10-18 11:32:36 -04:00
|
|
|
public function login ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
|
|
|
|
require_once 'classes/model/LoginLog.php';
|
2012-10-18 11:32:36 -04:00
|
|
|
G::LoadClass( 'system' );
|
|
|
|
|
G::loadClass( 'configuration' );
|
|
|
|
|
$this->conf = new Configurations();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
// getting posibles errors passed by GET method
|
|
|
|
|
$this->getInUrlError();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (! isset( $_SESSION['G_MESSAGE'] )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$_SESSION['G_MESSAGE'] = '';
|
|
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
if (! isset( $_SESSION['G_MESSAGE_TYPE'] )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$_SESSION['G_MESSAGE_TYPE'] = '';
|
|
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$msg = $_SESSION['G_MESSAGE'];
|
|
|
|
|
$msgType = $_SESSION['G_MESSAGE_TYPE'];
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (! isset( $_SESSION['FAILED_LOGINS'] )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$_SESSION['FAILED_LOGINS'] = 0;
|
|
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
$sFailedLogins = $_SESSION['FAILED_LOGINS'];
|
2012-07-10 19:01:57 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (isset( $_SESSION['USER_LOGGED'] )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
//close the session, if the current session_id was used in PM.
|
2012-10-18 11:32:36 -04:00
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->add( LoginLogPeer::LOG_SID, session_id() );
|
|
|
|
|
$oCriteria->add( LoginLogPeer::USR_UID, isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : '-' );
|
|
|
|
|
$oCriteria->add( LoginLogPeer::LOG_STATUS, 'ACTIVE' );
|
|
|
|
|
$oCriteria->add( LoginLogPeer::LOG_END_DATE, null, Criteria::ISNULL );
|
|
|
|
|
$oDataset = LoginLogPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
|
|
|
|
$oDataset->next();
|
|
|
|
|
$aRow = $oDataset->getRow();
|
2012-07-10 19:01:57 -04:00
|
|
|
if ($aRow) {
|
2012-10-18 11:32:36 -04:00
|
|
|
if ($aRow['LOG_STATUS'] != 'CLOSED' && $aRow['LOG_END_DATE'] == null) {
|
|
|
|
|
$weblog = new LoginLog();
|
2016-10-20 16:00:08 -04:00
|
|
|
$aLog['LOG_ID'] = $aRow['LOG_ID'];
|
2012-10-18 11:32:36 -04:00
|
|
|
$aLog['LOG_UID'] = $aRow['LOG_UID'];
|
|
|
|
|
$aLog['LOG_STATUS'] = 'CLOSED';
|
|
|
|
|
$aLog['LOG_IP'] = $aRow['LOG_IP'];
|
|
|
|
|
$aLog['LOG_SID'] = session_id();
|
|
|
|
|
$aLog['LOG_INIT_DATE'] = $aRow['LOG_INIT_DATE'];
|
|
|
|
|
$aLog['LOG_END_DATE'] = date( 'Y-m-d H:i:s' );
|
|
|
|
|
$aLog['LOG_CLIENT_HOSTNAME'] = $aRow['LOG_CLIENT_HOSTNAME'];
|
|
|
|
|
$aLog['USR_UID'] = $aRow['USR_UID'];
|
|
|
|
|
$weblog->update( $aLog );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//remove memcached session
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->memcache->delete( 'rbacSession' . session_id() );
|
2012-07-10 19:01:57 -04:00
|
|
|
} else {
|
|
|
|
|
// Execute SSO trigger
|
2012-10-18 11:32:36 -04:00
|
|
|
$pluginRegistry = & PMPluginRegistry::getSingleton();
|
|
|
|
|
if (defined( 'PM_SINGLE_SIGN_ON' )) {
|
|
|
|
|
if ($pluginRegistry->existsTrigger( PM_SINGLE_SIGN_ON )) {
|
|
|
|
|
if ($pluginRegistry->executeTriggers( PM_SINGLE_SIGN_ON, null )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
// Start new session
|
|
|
|
|
@session_destroy();
|
|
|
|
|
session_start();
|
|
|
|
|
session_regenerate_id();
|
|
|
|
|
// Authenticate
|
|
|
|
|
$result = $this->authentication();
|
|
|
|
|
if ($result->success) {
|
|
|
|
|
// Redirect to landing page for the user
|
2012-10-18 11:32:36 -04:00
|
|
|
G::header( 'Location: ' . $result->url );
|
2012-07-10 19:01:57 -04:00
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//end log
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
//start new session
|
2012-10-18 11:32:36 -04:00
|
|
|
@session_destroy();
|
|
|
|
|
session_start();
|
|
|
|
|
session_regenerate_id();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (strlen( $msg ) > 0) {
|
|
|
|
|
$_SESSION['G_MESSAGE'] = $msg;
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
if (strlen( $msgType ) > 0) {
|
|
|
|
|
$_SESSION['G_MESSAGE_TYPE'] = $msgType;
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
$_SESSION['FAILED_LOGINS'] = $sFailedLogins;
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$availableLangArray = $this->getLanguagesList();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
G::LoadClass( "serverConfiguration" );
|
2012-09-19 12:26:44 -04:00
|
|
|
|
|
|
|
|
$sflag = 0;
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (($nextBeatDate = $this->memcache->get( 'nextBeatDate' )) === false) {
|
2012-08-30 16:14:09 -04:00
|
|
|
//get the serverconf singleton, and check if we can send the heartbeat
|
2012-10-18 11:32:36 -04:00
|
|
|
$oServerConf = & serverConf::getSingleton();
|
|
|
|
|
$sflag = $oServerConf->getHeartbeatProperty( 'HB_OPTION', 'HEART_BEAT_CONF' );
|
|
|
|
|
$sflag = (trim( $sflag ) != '') ? $sflag : '1';
|
2012-08-30 16:14:09 -04:00
|
|
|
//get date of next beat
|
2012-10-18 11:32:36 -04:00
|
|
|
$nextBeatDate = $oServerConf->getHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' );
|
|
|
|
|
$this->memcache->set( 'nextBeatDate', $nextBeatDate, 1 * 3600 );
|
2012-09-17 18:03:37 -04:00
|
|
|
} else {
|
|
|
|
|
$sflag = '1';
|
2012-08-30 16:14:09 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (($sflag == '1') && ((strtotime( "now" ) > $nextBeatDate) || is_null( $nextBeatDate ))) {
|
2012-08-02 16:22:45 -04:00
|
|
|
//To do: we need to change to ExtJs
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'flagHeartBeat', 1 );
|
2012-08-02 16:22:45 -04:00
|
|
|
} else {
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'flagHeartBeat', 0 );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (($flagGettingStarted = $this->memcache->get( 'flagGettingStarted' )) === false) {
|
2012-08-30 16:14:09 -04:00
|
|
|
require_once 'classes/model/Configuration.php';
|
2012-10-18 11:32:36 -04:00
|
|
|
$oConfiguration = new Configuration();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->add( ConfigurationPeer::CFG_UID, 'getStarted' );
|
|
|
|
|
$oCriteria->add( ConfigurationPeer::OBJ_UID, '' );
|
|
|
|
|
$oCriteria->add( ConfigurationPeer::CFG_VALUE, '1' );
|
|
|
|
|
$oCriteria->add( ConfigurationPeer::PRO_UID, '' );
|
|
|
|
|
$oCriteria->add( ConfigurationPeer::USR_UID, '' );
|
|
|
|
|
$oCriteria->add( ConfigurationPeer::APP_UID, '' );
|
|
|
|
|
$flagGettingStarted = ConfigurationPeer::doCount( $oCriteria );
|
|
|
|
|
$this->memcache->set( 'flagGettingStarted', $flagGettingStarted, 8 * 3600 );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'flagGettingStarted', ($flagGettingStarted == 0) );
|
2012-08-30 16:14:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
G::loadClass( 'configuration' );
|
|
|
|
|
$oConf = new Configurations();
|
|
|
|
|
$oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$flagForgotPassword = isset( $oConf->aConfig['login_enableForgotPassword'] ) ? $oConf->aConfig['login_enableForgotPassword'] : 'off';
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->includeExtJSLib( 'ux/virtualkeyboard' );
|
|
|
|
|
$this->includeExtJS( 'main/login' );
|
|
|
|
|
$this->setView( 'main/login' );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$forgotPasswd = isset( $oConf->aConfig['login_enableForgotPassword'] ) ? $oConf->aConfig['login_enableForgotPassword'] : false;
|
|
|
|
|
$virtualKeyboad = isset( $oConf->aConfig['login_enableVirtualKeyboard'] ) ? $oConf->aConfig['login_enableVirtualKeyboard'] : false;
|
|
|
|
|
$defaultLanguaje = isset( $oConf->aConfig['login_defaultLanguage'] ) ? $oConf->aConfig['login_defaultLanguage'] : 'en';
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'forgotPasswd', $forgotPasswd );
|
|
|
|
|
$this->setJSVar( 'virtualKeyboad', $virtualKeyboad );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'languages', $availableLangArray );
|
|
|
|
|
$this->setJSVar( 'defaultLang', $defaultLanguaje );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
//binding G::SendTemporalMessage() to Ext.msgBoxSlider.msgTopCenter()
|
|
|
|
|
if (($flyNotify = $this->getFlyNotify()) !== false) {
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'flyNotify', $flyNotify );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
//binding G::SendTemporalMessage() to Ext.msgBoxSlider.msgTopCenter()
|
2012-10-18 11:32:36 -04:00
|
|
|
if (isset( $_GET['u'] )) {
|
|
|
|
|
$this->setJSVar( 'urlRequested', urldecode( $_GET['u'] ) );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setVar( 'logo_company', $this->getCompanyLogo() );
|
|
|
|
|
$this->setVar( 'pmos_version', System::getVersion() );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$footerText = 'Copyright © 2003-' . date( 'Y' ) . ' Colosa, Inc. All rights reserved.';
|
2012-07-10 19:01:57 -04:00
|
|
|
$adviseText = 'Supplied free of charge with no support, certification, warranty,
|
|
|
|
|
maintenance nor indemnity by Colosa and its Certified Partners. ';
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setVar( 'footer_text', $footerText );
|
|
|
|
|
$this->setVar( 'advise_text', $adviseText );
|
|
|
|
|
$loginScript = $this->getHeadPublisher()->getExtJsLibraries();
|
2012-07-10 19:01:57 -04:00
|
|
|
$loginScript .= $this->getHeadPublisher()->getExtJsScripts();
|
2013-04-25 12:42:30 -04:00
|
|
|
$this->setVar("login_script", $loginScript);
|
|
|
|
|
$this->setVar("login_vars", $this->getHeadPublisher()->getExtJsVariablesScript());
|
|
|
|
|
$this->setVar("URL_TRANSLATION_JS", G::browserCacheFilesUrl("/js/ext/translation.en.js"));
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2013-04-25 12:42:30 -04:00
|
|
|
$this->setLayout("pm-modern-login");
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$this->render();
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
/**
|
|
|
|
|
* SysLogin
|
|
|
|
|
*/
|
2012-10-18 11:32:36 -04:00
|
|
|
public function sysLogin ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
|
|
|
|
require_once ("propel/Propel.php");
|
|
|
|
|
require_once ("creole/Creole.php");
|
2012-10-18 11:32:36 -04:00
|
|
|
G::LoadClass( 'system' );
|
|
|
|
|
G::LoadThirdParty( "pake", "pakeColor.class" );
|
|
|
|
|
Propel::init( PATH_CORE . "config/databases.php" );
|
|
|
|
|
Creole::registerDriver( 'dbarray', 'creole.contrib.DBArrayConnection' );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
// getting posibles errors passed by GET method
|
|
|
|
|
$this->getInUrlError();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$availableWorkspace = $this->getWorkspacesAvailable();
|
2012-10-18 11:32:36 -04:00
|
|
|
$availableWorkspaceList = array ();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
foreach ($availableWorkspace as $ws) {
|
2012-10-18 11:32:36 -04:00
|
|
|
$availableWorkspaceList[] = array ($ws,$ws
|
|
|
|
|
);
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$aField['LOGIN_VERIFY_MSG'] = G::loadTranslation( 'LOGIN_VERIFY_MSG' );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
//Get Server Configuration
|
2012-10-18 11:32:36 -04:00
|
|
|
G::LoadClass( 'serverConfiguration' );
|
|
|
|
|
$oServerConf = & serverConf::getSingleton();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$availableLangArray = $this->getLanguagesList();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->includeExtJSLib( 'ux/virtualkeyboard' );
|
|
|
|
|
$this->setJSVar( 'sysLang', SYS_LANG );
|
|
|
|
|
$this->includeExtJS( 'main/sysLogin' );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setVar( 'logo_company', $this->getCompanyLogo() );
|
|
|
|
|
$this->setVar( 'pmos_version', System::getVersion() );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2013-03-14 15:15:04 -04:00
|
|
|
$footerText = G::LoadTranslation('ID_COPYRIGHT_FROM') . date( 'Y' ) . G::LoadTranslation('ID_COPYRIGHT_COL');
|
|
|
|
|
$adviseText = G::LoadTranslation('ID_COLOSA_AND_CERTIFIED_PARTNERS');
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setVar( 'footer_text', $footerText );
|
|
|
|
|
$this->setVar( 'advise_text', $adviseText );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
//binding G::SendTemporalMessage() to Ext.msgBoxSlider.msgTopCenter()
|
|
|
|
|
if (($flyNotify = $this->getFlyNotify()) !== false) {
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'flyNotify', $flyNotify );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'languages', $availableLangArray );
|
|
|
|
|
$this->setJSVar( 'workspaces', $availableWorkspaceList );
|
|
|
|
|
$this->setJSVar( 'wsPrivate', $oServerConf->getProperty( 'LOGIN_NO_WS' ) );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setJSVar( 'defaultLang', 'en' );
|
|
|
|
|
$this->setJSVar( 'defaultWS', '' );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$loginScript = $this->getHeadPublisher()->getExtJsLibraries();
|
2012-07-10 19:01:57 -04:00
|
|
|
$loginScript .= $this->getHeadPublisher()->getExtJsScripts();
|
2013-04-25 12:42:30 -04:00
|
|
|
$this->setVar("login_script", $loginScript);
|
|
|
|
|
$this->setVar("login_vars", $this->getHeadPublisher()->getExtJsVariablesScript());
|
|
|
|
|
$this->setVar("URL_TRANSLATION_JS", G::browserCacheFilesUrl("/js/ext/translation.en.js"));
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2013-04-25 12:42:30 -04:00
|
|
|
$this->setLayout("pm-modern-login");
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$this->render();
|
|
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
public function forgotPassword ($httpData)
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setResponseType( 'json' );
|
2012-07-10 19:01:57 -04:00
|
|
|
global $RBAC;
|
2012-10-18 11:32:36 -04:00
|
|
|
require_once PATH_RBAC . "model/RbacUsers.php";
|
2012-07-10 19:01:57 -04:00
|
|
|
require_once 'classes/model/Users.php';
|
2012-10-18 11:32:36 -04:00
|
|
|
G::LoadClass( "system" );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$rbacUser = new RbacUsers();
|
|
|
|
|
$user = new Users();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
try {
|
2012-10-18 11:32:36 -04:00
|
|
|
$userData = $rbacUser->getByUsername( $httpData->username );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (! $userData) {
|
|
|
|
|
$msg = G::LoadTranslation( 'ID_USER' ) . ' <b>' . $httpData->username . '</b> ' . G::LoadTranslation( 'ID_IS_NOT_REGISTERED' );
|
|
|
|
|
throw new Exception( $msg );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (trim( $userData['USR_EMAIL'] ) != trim( $httpData->email )) {
|
|
|
|
|
$msg = G::LoadTranslation( 'ID_EMAIL_DOES_NOT_MATCH_FOR_USER' ) . ' <b>' . $httpData->username . '</b>';
|
|
|
|
|
throw new Exception( $msg );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$newPass = G::generate_password();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$aData['USR_UID'] = $userData['USR_UID'];
|
2014-10-02 16:31:50 -04:00
|
|
|
$aData['USR_PASSWORD'] = Bootstrap::hashPassword( $newPass );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$rbacUser->update( $aData );
|
|
|
|
|
$user->update( $aData );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$subject = G::loadTranslation( 'ID_PROCESSMAKER_FORGOT_PASSWORD_SERVICE' );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$template = new TemplatePower( PATH_TPL . 'main/forgotPassword.tpl' );
|
2012-07-10 19:01:57 -04:00
|
|
|
$template->prepare();
|
2012-10-18 11:32:36 -04:00
|
|
|
$template->assign( 'server', $_SERVER['SERVER_NAME'] );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$template->assign( 'serviceMsg', G::loadTranslation( 'ID_PROCESSMAKER_FORGOT_PASSWORD_SERVICE' ) );
|
|
|
|
|
$template->assign( 'content', G::loadTranslation( 'ID_PASSWORD_CHANGED_SUCCESSFULLY' ) );
|
|
|
|
|
$template->assign( 'passwd', $newPass );
|
|
|
|
|
$template->assign( 'poweredBy', G::loadTranslation( 'ID_PROCESSMAKER_SLOGAN1' ) );
|
|
|
|
|
$template->assign( 'versionLabel', G::loadTranslation( 'ID_VERSION' ) );
|
|
|
|
|
$template->assign( 'version', System::getVersion() );
|
|
|
|
|
$template->assign( 'visit', G::loadTranslation( 'ID_VISIT' ) );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$template->assign( 'footer', '' );
|
2012-07-10 19:01:57 -04:00
|
|
|
$body = $template->getOutputContent();
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
G::sendMail( '', 'ProcessMaker Service', $httpData->email, $subject, $body );
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$result->success = true;
|
2012-10-18 11:32:36 -04:00
|
|
|
$result->message = G::LoadTranslation( 'ID_NEW_PASSWORD_SENT' );
|
2012-07-10 19:01:57 -04:00
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$result->success = false;
|
|
|
|
|
$result->message = $e->getMessage();
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
/**
|
|
|
|
|
* *
|
|
|
|
|
* Private Functions *
|
|
|
|
|
* *
|
|
|
|
|
*/
|
|
|
|
|
private function getMenu ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
|
|
|
|
global $G_MAIN_MENU;
|
|
|
|
|
global $G_SUB_MENU;
|
|
|
|
|
global $G_MENU_SELECTED;
|
|
|
|
|
global $G_SUB_MENU_SELECTED;
|
|
|
|
|
global $G_ID_MENU_SELECTED;
|
|
|
|
|
global $G_ID_SUB_MENU_SELECTED;
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$G_MAIN_MENU = 'processmaker';
|
|
|
|
|
$G_SUB_MENU = 'process';
|
|
|
|
|
$G_ID_MENU_SELECTED = 'BPMN';
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
$oMenu = new Menu();
|
2012-10-18 11:32:36 -04:00
|
|
|
$menus = $oMenu->generateArrayForTemplate( $G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED, $G_ID_MENU_SELECTED );
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
foreach ($menus as $i => $menu) {
|
2012-10-18 11:32:36 -04:00
|
|
|
if (strpos( $menu['target'], 'cases/main' ) !== false) {
|
|
|
|
|
$menus[$i]['target'] = str_replace( 'cases/main', 'cases/main_init', $menus[$i]['target'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
if (strpos( $menu['target'], 'processes/main' ) !== false) {
|
|
|
|
|
$menus[$i]['target'] = str_replace( 'processes/main', 'processes/mainInit', $menus[$i]['target'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
if (strpos( $menu['target'], 'setup/main' ) !== false) {
|
|
|
|
|
$menus[$i]['target'] = str_replace( 'setup/main', 'setup/main_init', $menus[$i]['target'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
if (strpos( $menu['target'], 'dashboard/main' ) !== false) {
|
|
|
|
|
$menus[$i]['target'] = str_replace( 'dashboard/main', 'dashboard', $menus[$i]['target'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
$menus[$i]['elementclass'] = preg_replace( array ('/class=/','/"/'
|
|
|
|
|
), array ('',''
|
|
|
|
|
), $menus[$i]['elementclass'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
return $menus;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function resolveUrlToTabIndex ($url)
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
if (strpos( $url, 'cases/main' ) !== false) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$activeTab = 0;
|
2012-10-18 11:32:36 -04:00
|
|
|
} elseif (strpos( $url, 'processes/main' ) !== false) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$activeTab = 1;
|
2012-10-18 11:32:36 -04:00
|
|
|
} elseif (strpos( $url, 'dashboard/main' ) !== false) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$activeTab = 2;
|
2012-10-18 11:32:36 -04:00
|
|
|
} elseif (strpos( $url, 'setup/main' ) !== false) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$activeTab = 3;
|
|
|
|
|
} else {
|
|
|
|
|
$activeTab = 0;
|
|
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
return $activeTab;
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function getCompanyLogo ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
|
|
|
|
$sCompanyLogo = '/images/processmaker2.logo2.png';
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (defined( "SYS_SYS" )) {
|
|
|
|
|
if (($aFotoSelect = $this->memcache->get( 'aFotoSelect' )) === false) {
|
|
|
|
|
G::LoadClass( 'replacementLogo' );
|
2012-07-10 19:01:57 -04:00
|
|
|
$oLogoR = new replacementLogo();
|
2012-10-18 11:32:36 -04:00
|
|
|
$aFotoSelect = $oLogoR->getNameLogo( (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : '' );
|
|
|
|
|
$this->memcache->set( 'aFotoSelect', $aFotoSelect, 1 * 3600 );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
if (is_array( $aFotoSelect )) {
|
|
|
|
|
$sFotoSelect = trim( $aFotoSelect['DEFAULT_LOGO_NAME'] );
|
|
|
|
|
$sWspaceSelect = trim( $aFotoSelect['WORKSPACE_LOGO_NAME'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
if (class_exists( 'PMPluginRegistry' )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
2012-10-18 11:32:36 -04:00
|
|
|
$logoPlugin = $oPluginRegistry->getCompanyLogo( $sCompanyLogo );
|
2012-10-04 10:34:46 -04:00
|
|
|
if ($logoPlugin != '/images/processmaker2.logo2.png') {
|
|
|
|
|
$sCompanyLogo = $logoPlugin;
|
2012-10-18 11:32:36 -04:00
|
|
|
} elseif (isset( $sFotoSelect ) && $sFotoSelect != '' && ! (strcmp( $sWspaceSelect, SYS_SYS ))) {
|
|
|
|
|
$sCompanyLogo = $oPluginRegistry->getCompanyLogo( $sFotoSelect );
|
|
|
|
|
$sCompanyLogo = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/adminProxy/showLogoFile?id=" . base64_encode( $sCompanyLogo );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $sCompanyLogo;
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
public function getLanguagesList ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-11-22 10:02:49 -04:00
|
|
|
$Translations = new Translation;
|
2012-07-10 19:01:57 -04:00
|
|
|
$translationsTable = $Translations->getTranslationEnvironments();
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (($languagesList = $this->memcache->get( 'languagesList' )) === false) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$languagesList = array ();
|
|
|
|
|
|
|
|
|
|
foreach ($translationsTable as $locale) {
|
|
|
|
|
$LANG_ID = $locale['LOCALE'];
|
|
|
|
|
|
|
|
|
|
if ($locale['COUNTRY'] != '.') {
|
2012-10-18 11:32:36 -04:00
|
|
|
$LANG_NAME = $locale['LANGUAGE'] . ' (' . (ucwords( strtolower( $locale['COUNTRY'] ) )) . ')';
|
2012-07-10 19:01:57 -04:00
|
|
|
} else {
|
|
|
|
|
$LANG_NAME = $locale['LANGUAGE'];
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$languagesList[] = array ($LANG_ID,$LANG_NAME
|
|
|
|
|
);
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->memcache->set( 'languagesList', $languagesList, 1 * 3600 );
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
return $languagesList;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function getWorkspacesAvailable ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
G::LoadClass( 'serverConfiguration' );
|
|
|
|
|
$oServerConf = & serverConf::getSingleton();
|
2012-07-10 19:01:57 -04:00
|
|
|
$dir = PATH_DB;
|
|
|
|
|
$filesArray = array ();
|
2012-10-18 11:32:36 -04:00
|
|
|
if (file_exists( $dir )) {
|
|
|
|
|
if ($handle = opendir( $dir )) {
|
|
|
|
|
while (false !== ($file = readdir( $handle ))) {
|
2012-07-10 19:01:57 -04:00
|
|
|
if (($file != ".") && ($file != "..")) {
|
2012-10-18 11:32:36 -04:00
|
|
|
if (file_exists( PATH_DB . $file . '/db.php' )) {
|
|
|
|
|
if (! $oServerConf->isWSDisabled( $file )) {
|
|
|
|
|
$filesArray[] = $file;
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
closedir( $handle );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
sort( $filesArray, SORT_STRING );
|
2012-07-10 19:01:57 -04:00
|
|
|
return $filesArray;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function getUserRole ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
|
|
|
|
global $RBAC;
|
2012-10-18 11:32:36 -04:00
|
|
|
$rolCode = str_replace( '_', ' ', $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'] );
|
|
|
|
|
$rolUid = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_UID'];
|
|
|
|
|
|
|
|
|
|
$oCriteria1 = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria1->add( ContentPeer::CON_CATEGORY, 'ROL_NAME' );
|
|
|
|
|
$oCriteria1->add( ContentPeer::CON_ID, $rolUid );
|
|
|
|
|
$oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG );
|
|
|
|
|
$oDataset1 = ContentPeer::doSelectRS( $oCriteria1 );
|
|
|
|
|
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-10 19:01:57 -04:00
|
|
|
$oDataset1->next();
|
|
|
|
|
$aRow = $oDataset1->getRow();
|
|
|
|
|
$rolName = $aRow['CON_VALUE'];
|
|
|
|
|
|
|
|
|
|
return $rolName ? $rolName : $rolCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* binding G::SendTemporalMessage() to Javascript routine Ext.msgBoxSlider.msgTopCenter()
|
|
|
|
|
*/
|
2012-10-18 11:32:36 -04:00
|
|
|
private function getFlyNotify ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
if (! isset( $_SESSION['G_MESSAGE'] )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$flyNotify['title'] = isset( $_SESSION['G_MESSAGE_TITLE'] ) ? $_SESSION['G_MESSAGE_TITLE'] : '';
|
2012-07-10 19:01:57 -04:00
|
|
|
$flyNotify['text'] = $_SESSION['G_MESSAGE'];
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
unset( $_SESSION['G_MESSAGE'] );
|
|
|
|
|
if (isset( $_SESSION['G_MESSAGE_TYPE'] )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$flyNotify['type'] = $_SESSION['G_MESSAGE_TYPE'];
|
2012-10-18 11:32:36 -04:00
|
|
|
unset( $_SESSION['G_MESSAGE_TYPE'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
} else {
|
|
|
|
|
$flyNotify['type'] = '';
|
|
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
if ($flyNotify['title'] == '') {
|
2012-10-18 11:32:36 -04:00
|
|
|
switch ($flyNotify['type']) {
|
2012-07-10 19:01:57 -04:00
|
|
|
case 'alert':
|
|
|
|
|
case 'warning':
|
|
|
|
|
case 'tmp-warning':
|
2012-10-18 11:32:36 -04:00
|
|
|
$flyNotify['title'] = G::loadTranslation( 'ID_WARNING' );
|
2012-07-10 19:01:57 -04:00
|
|
|
break;
|
|
|
|
|
case 'error':
|
|
|
|
|
case 'tmp-error':
|
2012-10-18 11:32:36 -04:00
|
|
|
$flyNotify['title'] = G::loadTranslation( 'ID_ERROR' );
|
2012-07-10 19:01:57 -04:00
|
|
|
break;
|
|
|
|
|
case 'tmp-info':
|
|
|
|
|
case 'info':
|
2012-10-18 11:32:36 -04:00
|
|
|
$flyNotify['title'] = G::loadTranslation( 'ID_INFO' );
|
2012-07-10 19:01:57 -04:00
|
|
|
break;
|
|
|
|
|
case 'success':
|
|
|
|
|
case 'ok':
|
2012-10-18 11:32:36 -04:00
|
|
|
$flyNotify['title'] = G::loadTranslation( 'ID_SUCCESS' );
|
2012-07-10 19:01:57 -04:00
|
|
|
break;
|
|
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
$flyNotify['title'] = strtoupper( $flyNotify['title'] );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
//TODO make dinamic
|
|
|
|
|
$flyNotify['time'] = 5;
|
|
|
|
|
$this->flyNotify = $flyNotify;
|
|
|
|
|
|
|
|
|
|
return $this->flyNotify;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function setFlyNotify ($type, $title, $text, $time = 5)
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->flyNotify = array ('type' => $type,'title' => $title,'text' => $text,'time' => $time
|
2012-07-10 19:01:57 -04:00
|
|
|
);
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$_SESSION['G_MESSAGE'] = $text;
|
|
|
|
|
$_SESSION['G_MESSAGE_TYPE'] = $type;
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function getInUrlError ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
if (isset( $_GET['errno'] )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
switch ($_GET['errno']) {
|
|
|
|
|
case '1':
|
|
|
|
|
$trnLabel = 'ID_USER_HAVENT_RIGHTS_PAGE';
|
|
|
|
|
break;
|
|
|
|
|
case '2':
|
|
|
|
|
$trnLabel = 'ID_NOT_WORKSPACE';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$trnLabel = 'ID_USER_HAVENT_RIGHTS_PAGE';
|
|
|
|
|
break;
|
|
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
$this->setFlyNotify( 'error', 'ERROR', G::loadTranslation( $trnLabel ) );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
}
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function getActiveTab ($activeTab)
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
if (! is_numeric( $activeTab )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
switch ($activeTab) {
|
|
|
|
|
case 'home':
|
|
|
|
|
$activeTab = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 'designer':
|
|
|
|
|
$activeTab = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 'dashboard':
|
|
|
|
|
$activeTab = 2;
|
|
|
|
|
break;
|
|
|
|
|
case 'admin':
|
|
|
|
|
$activeTab = 3;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$activeTab = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2012-10-18 11:32:36 -04:00
|
|
|
$activeTab = $activeTab > - 1 && $activeTab < 3 ? (int) $activeTab : '';
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
return $activeTab;
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function getUrlGetParams ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
|
|
|
|
$urlGetParams = '';
|
|
|
|
|
foreach ($_GET as $key => $value) {
|
|
|
|
|
$urlGetParams .= $urlGetParams == '' ? $key : "&" . $key;
|
2012-10-18 11:32:36 -04:00
|
|
|
$urlGetParams .= trim( $value ) != '' ? '=' . $value : '';
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
return $urlGetParams;
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function getUserFullName ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
return isset( $_SESSION['USR_FULLNAME'] ) ? $_SESSION['USR_FULLNAME'] : '';
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function _getSystemInfo ()
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
G::LoadClass( "system" );
|
2012-07-10 19:01:57 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
if (getenv( 'HTTP_CLIENT_IP' )) {
|
|
|
|
|
$ip = getenv( 'HTTP_CLIENT_IP' );
|
2012-07-10 19:01:57 -04:00
|
|
|
} else {
|
2012-10-18 11:32:36 -04:00
|
|
|
if (getenv( 'HTTP_X_FORWARDED_FOR' )) {
|
|
|
|
|
$ip = getenv( 'HTTP_X_FORWARDED_FOR' );
|
2012-07-10 19:01:57 -04:00
|
|
|
} else {
|
2012-10-18 11:32:36 -04:00
|
|
|
$ip = getenv( 'REMOTE_ADDR' );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$redhat = '';
|
2012-10-18 11:32:36 -04:00
|
|
|
if (file_exists( '/etc/redhat-release' )) {
|
|
|
|
|
$fnewsize = filesize( '/etc/redhat-release' );
|
|
|
|
|
$fp = fopen( '/etc/redhat-release', 'r' );
|
|
|
|
|
$redhat = trim( fread( $fp, $fnewsize ) );
|
|
|
|
|
fclose( $fp );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$redhat .= " (" . PHP_OS . ")";
|
2012-10-18 11:32:36 -04:00
|
|
|
if (defined( "DB_HOST" )) {
|
|
|
|
|
G::LoadClass( 'net' );
|
|
|
|
|
G::LoadClass( 'dbConnections' );
|
|
|
|
|
$dbNetView = new NET( DB_HOST );
|
|
|
|
|
$dbNetView->loginDbServer( DB_USER, DB_PASS );
|
2012-07-10 19:01:57 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
$dbConns = new dbConnections( '' );
|
2012-07-10 19:01:57 -04:00
|
|
|
$availdb = '';
|
2012-10-18 11:32:36 -04:00
|
|
|
foreach ($dbConns->getDbServicesAvailables() as $key => $val) {
|
2012-07-10 19:01:57 -04:00
|
|
|
if ($availdb != '') {
|
|
|
|
|
$availdb .= ', ';
|
|
|
|
|
}
|
2012-10-18 11:32:36 -04:00
|
|
|
$availdb .= $val['name'];
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
2012-10-18 11:32:36 -04:00
|
|
|
$sMySQLVersion = $dbNetView->getDbServerVersion( DB_ADAPTER );
|
2012-07-10 19:01:57 -04:00
|
|
|
} catch (Exception $oException) {
|
|
|
|
|
$sMySQLVersion = '?????';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-23 13:28:16 -04:00
|
|
|
|
2014-05-29 17:17:15 -04:00
|
|
|
if (file_exists(PATH_HTML . "lib/versions")) {
|
|
|
|
|
$versions = json_decode(file_get_contents(PATH_HTML . "lib/versions"), true);
|
|
|
|
|
$pmuiVer = $versions["pmui_ver"];
|
|
|
|
|
$mafeVer = $versions["mafe_ver"];
|
2014-10-23 13:28:16 -04:00
|
|
|
$pmdynaformVer = isset($versions["pmdynaform_ver"]) ? $versions["pmdynaform_ver"] : '';
|
2014-05-29 17:17:15 -04:00
|
|
|
} else {
|
2014-07-01 16:53:02 -04:00
|
|
|
$pmuiVer = $mafeVer = $pmdynaformVer = "(unknown)";
|
2014-05-29 17:17:15 -04:00
|
|
|
}
|
|
|
|
|
|
2013-02-20 17:33:13 -04:00
|
|
|
$sysSection = G::loadTranslation('ID_SYSTEM_INFO' );
|
|
|
|
|
$pmSection = G::LoadTranslation('ID_PROCESS_INFORMATION');
|
2012-10-18 11:32:36 -04:00
|
|
|
|
|
|
|
|
$properties = array ();
|
|
|
|
|
$ee = class_exists( 'pmLicenseManager' ) ? " - Enterprise Edition" : '';
|
2013-04-26 11:45:03 -04:00
|
|
|
$systemName = 'ProcessMaker';
|
2013-04-26 12:55:16 -04:00
|
|
|
if (defined('SYSTEM_NAME')) {
|
2013-04-26 11:45:03 -04:00
|
|
|
$systemName = SYSTEM_NAME;
|
|
|
|
|
}
|
|
|
|
|
$properties[] = array ($systemName. ' Ver.', System::getVersion() . $ee, $pmSection);
|
2014-05-29 17:17:15 -04:00
|
|
|
$properties[] = array("PMUI JS Lib. Ver.", $pmuiVer, $pmSection);
|
|
|
|
|
$properties[] = array("MAFE JS Lib. Ver.", $mafeVer, $pmSection);
|
2014-07-01 16:53:02 -04:00
|
|
|
$properties[] = array("PM Dynaform JS Lib. Ver.", $pmdynaformVer, $pmSection);
|
2013-02-20 10:11:03 -04:00
|
|
|
|
|
|
|
|
if (file_exists(PATH_DATA. 'log/upgrades.log')) {
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_UPGRADES_PATCHES'), '<a href="#" onclick="showUpgradedLogs(); return false;">' . G::LoadTranslation( 'ID_UPGRADE_VIEW_LOG') . '</a>' ,$pmSection);
|
2013-02-20 10:11:03 -04:00
|
|
|
} else {
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_UPGRADES_PATCHES'), G::LoadTranslation( 'ID_UPGRADE_NEVER_UPGRADE') ,$pmSection);
|
2013-02-20 10:11:03 -04:00
|
|
|
}
|
|
|
|
|
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_OPERATING_SYSTEM') ,$redhat,$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_TIME_ZONE') ,(defined( 'TIME_ZONE' )) ? TIME_ZONE : "Unknown",$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_WEB_SERVER') ,getenv( 'SERVER_SOFTWARE' ),$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_SERVER_NAME') ,getenv( 'SERVER_NAME' ),$pmSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_SERVER_IP') ,$this->lookup( $ip ),$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_PHP_VERSION') ,phpversion(),$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (defined( "DB_HOST" )) {
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_DATABASE') ,$dbNetView->dbName( DB_ADAPTER ) . ' (Version ' . $sMySQLVersion . ')',$pmSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_DATABASE_SERVER') ,DB_HOST,$pmSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_DATABASE_NAME') ,DB_NAME,$pmSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_AVAILABLE_DB') ,$availdb,$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2012-07-10 19:01:57 -04:00
|
|
|
} else {
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_DATABASE') ,"Not defined",$pmSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_DATABASE_SERVER') ,"Not defined",$pmSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_DATABASE_NAME') ,"Not defined",$pmSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array (G::LoadTranslation('ID_AVAILABLE_DB') ,"Not defined",$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array ( G::LoadTranslation('ID_WORKSPACE') ,defined( "SYS_SYS" ) ? SYS_SYS : "Not defined",$pmSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2012-07-10 19:01:57 -04:00
|
|
|
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array ( G::LoadTranslation('ID_SERVER_PROTOCOL') ,getenv( 'SERVER_PROTOCOL' ),$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-21 10:31:45 -04:00
|
|
|
$properties[] = array ( G::LoadTranslation('ID_SERVER_PORT') ,getenv( 'SERVER_PORT' ),$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
//$sysSection[] = array('Remote Host', getenv ('REMOTE_HOST'), $sysSection);
|
|
|
|
|
$properties[] = array ( G::LoadTranslation('ID_SERVER_NAME') , getenv( 'SERVER_ADDR' ),$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2013-02-20 17:33:13 -04:00
|
|
|
$properties[] = array ( G::LoadTranslation('ID_USER_BROWSER') , getenv( 'HTTP_USER_AGENT' ),$sysSection
|
2012-10-18 11:32:36 -04:00
|
|
|
);
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
return $properties;
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
2012-07-10 19:01:57 -04:00
|
|
|
|
2012-10-18 11:32:36 -04:00
|
|
|
private function lookup ($target)
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
|
|
|
|
global $ntarget;
|
|
|
|
|
$msg = $target . ' => ';
|
|
|
|
|
//if (eregi ('[a-zA-Z]', $target))
|
2012-10-18 11:32:36 -04:00
|
|
|
if (preg_match( '[a-zA-Z]', $target )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
//Made compatible to PHP 5.3
|
2012-10-18 11:32:36 -04:00
|
|
|
$ntarget = gethostbyname( $target );
|
2012-07-10 19:01:57 -04:00
|
|
|
} else {
|
2012-10-18 11:32:36 -04:00
|
|
|
$ntarget = gethostbyaddr( $target );
|
2012-07-10 19:01:57 -04:00
|
|
|
}
|
|
|
|
|
$msg .= $ntarget;
|
|
|
|
|
return ($msg);
|
2012-03-29 16:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
/**
|
|
|
|
|
* Execute common reoutes after index() action load
|
|
|
|
|
*/
|
2012-10-18 11:32:36 -04:00
|
|
|
private function afterLoad ($httpData)
|
2012-07-10 19:01:57 -04:00
|
|
|
{
|
2012-10-18 11:32:36 -04:00
|
|
|
if (isset( $httpData->i18 ) || isset( $httpData->i18n )) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$_SESSION['DEV_FLAG'] = true;
|
|
|
|
|
}
|
2012-04-04 18:02:32 -04:00
|
|
|
}
|
2012-07-10 17:55:22 -04:00
|
|
|
}
|
2012-07-10 19:01:57 -04:00
|
|
|
|