CODE STYLE, workflow/engine/controllers/

FILES:
caseSchedulerProxy.php
dashboard.php
home.php
installer.php
main.php
This commit is contained in:
jennylee
2012-10-18 11:32:36 -04:00
parent e456979aa3
commit 48793f82b5
5 changed files with 2639 additions and 2497 deletions

View File

@@ -1,8 +1,10 @@
<?php
class caseSchedulerProxy extends HttpProxyController
{
function load($params){
function load ($params)
{
require_once "classes/model/Event.php";
$PRO_UID = $params->PRO_UID;
$EVN_UID = $params->EVN_UID;
@@ -13,10 +15,9 @@ class caseSchedulerProxy extends HttpProxyController
if ($sch_uid != '') {
G::LoadClass( 'processMap' );
$oProcessMap = new processMap(new DBConnection);
$oProcessMap = new processMap( new DBConnection() );
$rows = $oProcessMap->caseNewSchedulerList( $sch_uid );
if($rows['SCH_OPTION'] == '3')
{
if ($rows['SCH_OPTION'] == '3') {
$sch_start_day = explode( '|', $rows['SCH_START_DAY'] );
$count = count( $sch_start_day );
switch ($count) {
@@ -34,13 +35,11 @@ class caseSchedulerProxy extends HttpProxyController
break;
}
}
if($rows['SCH_START_DATE'] != '')
{
if ($rows['SCH_START_DATE'] != '') {
$sch_str_dt = explode( ' ', $rows['SCH_START_DATE'] );
$rows['SCH_START_DATE'] = $sch_str_dt[0];
}
if($rows['SCH_END_DATE'] != '')
{
if ($rows['SCH_END_DATE'] != '') {
$sch_str_dt = explode( ' ', $rows['SCH_END_DATE'] );
$rows['SCH_END_DATE'] = $sch_str_dt[0];
}
@@ -51,7 +50,8 @@ class caseSchedulerProxy extends HttpProxyController
}
}
function delete($params){
function delete ($params)
{
require_once 'classes/model/CaseScheduler.php';
require_once 'classes/model/Event.php';
$SCH_UID = $params->SCH_UID;
@@ -68,7 +68,8 @@ class caseSchedulerProxy extends HttpProxyController
$this->msg = G::LoadTranslation( 'ID_SCHEDULER_SUCCESS_DELETE' );
}
function changeStatus($params){
function changeStatus ($params)
{
require_once 'classes/model/CaseScheduler.php';
$SCH_UID = $params->SCH_UID;
$oCaseScheduler = new CaseScheduler();
@@ -79,7 +80,8 @@ class caseSchedulerProxy extends HttpProxyController
$this->msg = G::LoadTranslation( 'ID_SCHEDULER_SUCCESS_CHANGE_STATUS' );
}
function checkCredentials($params){
function checkCredentials ($params)
{
require_once 'classes/model/Event.php';
require_once 'classes/model/Users.php';
require_once 'classes/model/TaskUser.php';
@@ -89,19 +91,21 @@ function checkCredentials($params){
$sWS_USER = trim( $params->WS_USER );
$sWS_PASS = trim( $params->WS_PASS );
if (G::is_https ())
if (G::is_https()) {
$http = 'https://';
else
} else {
$http = 'http://';
}
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
@$client = new SoapClient( $endpoint );
$user = $sWS_USER;
$pass = $sWS_PASS;
$parameters = array ('userid' => $user, 'password' => $pass );
$result = $client->__SoapCall ( 'login', array ($parameters) );
$parameters = array ('userid' => $user,'password' => $pass
);
$result = $client->__SoapCall( 'login', array ($parameters
) );
$fields['status_code'] = $result->status_code;
$fields['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message;
@@ -162,7 +166,8 @@ function checkCredentials($params){
$this->msg = $message;
}
function save($params){
function save ($params)
{
require_once 'classes/model/CaseScheduler.php';
$oCaseScheduler = new CaseScheduler();
@@ -174,6 +179,7 @@ function checkCredentials($params){
$aData['PRO_UID'] = $params->pro_uid; //$_POST['form']['PRO_UID'];
$aData['TAS_UID'] = $params->tas_uid; //$_POST['form']['TAS_UID'];
$aData['SCH_STATE'] = 'ACTIVE';
$aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE';
$aData['USR_UID'] = $_SESSION['USER_LOGGED'];
@@ -181,10 +187,18 @@ function checkCredentials($params){
$sOption = $params->fType; //$_POST['form']['SCH_OPTION'];
switch ($sOption) {
case 'Daily' : $sOption = '1'; break;
case 'Weekly' : $sOption = '2'; break;
case 'Monthly' : $sOption = '3'; break;
default : $sOption = '4'; break;
case 'Daily':
$sOption = '1';
break;
case 'Weekly':
$sOption = '2';
break;
case 'Monthly':
$sOption = '3';
break;
default:
$sOption = '4';
break;
}
$aData['SCH_OPTION'] = $sOption;
@@ -195,17 +209,21 @@ function checkCredentials($params){
// $sDateTmp = date('Y-m-d');
// }
$sDateTmp = $params->SCH_START_DATE;
$sTimeTmp = $params->SCH_START_TIME; //$_POST['form']['SCH_START_TIME'];
$aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
$aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
//g::pr($aData);
$nActualTime = $sTimeTmp; //date("Y-m-d H:i:s"); // time();
//$nActualDate = date("Y-m-d H:i:s");
$sValue = '';
$sDaysPerformTask = '';
$sWeeks = '';
@@ -214,12 +232,12 @@ function checkCredentials($params){
$sStartDay = '';
$nSW = 0;
switch ($sOption) {
case '1': // Option 1
$sValue = isset( $params->SCH_DAYS_PERFORM_TASK ) ? $params->SCH_DAYS_PERFORM_TASK : '1'; //$_POST['form']['SCH_DAYS_PERFORM_TASK'];
switch ($sValue) {
case '1' : $aData['SCH_DAYS_PERFORM_TASK'] = $sValue . '|1';
case '1':
$aData['SCH_DAYS_PERFORM_TASK'] = $sValue . '|1';
break;
case '2':
$aData['SCH_OPTION'] = '2';
@@ -232,35 +250,48 @@ function checkCredentials($params){
break;
}
break;
case '2': // If the option is zero, set by default 1
$sWeeks = '';
if (isset( $params->W1 )) {
if ($sWeeks != '') $sWeeks .= '|';
if ($sWeeks != '') {
$sWeeks .= '|';
}
$sWeeks .= '1';
}
if (isset( $params->W2 )) {
if ($sWeeks != '') $sWeeks .= '|';
if ($sWeeks != '') {
$sWeeks .= '|';
}
$sWeeks .= '2';
}
if (isset( $params->W3 )) {
if ($sWeeks != '') $sWeeks .= '|';
if ($sWeeks != '') {
$sWeeks .= '|';
}
$sWeeks .= '3';
}
if (isset( $params->W4 )) {
if ($sWeeks != '') $sWeeks .= '|';
if ($sWeeks != '') {
$sWeeks .= '|';
}
$sWeeks .= '4';
}
if (isset( $params->W5 )) {
if ($sWeeks != '') $sWeeks .= '|';
if ($sWeeks != '') {
$sWeeks .= '|';
}
$sWeeks .= '5';
}
if (isset( $params->W6 )) {
if ($sWeeks != '') $sWeeks .= '|';
if ($sWeeks != '') {
$sWeeks .= '|';
}
$sWeeks .= '6';
}
if (isset( $params->W7 )) {
if ($sWeeks != '') $sWeeks .= '|';
if ($sWeeks != '') {
$sWeeks .= '|';
}
$sWeeks .= '7';
}
$sStartTime = $params->SCH_START_TIME;
@@ -269,79 +300,131 @@ function checkCredentials($params){
break;
case '3':
$nStartDay = $params->SCH_START_DAY;
if ($nStartDay=='Day of Month') $nStartDay = 1;
if ($nStartDay=='The Day') $nStartDay = 2;
if ($nStartDay == 'Day of Month') {
$nStartDay = 1;
}
if ($nStartDay == 'The Day') {
$nStartDay = 2;
}
if ($nStartDay == 1) {
$aData['SCH_START_DAY'] = $nStartDay . '|' . $params->SCH_START_DAY_OPT_1;
} else {
$opt2weeks = $params->SCH_START_DAY_OPT_2_WEEKS;
switch ($opt2weeks) {
case 'First': $opt2weeks = 1; break;
case 'Second': $opt2weeks = 2; break;
case 'Third': $opt2weeks = 3; break;
case 'Fourth': $opt2weeks = 4; break;
case 'Last': $opt2weeks = 5; break;
case 'First':
$opt2weeks = 1;
break;
case 'Second':
$opt2weeks = 2;
break;
case 'Third':
$opt2weeks = 3;
break;
case 'Fourth':
$opt2weeks = 4;
break;
case 'Last':
$opt2weeks = 5;
break;
}
$opt2days = $params->SCH_START_DAY_OPT_2_DAYS_WEEK;
switch ($opt2days) {
case 'Monday': $opt2days = 1; break;
case 'Tuesday': $opt2days = 2; break;
case 'Wednesday': $opt2days = 3; break;
case 'Thursday': $opt2days = 4; break;
case 'Friday': $opt2days = 5; break;
case 'Saturday': $opt2days = 6; break;
case 'Sunday': $opt2days = 7; break;
case 'Monday':
$opt2days = 1;
break;
case 'Tuesday':
$opt2days = 2;
break;
case 'Wednesday':
$opt2days = 3;
break;
case 'Thursday':
$opt2days = 4;
break;
case 'Friday':
$opt2days = 5;
break;
case 'Saturday':
$opt2days = 6;
break;
case 'Sunday':
$opt2days = 7;
break;
}
$aData['SCH_START_DAY'] = $nStartDay . '|' . $opt2weeks . '|' . $opt2days;
}
$sMonths = '';
if (isset( $params->M1 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '1';
}
if (isset( $params->M2 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '2';
}
if (isset( $params->M3 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '3';
}
if (isset( $params->M4 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '4';
}
if (isset( $params->M5 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '5';
}
if (isset( $params->M6 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '6';
}
if (isset( $params->M7 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '7';
}
if (isset( $params->M8 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '8';
}
if (isset( $params->M9 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '9';
}
if (isset( $params->M10 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '10';
}
if (isset( $params->M11 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '11';
}
if (isset( $params->M12 )) {
if ($sMonths != '') $sMonths .= '|';
if ($sMonths != '') {
$sMonths .= '|';
}
$sMonths .= '12';
}
// if(!empty($params->SCH_MONTHS)){
@@ -367,7 +450,6 @@ function checkCredentials($params){
$sValue = $nStartDay;
break;
}
if (($sOption != '1') && ($sOption != '4')) {
if ($sStartDay == '') {
@@ -408,12 +490,11 @@ function checkCredentials($params){
if (! empty( $params->SCH_REPEAT_TASK_CHK )) {
$nOptEvery = $params->SCH_REPEAT_EVERY_OPT;
if($nOptEvery ==2)
if ($nOptEvery == 2) {
$aData['SCH_REPEAT_EVERY'] = $params->SCH_REPEAT_EVERY_OPT * 60;
else
} else {
$aData['SCH_REPEAT_EVERY'] = $params->SCH_REPEAT_EVERY_OPT;
}
}
if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
@@ -440,7 +521,6 @@ function checkCredentials($params){
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
$caseSchedulerSelected = $caseSchedulerPluginDetail;
}
}
if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
@@ -467,6 +547,7 @@ function checkCredentials($params){
$event->update( $editEvent );
//End Adding
$sch = new CaseScheduler();
$sch->load( $sch_uid );
@@ -475,13 +556,15 @@ function checkCredentials($params){
$this->NEXT = $sch->getSchTimeNextRun();
$this->DESCRIPTION = $sch->getSchName();
$this->TAS_NAME = $tas_name;
if ($sw_update)
if ($sw_update) {
$this->msg = G::LoadTranslation( 'ID_SCHEDULER_SUCCESS_UPDATE' );
else
} else {
$this->msg = G::LoadTranslation( 'ID_SCHEDULER_SUCCESS_NEW' );
}
}
function loadCS($params){
function loadCS ($params)
{
require_once 'classes/model/CaseScheduler.php';
$SCH_UID = $params->SCH_UID;
$oCaseScheduler = new CaseScheduler();
@@ -503,13 +586,27 @@ function checkCredentials($params){
$w1 = $w2 = $w3 = $w4 = $w5 = $w6 = $w7 = false;
foreach ($week as $w) {
switch ($w) {
case 1: $w1 = true; break;
case 2: $w2 = true; break;
case 3: $w3 = true; break;
case 4: $w4 = true; break;
case 5: $w5 = true; break;
case 6: $w6 = true; break;
case 7: $w7 = true; break;
case 1:
$w1 = true;
break;
case 2:
$w2 = true;
break;
case 3:
$w3 = true;
break;
case 4:
$w4 = true;
break;
case 5:
$w5 = true;
break;
case 6:
$w6 = true;
break;
case 7:
$w7 = true;
break;
}
}
$data['W1'] = $w1;
@@ -525,18 +622,42 @@ function checkCredentials($params){
$m1 = $m2 = $m3 = $m4 = $m5 = $m6 = $m7 = $m8 = $m9 = $m10 = $m11 = $m12 = false;
foreach ($year as $month) {
switch ($month) {
case 1: $m1 = true; break;
case 2: $m2 = true; break;
case 3: $m3 = true; break;
case 4: $m4 = true; break;
case 5: $m5 = true; break;
case 6: $m6 = true; break;
case 7: $m7 = true; break;
case 8: $m8 = true; break;
case 9: $m9 = true; break;
case 10: $m10 = true; break;
case 11: $m11 = true; break;
case 12: $m12 = true; break;
case 1:
$m1 = true;
break;
case 2:
$m2 = true;
break;
case 3:
$m3 = true;
break;
case 4:
$m4 = true;
break;
case 5:
$m5 = true;
break;
case 6:
$m6 = true;
break;
case 7:
$m7 = true;
break;
case 8:
$m8 = true;
break;
case 9:
$m9 = true;
break;
case 10:
$m10 = true;
break;
case 11:
$m11 = true;
break;
case 12:
$m12 = true;
break;
}
}
@@ -567,3 +688,4 @@ function checkCredentials($params){
}
} //End caseSchedulerProxy

View File

@@ -1,36 +1,42 @@
<?php
/**
* Dashboard controller
* @inherits Controller
*
* @access public
*/
class Dashboard extends Controller {
class Dashboard extends Controller
{
// Class properties
private $pmDashlet;
// Class constructor
public function __construct() {
public function __construct ()
{
G::LoadClass( 'pmDashlet' );
$this->pmDashlet = new PMDashlet();
}
// Functions for the dashboards users module - Start
public function index($httpData) {
public function index ($httpData)
{
try {
$this->setJSVar( 'dashletsInstances', $this->getDashletsInstancesForCurrentUser() );
$this->includeExtJS( 'dashboard/index' );
$this->includeExtJSLib( 'ux/portal' );
G::RenderPage( 'publish', 'extJs' );
}
catch (Exception $error) {
} catch (Exception $error) {
//ToDo: Display a error message
}
}
public function renderDashletInstance($data) {
public function renderDashletInstance ($data)
{
try {
if (! isset( $data->DAS_INS_UID )) {
$data->DAS_INS_UID = '';
@@ -42,35 +48,36 @@ class Dashboard extends Controller {
if (! isset( $_REQUEST['w'] )) {
$width = 300;
}
else {
} else {
$width = $_REQUEST['w'];
}
$this->pmDashlet->render( $width );
}
catch (Exception $error) {
} catch (Exception $error) {
//ToDo: Show the error message
echo $error->getMessage();
}
}
private function getDashletsInstancesForCurrentUser() {
private function getDashletsInstancesForCurrentUser ()
{
try {
if (! isset( $_SESSION['USER_LOGGED'] )) {
throw new Exception( 'The session has expired.' );
}
return $this->pmDashlet->getDashletsInstancesForUser( $_SESSION['USER_LOGGED'] );
}
catch (Exception $error) {
} catch (Exception $error) {
throw $error;
}
}
// Functions for the dashboards users module - End
// Functions for the dasboards administration module - Start
public function dashletsList() {
public function dashletsList ()
{
try {
$this->includeExtJS( 'dashboard/dashletsList' );
if (isset( $_SESSION['__DASHBOARD_ERROR__'] )) {
@@ -79,13 +86,13 @@ class Dashboard extends Controller {
}
$this->setView( 'dashboard/dashletsList' );
G::RenderPage( 'publish', 'extJs' );
}
catch (Exception $error) {
} catch (Exception $error) {
//ToDo: Display a error message
}
}
public function getDashletsInstances($data) {
public function getDashletsInstances ($data)
{
$this->setResponseType( 'json' );
$result = new stdclass();
$result->status = 'OK';
@@ -98,15 +105,15 @@ class Dashboard extends Controller {
}
$result->dashletsInstances = $this->pmDashlet->getDashletsInstances( $data->start, $data->limit );
$result->totalDashletsInstances = $this->pmDashlet->getDashletsInstancesQuantity();
}
catch (Exception $error) {
} catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
return $result;
}
public function dashletInstanceForm($data) {
public function dashletInstanceForm ($data)
{
try {
$this->includeExtJS( 'dashboard/dashletInstanceForm', false );
$this->setView( 'dashboard/dashletInstanceForm' );
@@ -119,8 +126,7 @@ class Dashboard extends Controller {
$this->pmDashlet->setup( $data->DAS_INS_UID );
$this->setJSVar( 'dashletInstance', $this->pmDashlet->getDashletInstance() );
$this->setJSVar( 'additionalFields', PMDashlet::getAdditionalFields( get_class( $this->pmDashlet->getDashletObject() ) ) );
}
else {
} else {
$dashletInstance = new stdclass();
$dashletInstance->DAS_UID = $dashlets[0][0];
$dashlet = new Dashlet();
@@ -130,29 +136,29 @@ class Dashboard extends Controller {
}
G::RenderPage( 'publish', 'extJs' );
return null;
}
catch (Exception $error) {
} catch (Exception $error) {
$_SESSION['__DASHBOARD_ERROR__'] = $error->getMessage();
G::header( 'Location: dashletsList' );
die();
}
}
public function saveDashletInstance($data) {
public function saveDashletInstance ($data)
{
$this->setResponseType( 'json' );
$result = new stdclass();
$result->status = 'OK';
try {
$this->pmDashlet->saveDashletInstance( get_object_vars( $data ) );
}
catch (Exception $error) {
} catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
return $result;
}
public function deleteDashletInstance($data) {
public function deleteDashletInstance ($data)
{
$this->setResponseType( 'json' );
$result = new stdclass();
$result->status = 'OK';
@@ -164,15 +170,15 @@ class Dashboard extends Controller {
throw new Exception( 'Parameter "DAS_INS_UID" is empty.' );
}
$this->pmDashlet->deleteDashletInstance( $data->DAS_INS_UID );
}
catch (Exception $error) {
} catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
return $result;
}
public function getAdditionalFields($data) {
public function getAdditionalFields ($data)
{
$this->setResponseType( 'json' );
$result = new stdclass();
$result->status = 'OK';
@@ -181,19 +187,18 @@ class Dashboard extends Controller {
$dashletFields = $dashlet->load( $data->DAS_UID );
if (! is_null( $dashletFields )) {
$result->additionalFields = PMDashlet::getAdditionalFields( $dashletFields['DAS_CLASS'] );
}
else {
} else {
throw new Exception( 'Dashlet "' . $data->DAS_UID . '" does not exist.' );
}
}
catch (Exception $error) {
} catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
return $result;
}
public function getOwnersByType($data) {
public function getOwnersByType ($data)
{
$this->setResponseType( 'json' );
$result = new stdclass();
$result->status = 'OK';
@@ -211,7 +216,8 @@ class Dashboard extends Controller {
$usersInstance = new Users();
$allUsers = $usersInstance->getAll();
foreach ($allUsers->data as $user) {
$users[] = array('OWNER_UID' => $user['USR_UID'], 'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']);
$users[] = array ('OWNER_UID' => $user['USR_UID'],'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']
);
}
$result->total = $allUsers->totalCount;
@@ -229,9 +235,12 @@ class Dashboard extends Controller {
$criteria->addSelectColumn( ContentPeer::CON_VALUE );
//FROM
$conditions = array ();
$conditions[] = array(DepartmentPeer::DEP_UID, ContentPeer::CON_ID);
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter());
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
$conditions[] = array (DepartmentPeer::DEP_UID,ContentPeer::CON_ID
);
$conditions[] = array (ContentPeer::CON_CATEGORY,DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter()
);
$conditions[] = array (ContentPeer::CON_LANG,DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter()
);
$criteria->addJoinMC( $conditions, Criteria::LEFT_JOIN );
//WHERE
$criteria->add( DepartmentPeer::DEP_STATUS, 'ACTIVE' );
@@ -242,7 +251,8 @@ class Dashboard extends Controller {
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$dataset->next();
while ($row = $dataset->getRow()) {
$departments[] = array('OWNER_UID' => $row['DEP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
$departments[] = array ('OWNER_UID' => $row['DEP_UID'],'OWNER_NAME' => $row['CON_VALUE']
);
$dataset->next();
}
@@ -261,9 +271,12 @@ class Dashboard extends Controller {
$criteria->addSelectColumn( ContentPeer::CON_VALUE );
//FROM
$conditions = array ();
$conditions[] = array(GroupwfPeer::GRP_UID, ContentPeer::CON_ID);
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter());
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
$conditions[] = array (GroupwfPeer::GRP_UID,ContentPeer::CON_ID
);
$conditions[] = array (ContentPeer::CON_CATEGORY,DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter()
);
$conditions[] = array (ContentPeer::CON_LANG,DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter()
);
$criteria->addJoinMC( $conditions, Criteria::LEFT_JOIN );
//WHERE
$criteria->add( GroupwfPeer::GRP_STATUS, 'ACTIVE' );
@@ -274,7 +287,8 @@ class Dashboard extends Controller {
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$dataset->next();
while ($row = $dataset->getRow()) {
$groups[] = array('OWNER_UID' => $row['GRP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
$groups[] = array ('OWNER_UID' => $row['GRP_UID'],'OWNER_NAME' => $row['CON_VALUE']
);
$dataset->next();
}
@@ -282,15 +296,15 @@ class Dashboard extends Controller {
$result->owners = $groups;
break;
}
}
catch (Exception $error) {
} catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
return $result;
}
private function getDashlets() {
private function getDashlets ()
{
try {
require_once 'classes/model/Dashlet.php';
@@ -307,12 +321,12 @@ class Dashboard extends Controller {
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$dataset->next();
while ($row = $dataset->getRow()) {
$dashlets[] = array($row['DAS_UID'], $row['DAS_TITLE']);
$dashlets[] = array ($row['DAS_UID'],$row['DAS_TITLE']
);
$dataset->next();
}
}
catch (Exception $error) {
} catch (Exception $error) {
throw $error;
}
return $dashlets;
@@ -320,3 +334,4 @@ class Dashboard extends Controller {
// Functions for the dasboards administration module - End
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Home controller
*
@@ -53,7 +54,8 @@ class Home extends Controller
$skin = $this->clientBrowser['name'] == 'msie' ? $this->lastSkin : 'simplified';
if (! is_array( $data )) {
$data = array('u'=>'', 'p'=>'', 'm'=>'');
$data = array ('u' => '','p' => '','m' => ''
);
}
$this->setVar( 'msg', $data['m'] );
@@ -67,6 +69,7 @@ class Home extends Controller
/**
* getting default list
*
* @param string $httpData (opional)
*/
@@ -112,18 +115,12 @@ class Home extends Controller
if (! empty( $mnu->Options )) {
foreach ($mnu->Options as $index => $value) {
$option = array(
'id' => $mnu->Id[$index],
'url' => $mnu->Options[$index],
'label' => $mnu->Labels[$index],
'icon' => $mnu->Icons[$index],
'class' => $mnu->ElementClass[$index]
$option = array ('id' => $mnu->Id[$index],'url' => $mnu->Options[$index],'label' => $mnu->Labels[$index],'icon' => $mnu->Icons[$index],'class' => $mnu->ElementClass[$index]
);
if ($mnu->Id[$index] != 'S_NEW_CASE') {
$arrayMnuOption[] = $option;
}
else {
} else {
$mnuNewCase = $option;
}
}
@@ -150,7 +147,7 @@ class Home extends Controller
G::LoadClass( 'applications' );
$apps = new Applications();
$step = new Step;
$step = new Step();
$cases = $apps->getAll( $this->userID, 0, 1, 'todo' );
@@ -247,6 +244,7 @@ class Home extends Controller
$cases = $apps->getAll( $this->userID, $start, $limit, $type );
//g::pr($cases['data']); die;
// formating & complitting apps data with 'Notes'
foreach ($cases['data'] as $i => $row) {
// Formatting
@@ -257,8 +255,7 @@ class Home extends Controller
}
if (isset( $row['DEL_DELEGATE_DATE'] )) {
$cases['data'][$i]['DEL_DELEGATE_DATE'] = G::getformatedDate($row['DEL_DELEGATE_DATE'],
'M d, yyyy - h:i:s');
$cases['data'][$i]['DEL_DELEGATE_DATE'] = G::getformatedDate( $row['DEL_DELEGATE_DATE'], 'M d, yyyy - h:i:s' );
}
if (isset( $row['APP_DEL_PREVIOUS_USER'] )) {
$cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords( $row['APP_DEL_PREVIOUS_USER'] );
@@ -305,11 +302,15 @@ class Home extends Controller
$httpData->no = isset( $httpData->no ) ? $httpData->no : 0;
switch ($httpData->no) {
case 2: $tpl = $this->userUxBaseTemplate . PATH_SEP . 'noAppsMsg'; break;
default: $tpl = $this->userUxBaseTemplate . PATH_SEP . 'error';
case 2:
$tpl = $this->userUxBaseTemplate . PATH_SEP . 'noAppsMsg';
break;
default:
$tpl = $this->userUxBaseTemplate . PATH_SEP . 'error';
}
$this->setView( $tpl );
$this->render();
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Install Controller
*
@@ -16,6 +17,7 @@ class Installer extends Controller
public $link; #resource for database connection
public function __construct ()
{
$this->path_config = PATH_CORE . 'config/';
@@ -29,20 +31,14 @@ class Installer extends Controller
public function index ($httpData)
{
$step1_txt = 'If any of these items is not supported (marked as No) then please take actions to correct them.<br><br>' .
'Failure to do so could lead to your ProcessMaker installation not functioning correctly!<br><br>' .
$step1_txt = 'If any of these items is not supported (marked as No) then please take actions to correct them.<br><br>' . 'Failure to do so could lead to your ProcessMaker installation not functioning correctly!<br><br>' .
//'(*) MSSQL Support is optional.<br><br>' .
'(*) OpenSSL is optional.<br><br>' .
'(*) LDAP is optional.';
'(*) OpenSSL is optional.<br><br>' . '(*) LDAP is optional.';
$step2_txt = 'These settings are recommended for PHP in order to ensure full compatibility with ProcessMaker. <> ' .
'However, ProcessMaker still operate if your settings do not quite match the recommended';
$step3_txt = 'In order for ProcessMaker to work correctly, it needs to be able read and write to certain directories and their files.<br>' .
'Make sure to give read and write access to the directories listed below and all their subdirectories and files.';
$step4_txt = 'ProcessMaker stores all of its data in a database. Enter the address and port number used by the database. Also enter' .
'the username and password of the database user who will set up the databases used by ProcessMaker<br>';
$step5_txt = 'ProcessMaker uses workspaces to store data in the database. Please enter a valid workspace name and a username and password to login'.
' as the administrator.';
$step2_txt = 'These settings are recommended for PHP in order to ensure full compatibility with ProcessMaker. <> ' . 'However, ProcessMaker still operate if your settings do not quite match the recommended';
$step3_txt = 'In order for ProcessMaker to work correctly, it needs to be able read and write to certain directories and their files.<br>' . 'Make sure to give read and write access to the directories listed below and all their subdirectories and files.';
$step4_txt = 'ProcessMaker stores all of its data in a database. Enter the address and port number used by the database. Also enter' . 'the username and password of the database user who will set up the databases used by ProcessMaker<br>';
$step5_txt = 'ProcessMaker uses workspaces to store data in the database. Please enter a valid workspace name and a username and password to login' . ' as the administrator.';
$step6_txt = 'xxx';
$licenseContent = file_get_contents( PATH_TRUNK . 'LICENSE.txt' );
@@ -78,8 +74,7 @@ class Installer extends Controller
public function newSite ()
{
$textStep1 = 'ProcessMaker stores all of its data in a database. This screen gives the installation program the information needed to create this database.<br><br>' .
'If you are installing ProcessMaker on a remote web server, you will need to get this information from your Database Server.';
$textStep1 = 'ProcessMaker stores all of its data in a database. This screen gives the installation program the information needed to create this database.<br><br>' . 'If you are installing ProcessMaker on a remote web server, you will need to get this information from your Database Server.';
$textStep2 = 'ProcessMaker uses a workspaces to store data. Please select a valid workspace name and credentials to log in it.';
$this->includeExtJS( 'installer/CardLayout', false );
@@ -216,8 +211,7 @@ class Installer extends Controller
$info->memory->version = $memory . 'M';
if ($memory > 80) {
$info->memory->result = true;
}
else {
} else {
$info->memory->result = false;
}
@@ -242,8 +236,7 @@ class Installer extends Controller
$info->pathConfig->result = G::is_writable_r( $_REQUEST['pathConfig'], $noWritableFiles );
if ($info->pathConfig->result) {
$info->pathConfig->message = 'writeable';
}
else {
} else {
$info->success = false;
}
@@ -251,8 +244,7 @@ class Installer extends Controller
$info->pathLanguages->result = G::is_writable_r( $_REQUEST['pathLanguages'], $noWritableFiles );
if ($info->pathLanguages->result) {
$info->pathLanguages->message = 'writeable';
}
else {
} else {
$info->success = false;
}
@@ -260,8 +252,7 @@ class Installer extends Controller
$info->pathPlugins->result = G::is_writable_r( $_REQUEST['pathPlugins'], $noWritableFiles );
if ($info->pathPlugins->result) {
$info->pathPlugins->message = 'writeable';
}
else {
} else {
$info->success = false;
}
@@ -269,8 +260,7 @@ class Installer extends Controller
$info->pathXmlforms->result = G::is_writable_r( $_REQUEST['pathXmlforms'], $noWritableFiles );
if ($info->pathXmlforms->result) {
$info->pathXmlforms->message = 'writeable';
}
else {
} else {
$info->success = false;
}
@@ -278,8 +268,7 @@ class Installer extends Controller
$info->pathPublic->result = G::is_writable_r( $_REQUEST['pathPublic'], $noWritableFiles );
if ($info->pathPublic->result) {
$info->pathShared->message = 'writeable';
}
else {
} else {
$info->success = false;
}
@@ -287,15 +276,15 @@ class Installer extends Controller
$info->pathShared->result = G::is_writable_r( $_REQUEST['pathShared'], $noWritableFiles );
if ($info->pathShared->result) {
$info->pathShared->message = 'writeable';
}
else {
} else {
G::verifyPath( $_REQUEST['pathShared'], true );
$info->pathShared->result = G::is_writable_r( $_REQUEST['pathShared'], $noWritableFiles );
if ( $info->pathShared->result )
if ($info->pathShared->result) {
$info->pathShared->message = 'writeable';
else
} else {
$info->success = false;
}
}
if ($info->pathShared->result) {
$aux = pathinfo( $_REQUEST['pathLogFile'] );
@@ -316,8 +305,7 @@ class Installer extends Controller
if ($info->success) {
$info->notify = 'Success, all required directories are writable.';
}
else {
} else {
$info->notify = 'Some directories and/or files inside it are not writable.';
}
@@ -331,8 +319,7 @@ class Installer extends Controller
$this->setResponseType( 'json' );
if ($_REQUEST['db_engine'] == 'mysql') {
return $this->testMySQLconnection();
}
else {
} else {
return $this->testMSSQLconnection();
}
}
@@ -346,22 +333,23 @@ class Installer extends Controller
{
$serverAddr = $_SERVER['SERVER_ADDR'];
//if this function is called outside the createWorkspace, just returns and do nothing
if ( !isset( $_REQUEST['pathShared']) )
if (! isset( $_REQUEST['pathShared'] )) {
return;
}
//log file is in shared/logs
$pathShared = trim( $_REQUEST['pathShared'] );
if ( substr($pathShared,-1) != '/' ) $pathShared .= '/';
if (substr( $pathShared, - 1 ) != '/') {
$pathShared .= '/';
}
$logFile = $pathShared . 'log/install.log';
if (! is_file( $logFile )) {
G::mk_dir( dirname( $pathShared ) );
$fpt = fopen( $logFile, 'w' );
if ( $fpt !== NULL ) {
if ($fpt !== null) {
fwrite( $fpt, sprintf( "%s %s\n", date( 'Y:m:d H:i:s' ), '----- starting log file ------' ) );
fclose( $fpt );
}
else {
} else {
throw (new Exception( sprintf( "File '%s' is not writeable. Please check permission before continue", $logFile ) ));
return $false;
}
@@ -382,8 +370,7 @@ class Installer extends Controller
$this->setResponseType( 'json' );
if ($_REQUEST['db_engine'] == 'mysql') {
$info = $this->createMySQLWorkspace();
}
else {
} else {
$info = $this->createMSSQLWorkspace();
}
@@ -454,12 +441,14 @@ class Installer extends Controller
// $content = file_get_contents($file);
// $queries = explode(';', $content);
// foreach( $queries as $sql) {
// if (trim($sql) != '') {
// $query = @mysql_query($sql, $this->link);
// if (!$query) {
// $errorMessage = mysql_error($this->link);
// $this->installLog ( sprintf ( 'MySQL error: %s Query: %s ', $errorMessage, $sql ) );
// throw ( new Exception ( $errorMessage ) );
// return false;
@@ -467,15 +456,18 @@ class Installer extends Controller
// }
// }
//erik: New Update, to support more complex queries
$lines = file( $file );
$previous = NULL;
$previous = null;
$errors = '';
@mysql_query( "SET NAMES 'utf8';" );
foreach ($lines as $j => $line) {
$line = trim( $line ); // Remove comments from the script
if (strpos( $line, "--" ) === 0) {
$line = substr( $line, 0, strpos( $line, "--" ) );
}
@@ -496,7 +488,7 @@ class Installer extends Controller
if ($previous) {
$line = $previous . " " . $line;
}
$previous = NULL;
$previous = null;
// If the current line doesnt end with ; then put this line together
// with the next one, thus supporting multi-line statements.
@@ -627,7 +619,9 @@ class Installer extends Controller
$adminUsername = trim( $_REQUEST['adminUsername'] );
$deleteDB = ($_REQUEST['deleteDB'] == 'true');
if ( substr($pathShared,-1) != '/' ) $pathShared .= '/';
if (substr( $pathShared, - 1 ) != '/') {
$pathShared .= '/';
}
$this->installLog( '-------------------------------------------' );
$this->installLog( sprintf( "Creating workspace '%s' ", $workspace ) );
@@ -715,7 +709,6 @@ class Installer extends Controller
$this->installLog( 'Creating: ' . $databases_file );
file_put_contents( $databases_file, $databasesText );
// Execute scripts to create and populates databases
$query = sprintf( "USE %s;", $rb );
$this->mysqlQuery( $query );
@@ -729,11 +722,7 @@ class Installer extends Controller
$this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/insert.sql' );
// Create the triggers
if (file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql') &&
file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql') &&
file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql') &&
file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationDelete.sql') &&
file_exists(PATH_HOME . 'engine/methods/setup/setupSchemas/triggerContentUpdate.sql')) {
if (file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql' ) && file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationDelete.sql' ) && file_exists( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerContentUpdate.sql' )) {
$this->mysqlQuery( @file_get_contents( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationInsert.sql' ) );
$this->mysqlQuery( @file_get_contents( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerAppDelegationUpdate.sql' ) );
$this->mysqlQuery( @file_get_contents( PATH_HOME . 'engine/methods/setup/setupSchemas/triggerApplicationUpdate.sql' ) );
@@ -745,7 +734,8 @@ class Installer extends Controller
)
VALUES (
'APP_CACHE_VIEW_ENGINE',
'" . mysql_real_escape_string(serialize(array('LANG' => 'en', 'STATUS' => 'active'))) . "'
'" . mysql_real_escape_string( serialize( array ('LANG' => 'en','STATUS' => 'active'
) ) ) . "'
)" );
}
@@ -816,6 +806,7 @@ class Installer extends Controller
//end AppCacheView Build
//erik: for new env conf handling
G::loadClass( 'system' );
$envFile = PATH_CONFIG . 'env.ini';
@@ -826,8 +817,7 @@ class Installer extends Controller
try {
G::update_php_ini( $envFile, $updatedConf );
}
catch (Exception $e) {
} catch (Exception $e) {
$info->result = false;
$info->message = "ProcessMaker couldn't write on configuration file: $envFile.<br/>";
$info->message .= "The new ProcessMaker UI couldn't be applied on installation, you can enable it after from Admin->System settings.";
@@ -840,12 +830,9 @@ class Installer extends Controller
try {
// update the main index file
$indexFileUpdated = System::updateIndexFile(array(
'lang' => 'en',
'skin' => $updatedConf['default_skin']
$indexFileUpdated = System::updateIndexFile( array ('lang' => 'en','skin' => $updatedConf['default_skin']
) );
}
catch (Exception $e) {
} catch (Exception $e) {
$info->result = false;
$info->message = "ProcessMaker couldn't write on configuration file: " . PATH_HTML . "index.html.<br/>";
$info->message .= "The new ProcessMaker UI couldn't be applied on installation, you can enable it after from Admin->System settings.";
@@ -858,8 +845,7 @@ class Installer extends Controller
$info->result = true;
$info->message = 'Succesfully OK';
}
catch (Exception $e) {
} catch (Exception $e) {
$info->canRedirect = false;
$info->result = false;
$info->message = $e->getMessage();
@@ -890,7 +876,9 @@ class Installer extends Controller
$adminUsername = trim( $_REQUEST['adminUsername'] );
$deleteDB = ($_REQUEST['deleteDB'] == 'true');
if ( substr($pathShared,-1) != '/' ) $pathShared .= '/';
if (substr( $pathShared, - 1 ) != '/') {
$pathShared .= '/';
}
$this->installLog( '-------------------------------------------' );
$this->installLog( sprintf( "Creating workspace '%s' ", $workspace ) );
@@ -994,11 +982,7 @@ class Installer extends Controller
$this->mssqlFileQuery( PATH_HOME . 'engine/data/mssql/insert.sql' );
// Create the triggers
if (file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql') &&
file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql') &&
file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql') &&
file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql') &&
file_exists(PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql')) {
if (file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationDelete.sql' ) && file_exists( PATH_HOME . 'engine/plugins/enterprise/data/triggerContentUpdate.sql' )) {
$this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationInsert.sql' ) );
$this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerAppDelegationUpdate.sql' ) );
$this->mssqlQuery( @file_get_contents( PATH_HOME . 'engine/plugins/enterprise/data/triggerApplicationUpdate.sql' ) );
@@ -1010,7 +994,8 @@ class Installer extends Controller
)
VALUES (
'APP_CACHE_VIEW_ENGINE',
'" . addslashes(serialize(array('LANG' => 'en', 'STATUS' => 'active'))) . "'
'" . addslashes( serialize( array ('LANG' => 'en','STATUS' => 'active'
) ) ) . "'
)" );
}
@@ -1043,8 +1028,7 @@ class Installer extends Controller
$info->result = true;
$info->message = 'Succesfully';
$info->url = '/sys' . $_REQUEST['workspace'] . '/en/classic/main/login';
}
catch (Exception $e) {
} catch (Exception $e) {
$info->result = false;
$info->message = $e->getMessage();
}
@@ -1061,13 +1045,15 @@ class Installer extends Controller
$engine->label = 'MySQL';
$engines[] = $engine;
}
/** DISABLED TEMPORARELY
if (function_exists('mssql_query')) {
$engine = new stdclass();
$engine->id = 'mssql';
$engine->label = 'Microsoft SQL Server';
$engines[] = $engine;
}*/
/**
* DISABLED TEMPORARELY
* if (function_exists('mssql_query')) {
* $engine = new stdclass();
* $engine->id = 'mssql';
* $engine->label = 'Microsoft SQL Server';
* $engines[] = $engine;
* }
*/
return $engines;
}
@@ -1084,8 +1070,7 @@ class Installer extends Controller
$info->rbDatabaseExists = (@mysql_num_rows( $dataset ) > 0);
$dataset = @mysql_query( "show databases like '" . $_REQUEST['rpDatabase'] . "'", $link );
$info->rpDatabaseExists = (@mysql_num_rows( $dataset ) > 0);
}
else {
} else {
$link = @mssql_connect( $_REQUEST['db_hostname'], $_REQUEST['db_username'], $_REQUEST['db_password'] );
$dataset = @mssql_query( "select * from sys.databases where name = '" . $_REQUEST['wfDatabase'] . "'", $link );
$info->wfDatabaseExists = (@mssql_num_rows( $dataset ) > 0);
@@ -1177,7 +1162,9 @@ class Installer extends Controller
$res = @mssql_query( "EXEC sp_helpsrvrolemember 'dbcreator' ", $link );
$row = mssql_fetch_array( $res );
while (is_array( $row )) {
if ( $row['MemberName'] == $db_username ) $hasDbCreator = true;
if ($row['MemberName'] == $db_username) {
$hasDbCreator = true;
}
$row = mssql_fetch_array( $res );
}
mssql_free_result( $res );
@@ -1185,7 +1172,9 @@ class Installer extends Controller
$res = @mssql_query( "EXEC sp_helpsrvrolemember 'sysadmin' ", $link );
$row = mssql_fetch_array( $res );
while (is_array( $row )) {
if ( $row['MemberName'] == $db_username ) $hasSysAdmin = true;
if ($row['MemberName'] == $db_username) {
$hasSysAdmin = true;
}
$row = mssql_fetch_array( $res );
}
mssql_free_result( $res );
@@ -1193,7 +1182,9 @@ class Installer extends Controller
$res = @mssql_query( "EXEC sp_helpsrvrolemember 'SecurityAdmin' ", $link );
$row = mssql_fetch_array( $res );
while (is_array( $row )) {
if ( $row['MemberName'] == $db_username ) $hasSecurityAdmin = true;
if ($row['MemberName'] == $db_username) {
$hasSecurityAdmin = true;
}
$row = mssql_fetch_array( $res );
}
mssql_free_result( $res );
@@ -1208,3 +1199,4 @@ class Installer extends Controller
return $info;
}
}

View File

@@ -1,7 +1,9 @@
<?php
/**
* Main Controller for processMaker v2.1
* @date Jul 17, 2011
*
* @author Erik Amaru Ortiz <erik@colosa.com>
*/
@@ -26,7 +28,7 @@ class Main extends Controller
{
global $RBAC;
$RBAC->requirePermissions( 'PM_LOGIN' );
$meta = new stdClass;
$meta = new stdClass();
$showSystemInfo = $RBAC->userCanAccess( 'PM_SETUP' ) == 1;
// setting variables for template
@@ -50,7 +52,8 @@ class Main extends Controller
$this->setVar( 'licenseNotification', $expireInLabel );
// setting variables on javascript env.
$this->setJSVar('meta', array('menu'=>$this->getMenu()));
$this->setJSVar( 'meta', array ('menu' => $this->getMenu()
) );
$activeTab = 0;
if (isset( $_SESSION['_defaultUserLocation'] )) {
@@ -89,10 +92,7 @@ class Main extends Controller
$data = array ();
foreach ($infoList as $row) {
$data[] = array(
'label' => $row[0],
'value' => $row[1],
'section' => $row[2],
$data[] = array ('label' => $row[0],'value' => $row[1],'section' => $row[2]
);
}
return $data;
@@ -106,7 +106,7 @@ class Main extends Controller
require_once 'classes/model/LoginLog.php';
G::LoadClass( 'system' );
G::loadClass( 'configuration' );
$this->conf = new Configurations;
$this->conf = new Configurations();
// getting posibles errors passed by GET method
$this->getInUrlError();
@@ -130,8 +130,7 @@ class Main extends Controller
//close the session, if the current session_id was used in PM.
$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::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 );
@@ -177,6 +176,7 @@ class Main extends Controller
}
//end log
//start new session
@session_destroy();
session_start();
@@ -232,11 +232,10 @@ class Main extends Controller
$this->setJSVar( 'flagGettingStarted', ($flagGettingStarted == 0) );
G::loadClass( 'configuration' );
$oConf = new Configurations;
$oConf = new Configurations();
$oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
$flagForgotPassword = isset($oConf->aConfig['login_enableForgotPassword'])?
$oConf->aConfig['login_enableForgotPassword']: 'off';
$flagForgotPassword = isset( $oConf->aConfig['login_enableForgotPassword'] ) ? $oConf->aConfig['login_enableForgotPassword'] : 'off';
$this->includeExtJSLib( 'ux/virtualkeyboard' );
$this->includeExtJS( 'main/login' );
@@ -244,12 +243,9 @@ class Main extends Controller
$oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
$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';
$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';
$this->setJSVar( 'forgotPasswd', $forgotPasswd );
$this->setJSVar( 'virtualKeyboad', $virtualKeyboad );
@@ -304,7 +300,8 @@ class Main extends Controller
$availableWorkspaceList = array ();
foreach ($availableWorkspace as $ws) {
$availableWorkspaceList[] = array($ws, $ws);
$availableWorkspaceList[] = array ($ws,$ws
);
}
$aField['LOGIN_VERIFY_MSG'] = G::loadTranslation( 'LOGIN_VERIFY_MSG' );
@@ -365,8 +362,7 @@ class Main extends Controller
$userData = $rbacUser->getByUsername( $httpData->username );
if (! $userData) {
$msg = G::LoadTranslation('ID_USER') . ' <b>' . $httpData->username . '</b> '.
G::LoadTranslation('ID_IS_NOT_REGISTERED');
$msg = G::LoadTranslation( 'ID_USER' ) . ' <b>' . $httpData->username . '</b> ' . G::LoadTranslation( 'ID_IS_NOT_REGISTERED' );
throw new Exception( $msg );
}
@@ -411,9 +407,11 @@ class Main extends Controller
return $result;
}
/** *
/**
* *
* Private Functions *
* **/
* *
*/
private function getMenu ()
{
global $G_MAIN_MENU;
@@ -428,8 +426,7 @@ class Main extends Controller
$G_ID_MENU_SELECTED = 'BPMN';
$oMenu = new Menu();
$menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED,
$G_ID_MENU_SELECTED);
$menus = $oMenu->generateArrayForTemplate( $G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED, $G_ID_MENU_SELECTED );
foreach ($menus as $i => $menu) {
if (strpos( $menu['target'], 'cases/main' ) !== false) {
@@ -447,8 +444,9 @@ class Main extends Controller
if (strpos( $menu['target'], 'dashboard/main' ) !== false) {
$menus[$i]['target'] = str_replace( 'dashboard/main', 'dashboard', $menus[$i]['target'] );
}
$menus[$i]['elementclass'] = preg_replace(array('/class=/', '/"/'), array('', ''),
$menus[$i]['elementclass']) ;
$menus[$i]['elementclass'] = preg_replace( array ('/class=/','/"/'
), array ('',''
), $menus[$i]['elementclass'] );
}
return $menus;
}
@@ -478,8 +476,7 @@ class Main extends Controller
if (($aFotoSelect = $this->memcache->get( 'aFotoSelect' )) === false) {
G::LoadClass( 'replacementLogo' );
$oLogoR = new replacementLogo();
$aFotoSelect = $oLogoR->getNameLogo((isset($_SESSION['USER_LOGGED'])) ?
$_SESSION['USER_LOGGED'] : '');
$aFotoSelect = $oLogoR->getNameLogo( (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : '' );
$this->memcache->set( 'aFotoSelect', $aFotoSelect, 1 * 3600 );
}
if (is_array( $aFotoSelect )) {
@@ -494,8 +491,7 @@ class Main extends Controller
$sCompanyLogo = $logoPlugin;
} 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);
$sCompanyLogo = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/adminProxy/showLogoFile?id=" . base64_encode( $sCompanyLogo );
}
}
return $sCompanyLogo;
@@ -519,7 +515,8 @@ class Main extends Controller
$LANG_NAME = $locale['LANGUAGE'];
}
$languagesList [] = array($LANG_ID, $LANG_NAME);
$languagesList[] = array ($LANG_ID,$LANG_NAME
);
}
$this->memcache->set( 'languagesList', $languagesList, 1 * 3600 );
}
@@ -621,11 +618,7 @@ class Main extends Controller
private function setFlyNotify ($type, $title, $text, $time = 5)
{
$this->flyNotify = array(
'type' => $type,
'title' => $title,
'text' => $text,
'time' => $time
$this->flyNotify = array ('type' => $type,'title' => $title,'text' => $text,'time' => $time
);
$_SESSION['G_MESSAGE'] = $text;
@@ -741,34 +734,53 @@ class Main extends Controller
$properties = array ();
$ee = class_exists( 'pmLicenseManager' ) ? " - Enterprise Edition" : '';
$properties[] = array('ProcessMaker Ver.', System::getVersion() . $ee, $pmSection);
$properties[] = array('Operating System', $redhat, $sysSection);
$properties[] = array('Time Zone', (defined('TIME_ZONE')) ? TIME_ZONE : "Unknown", $sysSection);
$properties[] = array('Web Server', getenv ('SERVER_SOFTWARE'), $sysSection);
$properties[] = array('Server Name', getenv ('SERVER_NAME'), $pmSection);
$properties[] = array('Server IP Address', $this->lookup ($ip), $sysSection);
$properties[] = array('PHP Version', phpversion(), $sysSection);
$properties[] = array ('ProcessMaker Ver.',System::getVersion() . $ee,$pmSection
);
$properties[] = array ('Operating System',$redhat,$sysSection
);
$properties[] = array ('Time Zone',(defined( 'TIME_ZONE' )) ? TIME_ZONE : "Unknown",$sysSection
);
$properties[] = array ('Web Server',getenv( 'SERVER_SOFTWARE' ),$sysSection
);
$properties[] = array ('Server Name',getenv( 'SERVER_NAME' ),$pmSection
);
$properties[] = array ('Server IP Address',$this->lookup( $ip ),$sysSection
);
$properties[] = array ('PHP Version',phpversion(),$sysSection
);
if (defined( "DB_HOST" )) {
$properties[] = array('Data Base', $dbNetView->dbName(DB_ADAPTER) . ' (Version ' . $sMySQLVersion . ')',
$pmSection);
$properties[] = array('Data Base Server', DB_HOST, $pmSection);
$properties[] = array('Data Base Name', DB_NAME, $pmSection);
$properties[] = array('Available DB Engines', $availdb, $sysSection);
$properties[] = array ('Data Base',$dbNetView->dbName( DB_ADAPTER ) . ' (Version ' . $sMySQLVersion . ')',$pmSection
);
$properties[] = array ('Data Base Server',DB_HOST,$pmSection
);
$properties[] = array ('Data Base Name',DB_NAME,$pmSection
);
$properties[] = array ('Available DB Engines',$availdb,$sysSection
);
} else {
$properties[] = array('Data Base', "Not defined", $pmSection);
$properties[] = array('Data Base Server', "Not defined", $pmSection);
$properties[] = array('Data Base Name', "Not defined", $pmSection);
$properties[] = array('Available DB Engines', "Not defined", $sysSection);
$properties[] = array ('Data Base',"Not defined",$pmSection
);
$properties[] = array ('Data Base Server',"Not defined",$pmSection
);
$properties[] = array ('Data Base Name',"Not defined",$pmSection
);
$properties[] = array ('Available DB Engines',"Not defined",$sysSection
);
}
$properties[] = array('Workspace', defined ("SYS_SYS") ? SYS_SYS : "Not defined", $pmSection);
$properties[] = array ('Workspace',defined( "SYS_SYS" ) ? SYS_SYS : "Not defined",$pmSection
);
$properties[] = array('Server Protocol', getenv ('SERVER_PROTOCOL'), $sysSection);
$properties[] = array('Server Port', getenv ('SERVER_PORT'), $sysSection);
$properties[] = array ('Server Protocol',getenv( 'SERVER_PROTOCOL' ),$sysSection
);
$properties[] = array ('Server Port',getenv( 'SERVER_PORT' ),$sysSection
);
//$properties[] = array('Remote Host', getenv ('REMOTE_HOST'), $sysSection);
$properties[] = array('Server Addr.', getenv ('SERVER_ADDR'), $sysSection);
$properties[] = array('User\'s Browser', getenv ('HTTP_USER_AGENT'), $sysSection);
$properties[] = array ('Server Addr.',getenv( 'SERVER_ADDR' ),$sysSection
);
$properties[] = array ('User\'s Browser',getenv( 'HTTP_USER_AGENT' ),$sysSection
);
return $properties;
}