diff --git a/workflow/engine/methods/authSources/authSources_List.php b/workflow/engine/methods/authSources/authSources_List.php index 3285ebde6..16955e9b6 100755 --- a/workflow/engine/methods/authSources/authSources_List.php +++ b/workflow/engine/methods/authSources/authSources_List.php @@ -1,51 +1,50 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -global $RBAC; -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; -} - -G::LoadClass('configuration'); -$c = new Configurations(); -$configPage = $c->getConfiguration('authSourcesList', 'pageSize','',$_SESSION['USER_LOGGED']); -$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20; - -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'users'; -$G_ID_MENU_SELECTED = 'USERS'; -$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; - -$G_PUBLISH = new Publisher; - -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addExtJsScript('authSources/authSourcesList', false); //adding a javascript file .js -$oHeadPublisher->addContent('authSources/authSourcesList'); //adding a html file .html. -$oHeadPublisher->assign('FORMATS',$c->getFormats()); -$oHeadPublisher->assign('CONFIG', $Config); -G::RenderPage('publish', 'extJs'); -?> +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +G::LoadClass( 'configuration' ); +$c = new Configurations(); +$configPage = $c->getConfiguration( 'authSourcesList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); +$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20; + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'users'; +$G_ID_MENU_SELECTED = 'USERS'; +$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; + +$G_PUBLISH = new Publisher(); + +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addExtJsScript( 'authSources/authSourcesList', false ); //adding a javascript file .js +$oHeadPublisher->addContent( 'authSources/authSourcesList' ); //adding a html file .html. +$oHeadPublisher->assign( 'FORMATS', $c->getFormats() ); +$oHeadPublisher->assign( 'CONFIG', $Config ); +G::RenderPage( 'publish', 'extJs' ); + diff --git a/workflow/engine/methods/authSources/authSources_New.php b/workflow/engine/methods/authSources/authSources_New.php index 4e6273ab1..1c3c1dcba 100755 --- a/workflow/engine/methods/authSources/authSources_New.php +++ b/workflow/engine/methods/authSources/authSources_New.php @@ -1,59 +1,54 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - global $RBAC; - if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - } - - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'users'; - $G_ID_MENU_SELECTED = 'USERS'; - $G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; - - $fields = array('AUTH_SOURCE_PROVIDER' => $_REQUEST['AUTH_SOURCE_PROVIDER']); - - - $G_PUBLISH = new Publisher(); - - if (file_exists(PATH_PLUGINS . $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) { - if (class_exists($fields['AUTH_SOURCE_PROVIDER'])) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml', '', $fields, '../authSources/authSources_Save'); - } - else { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => G::LoadTranslation('ID_AUTH_SOURCE_MISSING'))); - } - } - else { - if (file_exists(PATH_XMLFORM . 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit', '', $fields, '../authSources/authSources_Save'); - } - else { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => 'File: ' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' . ' not exists.')); - } - } - G::RenderPage('publish','blank'); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'users'; +$G_ID_MENU_SELECTED = 'USERS'; +$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; + +$fields = array ('AUTH_SOURCE_PROVIDER' => $_REQUEST['AUTH_SOURCE_PROVIDER']); + +$G_PUBLISH = new Publisher(); + +if (file_exists( PATH_PLUGINS . $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' )) { + if (class_exists( $fields['AUTH_SOURCE_PROVIDER'] )) { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml', '', $fields, '../authSources/authSources_Save' ); + } else { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => G::LoadTranslation( 'ID_AUTH_SOURCE_MISSING' )) ); + } +} else { + if (file_exists( PATH_XMLFORM . 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' )) { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit', '', $fields, '../authSources/authSources_Save' ); + } else { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => 'File: ' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' . ' not exists.') ); + } +} +G::RenderPage( 'publish', 'blank' ); \ No newline at end of file diff --git a/workflow/engine/methods/authSources/authSources_Save.php b/workflow/engine/methods/authSources/authSources_Save.php index f8c2a0f72..2169abcd2 100755 --- a/workflow/engine/methods/authSources/authSources_Save.php +++ b/workflow/engine/methods/authSources/authSources_Save.php @@ -1,67 +1,53 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - global $RBAC; - if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - } - - unset($_POST['form']['btnSave']); - - $aCommonFields = array('AUTH_SOURCE_UID', - 'AUTH_SOURCE_NAME', - 'AUTH_SOURCE_PROVIDER', - 'AUTH_SOURCE_SERVER_NAME', - 'AUTH_SOURCE_PORT', - 'AUTH_SOURCE_ENABLED_TLS', - 'AUTH_ANONYMOUS', - 'AUTH_SOURCE_SEARCH_USER', - 'AUTH_SOURCE_PASSWORD', - 'AUTH_SOURCE_VERSION', - 'AUTH_SOURCE_BASE_DN', - 'AUTH_SOURCE_OBJECT_CLASSES', - 'AUTH_SOURCE_ATTRIBUTES'); - - $aFields = $aData = array(); - foreach ($_POST['form'] as $sField => $sValue) { - if (in_array($sField, $aCommonFields)) { - $aFields[$sField] = $sValue; - } - else { - $aData[$sField] = $sValue; - } - } - $aFields['AUTH_SOURCE_DATA'] = $aData; - - if ($aFields['AUTH_SOURCE_UID'] == '') { - $RBAC->createAuthSource($aFields); - } - else { - $RBAC->updateAuthSource($aFields); - } - - G::header('location: authSources_List'); \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +unset( $_POST['form']['btnSave'] ); + +$aCommonFields = array ('AUTH_SOURCE_UID','AUTH_SOURCE_NAME','AUTH_SOURCE_PROVIDER','AUTH_SOURCE_SERVER_NAME','AUTH_SOURCE_PORT','AUTH_SOURCE_ENABLED_TLS','AUTH_ANONYMOUS','AUTH_SOURCE_SEARCH_USER','AUTH_SOURCE_PASSWORD','AUTH_SOURCE_VERSION','AUTH_SOURCE_BASE_DN','AUTH_SOURCE_OBJECT_CLASSES','AUTH_SOURCE_ATTRIBUTES'); + +$aFields = $aData = array (); +foreach ($_POST['form'] as $sField => $sValue) { + if (in_array( $sField, $aCommonFields )) { + $aFields[$sField] = $sValue; + } else { + $aData[$sField] = $sValue; + } +} +$aFields['AUTH_SOURCE_DATA'] = $aData; + +if ($aFields['AUTH_SOURCE_UID'] == '') { + $RBAC->createAuthSource( $aFields ); +} else { + $RBAC->updateAuthSource( $aFields ); +} + +G::header( 'location: authSources_List' ); + diff --git a/workflow/engine/methods/authSources/authSources_SearchUsers.php b/workflow/engine/methods/authSources/authSources_SearchUsers.php index accc8fc64..da4c9d653 100755 --- a/workflow/engine/methods/authSources/authSources_SearchUsers.php +++ b/workflow/engine/methods/authSources/authSources_SearchUsers.php @@ -1,39 +1,39 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; -} - -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'users'; -$G_ID_MENU_SELECTED = 'USERS'; -$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; - -$G_PUBLISH = new Publisher(); -$G_PUBLISH->AddContent('xmlform', 'xmlform', 'authSources/authSources_SearchUsers', '', array('AUTH_SOURCE_UID' => $_GET['sUID']), '../authSources/authSources_ImportUsers'); -G::RenderPage('publish','blank'); \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'users'; +$G_ID_MENU_SELECTED = 'USERS'; +$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'authSources/authSources_SearchUsers', '', array ('AUTH_SOURCE_UID' => $_GET['sUID']), '../authSources/authSources_ImportUsers' ); +G::RenderPage( 'publish', 'blank' ); + diff --git a/workflow/engine/methods/authSources/authSources_SelectType.php b/workflow/engine/methods/authSources/authSources_SelectType.php index 0fc26c2d5..437823ba8 100755 --- a/workflow/engine/methods/authSources/authSources_SelectType.php +++ b/workflow/engine/methods/authSources/authSources_SelectType.php @@ -1,54 +1,54 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; -} - -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'users'; -$G_ID_MENU_SELECTED = 'USERS'; -$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; - -$aAuthSourceTypes = array(array('sType' => 'char', 'sLabel' => 'char')); -$oDirectory = dir(PATH_RBAC . 'plugins' . PATH_SEP); -while($sObject = $oDirectory->read()) { - if (($sObject != '.') && ($sObject != '..') && ($sObject != '.svn') && ($sObject != 'ldap')) { - if (is_file(PATH_RBAC . 'plugins' . PATH_SEP . $sObject)) { - $sType = trim(str_replace('class.', '', str_replace('.php', '', $sObject))); - $aAuthSourceTypes[] = array('sType' => $sType, 'sLabel' => $sType); - } - } -} -global $_DBArray; -$_DBArray['authSourceTypes'] = $aAuthSourceTypes; -$_SESSION['_DBArray'] = $_DBArray; - -$G_PUBLISH = new Publisher(); -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addExtJsScript('authSources/authSourcesListNew', true); //adding a javascript file .js -G::RenderPage('publish', 'extJs'); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'users'; +$G_ID_MENU_SELECTED = 'USERS'; +$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; + +$aAuthSourceTypes = array (array ('sType' => 'char','sLabel' => 'char')); +$oDirectory = dir( PATH_RBAC . 'plugins' . PATH_SEP ); +while ($sObject = $oDirectory->read()) { + if (($sObject != '.') && ($sObject != '..') && ($sObject != '.svn') && ($sObject != 'ldap')) { + if (is_file( PATH_RBAC . 'plugins' . PATH_SEP . $sObject )) { + $sType = trim( str_replace( 'class.', '', str_replace( '.php', '', $sObject ) ) ); + $aAuthSourceTypes[] = array ('sType' => $sType,'sLabel' => $sType ); + } + } +} +global $_DBArray; +$_DBArray['authSourceTypes'] = $aAuthSourceTypes; +$_SESSION['_DBArray'] = $_DBArray; + +$G_PUBLISH = new Publisher(); +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addExtJsScript( 'authSources/authSourcesListNew', true ); //adding a javascript file .js +G::RenderPage( 'publish', 'extJs' ); + diff --git a/workflow/engine/methods/authSources/authSources_kindof.php b/workflow/engine/methods/authSources/authSources_kindof.php index 5ffeb6350..6b48b8794 100755 --- a/workflow/engine/methods/authSources/authSources_kindof.php +++ b/workflow/engine/methods/authSources/authSources_kindof.php @@ -27,7 +27,6 @@ if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { G::header( 'location: ../login/login' ); die(); } - $G_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'users'; $G_ID_MENU_SELECTED = 'USERS'; diff --git a/workflow/engine/methods/setup/holiday.php b/workflow/engine/methods/setup/holiday.php index 1b9476661..5c6fbeabb 100755 --- a/workflow/engine/methods/setup/holiday.php +++ b/workflow/engine/methods/setup/holiday.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; - $G_ENABLE_BLANK_SKIN = true; - - $dbc = new DBConnection; - $G_PUBLISH = new Publisher; - - $G_PUBLISH->AddContent( 'pagedtable', 'paged-table', "setup/holidayList" ); - - G::RenderPage( 'publish' ); - -?> \ No newline at end of file +if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1) + return $RBAC_Response; +$G_ENABLE_BLANK_SKIN = true; + +$dbc = new DBConnection(); +$G_PUBLISH = new Publisher(); + +$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', "setup/holidayList" ); + +G::RenderPage( 'publish' ); + diff --git a/workflow/engine/methods/setup/holidayNew.php b/workflow/engine/methods/setup/holidayNew.php index 16f8562d7..ca0946270 100755 --- a/workflow/engine/methods/setup/holidayNew.php +++ b/workflow/engine/methods/setup/holidayNew.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; - $G_ENABLE_BLANK_SKIN = true; - - $dbc = new DBConnection; - $G_PUBLISH = new Publisher; - - $fields['DATE'] = date('Y-m-d'); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/holiday", '', $fields, "holidaySave"); - - G::RenderPage( 'publish' ); - -?> \ No newline at end of file +if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1) + return $RBAC_Response; +$G_ENABLE_BLANK_SKIN = true; + +$dbc = new DBConnection(); +$G_PUBLISH = new Publisher(); + +$fields['DATE'] = date( 'Y-m-d' ); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/holiday", '', $fields, "holidaySave" ); + +G::RenderPage( 'publish' ); + diff --git a/workflow/engine/methods/setup/index.php b/workflow/engine/methods/setup/index.php index 845c3d0d1..f2d80e145 100755 --- a/workflow/engine/methods/setup/index.php +++ b/workflow/engine/methods/setup/index.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - $newFile = str_replace ( 'index.php', 'setup.php' , __FILE__ ) ; - return $newFile; - - +$newFile = str_replace( 'index.php', 'setup.php', __FILE__ ); +return $newFile; + diff --git a/workflow/engine/methods/setup/jasper.php b/workflow/engine/methods/setup/jasper.php index 1e82f732f..b4a94cbd0 100755 --- a/workflow/engine/methods/setup/jasper.php +++ b/workflow/engine/methods/setup/jasper.php @@ -1,139 +1,136 @@ -ws_list("/"); +$response = $oJasper->ws_list( "/" ); - if (is_object($response) && get_class($response) == 'SOAP_Fault') { +if (is_object( $response ) && get_class( $response ) == 'SOAP_Fault') { $errorMessage = $response->getFault()->faultstring; - } - else { - $folders = $oJasper->getResourceDescriptors($response); - } +} else { + $folders = $oJasper->getResourceDescriptors( $response ); +} - //$result = $oJasper->ws_put(); - krumo ($response); - - //execute a report - - $currentUri = "/reports/samples/Employees"; - $result = $oJasper->ws_get($currentUri); +//$result = $oJasper->ws_put(); +krumo( $response ); - $folders = $oJasper->getResourceDescriptors($result); - - if (count($folders) != 1 || $folders[0]['type'] != 'reportUnit') - { - echo "

Invalid RU ($currentUri)

"; - echo "
$result
"; - exit(); - } +//execute a report - $reportUnit = $folders[0]; - - // 2. Prepare the parameters array looking in the $_GET for params - // starting with PARAM_ ... - // - - $report_params = array(); - - $moveToPage = "jasper?uri=$currentUri"; - - foreach (array_keys($_GET) AS $param_name) { - if (strncmp("PARAM_", $param_name,6) == 0) { - $report_params[substr($param_name,6)] = $_GET[$param_name]; + +$currentUri = "/reports/samples/Employees"; +$result = $oJasper->ws_get( $currentUri ); + +$folders = $oJasper->getResourceDescriptors( $result ); + +if (count( $folders ) != 1 || $folders[0]['type'] != 'reportUnit') { + echo "

Invalid RU ($currentUri)

"; + echo "
$result
"; + exit(); +} + +$reportUnit = $folders[0]; + +// 2. Prepare the parameters array looking in the $_GET for params +// starting with PARAM_ ... +// + + +$report_params = array (); + +$moveToPage = "jasper?uri=$currentUri"; + +foreach (array_keys( $_GET ) as $param_name) { + if (strncmp( "PARAM_", $param_name, 6 ) == 0) { + $report_params[substr( $param_name, 6 )] = $_GET[$param_name]; } - -// if ($param_name != "page" && $param_name != "uri") { -// $moveToPage .= "&".urlencode($param_name)."=". urlencode($_GET[$param_name]); -// } - } - - $formatReport = RUN_OUTPUT_FORMAT_XML; - $formatReport = RUN_OUTPUT_FORMAT_CSV; - $formatReport = RUN_OUTPUT_FORMAT_RTF; - $formatReport = RUN_OUTPUT_FORMAT_PDF; - $formatReport = RUN_OUTPUT_FORMAT_HTML; - $moveToPage .="&page="; - - // 3. Execute the report - $output_params = array(); - $output_params[RUN_OUTPUT_FORMAT] = $formatReport; - - if ( $formatReport == RUN_OUTPUT_FORMAT_HTML) { + + // if ($param_name != "page" && $param_name != "uri") { + // $moveToPage .= "&".urlencode($param_name)."=". urlencode($_GET[$param_name]); + // } +} + +$formatReport = RUN_OUTPUT_FORMAT_XML; +$formatReport = RUN_OUTPUT_FORMAT_CSV; +$formatReport = RUN_OUTPUT_FORMAT_RTF; +$formatReport = RUN_OUTPUT_FORMAT_PDF; +$formatReport = RUN_OUTPUT_FORMAT_HTML; +$moveToPage .= "&page="; + +// 3. Execute the report +$output_params = array (); +$output_params[RUN_OUTPUT_FORMAT] = $formatReport; + +if ($formatReport == RUN_OUTPUT_FORMAT_HTML) { //$pageReport = isset ( $_GET['page'] ) ? $_GET['page'] : 1; //$output_params[RUN_OUTPUT_PAGE] = $pageReport; //$output_params[RUN_OUTPUT_IMAGES_URI] = '/sysos/'. SYS_LANG. '/classic'; - } - - $result = $oJasper->ws_runReport($currentUri, $report_params, $output_params, $attachments); - - // 4. - if (is_object($result) && get_class($result) == 'SOAP_Fault') { +} + +$result = $oJasper->ws_runReport( $currentUri, $report_params, $output_params, $attachments ); + +// 4. +if (is_object( $result ) && get_class( $result ) == 'SOAP_Fault') { $errorMessage = $result->getFault()->faultstring; - + echo $errorMessage; exit(); - } - - $operationResult = $oJasper->getOperationResult($result); - - if ($operationResult['returnCode'] != '0') { - echo "Error executing the report:
".$operationResult['returnMessage'].""; +} + +$operationResult = $oJasper->getOperationResult( $result ); + +if ($operationResult['returnCode'] != '0') { + echo "Error executing the report:
" . $operationResult['returnMessage'] . ""; exit(); - } - - if (is_array($attachments)) - { +} + +if (is_array( $attachments )) { //krumo ($attachments); - switch ($formatReport) { - case RUN_OUTPUT_FORMAT_PDF : - header ( "Content-type: application/pdf" ); - echo( $attachments["cid:report"]); - break; - - case RUN_OUTPUT_FORMAT_HTML : - // 1. Save attachments.... - // 2. Print the report.... - header ( "Content-type: text/html"); - foreach (array_keys($attachments) as $key) { - if ($key != "cid:report") { - $f = fopen("images/".substr($key,4),"w"); - fwrite($f, $attachments[$key]); - fclose($f); - } - } - - echo "
"; - $prevpage = ($pageReport > 0) ? $pageReport - 1 : 0; - $nextpage = $pageReport + 1; - - echo "Prev page | Next page"; - echo "

"; - - echo $attachments["cid:report"]; - //print_r(array_keys($attachments)); - break; - - case RUN_OUTPUT_FORMAT_CSV : - case RUN_OUTPUT_FORMAT_XLS : - header ( 'Content-type: application/xls' ); - header ( 'Content-Disposition: attachment; filename="report.xls"'); - echo( $attachments["cid:report"]); - break; - case RUN_OUTPUT_FORMAT_RTF : - header ( 'Content-type: text/rtf' ); - header ( 'Content-Disposition: attachment; filename="report.rtf"'); - echo( $attachments["cid:report"]); - break; + switch ($formatReport) { + case RUN_OUTPUT_FORMAT_PDF: + header( "Content-type: application/pdf" ); + echo ($attachments["cid:report"]); + break; + case RUN_OUTPUT_FORMAT_HTML: + // 1. Save attachments.... + // 2. Print the report.... + header( "Content-type: text/html" ); + foreach (array_keys( $attachments ) as $key) { + if ($key != "cid:report") { + $f = fopen( "images/" . substr( $key, 4 ), "w" ); + fwrite( $f, $attachments[$key] ); + fclose( $f ); + } + } + + echo "
"; + $prevpage = ($pageReport > 0) ? $pageReport - 1 : 0; + $nextpage = $pageReport + 1; + + echo "Prev page | Next page"; + echo "

"; + + echo $attachments["cid:report"]; + //print_r(array_keys($attachments)); + break; + case RUN_OUTPUT_FORMAT_CSV: + case RUN_OUTPUT_FORMAT_XLS: + header( 'Content-type: application/xls' ); + header( 'Content-Disposition: attachment; filename="report.xls"' ); + echo ($attachments["cid:report"]); + break; + case RUN_OUTPUT_FORMAT_RTF: + header( 'Content-type: text/rtf' ); + header( 'Content-Disposition: attachment; filename="report.rtf"' ); + echo ($attachments["cid:report"]); + break; + default: + //header ( 'Content-type: application/xls' ); + //header ( 'Content-Disposition: attachment; filename="report.xls"'); + echo ($attachments["cid:report"]); + break; + } + exit(); +} else + echo "No attachment found!"; - default : - //header ( 'Content-type: application/xls' ); - //header ( 'Content-Disposition: attachment; filename="report.xls"'); - echo( $attachments["cid:report"]); - break; - } - exit(); - } - else echo "No attachment found!"; diff --git a/workflow/engine/methods/setup/language.php b/workflow/engine/methods/setup/language.php index 301cc0d6e..ae22f6372 100755 --- a/workflow/engine/methods/setup/language.php +++ b/workflow/engine/methods/setup/language.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; - $G_ENABLE_BLANK_SKIN = true; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1) + return $RBAC_Response; +$G_ENABLE_BLANK_SKIN = true; - $dbc = new DBConnection; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/language","", "" , "language_save" ); - $G_PUBLISH->AddContent( "xmlform", "pagedTable", "setup/language_table","","", "../setup/languageAjax.php" ); - G::RenderPage( 'publish' ); +$dbc = new DBConnection(); +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/language", "", "", "language_save" ); +$G_PUBLISH->AddContent( "xmlform", "pagedTable", "setup/language_table", "", "", "../setup/languageAjax.php" ); +G::RenderPage( 'publish' ); ?> + diff --git a/workflow/engine/methods/setup/language_Ajax.php b/workflow/engine/methods/setup/language_Ajax.php index 9b7df4d4b..c645ff3a3 100755 --- a/workflow/engine/methods/setup/language_Ajax.php +++ b/workflow/engine/methods/setup/language_Ajax.php @@ -1,173 +1,172 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - - G::LoadInclude('ajax'); - if(isset($_POST['form'])) { - $_POST = $_POST['form']; - } - $_POST['function'] = get_ajax_value('function'); - switch($_POST['function']) { - case 'savePredetermined': - require_once "classes/model/Translation.php"; - $tranlationsList = Translation::getTranslationEnvironments(); - g::pr($tranlationsList); die; - if( isset($meta['LAN_ID']) && $meta['LAN_ID'] == $_POST['lang'] ){ - echo 'The Setting was saved successfully!'; - } else { - echo 'Some error occured while the setting was being save, try later please.'; - } - break; - - case 'languagesList': - require_once 'classes/model/Language.php'; - require_once 'classes/model/IsoCountry.php'; - require_once 'classes/model/Translation.php'; - G::loadClass('configuration'); - - $isoCountry = new isoCountry(); - $translationRow = new Translation(); - $response = new stdClass(); - $translationsEnvList = $translationRow->getTranslationEnvironments(); - //print_r($translationsEnvList); die; - $i = 0; - foreach( $translationsEnvList as $locale=>$translationRow) { - - $COUNTRY_ID = $translationRow['IC_UID']; - if( $COUNTRY_ID != '' ) { - $isoCountryRecord = $isoCountry->findById(strtoupper($COUNTRY_ID)); - $flag = strtolower($isoCountryRecord['IC_UID']); - $countryName = $translationRow['HEADERS']['X-Poedit-Country']; - } else { - $flag = 'international'; - $countryName = G::LoadTranslation('ID_INTERNATIONAL'); - } - - G::LoadClass ( 'configuration' ); - - $conf = new Configurations(); - $confCasesList = $conf->getConfiguration('casesList','todo'); - //echo date($confCasesList['dateformat'], '2010-01-01'); - - if( isset($confCasesList['dateformat']) ){ - $datetime = explode(' ', $translationRow['DATE']); - - $date = explode('-', $datetime[0]); - if( count($datetime) == 2 ) - $time = explode(':', $datetime[1]); - - if( count($date) == 3 ){ - if( count($time) >= 2 ){ - $DATE = date($confCasesList['dateformat'], mktime($time[0], $time[1], 0, $date[1], $date[2], $date[0])); - } else { - $DATE = date($confCasesList['dateformat'], mktime(0, 0, 0, $date[1], $date[2], $date[0])); - } - } else { - $DATE = $translationRow['DATE']; - } - - $datetime = explode(' ', $translationRow['HEADERS']['PO-Revision-Date']); - - $date = explode('-', $datetime[0]); - if( count($datetime) == 2 ) - $time = explode(':', $datetime[1]); - - if( count($date) == 3 ){ - if( count($time) >= 2 ){ - $REV_DATE = date($confCasesList['dateformat'], mktime($time[0], substr($time[1],0,2), 0, $date[1], $date[2], $date[0])); - } else { - $REV_DATE = date($confCasesList['dateformat'], mktime(0, 0, 0, $date[1], $date[2], $date[0])); - } - } else { - $REV_DATE = $translationRow['HEADERS']['PO-Revision-Date']; - } - } else { - $DATE = $translationRow['DATE']; - $REV_DATE = $translationRow['HEADERS']['PO-Revision-Date']; - } - - $languagesList[$i]['LAN_ID'] = $translationRow['LAN_ID']; - $languagesList[$i]['LOCALE'] = $translationRow['LOCALE']; - $languagesList[$i]['LAN_FLAG'] = $flag; - $languagesList[$i]['NUM_RECORDS'] = $translationRow['NUM_RECORDS']; - $languagesList[$i]['DATE'] = $DATE; - $languagesList[$i]['LAN_NAME'] = $translationRow['HEADERS']['X-Poedit-Language']; - $languagesList[$i]['COUNTRY_NAME'] = $countryName; - $languagesList[$i]['TRANSLATOR'] = htmlentities($translationRow['HEADERS']['Last-Translator']); - $languagesList[$i]['REV_DATE'] = $REV_DATE; - $languagesList[$i]['VERSION'] = $translationRow['HEADERS']['Project-Id-Version']; - - $i++; - } - $translationRow = new Translation(); - - $response->data = $languagesList; - - print(G::json_encode($response)); - break; - - case 'delete': - include_once 'classes/model/Translation.php'; - include_once 'classes/model/Content.php'; - $locale = $_POST['LOCALE']; - $trn = new Translation(); - - if( strpos($locale, Translation::$localeSeparator) ) - list($LAN_ID, $IC_UID) = explode(Translation::$localeSeparator, $locale); - else { - $LAN_ID = $locale; - $LAN_ID = ''; - } - - $oCriteria = new Criteria('workflow'); - //$oCriteria->addSelectColumn('COUNT('.ContentPeer::CON_CATEGORY.')'); - $oCriteria->addSelectColumn(ContentPeer::CON_CATEGORY); - $oCriteria->addSelectColumn(ContentPeer::CON_VALUE); - $oCriteria->add(ContentPeer::CON_LANG, $locale); - $oCriteria->add(ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL ); - $oDataset = ContentPeer::doSelectRS($oCriteria); - - $oDataset->next(); - $oContent = new Content(); - $aRow = $oDataset->getRow(); - - //THERE IS NO ANY CASE STARTED FROM THES LANGUAGE - if( $aRow[0] == 0 ) { //so we can delete this language - try{ - Content::removeLanguageContent($locale); - $trn->removeTranslationEnvironment($locale); - echo G::LoadTranslation('ID_LANGUAGE_DELETED_SUCCESSFULLY'); - } catch (Exception $e){ - echo $e->getMessage(); - } - } else { - echo str_replace('{0}', $aRow[0], G::LoadTranslation('ID_LANGUAGE_CANT_DELETE')); - } - break; - } -} catch ( Exception $oException ) { - die($oException->getMessage()); -} -?> +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + + G::LoadInclude( 'ajax' ); + if (isset( $_POST['form'] )) { + $_POST = $_POST['form']; + } + $_POST['function'] = get_ajax_value( 'function' ); + switch ($_POST['function']) { + case 'savePredetermined': + require_once "classes/model/Translation.php"; + $tranlationsList = Translation::getTranslationEnvironments(); + g::pr( $tranlationsList ); + die(); + if (isset( $meta['LAN_ID'] ) && $meta['LAN_ID'] == $_POST['lang']) { + echo 'The Setting was saved successfully!'; + } else { + echo 'Some error occured while the setting was being save, try later please.'; + } + break; + case 'languagesList': + require_once 'classes/model/Language.php'; + require_once 'classes/model/IsoCountry.php'; + require_once 'classes/model/Translation.php'; + G::loadClass( 'configuration' ); + + $isoCountry = new isoCountry(); + $translationRow = new Translation(); + $response = new stdClass(); + $translationsEnvList = $translationRow->getTranslationEnvironments(); + //print_r($translationsEnvList); die; + $i = 0; + foreach ($translationsEnvList as $locale => $translationRow) { + + $COUNTRY_ID = $translationRow['IC_UID']; + if ($COUNTRY_ID != '') { + $isoCountryRecord = $isoCountry->findById( strtoupper( $COUNTRY_ID ) ); + $flag = strtolower( $isoCountryRecord['IC_UID'] ); + $countryName = $translationRow['HEADERS']['X-Poedit-Country']; + } else { + $flag = 'international'; + $countryName = G::LoadTranslation( 'ID_INTERNATIONAL' ); + } + + G::LoadClass( 'configuration' ); + + $conf = new Configurations(); + $confCasesList = $conf->getConfiguration( 'casesList', 'todo' ); + //echo date($confCasesList['dateformat'], '2010-01-01'); + + + if (isset( $confCasesList['dateformat'] )) { + $datetime = explode( ' ', $translationRow['DATE'] ); + + $date = explode( '-', $datetime[0] ); + if (count( $datetime ) == 2) + $time = explode( ':', $datetime[1] ); + + if (count( $date ) == 3) { + if (count( $time ) >= 2) { + $DATE = date( $confCasesList['dateformat'], mktime( $time[0], $time[1], 0, $date[1], $date[2], $date[0] ) ); + } else { + $DATE = date( $confCasesList['dateformat'], mktime( 0, 0, 0, $date[1], $date[2], $date[0] ) ); + } + } else { + $DATE = $translationRow['DATE']; + } + + $datetime = explode( ' ', $translationRow['HEADERS']['PO-Revision-Date'] ); + + $date = explode( '-', $datetime[0] ); + if (count( $datetime ) == 2) + $time = explode( ':', $datetime[1] ); + + if (count( $date ) == 3) { + if (count( $time ) >= 2) { + $REV_DATE = date( $confCasesList['dateformat'], mktime( $time[0], substr( $time[1], 0, 2 ), 0, $date[1], $date[2], $date[0] ) ); + } else { + $REV_DATE = date( $confCasesList['dateformat'], mktime( 0, 0, 0, $date[1], $date[2], $date[0] ) ); + } + } else { + $REV_DATE = $translationRow['HEADERS']['PO-Revision-Date']; + } + } else { + $DATE = $translationRow['DATE']; + $REV_DATE = $translationRow['HEADERS']['PO-Revision-Date']; + } + + $languagesList[$i]['LAN_ID'] = $translationRow['LAN_ID']; + $languagesList[$i]['LOCALE'] = $translationRow['LOCALE']; + $languagesList[$i]['LAN_FLAG'] = $flag; + $languagesList[$i]['NUM_RECORDS'] = $translationRow['NUM_RECORDS']; + $languagesList[$i]['DATE'] = $DATE; + $languagesList[$i]['LAN_NAME'] = $translationRow['HEADERS']['X-Poedit-Language']; + $languagesList[$i]['COUNTRY_NAME'] = $countryName; + $languagesList[$i]['TRANSLATOR'] = htmlentities( $translationRow['HEADERS']['Last-Translator'] ); + $languagesList[$i]['REV_DATE'] = $REV_DATE; + $languagesList[$i]['VERSION'] = $translationRow['HEADERS']['Project-Id-Version']; + + $i ++; + } + $translationRow = new Translation(); + + $response->data = $languagesList; + + print (G::json_encode( $response )) ; + break; + case 'delete': + include_once 'classes/model/Translation.php'; + include_once 'classes/model/Content.php'; + $locale = $_POST['LOCALE']; + $trn = new Translation(); + + if (strpos( $locale, Translation::$localeSeparator )) + list ($LAN_ID, $IC_UID) = explode( Translation::$localeSeparator, $locale ); + else { + $LAN_ID = $locale; + $LAN_ID = ''; + } + + $oCriteria = new Criteria( 'workflow' ); + //$oCriteria->addSelectColumn('COUNT('.ContentPeer::CON_CATEGORY.')'); + $oCriteria->addSelectColumn( ContentPeer::CON_CATEGORY ); + $oCriteria->addSelectColumn( ContentPeer::CON_VALUE ); + $oCriteria->add( ContentPeer::CON_LANG, $locale ); + $oCriteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL ); + $oDataset = ContentPeer::doSelectRS( $oCriteria ); + + $oDataset->next(); + $oContent = new Content(); + $aRow = $oDataset->getRow(); + + //THERE IS NO ANY CASE STARTED FROM THES LANGUAGE + if ($aRow[0] == 0) { //so we can delete this language + try { + Content::removeLanguageContent( $locale ); + $trn->removeTranslationEnvironment( $locale ); + echo G::LoadTranslation( 'ID_LANGUAGE_DELETED_SUCCESSFULLY' ); + } catch (Exception $e) { + echo $e->getMessage(); + } + } else { + echo str_replace( '{0}', $aRow[0], G::LoadTranslation( 'ID_LANGUAGE_CANT_DELETE' ) ); + } + break; + } +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/setup/languages.php b/workflow/engine/methods/setup/languages.php index 94d260089..fad45b1a1 100755 --- a/workflow/engine/methods/setup/languages.php +++ b/workflow/engine/methods/setup/languages.php @@ -1,38 +1,35 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -$RBAC->requirePermissions('PM_SETUP_ADVANCE'); - -$oHeadPublisher->addExtJsScript('setup/languages', false); //adding a javascript file .js -$oHeadPublisher->addContent('setup/languages'); //adding a html file .html. - -$labels = G::getTranslations(Array( - 'ID_LAN_PREDETERMINED', 'ID_LANG_INSTALL_UPDATE', 'ID_LAN_LANGUAGE', 'ID_LAN_COUNTRY', 'ID_LAN_UPDATE_DATE', - 'ID_LAN_REV_DATE', 'ID_LAN_FILE', 'ID_LAN_REV_DATE', 'ID_LAN_VERSION', 'ID_LAN_GRID_TITLE', 'ID_LAN_UPLOAD_TITLE', - 'ID_LAN_FILE_WATER_LABEL', 'ID_EXPORT', 'ID_UPLOAD', 'ID_CANCEL', 'ID_DELETE_LANGUAGE', 'ID_DELETE_LANGUAGE_CONFIRM', - 'ID_DELETE_LANGUAGE_WARNING', 'ID_ACTIONS', 'ID_LAN_LOCALE', 'ID_LAN_TRANSLATOR', 'ID_LAN_NUM_RECORDS', 'ID_UPLOADING_TRANSLATION_FILE' -)); - -//$oHeadPublisher->assign('TRANSLATIONS', $labels); -G::RenderPage('publish', 'extJs'); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' ); + +$oHeadPublisher->addExtJsScript( 'setup/languages', false ); //adding a javascript file .js +$oHeadPublisher->addContent( 'setup/languages' ); //adding a html file .html. + + +$labels = G::getTranslations( Array ('ID_LAN_PREDETERMINED','ID_LANG_INSTALL_UPDATE','ID_LAN_LANGUAGE','ID_LAN_COUNTRY','ID_LAN_UPDATE_DATE','ID_LAN_REV_DATE','ID_LAN_FILE','ID_LAN_REV_DATE','ID_LAN_VERSION','ID_LAN_GRID_TITLE','ID_LAN_UPLOAD_TITLE','ID_LAN_FILE_WATER_LABEL','ID_EXPORT','ID_UPLOAD','ID_CANCEL','ID_DELETE_LANGUAGE','ID_DELETE_LANGUAGE_CONFIRM','ID_DELETE_LANGUAGE_WARNING','ID_ACTIONS','ID_LAN_LOCALE','ID_LAN_TRANSLATOR','ID_LAN_NUM_RECORDS','ID_UPLOADING_TRANSLATION_FILE' +) ); + +//$oHeadPublisher->assign('TRANSLATIONS', $labels); +G::RenderPage( 'publish', 'extJs' ); + diff --git a/workflow/engine/methods/setup/languages_Delete.php b/workflow/engine/methods/setup/languages_Delete.php index 02dae752a..82879e339 100755 --- a/workflow/engine/methods/setup/languages_Delete.php +++ b/workflow/engine/methods/setup/languages_Delete.php @@ -1,73 +1,73 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -//print_r($_GET['LAN_ID']); - -require_once 'classes/model/Language.php'; -require_once 'classes/model/Content.php'; - - -$kk=new Criteria(); -$kk->add(ContentPeer::CON_LANG, $_GET['LAN_ID']); -$oDataset=ContentPeer::doSelectRS($kk); -$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); -$oDataset->next(); - -$aRow1 = $oDataset->getRow(); - -if(is_array($aRow1)) { - - $G_PUBLISH = new Publisher; - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'SETUP'; - $G_SUB_MENU = 'setup'; - $G_ID_SUB_MENU_SELECTED = 'LANGUAGES'; - - //$aMessage['MESSAGE'] = G::LoadTranslation('CANT_DEL_LANGUAGE');//"you can't delete this language is in use"; - //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/showMessage', '', $aMessage ); - //G::RenderPage('publishBlank', 'blank'); - G::SendTemporalMessage('CANT_DEL_LANGUAGE', 'error', 'labels'); - G::header('location: languages'); -}else { - - /*the reason why comment it was because when delete some language,we're losing some labels about this language*/ - $oCriteria = new Criteria('workflow'); - $oCriteria->add(ContentPeer::CON_LANG, $_GET['LAN_ID']); - ContentPeer::doDelete($oCriteria); - - /* - $oCriteria1 = new Criteria('workflow'); - $oCriteria1->add(LanguagePeer::LAN_ENABLED, 0); - $oCriteria2 = new Criteria('workflow'); - $oCriteria2->add(LanguagePeer::LAN_ID, $_GET['LAN_ID']); - LanguagePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow')); - */ - $aLanguage['LAN_ID'] =$_GET['LAN_ID']; - $aLanguage['LAN_ENABLED']=0; - - $oLanguage = new Language(); - $oLanguage->update($aLanguage); - - G::header('Location: languages'); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +//print_r($_GET['LAN_ID']); + + +require_once 'classes/model/Language.php'; +require_once 'classes/model/Content.php'; + +$kk = new Criteria(); +$kk->add( ContentPeer::CON_LANG, $_GET['LAN_ID'] ); +$oDataset = ContentPeer::doSelectRS( $kk ); +$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); +$oDataset->next(); + +$aRow1 = $oDataset->getRow(); + +if (is_array( $aRow1 )) { + + $G_PUBLISH = new Publisher(); + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'SETUP'; + $G_SUB_MENU = 'setup'; + $G_ID_SUB_MENU_SELECTED = 'LANGUAGES'; + + //$aMessage['MESSAGE'] = G::LoadTranslation('CANT_DEL_LANGUAGE');//"you can't delete this language is in use"; + //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/showMessage', '', $aMessage ); + //G::RenderPage('publishBlank', 'blank'); + G::SendTemporalMessage( 'CANT_DEL_LANGUAGE', 'error', 'labels' ); + G::header( 'location: languages' ); +} else { + + /*the reason why comment it was because when delete some language,we're losing some labels about this language*/ + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->add( ContentPeer::CON_LANG, $_GET['LAN_ID'] ); + ContentPeer::doDelete( $oCriteria ); + + /* + $oCriteria1 = new Criteria('workflow'); + $oCriteria1->add(LanguagePeer::LAN_ENABLED, 0); + $oCriteria2 = new Criteria('workflow'); + $oCriteria2->add(LanguagePeer::LAN_ID, $_GET['LAN_ID']); + LanguagePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow')); + */ + $aLanguage['LAN_ID'] = $_GET['LAN_ID']; + $aLanguage['LAN_ENABLED'] = 0; + + $oLanguage = new Language(); + $oLanguage->update( $aLanguage ); + + G::header( 'Location: languages' ); +} + diff --git a/workflow/engine/methods/setup/languages_Export.php b/workflow/engine/methods/setup/languages_Export.php index 5f1e7967d..339931416 100755 --- a/workflow/engine/methods/setup/languages_Export.php +++ b/workflow/engine/methods/setup/languages_Export.php @@ -12,23 +12,21 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ require_once "classes/model/Language.php"; -if( ! isset($_GET['LOCALE']) ) - throw new Exception('Language Target ID was not set!'); +if (! isset( $_GET['LOCALE'] )) + throw new Exception( 'Language Target ID was not set!' ); $language = new Language(); $language->export(); - diff --git a/workflow/engine/methods/setup/languages_Import.php b/workflow/engine/methods/setup/languages_Import.php index f8ad6e300..c50ba9b0c 100755 --- a/workflow/engine/methods/setup/languages_Import.php +++ b/workflow/engine/methods/setup/languages_Import.php @@ -1,113 +1,110 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -require_once "classes/model/Language.php"; - -global $RBAC; -$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE'); - -if( $access != 1 ) { - switch( $access ) { - case -1: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); break; - case -2: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); break; - default: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); break; - } - G::header('location: ../login/login'); - exit(0); -} - -$result = new stdClass(); - -try { - //if the xmlform path is writeable - if( ! is_writable(PATH_XMLFORM) ) - throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE')); - - //if all xml files within the xmlform directory are writeable - if( ! G::is_rwritable(PATH_XMLFORM) ) - throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE2')); - - $sMaxExecutionTime = ini_get('max_execution_time'); - ini_set('max_execution_time', '0'); - G::LoadClass('configuration'); - - $languageFile = $_FILES['form']['tmp_name']['LANGUAGE_FILENAME']; - $languageFilename = $_FILES['form']['name']['LANGUAGE_FILENAME']; - - if (substr_compare($languageFilename, ".gz", -3, 3, true) == 0) { - $zp = gzopen($languageFile, "r"); - $languageFile = tempnam(__FILE__, ''); - $handle = fopen($languageFile, "w"); - while (!gzeof($zp)) { - $data = gzread($zp, 1024); - fwrite($handle, $data); - } - gzclose($zp); - fclose($handle); - } - - $language = new Language(); - $configuration = new Configurations; - $importResults = $language->import($languageFile); - - G::LoadClass("wsTools"); - $renegerateContent = new workspaceTools(SYS_SYS); - $messs = $renegerateContent->upgradeContent(); - - $result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\n"; - $result->msg .= "PO File num. records: " . $importResults->recordsCount . "\n"; - $result->msg .= "Success Records: " . $importResults->recordsCountSuccess . "\n"; - $result->msg .= "Failed Records: " . ($importResults->recordsCount-$importResults->recordsCountSuccess) . "\n"; - - if( $importResults->errMsg != '' ){ - $result->msg .= "Errors registered: \n" . $importResults->errMsg . "\n"; - } - - //$result->msg = htmlentities($result->msg); - $result->success = true; - - //saving metadata - $configuration->aConfig = Array( - 'headers' => $importResults->headers, - 'language' => $importResults->lang, - 'import-date' => date('Y-m-d H:i:s'), - 'user' => '', - 'version' => '1.0' - ); - $configuration->saveConfig('LANGUAGE_META', $importResults->lang); - - ini_set('max_execution_time', $sMaxExecutionTime); - -} catch (Exception $oError) { - $result->msg = $oError->getMessage(); - //print_r($oError->getTrace()); - $result->success = false; - //G::SendTemporalMessage($oError->getMessage(), 'error', 'string'); - //G::header('location: languages_ImportForm'); -} -echo G::json_encode($result); - - - - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +require_once "classes/model/Language.php"; + +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ); + +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + break; + } + G::header( 'location: ../login/login' ); + exit( 0 ); +} + +$result = new stdClass(); + +try { + //if the xmlform path is writeable + if (! is_writable( PATH_XMLFORM )) + throw new Exception( G::LoadTranslation( 'IMPORT_LANGUAGE_ERR_NO_WRITABLE' ) ); + + //if all xml files within the xmlform directory are writeable + if (! G::is_rwritable( PATH_XMLFORM )) + throw new Exception( G::LoadTranslation( 'IMPORT_LANGUAGE_ERR_NO_WRITABLE2' ) ); + + $sMaxExecutionTime = ini_get( 'max_execution_time' ); + ini_set( 'max_execution_time', '0' ); + G::LoadClass( 'configuration' ); + + $languageFile = $_FILES['form']['tmp_name']['LANGUAGE_FILENAME']; + $languageFilename = $_FILES['form']['name']['LANGUAGE_FILENAME']; + + if (substr_compare( $languageFilename, ".gz", - 3, 3, true ) == 0) { + $zp = gzopen( $languageFile, "r" ); + $languageFile = tempnam( __FILE__, '' ); + $handle = fopen( $languageFile, "w" ); + while (! gzeof( $zp )) { + $data = gzread( $zp, 1024 ); + fwrite( $handle, $data ); + } + gzclose( $zp ); + fclose( $handle ); + } + + $language = new Language(); + $configuration = new Configurations(); + $importResults = $language->import( $languageFile ); + + G::LoadClass( "wsTools" ); + $renegerateContent = new workspaceTools( SYS_SYS ); + $messs = $renegerateContent->upgradeContent(); + + $result->msg = G::LoadTranslation( 'IMPORT_LANGUAGE_SUCCESS' ) . "\n"; + $result->msg .= "PO File num. records: " . $importResults->recordsCount . "\n"; + $result->msg .= "Success Records: " . $importResults->recordsCountSuccess . "\n"; + $result->msg .= "Failed Records: " . ($importResults->recordsCount - $importResults->recordsCountSuccess) . "\n"; + + if ($importResults->errMsg != '') { + $result->msg .= "Errors registered: \n" . $importResults->errMsg . "\n"; + } + + //$result->msg = htmlentities($result->msg); + $result->success = true; + + //saving metadata + $configuration->aConfig = Array ('headers' => $importResults->headers,'language' => $importResults->lang,'import-date' => date( 'Y-m-d H:i:s' ),'user' => '','version' => '1.0' + ); + $configuration->saveConfig( 'LANGUAGE_META', $importResults->lang ); + + ini_set( 'max_execution_time', $sMaxExecutionTime ); + +} catch (Exception $oError) { + $result->msg = $oError->getMessage(); + //print_r($oError->getTrace()); + $result->success = false; + //G::SendTemporalMessage($oError->getMessage(), 'error', 'string'); + //G::header('location: languages_ImportForm'); +} +echo G::json_encode( $result ); + diff --git a/workflow/engine/methods/setup/languages_ImportForm.php b/workflow/engine/methods/setup/languages_ImportForm.php index d90f92324..0997b1c57 100755 --- a/workflow/engine/methods/setup/languages_ImportForm.php +++ b/workflow/engine/methods/setup/languages_ImportForm.php @@ -1,66 +1,60 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'setup'; -$G_ID_MENU_SELECTED = 'SETUP'; -$G_ID_SUB_MENU_SELECTED = 'LANGUAGES'; - -/* -$oForm = new Form('setup/languages_ImportForm', '', SYS_LANG); -$oForm->action = 'languages_Import'; -echo '' . -$oForm->render(PATH_CORE . 'templates/xmlform.html', $scriptCode = ''); -*/ - -$G_PUBLISH = new Publisher; -$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/languages_ImportForm', '', '', 'languages_Import'); -G::RenderPage('publishBlank', 'blank'); - - - - - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'setup'; +$G_ID_MENU_SELECTED = 'SETUP'; +$G_ID_SUB_MENU_SELECTED = 'LANGUAGES'; + +/* +$oForm = new Form('setup/languages_ImportForm', '', SYS_LANG); +$oForm->action = 'languages_Import'; +echo '' . +$oForm->render(PATH_CORE . 'templates/xmlform.html', $scriptCode = ''); +*/ + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/languages_ImportForm', '', '', 'languages_Import' ); +G::RenderPage( 'publishBlank', 'blank' ); + diff --git a/workflow/engine/methods/setup/location.php b/workflow/engine/methods/setup/location.php index a3533bc64..876af0bf8 100755 --- a/workflow/engine/methods/setup/location.php +++ b/workflow/engine/methods/setup/location.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1) + return $RBAC_Response; - $G_ENABLE_BLANK_SKIN = true; +$G_ENABLE_BLANK_SKIN = true; - $uid = $_SESSION['USER_LOGGED']; +$uid = $_SESSION['USER_LOGGED']; - $dbc = new DBConnection; - $ses = new DBSession($dbc); +$dbc = new DBConnection(); +$ses = new DBSession( $dbc ); - G::LoadClass ( 'templateTable' ); +G::LoadClass( 'templateTable' ); - $query=$ses->execute('select USR_COUNTRY ,USR_CITY ,USR_LOCATION from USER where UID = "'.$uid.'"'); - $param=$query->read(); +$query = $ses->execute( 'select USR_COUNTRY ,USR_CITY ,USR_LOCATION from USER where UID = "' . $uid . '"' ); +$param = $query->read(); - $city=$param['USR_CITY']; - $query=$ses->execute('SELECT UID,CAPTION FROM TERRITORY WHERE TERRITORY="LOCATION" AND RELATION="'.$city.'"'); -/* +$city = $param['USR_CITY']; +$query = $ses->execute( 'SELECT UID,CAPTION FROM TERRITORY WHERE TERRITORY="LOCATION" AND RELATION="' . $city . '"' ); +/* $table=new templateTable('list_template.html','DIV_LOCATIONS'); $table->formatTitleCol(0,'width="80%"'); $table->formatTitleCol(1,'align="center"'); $table->formatCol(0,'width="80%" '); $table->formatCol(1,'align="center"'); - + $table->addTitle(array(G::LoadTranslation('ID_LOCATION'),'')); for($r=0;$r<$query->count();$r++) { @@ -61,10 +61,11 @@ $table->addRowTag($r,'lastRow','',''); )); */ -$G_PUBLISH = new Publisher; +$G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/location', '', $param ); //$G_PUBLISH->AddContent('template', '', '', '', $table->tpl); + G::RenderPage( 'publish' ); ?> @@ -160,3 +161,4 @@ function ajax_function(ajax_server, funcion, parameters) return objetus.responseText; } + diff --git a/workflow/engine/methods/setup/loginSettings.php b/workflow/engine/methods/setup/loginSettings.php index 72123cfea..b7962e6d3 100755 --- a/workflow/engine/methods/setup/loginSettings.php +++ b/workflow/engine/methods/setup/loginSettings.php @@ -12,35 +12,34 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - G::loadClass('configuration'); - $oConf = new Configurations; - - $oHeadPublisher =& headPublisher::getSingleton(); - $oServerConf =& serverConf::getSingleton(); - - $oHeadPublisher->addExtJsScript('setup/loginSettings', true ); //adding a javascript file .js - $oHeadPublisher->addContent('setup/loginSettings'); //adding a html file .html. - - $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'; - - - $oHeadPublisher->assign('currentLang', $defaultLanguaje); - $oHeadPublisher->assign('forgotPasswd', $forgotPasswd); - $oHeadPublisher->assign('virtualKeyboad',$virtualKeyboad); - - G::RenderPage('publish', 'extJs'); +G::loadClass( 'configuration' ); +$oConf = new Configurations(); + +$oHeadPublisher = & headPublisher::getSingleton(); +$oServerConf = & serverConf::getSingleton(); + +$oHeadPublisher->addExtJsScript( 'setup/loginSettings', true ); //adding a javascript file .js +$oHeadPublisher->addContent( 'setup/loginSettings' ); //adding a html file .html. + + +$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'; + +$oHeadPublisher->assign( 'currentLang', $defaultLanguaje ); +$oHeadPublisher->assign( 'forgotPasswd', $forgotPasswd ); +$oHeadPublisher->assign( 'virtualKeyboad', $virtualKeyboad ); + +G::RenderPage( 'publish', 'extJs' ); diff --git a/workflow/engine/methods/setup/loginSettingsAjax.php b/workflow/engine/methods/setup/loginSettingsAjax.php index ed7bd13e2..eb191a601 100755 --- a/workflow/engine/methods/setup/loginSettingsAjax.php +++ b/workflow/engine/methods/setup/loginSettingsAjax.php @@ -1,38 +1,39 @@ rows = Array(); - - $langs = $Translations->getTranslationEnvironments(); - foreach($langs as $lang){ - $result->rows[] = Array('LAN_ID'=>$lang['LOCALE'], 'LAN_NAME'=>$lang['LANGUAGE']); - } - - print(G::json_encode($result)); - break; +switch ($request) { + case 'getLangList': + $Translations = G::getModel( 'Translation' ); + $result = new stdClass(); + $result->rows = Array (); + + $langs = $Translations->getTranslationEnvironments(); + foreach ($langs as $lang) { + $result->rows[] = Array ('LAN_ID' => $lang['LOCALE'],'LAN_NAME' => $lang['LANGUAGE'] + ); + } + + print (G::json_encode( $result )) ; + break; case 'saveSettings': - $memcache = & PMmemcached::getSingleton(defined('SYS_SYS') ? SYS_SYS : ''); - G::LoadClass('configuration'); - $conf = new Configurations; - $conf->loadConfig($obj, 'ENVIRONMENT_SETTINGS',''); + $memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? SYS_SYS : '' ); + G::LoadClass( 'configuration' ); + $conf = new Configurations(); + $conf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' ); - $conf->aConfig['login_enableForgotPassword'] = isset($_REQUEST['forgotPasswd']); - $conf->aConfig['login_enableVirtualKeyboard'] = isset($_REQUEST['virtualKeyboad']); - $conf->aConfig['login_defaultLanguage'] = isset($_REQUEST['lang'])? $_REQUEST['lang'] : 'en'; + $conf->aConfig['login_enableForgotPassword'] = isset( $_REQUEST['forgotPasswd'] ); + $conf->aConfig['login_enableVirtualKeyboard'] = isset( $_REQUEST['virtualKeyboad'] ); + $conf->aConfig['login_defaultLanguage'] = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : 'en'; - $conf->saveConfig('ENVIRONMENT_SETTINGS', ''); - - //remove from memcache when this value is updated/created - $memcache->delete('flagForgotPassword') ; - - $response->success = true; - echo G::json_encode($response); + $conf->saveConfig( 'ENVIRONMENT_SETTINGS', '' ); + + //remove from memcache when this value is updated/created + $memcache->delete( 'flagForgotPassword' ); + + $response->success = true; + echo G::json_encode( $response ); + + break; +} - break; - } \ No newline at end of file diff --git a/workflow/engine/methods/setup/logo_Delete.php b/workflow/engine/methods/setup/logo_Delete.php index 38232eac4..36ef7d21c 100755 --- a/workflow/engine/methods/setup/logo_Delete.php +++ b/workflow/engine/methods/setup/logo_Delete.php @@ -1,5 +1,5 @@ -. + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_FACTORY')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_FACTORY' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + + $snameLogo = trim( $_GET['NAMELOGO'] ); + $ainfoSite = explode( "/", $_SERVER["REQUEST_URI"] ); + $dir = PATH_DATA . "sites" . PATH_SEP . str_replace( "sys", "", $ainfoSite[1] ) . PATH_SEP . "files/logos"; + $sfileDir = $dir . PATH_SEP . $snameLogo; + unlink( $sfileDir ); + //header('location: uplogo.php'); + - $snameLogo =trim($_GET['NAMELOGO']); - $ainfoSite = explode("/",$_SERVER["REQUEST_URI"]); - $dir=PATH_DATA."sites".PATH_SEP.str_replace("sys","",$ainfoSite[1]).PATH_SEP."files/logos"; - $sfileDir=$dir.PATH_SEP.$snameLogo; - unlink($sfileDir); - //header('location: uplogo.php'); - } catch (Exception $oException) { - die($oException->getMessage()); + die( $oException->getMessage() ); } -?> \ No newline at end of file + diff --git a/workflow/engine/methods/setup/main.php b/workflow/engine/methods/setup/main.php index 265c0304c..4e08f06d7 100755 --- a/workflow/engine/methods/setup/main.php +++ b/workflow/engine/methods/setup/main.php @@ -12,36 +12,35 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -$RBAC->requirePermissions('PM_SETUP', 'PM_USERS'); +$RBAC->requirePermissions( 'PM_SETUP', 'PM_USERS' ); -$G_MAIN_MENU = 'processmaker'; -$G_ID_MENU_SELECTED = 'SETUP'; -$G_PUBLISH = new Publisher; +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'SETUP'; +$G_PUBLISH = new Publisher(); -if( isset($_GET['i18']) ) - $_SESSION['DEV_FLAG'] = $_SESSION['TOOLS_VIEWTYPE'] = isset($_GET['i18']); +if (isset( $_GET['i18'] )) + $_SESSION['DEV_FLAG'] = $_SESSION['TOOLS_VIEWTYPE'] = isset( $_GET['i18'] ); else { - unset($_SESSION['DEV_FLAG']); - unset($_SESSION['TOOLS_VIEWTYPE']); + unset( $_SESSION['DEV_FLAG'] ); + unset( $_SESSION['TOOLS_VIEWTYPE'] ); } -if( isset($_GET['s']) ) - $_SESSION['ADMIN_SELECTED'] = $_GET['s']; +if (isset( $_GET['s'] )) + $_SESSION['ADMIN_SELECTED'] = $_GET['s']; else { - unset($_SESSION['ADMIN_SELECTED']); + unset( $_SESSION['ADMIN_SELECTED'] ); } -$G_PUBLISH->AddContent('view', 'setup/main_Load'); -G::RenderPage('publish'); +$G_PUBLISH->AddContent( 'view', 'setup/main_Load' ); +G::RenderPage( 'publish' ); diff --git a/workflow/engine/methods/setup/mainAjax.php b/workflow/engine/methods/setup/mainAjax.php index 00a3b204c..54937ba0e 100755 --- a/workflow/engine/methods/setup/mainAjax.php +++ b/workflow/engine/methods/setup/mainAjax.php @@ -1,84 +1,69 @@ load('setup'); - $items = array(); - - foreach ($oMenu->Options as $i => $option) { - if ($oMenu->Types[$i] == $_GET['menu']) { - $items[] = array( - 'id' => $oMenu->Id[$i], - 'url' => ($oMenu->Options[$i] != '')? $oMenu->Options[$i] : '#', - //'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '', - 'text' => $oMenu->Labels[$i], - //'icon' => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png', - //'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : '' - 'loaded' => true, - 'leaf' => true, - 'cls' => 'pm-tree-node', - 'iconCls' => 'ICON_' . $oMenu->Id[$i] - ); - } else if (in_array($oMenu->Types[$i], array('', 'admToolsContent')) && $_GET['menu'] == 'plugins') { - $items[] = array( - 'id' => $oMenu->Id[$i], - 'url' => ($oMenu->Options[$i] != '')? $oMenu->Options[$i] : '#', - //'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '', - 'text' => $oMenu->Labels[$i], - //'icon' => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png', - //'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : '' - 'loaded' => true, - 'leaf' => true, - 'cls' => 'pm-tree-node', - 'iconCls' => 'ICON_'.$oMenu->Id[$i] - ); - } - } - - if (isset($_SESSION['DEV_FLAG']) && $_SESSION['DEV_FLAG'] && $_GET['menu'] == 'settings') { - unset($_SESSION['DEV_FLAG']); - $items[] = array( - 'id' => 'translations', - 'url' => '../tools/main', - 'text' => 'Translations', - 'loaded' => true, - 'leaf' => true, - 'cls' => 'pm-tree-node', - 'iconCls' => 'ICON_' - ); - } - - $x = ob_get_contents(); - ob_end_clean(); - - /////// - if ($_GET["menu"] == "plugins") { - $i = 0; - - foreach ($items as $index => $value) { - if ($items[$index]["id"] == "PMENTERPRISE") { - $i = $index; - break; + case 'loadMenu': + if (! isset( $_GET['menu'] )) { + exit( 0 ); } - } - - $itemAux = $items[$i]; - - array_splice($items, $i, 1); - array_unshift($items, $itemAux); - } - - /////// - echo G::json_encode($items); - break; -} \ No newline at end of file + + global $G_TMP_MENU; + + $oMenu = new Menu(); + $oMenu->load( 'setup' ); + $items = array (); + + foreach ($oMenu->Options as $i => $option) { + if ($oMenu->Types[$i] == $_GET['menu']) { + $items[] = array ('id' => $oMenu->Id[$i],'url' => ($oMenu->Options[$i] != '') ? $oMenu->Options[$i] : '#', + //'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '', + 'text' => $oMenu->Labels[$i], + //'icon' => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png', + //'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : '' + 'loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_' . $oMenu->Id[$i] + ); + } else if (in_array( $oMenu->Types[$i], array ('','admToolsContent' + ) ) && $_GET['menu'] == 'plugins') { + $items[] = array ('id' => $oMenu->Id[$i],'url' => ($oMenu->Options[$i] != '') ? $oMenu->Options[$i] : '#', + //'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '', + 'text' => $oMenu->Labels[$i], + //'icon' => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png', + //'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : '' + 'loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_' . $oMenu->Id[$i] + ); + } + } + + if (isset( $_SESSION['DEV_FLAG'] ) && $_SESSION['DEV_FLAG'] && $_GET['menu'] == 'settings') { + unset( $_SESSION['DEV_FLAG'] ); + $items[] = array ('id' => 'translations','url' => '../tools/main','text' => 'Translations','loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_' + ); + } + + $x = ob_get_contents(); + ob_end_clean(); + + /////// + if ($_GET["menu"] == "plugins") { + $i = 0; + + foreach ($items as $index => $value) { + if ($items[$index]["id"] == "PMENTERPRISE") { + $i = $index; + break; + } + } + + $itemAux = $items[$i]; + + array_splice( $items, $i, 1 ); + array_unshift( $items, $itemAux ); + } + + /////// + echo G::json_encode( $items ); + break; +} + diff --git a/workflow/engine/methods/setup/main_init.php b/workflow/engine/methods/setup/main_init.php index 3adb0e8b4..4ea5e5100 100755 --- a/workflow/engine/methods/setup/main_init.php +++ b/workflow/engine/methods/setup/main_init.php @@ -1,105 +1,105 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -$RBAC->requirePermissions("PM_SETUP", "PM_USERS"); - -/////// -$adminSelected = null; - -if (isset($_REQUEST["s"])) { - $adminSelected = $_REQUEST["s"]; -} -else { - if (isset($_SESSION["ADMIN_SELECTED"])) { - $adminSelected = $_SESSION["ADMIN_SELECTED"]; - } -} - -/////// -$oHeadPublisher = &headPublisher::getSingleton(); - -global $G_TMP_MENU; - -$oMenu = new Menu(); -$oMenu->load("setup"); -$items = array(); - -$menuTypes = array_unique($oMenu->Types); -foreach ($menuTypes as $i => $v) { - if ($v == "admToolsContent") { - unset($menuTypes[$i]); - break; - } -} - -//sort($menuTypes); - -$tabItems = array(); -$i = 0; - -foreach ($menuTypes as $menuType) { - $tabItems[$i]->id = $menuType; - $LABEL_TRANSLATION = G::LoadTranslation("ID_" . strtoupper($menuType)); - - if (substr($LABEL_TRANSLATION, 0, 2) !== "**") { - $title = $LABEL_TRANSLATION; - } - else { - $title = str_replace("_", " ", ucwords($menuType)); - } - - $tabItems[$i]->title = $title; - $i++; -} - -/////// -$tabActive = ""; - -if ($adminSelected != null) { - foreach ($oMenu->Options as $i => $option) { - if ($oMenu->Id[$i] == $adminSelected) { - $tabActive = (in_array($oMenu->Types[$i], array("", "admToolsContent")))? "plugins" : $oMenu->Types[$i]; - break; - } - } -} - -/////// -$oHeadPublisher->addExtJsScript("setup/main", true); //adding a javascript file .js -$oHeadPublisher->addContent("setup/main"); //adding a html file .html. -$oHeadPublisher->assign("tabActive", $tabActive); -$oHeadPublisher->assign("tabItems", $tabItems); -$oHeadPublisher->assign("_item_selected", (($adminSelected != null)? $adminSelected : "")); - -G::RenderPage("publish", "extJs"); - -//this patch enables the load of the plugin list panel inside de main admin panel iframe -if (isset($_GET["action"]) && $_GET["action"] == "pluginsList") { - echo " - - "; -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +$RBAC->requirePermissions( "PM_SETUP", "PM_USERS" ); + +/////// +$adminSelected = null; + +if (isset( $_REQUEST["s"] )) { + $adminSelected = $_REQUEST["s"]; +} else { + if (isset( $_SESSION["ADMIN_SELECTED"] )) { + $adminSelected = $_SESSION["ADMIN_SELECTED"]; + } +} + +/////// +$oHeadPublisher = &headPublisher::getSingleton(); + +global $G_TMP_MENU; + +$oMenu = new Menu(); +$oMenu->load( "setup" ); +$items = array (); + +$menuTypes = array_unique( $oMenu->Types ); +foreach ($menuTypes as $i => $v) { + if ($v == "admToolsContent") { + unset( $menuTypes[$i] ); + break; + } +} + +//sort($menuTypes); + + +$tabItems = array (); +$i = 0; + +foreach ($menuTypes as $menuType) { + $tabItems[$i]->id = $menuType; + $LABEL_TRANSLATION = G::LoadTranslation( "ID_" . strtoupper( $menuType ) ); + + if (substr( $LABEL_TRANSLATION, 0, 2 ) !== "**") { + $title = $LABEL_TRANSLATION; + } else { + $title = str_replace( "_", " ", ucwords( $menuType ) ); + } + + $tabItems[$i]->title = $title; + $i ++; +} + +/////// +$tabActive = ""; + +if ($adminSelected != null) { + foreach ($oMenu->Options as $i => $option) { + if ($oMenu->Id[$i] == $adminSelected) { + $tabActive = (in_array( $oMenu->Types[$i], array ("","admToolsContent" + ) )) ? "plugins" : $oMenu->Types[$i]; + break; + } + } +} + +/////// +$oHeadPublisher->addExtJsScript( "setup/main", true ); //adding a javascript file .js +$oHeadPublisher->addContent( "setup/main" ); //adding a html file .html. +$oHeadPublisher->assign( "tabActive", $tabActive ); +$oHeadPublisher->assign( "tabItems", $tabItems ); +$oHeadPublisher->assign( "_item_selected", (($adminSelected != null) ? $adminSelected : "") ); + +G::RenderPage( "publish", "extJs" ); + +//this patch enables the load of the plugin list panel inside de main admin panel iframe +if (isset( $_GET["action"] ) && $_GET["action"] == "pluginsList") { + echo " + + "; +} + diff --git a/workflow/engine/methods/setup/pluginsChange.php b/workflow/engine/methods/setup/pluginsChange.php index e43bf158e..2ad4b8552 100755 --- a/workflow/engine/methods/setup/pluginsChange.php +++ b/workflow/engine/methods/setup/pluginsChange.php @@ -12,50 +12,50 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ // lets display the items - $pluginFile = $_GET['id']; - $pluginStatus = $_GET['status']; +$pluginFile = $_GET['id']; +$pluginStatus = $_GET['status']; - $items = array (); - G::LoadClass('plugin'); - //here we are enabling or disabling the plugin and all related options registered. +$items = array (); +G::LoadClass( 'plugin' ); +//here we are enabling or disabling the plugin and all related options registered. - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - if ($handle = opendir( PATH_PLUGINS )) { - while ( false !== ($file = readdir($handle))) { - if ( strpos($file, '.php', 1 ) && $file == $pluginFile) { - - if ( $pluginStatus == '1' ) { - //print "change to disable"; - $details = $oPluginRegistry->getPluginDetails( $pluginFile ); - $oPluginRegistry->disablePlugin( $details->sNamespace ); - $size = file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() ); - print "size saved : $size
"; - } else { - //print "change to ENABLED"; - require_once ( PATH_PLUGINS . $pluginFile ); - $details = $oPluginRegistry->getPluginDetails( $pluginFile ); - $oPluginRegistry->enablePlugin( $details->sNamespace); - $oPluginRegistry->setupPlugins(); //get and setup enabled plugins - $size = file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() ); - print "size saved : $size
"; +$oPluginRegistry = & PMPluginRegistry::getSingleton(); + +if ($handle = opendir( PATH_PLUGINS )) { + while (false !== ($file = readdir( $handle ))) { + if (strpos( $file, '.php', 1 ) && $file == $pluginFile) { + + if ($pluginStatus == '1') { + //print "change to disable"; + $details = $oPluginRegistry->getPluginDetails( $pluginFile ); + $oPluginRegistry->disablePlugin( $details->sNamespace ); + $size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() ); + print "size saved : $size
"; + } else { + //print "change to ENABLED"; + require_once (PATH_PLUGINS . $pluginFile); + $details = $oPluginRegistry->getPluginDetails( $pluginFile ); + $oPluginRegistry->enablePlugin( $details->sNamespace ); + $oPluginRegistry->setupPlugins(); //get and setup enabled plugins + $size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() ); + print "size saved : $size
"; + } } - } } - closedir($handle); - } + closedir( $handle ); +} //$oPluginRegistry->showArrays(); //G::Header('location: pluginsList'); diff --git a/workflow/engine/methods/setup/pluginsImport.php b/workflow/engine/methods/setup/pluginsImport.php index 419867293..788d2987f 100755 --- a/workflow/engine/methods/setup/pluginsImport.php +++ b/workflow/engine/methods/setup/pluginsImport.php @@ -1,78 +1,76 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - G::LoadClass('plugin'); - - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'SETUP'; - $G_SUB_MENU = 'setup'; - $G_ID_SUB_MENU_SELECTED = 'PLUGINS'; - - - //calculating the max upload file size; - $POST_MAX_SIZE = ini_get('post_max_size'); - $mul = substr($POST_MAX_SIZE, -1); - $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); - $postMaxSize = (int)$POST_MAX_SIZE * $mul; - - $UPLOAD_MAX_SIZE = ini_get('upload_max_filesize'); - $mul = substr($UPLOAD_MAX_SIZE, -1); - $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); - $uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul; - - if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize; - $Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") "; - - $G_PUBLISH = new Publisher; - try { - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/pluginImport', '',$Fields ,'pluginsImportFile' ); - } - catch ( Exception $e ){ - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - } - G::RenderPage('publishBlank', 'blank'); \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} +G::LoadClass( 'plugin' ); + +$oPluginRegistry = & PMPluginRegistry::getSingleton(); +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'SETUP'; +$G_SUB_MENU = 'setup'; +$G_ID_SUB_MENU_SELECTED = 'PLUGINS'; + +//calculating the max upload file size; +$POST_MAX_SIZE = ini_get( 'post_max_size' ); +$mul = substr( $POST_MAX_SIZE, - 1 ); +$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); +$postMaxSize = (int) $POST_MAX_SIZE * $mul; + +$UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' ); +$mul = substr( $UPLOAD_MAX_SIZE, - 1 ); +$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); +$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul; + +if ($postMaxSize < $uploadMaxSize) + $uploadMaxSize = $postMaxSize; +$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") "; + +$G_PUBLISH = new Publisher(); +try { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/pluginImport', '', $Fields, 'pluginsImportFile' ); +} catch (Exception $e) { + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); +} +G::RenderPage( 'publishBlank', 'blank' ); + diff --git a/workflow/engine/methods/setup/pluginsImportFile.php b/workflow/engine/methods/setup/pluginsImportFile.php index a4efc8ae6..b1ed86713 100755 --- a/workflow/engine/methods/setup/pluginsImportFile.php +++ b/workflow/engine/methods/setup/pluginsImportFile.php @@ -1,166 +1,169 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -global $RBAC; -$RBAC->requirePermissions('PM_SETUP_ADVANCE'); - -try { - //load the variables - G::LoadClass('plugin'); - if ( ! isset($_FILES['form']['error']['PLUGIN_FILENAME'] ) || $_FILES['form']['error']['PLUGIN_FILENAME'] == 1 ) { - throw ( new Exception (G::loadTranslation('ID_ERROR_UPLOADING_PLUGIN_FILENAME') ) ); - } - - //save the file - if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) { - $filename = $_FILES['form']['name']['PLUGIN_FILENAME']; - $path = PATH_DOCUMENT . 'input' . PATH_SEP ; - $tempName = $_FILES['form']['tmp_name']['PLUGIN_FILENAME']; - G::uploadFile($tempName, $path, $filename ); - } - if ( ! $_FILES['form']['type']['PLUGIN_FILENAME'] == 'application/octet-stream') { - $pluginFilename = $_FILES['form']['type']['PLUGIN_FILENAME']; - throw ( new Exception ( G::loadTranslation('ID_FILES_INVALID_PLUGIN_FILENAME', SYS_LANG, array("pluginFilename"=>$pluginFilename)) )); - } - - - G::LoadThirdParty( 'pear/Archive','Tar'); - $tar = new Archive_Tar ( $path. $filename); - $sFileName = substr($filename,0,strrpos($filename, '.' )); - $sClassName = substr($filename,0,strpos($filename, '-' )); - - $aFiles = $tar->listContent(); - $bMainFile = false; - $bClassFile = false; - if(!is_array($aFiles)){ - throw ( new Exception (G::loadTranslation('ID_FAILED_IMPORT_PLUGINS', SYS_LANG, array("filename"=>$filename)) ) ) ; - } - foreach ( $aFiles as $key => $val ) { - if ( $val['filename'] == $sClassName . '.php' ) $bMainFile = true; - if ( $val['filename'] == $sClassName . PATH_SEP . 'class.' . $sClassName . '.php' ) $bClassFile = true; - } - - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - $pluginFile = $sClassName . '.php'; - - if ( $bMainFile && $bClassFile ) { - $sAux = $sClassName . 'Plugin'; - $fVersionOld = 0.0; - if (file_exists(PATH_PLUGINS . $pluginFile)) { - if (!class_exists($sAux) && !class_exists($sClassName . 'plugin')) { - include PATH_PLUGINS . $pluginFile; - } - if (!class_exists($sAux)) { - $sAux = $sClassName . 'plugin'; - } - $oClass = new $sAux($sClassName); - $fVersionOld = $oClass->iVersion; - unset($oClass); - } - $res = $tar->extract ( $path ); - - - $sContent = file_get_contents($path . $pluginFile); - $chain = preg_quote('extends enterprisePlugin'); - if(strpos($sContent,$chain)){ - throw ( new Exception ('The plugin '.$filename.' is a Enterprise Edition Plugin, please install the Enterprise Plugins Manager to use this plugin.')); - } - $sContent = str_ireplace($sAux, $sAux . '_', $sContent); - $sContent = str_ireplace('PATH_PLUGINS', "'".$path."'", $sContent); - $sContent = preg_replace("/\\\$oPluginRegistry\s*=\s*&\s*PMPluginRegistry::getSingleton\s*\(\s*\)\s*;/i", null, $sContent); - $sContent = preg_replace("/\\\$oPluginRegistry->registerPlugin\s*\(\s*[\"\']" . $sClassName . "[\"\']\s*,\s*__FILE__\s*\)\s*;/i", null, $sContent); - - //header('Content-Type: text/plain');var_dump($sClassName, $sContent);die; - file_put_contents($path . $pluginFile, $sContent); - - $sAux = $sAux . '_'; - - include ($path . $pluginFile); - - $oClass = new $sAux($sClassName); - $fVersionNew = $oClass->iVersion; - if (!isset($oClass->iPMVersion)) { - $oClass->iPMVersion = 0; - } - if ($oClass->iPMVersion > 0) { - G::LoadClass("system"); - if (System::getVersion() > 0) { - if ($oClass->iPMVersion > System::getVersion()) { - //throw new Exception('This plugin needs version ' . $oClass->iPMVersion . ' or higher of ProcessMaker'); - } - } - } - if (!isset($oClass->aDependences)) { - $oClass->aDependences = null; - } - if (!empty($oClass->aDependences)) { - foreach ($oClass->aDependences as $aDependence) { - if (file_exists(PATH_PLUGINS . $aDependence['sClassName'] . '.php')) { - require_once PATH_PLUGINS . $aDependence['sClassName'] . '.php'; - if (!$oPluginRegistry->getPluginDetails($aDependence['sClassName'] . '.php')) { - $sDependence = $aDependence['sClassName']; - throw new Exception( G::loadTranslation('ID_PLUGIN_DEPENDENCE_PLUGIN', SYS_LANG, array("Dependence"=>$sDependence )) ); - } - } - else { - $sDependence = $aDependence['sClassName']; - throw new Exception( G::loadTranslation('ID_PLUGIN_DEPENDENCE_PLUGIN', SYS_LANG, array("Dependence"=>$sDependence )) ); - } - } - } - unset($oClass); - if ($fVersionOld > $fVersionNew) { - throw new Exception(G::loadTranslation('ID_RECENT_VERSION_PLUGIN')); - } - $res = $tar->extract ( PATH_PLUGINS ); - } - else { - throw ( new Exception ( G::loadTranslation('ID_FILE_CONTAIN_CLASS_PLUGIN', SYS_LANG, array("filename"=>$filename, "className"=>$sClassName )) ) ) ; - } - - if ( !file_exists ( PATH_PLUGINS . $sClassName . '.php' ) ) { - throw ( new Exception( G::loadTranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array("pluginFile"=>$pluginFile )) ) ); - } - - require_once (PATH_PLUGINS . $pluginFile); - - $oPluginRegistry->registerPlugin($sClassName, PATH_PLUGINS . $sClassName . ".php"); - $size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance()); - - $details = $oPluginRegistry->getPluginDetails($pluginFile); - - $oPluginRegistry->installPlugin($details->sNamespace); - - $oPluginRegistry->setupPlugins(); //get and setup enabled plugins - $size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance()); - - G::header("Location: pluginsMain"); - die; -} -catch (Exception $e) { - $_SESSION['__PLUGIN_ERROR__'] = $e->getMessage(); - G::header('Location: pluginsMain'); - die(); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +global $RBAC; +$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' ); + +try { + //load the variables + G::LoadClass( 'plugin' ); + if (! isset( $_FILES['form']['error']['PLUGIN_FILENAME'] ) || $_FILES['form']['error']['PLUGIN_FILENAME'] == 1) { + throw (new Exception( G::loadTranslation( 'ID_ERROR_UPLOADING_PLUGIN_FILENAME' ) )); + } + + //save the file + if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) { + $filename = $_FILES['form']['name']['PLUGIN_FILENAME']; + $path = PATH_DOCUMENT . 'input' . PATH_SEP; + $tempName = $_FILES['form']['tmp_name']['PLUGIN_FILENAME']; + G::uploadFile( $tempName, $path, $filename ); + } + if (! $_FILES['form']['type']['PLUGIN_FILENAME'] == 'application/octet-stream') { + $pluginFilename = $_FILES['form']['type']['PLUGIN_FILENAME']; + throw (new Exception( G::loadTranslation( 'ID_FILES_INVALID_PLUGIN_FILENAME', SYS_LANG, array ("pluginFilename" => $pluginFilename + ) ) )); + } + + G::LoadThirdParty( 'pear/Archive', 'Tar' ); + $tar = new Archive_Tar( $path . $filename ); + $sFileName = substr( $filename, 0, strrpos( $filename, '.' ) ); + $sClassName = substr( $filename, 0, strpos( $filename, '-' ) ); + + $aFiles = $tar->listContent(); + $bMainFile = false; + $bClassFile = false; + if (! is_array( $aFiles )) { + throw (new Exception( G::loadTranslation( 'ID_FAILED_IMPORT_PLUGINS', SYS_LANG, array ("filename" => $filename + ) ) )); + } + foreach ($aFiles as $key => $val) { + if ($val['filename'] == $sClassName . '.php') + $bMainFile = true; + if ($val['filename'] == $sClassName . PATH_SEP . 'class.' . $sClassName . '.php') + $bClassFile = true; + } + + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + $pluginFile = $sClassName . '.php'; + + if ($bMainFile && $bClassFile) { + $sAux = $sClassName . 'Plugin'; + $fVersionOld = 0.0; + if (file_exists( PATH_PLUGINS . $pluginFile )) { + if (! class_exists( $sAux ) && ! class_exists( $sClassName . 'plugin' )) { + include PATH_PLUGINS . $pluginFile; + } + if (! class_exists( $sAux )) { + $sAux = $sClassName . 'plugin'; + } + $oClass = new $sAux( $sClassName ); + $fVersionOld = $oClass->iVersion; + unset( $oClass ); + } + $res = $tar->extract( $path ); + + $sContent = file_get_contents( $path . $pluginFile ); + $chain = preg_quote( 'extends enterprisePlugin' ); + if (strpos( $sContent, $chain )) { + throw (new Exception( 'The plugin ' . $filename . ' is a Enterprise Edition Plugin, please install the Enterprise Plugins Manager to use this plugin.' )); + } + $sContent = str_ireplace( $sAux, $sAux . '_', $sContent ); + $sContent = str_ireplace( 'PATH_PLUGINS', "'" . $path . "'", $sContent ); + $sContent = preg_replace( "/\\\$oPluginRegistry\s*=\s*&\s*PMPluginRegistry::getSingleton\s*\(\s*\)\s*;/i", null, $sContent ); + $sContent = preg_replace( "/\\\$oPluginRegistry->registerPlugin\s*\(\s*[\"\']" . $sClassName . "[\"\']\s*,\s*__FILE__\s*\)\s*;/i", null, $sContent ); + + //header('Content-Type: text/plain');var_dump($sClassName, $sContent);die; + file_put_contents( $path . $pluginFile, $sContent ); + + $sAux = $sAux . '_'; + + include ($path . $pluginFile); + + $oClass = new $sAux( $sClassName ); + $fVersionNew = $oClass->iVersion; + if (! isset( $oClass->iPMVersion )) { + $oClass->iPMVersion = 0; + } + if ($oClass->iPMVersion > 0) { + G::LoadClass( "system" ); + if (System::getVersion() > 0) { + if ($oClass->iPMVersion > System::getVersion()) { + //throw new Exception('This plugin needs version ' . $oClass->iPMVersion . ' or higher of ProcessMaker'); + } + } + } + if (! isset( $oClass->aDependences )) { + $oClass->aDependences = null; + } + if (! empty( $oClass->aDependences )) { + foreach ($oClass->aDependences as $aDependence) { + if (file_exists( PATH_PLUGINS . $aDependence['sClassName'] . '.php' )) { + require_once PATH_PLUGINS . $aDependence['sClassName'] . '.php'; + if (! $oPluginRegistry->getPluginDetails( $aDependence['sClassName'] . '.php' )) { + $sDependence = $aDependence['sClassName']; + throw new Exception( G::loadTranslation( 'ID_PLUGIN_DEPENDENCE_PLUGIN', SYS_LANG, array ("Dependence" => $sDependence + ) ) ); + } + } else { + $sDependence = $aDependence['sClassName']; + throw new Exception( G::loadTranslation( 'ID_PLUGIN_DEPENDENCE_PLUGIN', SYS_LANG, array ("Dependence" => $sDependence + ) ) ); + } + } + } + unset( $oClass ); + if ($fVersionOld > $fVersionNew) { + throw new Exception( G::loadTranslation( 'ID_RECENT_VERSION_PLUGIN' ) ); + } + $res = $tar->extract( PATH_PLUGINS ); + } else { + throw (new Exception( G::loadTranslation( 'ID_FILE_CONTAIN_CLASS_PLUGIN', SYS_LANG, array ("filename" => $filename,"className" => $sClassName + ) ) )); + } + + if (! file_exists( PATH_PLUGINS . $sClassName . '.php' )) { + throw (new Exception( G::loadTranslation( 'ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array ("pluginFile" => $pluginFile + ) ) )); + } + + require_once (PATH_PLUGINS . $pluginFile); + + $oPluginRegistry->registerPlugin( $sClassName, PATH_PLUGINS . $sClassName . ".php" ); + $size = file_put_contents( PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance() ); + + $details = $oPluginRegistry->getPluginDetails( $pluginFile ); + + $oPluginRegistry->installPlugin( $details->sNamespace ); + + $oPluginRegistry->setupPlugins(); //get and setup enabled plugins + $size = file_put_contents( PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance() ); + + G::header( "Location: pluginsMain" ); + die(); +} catch (Exception $e) { + $_SESSION['__PLUGIN_ERROR__'] = $e->getMessage(); + G::header( 'Location: pluginsMain' ); + die(); +} + diff --git a/workflow/engine/methods/setup/pluginsList.php b/workflow/engine/methods/setup/pluginsList.php index cac8b1c23..d86e0eaf3 100755 --- a/workflow/engine/methods/setup/pluginsList.php +++ b/workflow/engine/methods/setup/pluginsList.php @@ -1,125 +1,114 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -$RBAC->requirePermissions('PM_SETUP_ADVANCE'); - -// lets display the items -//$items = array ( 'id' => 'char', 'title' => 'char', 'type' => 'char', 'creator' => 'char' , 'modifiedBy' => 'char', 'filename' => 'char', 'size' => 'char', 'mime' => 'char'); - - -$items = Array(); -//***************** Plugins ************************** - G::LoadClass('plugin'); - //here we are loading all plugins registered -//krumo ($items); die; - $aPluginsPP = array(); - if (is_file(PATH_PLUGINS . 'enterprise/data/data')) { - $aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/data'))); - foreach ($aPlugins as $aPlugin) { - $aPluginsPP[] = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')) . '.php'; - } - } - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - if ($handle = opendir( PATH_PLUGINS )) { - while ( false !== ($file = readdir($handle))) { - - if (in_array($file, $aPluginsPP)) { - continue; - } - if ( strpos($file, '.php',1) && is_file(PATH_PLUGINS . $file) ) { - include_once ( PATH_PLUGINS . $file ); - $pluginDetail = $oPluginRegistry->getPluginDetails ( $file ); - //print_R ($pluginDetail ); - //die; - //$status = $pluginDetail->enabled ? 'Enabled' : 'Disabled'; - if($pluginDetail==NULL) continue; //When for some reason we gen NULL plugin - $status_label = $pluginDetail->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED'); - $status = $pluginDetail->enabled ? 1: 0; - if ( isset ($pluginDetail->aWorkspaces ) ) { - if ( ! in_array ( SYS_SYS, $pluginDetail->aWorkspaces) ) - continue; - } - $linkEditValue = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? G::LoadTranslation('ID_SETUP') : ' '; - //g::pr($pluginDetail->sSetupPage); - $setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0'; - - $link = 'pluginsChange?id=' . $file . '&status=' . $pluginDetail->enabled; - $linkEdit = 'pluginsSetup?id=' . $file ; - $pluginName = $pluginDetail->sFriendlyName; - $pluginId = $pluginDetail->sNamespace; - $removePluginMsg = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_REMOVE_PLUGIN')); - $linkRemove = 'javascript:showMessage(\''.$removePluginMsg .'
'.$pluginName.' \',\''.$pluginId.'\')'; -// $linkRemove = 'pluginsRemove?id='.$pluginId.'.php&status=1'; - if ( isset ($pluginDetail) ){ - if(!$pluginDetail->bPrivate){ - $items[] = array ( - 'id' => (count($items) + 1), - 'namespace'=>$pluginDetail->sNamespace, - 'title'=>$pluginDetail->sFriendlyName . "\n(" . $pluginDetail->sNamespace . '.php)', - 'className' => $pluginDetail->sNamespace, - 'description' => $pluginDetail->sDescription, - 'version' => $pluginDetail->iVersion, - 'setupPage' => $pluginDetail->sSetupPage, - 'status_label'=> $status_label, - 'status'=> $status, - 'setup'=>$setup, - - 'sFile' => $file, - 'sStatusFile' => $pluginDetail->enabled - ); - } - } - - } - } - closedir($handle); - } - - $folders['items'] = $items; - //g::pr($items); - echo G::json_encode($items); - die; - $_DBArray['plugins'] = $items; - $_SESSION['_DBArray'] = $_DBArray; - - G::LoadClass( 'ArrayPeer'); - $c = new Criteria ('dbarray'); - $c->setDBArrayTable('plugins'); - //$c->addAscendingOrderByColumn ('id'); - - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'SETUP'; - $G_SUB_MENU = 'setup'; - $G_ID_SUB_MENU_SELECTED = 'PLUGINS'; - - $G_PUBLISH = new Publisher; - - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile('/jscore/setup/pluginList.js'); - - $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/pluginList', $c ); - G::RenderPage('publishBlank', 'blank'); - -?> +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' ); + +// lets display the items +//$items = array ( 'id' => 'char', 'title' => 'char', 'type' => 'char', 'creator' => 'char' , 'modifiedBy' => 'char', 'filename' => 'char', 'size' => 'char', 'mime' => 'char'); + + +$items = Array (); +//***************** Plugins ************************** +G::LoadClass( 'plugin' ); +//here we are loading all plugins registered +//krumo ($items); die; +$aPluginsPP = array (); +if (is_file( PATH_PLUGINS . 'enterprise/data/data' )) { + $aPlugins = unserialize( trim( file_get_contents( PATH_PLUGINS . 'enterprise/data/data' ) ) ); + foreach ($aPlugins as $aPlugin) { + $aPluginsPP[] = substr( $aPlugin['sFilename'], 0, strpos( $aPlugin['sFilename'], '-' ) ) . '.php'; + } +} +$oPluginRegistry = & PMPluginRegistry::getSingleton(); +if ($handle = opendir( PATH_PLUGINS )) { + while (false !== ($file = readdir( $handle ))) { + + if (in_array( $file, $aPluginsPP )) { + continue; + } + if (strpos( $file, '.php', 1 ) && is_file( PATH_PLUGINS . $file )) { + include_once (PATH_PLUGINS . $file); + $pluginDetail = $oPluginRegistry->getPluginDetails( $file ); + //print_R ($pluginDetail ); + //die; + //$status = $pluginDetail->enabled ? 'Enabled' : 'Disabled'; + if ($pluginDetail == null) + continue; //When for some reason we gen NULL plugin + $status_label = $pluginDetail->enabled ? G::LoadTranslation( 'ID_ENABLED' ) : G::LoadTranslation( 'ID_DISABLED' ); + $status = $pluginDetail->enabled ? 1 : 0; + if (isset( $pluginDetail->aWorkspaces )) { + if (! in_array( SYS_SYS, $pluginDetail->aWorkspaces )) + continue; + } + $linkEditValue = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? G::LoadTranslation( 'ID_SETUP' ) : ' '; + //g::pr($pluginDetail->sSetupPage); + $setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0'; + + $link = 'pluginsChange?id=' . $file . '&status=' . $pluginDetail->enabled; + $linkEdit = 'pluginsSetup?id=' . $file; + $pluginName = $pluginDetail->sFriendlyName; + $pluginId = $pluginDetail->sNamespace; + $removePluginMsg = str_replace( "\r\n", "
", G::LoadTranslation( 'ID_MSG_REMOVE_PLUGIN' ) ); + $linkRemove = 'javascript:showMessage(\'' . $removePluginMsg . '
' . $pluginName . ' \',\'' . $pluginId . '\')'; + // $linkRemove = 'pluginsRemove?id='.$pluginId.'.php&status=1'; + if (isset( $pluginDetail )) { + if (! $pluginDetail->bPrivate) { + $items[] = array ('id' => (count( $items ) + 1),'namespace' => $pluginDetail->sNamespace,'title' => $pluginDetail->sFriendlyName . "\n(" . $pluginDetail->sNamespace . '.php)','className' => $pluginDetail->sNamespace,'description' => $pluginDetail->sDescription,'version' => $pluginDetail->iVersion,'setupPage' => $pluginDetail->sSetupPage,'status_label' => $status_label,'status' => $status,'setup' => $setup, + + 'sFile' => $file,'sStatusFile' => $pluginDetail->enabled + ); + } + } + + } + } + closedir( $handle ); +} + +$folders['items'] = $items; +//g::pr($items); +echo G::json_encode( $items ); +die(); +$_DBArray['plugins'] = $items; +$_SESSION['_DBArray'] = $_DBArray; + +G::LoadClass( 'ArrayPeer' ); +$c = new Criteria( 'dbarray' ); +$c->setDBArrayTable( 'plugins' ); +//$c->addAscendingOrderByColumn ('id'); + + +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'SETUP'; +$G_SUB_MENU = 'setup'; +$G_ID_SUB_MENU_SELECTED = 'PLUGINS'; + +$G_PUBLISH = new Publisher(); + +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptFile( '/jscore/setup/pluginList.js' ); + +$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/pluginList', $c ); +G::RenderPage( 'publishBlank', 'blank' ); + diff --git a/workflow/engine/methods/setup/pluginsMain.php b/workflow/engine/methods/setup/pluginsMain.php index b7429b1a1..6d9bc80bb 100755 --- a/workflow/engine/methods/setup/pluginsMain.php +++ b/workflow/engine/methods/setup/pluginsMain.php @@ -12,32 +12,26 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -$headPublisher =& headPublisher::getSingleton(); -$headPublisher->addExtJsScript('setup/pluginsMain', false); -$headPublisher->assign("PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN ); -$headPublisher->assign("SYS_SKIN", SYS_SKIN); -$translations = G::getTranslations(array( - 'ID_CONFIGURE', 'ID_STATUS', 'ID_DELETE', 'ID_IMPORT', 'ID_SELECT', - 'ID_STATUS', 'ID_ACTIVATE', 'ID_DEACTIVATE', 'ID_PLUGINS', - 'ID_SELECT', 'ID_NO_SELECTION_WARNING', 'ID_MSG_REMOVE_PLUGIN', - 'ID_TITLE', 'ID_VERSION', 'ID_STATUS', 'ID_TITLE', 'ID_VERSION', 'ID_DESCRIPTION', - 'ID_STATUS', 'ID_PLUGIN_CANT_DELETE', 'ID_XPDL_IMPORT', 'ID_DISABLE', 'ID_ENABLE', 'ID_CONFIRM' -)); -$headPublisher->assign('TRANSLATIONS', $translations); -if (isset($_SESSION['__PLUGIN_ERROR__'])) { - $headPublisher->assign('__PLUGIN_ERROR__', $_SESSION['__PLUGIN_ERROR__']); - unset($_SESSION['__PLUGIN_ERROR__']); +$headPublisher = & headPublisher::getSingleton(); +$headPublisher->addExtJsScript( 'setup/pluginsMain', false ); +$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN ); +$headPublisher->assign( "SYS_SKIN", SYS_SKIN ); +$translations = G::getTranslations( array ('ID_CONFIGURE','ID_STATUS','ID_DELETE','ID_IMPORT','ID_SELECT','ID_STATUS','ID_ACTIVATE','ID_DEACTIVATE','ID_PLUGINS','ID_SELECT','ID_NO_SELECTION_WARNING','ID_MSG_REMOVE_PLUGIN','ID_TITLE','ID_VERSION','ID_STATUS','ID_TITLE','ID_VERSION','ID_DESCRIPTION','ID_STATUS','ID_PLUGIN_CANT_DELETE','ID_XPDL_IMPORT','ID_DISABLE','ID_ENABLE','ID_CONFIRM' +) ); +$headPublisher->assign( 'TRANSLATIONS', $translations ); +if (isset( $_SESSION['__PLUGIN_ERROR__'] )) { + $headPublisher->assign( '__PLUGIN_ERROR__', $_SESSION['__PLUGIN_ERROR__'] ); + unset( $_SESSION['__PLUGIN_ERROR__'] ); } -G::RenderPage('publish', 'extJs'); +G::RenderPage( 'publish', 'extJs' ); diff --git a/workflow/engine/methods/setup/pluginsRemove.php b/workflow/engine/methods/setup/pluginsRemove.php index d5aaf215a..41ea327ba 100755 --- a/workflow/engine/methods/setup/pluginsRemove.php +++ b/workflow/engine/methods/setup/pluginsRemove.php @@ -12,15 +12,14 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ /* @@ -39,20 +38,17 @@ switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE')) break; }*/ -G::LoadClass("plugin"); - - - - +G::LoadClass( "plugin" ); $pluginName = $_REQUEST["pluginUid"]; -if (file_exists(PATH_PLUGINS . $pluginName . ".php")) { - $pluginRegistry = &PMPluginRegistry::getSingleton(); - - $pluginRegistry->uninstallPlugin($pluginName); - - $pluginRegistry->unSerializeInstance(file_get_contents(PATH_DATA_SITE . "plugin.singleton")); +if (file_exists( PATH_PLUGINS . $pluginName . ".php" )) { + $pluginRegistry = &PMPluginRegistry::getSingleton(); + + $pluginRegistry->uninstallPlugin( $pluginName ); + + $pluginRegistry->unSerializeInstance( file_get_contents( PATH_DATA_SITE . "plugin.singleton" ) ); } -echo $pluginName . " " . nl2br(G::LoadTranslation("ID_MSG_REMOVE_PLUGIN_SUCCESS")); +echo $pluginName . " " . nl2br( G::LoadTranslation( "ID_MSG_REMOVE_PLUGIN_SUCCESS" ) ); + diff --git a/workflow/engine/methods/setup/pluginsSetup.php b/workflow/engine/methods/setup/pluginsSetup.php index cffb20f89..d0080e964 100755 --- a/workflow/engine/methods/setup/pluginsSetup.php +++ b/workflow/engine/methods/setup/pluginsSetup.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - $pluginFile = $_GET['id']; +$pluginFile = $_GET['id']; - G::LoadClass('plugin'); +G::LoadClass( 'plugin' ); - $oPluginRegistry =& PMPluginRegistry::getSingleton(); +$oPluginRegistry = & PMPluginRegistry::getSingleton(); - $details = $oPluginRegistry->getPluginDetails( $pluginFile ); - $xmlform = isset($details->sPluginFolder) ? $details->sPluginFolder . '/' . $details->sSetupPage : ''; - - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'SETUP'; - $G_SUB_MENU = 'setup'; - $G_ID_SUB_MENU_SELECTED = 'PLUGINS'; - $G_PUBLISH = new Publisher; - try { - //the setup page is a special page - if ( substr($xmlform,-4) == '.php' && file_exists ( PATH_PLUGINS . $xmlform ) ) { - require_once ( PATH_PLUGINS . $xmlform ); - die; +$details = $oPluginRegistry->getPluginDetails( $pluginFile ); +$xmlform = isset( $details->sPluginFolder ) ? $details->sPluginFolder . '/' . $details->sSetupPage : ''; + +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'SETUP'; +$G_SUB_MENU = 'setup'; +$G_ID_SUB_MENU_SELECTED = 'PLUGINS'; +$G_PUBLISH = new Publisher(); +try { + //the setup page is a special page + if (substr( $xmlform, - 4 ) == '.php' && file_exists( PATH_PLUGINS . $xmlform )) { + require_once (PATH_PLUGINS . $xmlform); + die(); } - + //the setup page is a xmlform and using the default showform and saveform function to serialize data - if ( !file_exists ( PATH_PLUGINS.$xmlform.'.xml' ) ) throw ( new Exception ('setup .xml file is not defined for this plugin') ); - - - $Fields = $oPluginRegistry->getFieldsForPageSetup( $details->sNamespace ); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '',$Fields ,'pluginsSetupSave?id='.$pluginFile ); - } - catch ( Exception $e ){ - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - } - G::RenderPage('publishBlank', 'blank'); \ No newline at end of file + if (! file_exists( PATH_PLUGINS . $xmlform . '.xml' )) + throw (new Exception( 'setup .xml file is not defined for this plugin' )); + + $Fields = $oPluginRegistry->getFieldsForPageSetup( $details->sNamespace ); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $Fields, 'pluginsSetupSave?id=' . $pluginFile ); +} catch (Exception $e) { + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); +} +G::RenderPage( 'publishBlank', 'blank' ); + diff --git a/workflow/engine/methods/setup/pluginsSetupSave.php b/workflow/engine/methods/setup/pluginsSetupSave.php index 0f27a7be7..44c8f2a72 100755 --- a/workflow/engine/methods/setup/pluginsSetupSave.php +++ b/workflow/engine/methods/setup/pluginsSetupSave.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - $pluginFile = $_GET['id']; - G::LoadClass('plugin'); +$pluginFile = $_GET['id']; +G::LoadClass( 'plugin' ); - $oPluginRegistry =& PMPluginRegistry::getSingleton(); +$oPluginRegistry = & PMPluginRegistry::getSingleton(); - $details = $oPluginRegistry->getPluginDetails( $pluginFile ); - try { - $Fields = $oPluginRegistry->updateFieldsForPageSetup( $details->sNamespace, $_POST ); - $str = "$Fields fields saved successfully!"; - G::SendTemporalMessage($str, 'info', 'string', 3, 100); - G::Header("location: pluginsSetup?id=$pluginFile"); - } catch ( Exception $e ){ - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'SETUP'; - $G_SUB_MENU = 'setup'; +$details = $oPluginRegistry->getPluginDetails( $pluginFile ); +try { + $Fields = $oPluginRegistry->updateFieldsForPageSetup( $details->sNamespace, $_POST ); + $str = "$Fields fields saved successfully!"; + G::SendTemporalMessage( $str, 'info', 'string', 3, 100 ); + G::Header( "location: pluginsSetup?id=$pluginFile" ); +} catch (Exception $e) { + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'SETUP'; + $G_SUB_MENU = 'setup'; $G_ID_SUB_MENU_SELECTED = 'PLUGINS'; - - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish'); - } + + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish' ); +} diff --git a/workflow/engine/methods/setup/processHeartBeatAjax.php b/workflow/engine/methods/setup/processHeartBeatAjax.php index 66697a5cc..d743c42ae 100644 --- a/workflow/engine/methods/setup/processHeartBeatAjax.php +++ b/workflow/engine/methods/setup/processHeartBeatAjax.php @@ -1,30 +1,30 @@ unsetHeartbeatProperty('HB_BEAT_TYPE', 'HEART_BEAT_CONF'); - if (isset($_POST['acceptHB'])) { - $oServerConf->setHeartbeatProperty('HB_OPTION', 1, 'HEART_BEAT_CONF'); - $oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF'); - $response->enable = true; - } - else { - $oServerConf->setHeartbeatProperty('HB_OPTION', 0, 'HEART_BEAT_CONF'); - $oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF'); - $oServerConf->setHeartbeatProperty('HB_BEAT_TYPE', 'endbeat', 'HEART_BEAT_CONF'); - $response->enable = false; - } - $response->success = true; - - } catch ( Exception $e ) { - $response->success = false; - $response->msg = $e->getMessage(); - } - echo G::json_encode($response); - break; +switch ($_GET['action']) { + case 'saveOption': + try { + G::LoadClass( 'serverConfiguration' ); + $oServerConf = & serverConf::getSingleton(); + + /*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/ + $oServerConf->unsetHeartbeatProperty( 'HB_BEAT_TYPE', 'HEART_BEAT_CONF' ); + if (isset( $_POST['acceptHB'] )) { + $oServerConf->setHeartbeatProperty( 'HB_OPTION', 1, 'HEART_BEAT_CONF' ); + $oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' ); + $response->enable = true; + } else { + $oServerConf->setHeartbeatProperty( 'HB_OPTION', 0, 'HEART_BEAT_CONF' ); + $oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' ); + $oServerConf->setHeartbeatProperty( 'HB_BEAT_TYPE', 'endbeat', 'HEART_BEAT_CONF' ); + $response->enable = false; + } + $response->success = true; + + } catch (Exception $e) { + $response->success = false; + $response->msg = $e->getMessage(); + } + echo G::json_encode( $response ); + break; } + diff --git a/workflow/engine/methods/setup/processHeartBeatConfig.php b/workflow/engine/methods/setup/processHeartBeatConfig.php index b3c8ae992..518d3be3d 100755 --- a/workflow/engine/methods/setup/processHeartBeatConfig.php +++ b/workflow/engine/methods/setup/processHeartBeatConfig.php @@ -1,38 +1,37 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -$oHeadPublisher =& headPublisher::getSingleton(); -G::LoadClass('serverConfiguration'); -$oServerConf =& serverConf::getSingleton(); - -//you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace -$sflag = $oServerConf->getHeartbeatProperty('HB_OPTION', 'HEART_BEAT_CONF'); -$heartBeatChecked = $sflag == 1? true: false; - -$oHeadPublisher->addExtJsScript('setup/processHeartBeatConfig', true ); //adding a javascript file .js - -$oHeadPublisher->assign('heartBeatChecked', $heartBeatChecked); -G::RenderPage('publish', 'extJs'); - - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +$oHeadPublisher = & headPublisher::getSingleton(); +G::LoadClass( 'serverConfiguration' ); +$oServerConf = & serverConf::getSingleton(); + +//you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace +$sflag = $oServerConf->getHeartbeatProperty( 'HB_OPTION', 'HEART_BEAT_CONF' ); +$heartBeatChecked = $sflag == 1 ? true : false; + +$oHeadPublisher->addExtJsScript( 'setup/processHeartBeatConfig', true ); //adding a javascript file .js + + +$oHeadPublisher->assign( 'heartBeatChecked', $heartBeatChecked ); +G::RenderPage( 'publish', 'extJs' ); + diff --git a/workflow/engine/methods/setup/processHeartBeatSave.php b/workflow/engine/methods/setup/processHeartBeatSave.php index c5faa71d5..6fc17b397 100755 --- a/workflow/engine/methods/setup/processHeartBeatSave.php +++ b/workflow/engine/methods/setup/processHeartBeatSave.php @@ -1,35 +1,35 @@ -userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){ - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - //G::header('location: ../login/login'); - die; -} - try { - - G::LoadClass('serverConfiguration'); - $oServerConf =& serverConf::getSingleton(); - /*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/ - $sflag = $_POST['HB_OPTION']; - $oServerConf->unsetHeartbeatProperty('HB_BEAT_TYPE','HEART_BEAT_CONF'); - if($sflag){ - $oServerConf->setHeartbeatProperty('HB_OPTION',1,'HEART_BEAT_CONF'); - $oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF'); - echo "active"; - }else{ - $oServerConf->setHeartbeatProperty('HB_OPTION',0,'HEART_BEAT_CONF'); - $oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF'); - $oServerConf->setHeartbeatProperty('HB_BEAT_TYPE','endbeat','HEART_BEAT_CONF'); - echo "inactive"; - - -} - //$oServerConf->setHeartbeatProperty('HB_OPTION',$_POST['HB_OPTION'],'HEART_BEAT_CONF'); - - } - catch ( Exception $e ) { - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publishBlank', 'blank' ); - } \ No newline at end of file +userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + //G::header('location: ../login/login'); + die(); +} +try { + + G::LoadClass( 'serverConfiguration' ); + $oServerConf = & serverConf::getSingleton(); + /*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/ + $sflag = $_POST['HB_OPTION']; + $oServerConf->unsetHeartbeatProperty( 'HB_BEAT_TYPE', 'HEART_BEAT_CONF' ); + if ($sflag) { + $oServerConf->setHeartbeatProperty( 'HB_OPTION', 1, 'HEART_BEAT_CONF' ); + $oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' ); + echo "active"; + } else { + $oServerConf->setHeartbeatProperty( 'HB_OPTION', 0, 'HEART_BEAT_CONF' ); + $oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' ); + $oServerConf->setHeartbeatProperty( 'HB_BEAT_TYPE', 'endbeat', 'HEART_BEAT_CONF' ); + echo "inactive"; + + } + //$oServerConf->setHeartbeatProperty('HB_OPTION',$_POST['HB_OPTION'],'HEART_BEAT_CONF'); + + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publishBlank', 'blank' ); +} + diff --git a/workflow/engine/methods/setup/replacementLogo.php b/workflow/engine/methods/setup/replacementLogo.php index ea9cc5774..2d9028e2f 100755 --- a/workflow/engine/methods/setup/replacementLogo.php +++ b/workflow/engine/methods/setup/replacementLogo.php @@ -12,101 +12,94 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -try {//ini_set('display_errors','1'); - global $RBAC; - switch ($RBAC->userCanAccess('PM_LOGIN')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - function changeNamelogo($snameLogo) - { - // The ereg_replace function has been DEPRECATED as of PHP 5.3.0. - // $snameLogo = ereg_replace("[áàâãª]","a",$snameLogo); - // $snameLogo = ereg_replace("[ÁÀÂÃ]","A",$snameLogo); - // $snameLogo = ereg_replace("[ÍÌÎ]","I",$snameLogo); - // $snameLogo = ereg_replace("[íìî]","i",$snameLogo); - // $snameLogo = ereg_replace("[éèê]","e",$snameLogo); - // $snameLogo = ereg_replace("[ÉÈÊ]","E",$snameLogo); - // $snameLogo = ereg_replace("[óòôõº]","o",$snameLogo); - // $snameLogo = ereg_replace("[ÓÒÔÕ]","O",$snameLogo); - // $snameLogo = ereg_replace("[úùû]","u",$snameLogo); - // $snameLogo = ereg_replace("[ÚÙÛ]","U",$snameLogo); - $snameLogo = preg_replace("/[áàâãª]/", "a", $snameLogo); - $snameLogo = preg_replace("/[ÁÀÂÃ]/", "A", $snameLogo); - $snameLogo = preg_replace("/[ÍÌÎ]/", "I", $snameLogo); - $snameLogo = preg_replace("/[íìî]/", "i", $snameLogo); - $snameLogo = preg_replace("/[éèê]/", "e", $snameLogo); - $snameLogo = preg_replace("/[ÉÈÊ]/", "E", $snameLogo); - $snameLogo = preg_replace("/[óòôõº]/", "o", $snameLogo); - $snameLogo = preg_replace("/[ÓÒÔÕ]/", "O", $snameLogo); - $snameLogo = preg_replace("/[úùû]/", "u", $snameLogo); - $snameLogo = preg_replace("/[ÚÙÛ]/", "U", $snameLogo); - $snameLogo = str_replace("ç","c",$snameLogo); - $snameLogo = str_replace("Ç","C",$snameLogo); - $snameLogo = str_replace("[ñ]","n",$snameLogo); - $snameLogo = str_replace("[Ñ]","N",$snameLogo); - return ($snameLogo); - } +try { //ini_set('display_errors','1'); + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_LOGIN' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } - $sfunction =$_GET['function']; - switch($sfunction){ - case 'replacementLogo': - $snameLogo=urldecode($_GET['NAMELOGO']); - $snameLogo=trim($snameLogo); - $snameLogo=changeNamelogo($snameLogo); - G::loadClass('configuration'); - $oConf = new Configurations; - $aConf = Array( - 'WORKSPACE_LOGO_NAME' => SYS_SYS, - 'DEFAULT_LOGO_NAME' => $snameLogo - ); - - $oConf->aConfig = $aConf; - $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '',''); - - G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels'); - //header('location: uplogo.php'); - //G::header('location: uplogo'); - break; - case 'restoreLogo': - $snameLogo=$_GET['NAMELOGO']; - G::loadClass('configuration'); - $oConf = new Configurations; - $aConf = Array( - 'WORKSPACE_LOGO_NAME' => '', - 'DEFAULT_LOGO_NAME' => '' - ); - - $oConf->aConfig = $aConf; - $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '',''); - - - G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels'); - break; + function changeNamelogo ($snameLogo) + { + // The ereg_replace function has been DEPRECATED as of PHP 5.3.0. + // $snameLogo = ereg_replace("[áàâãª]","a",$snameLogo); + // $snameLogo = ereg_replace("[Ã�ÀÂÃ]","A",$snameLogo); + // $snameLogo = ereg_replace("[Ã�ÌÎ]","I",$snameLogo); + // $snameLogo = ereg_replace("[íìî]","i",$snameLogo); + // $snameLogo = ereg_replace("[éèê]","e",$snameLogo); + // $snameLogo = ereg_replace("[ÉÈÊ]","E",$snameLogo); + // $snameLogo = ereg_replace("[óòôõº]","o",$snameLogo); + // $snameLogo = ereg_replace("[ÓÒÔÕ]","O",$snameLogo); + // $snameLogo = ereg_replace("[úùû]","u",$snameLogo); + // $snameLogo = ereg_replace("[ÚÙÛ]","U",$snameLogo); + $snameLogo = preg_replace( "/[áàâãª]/", "a", $snameLogo ); + $snameLogo = preg_replace( "/[Ã�ÀÂÃ]/", "A", $snameLogo ); + $snameLogo = preg_replace( "/[Ã�ÌÎ]/", "I", $snameLogo ); + $snameLogo = preg_replace( "/[íìî]/", "i", $snameLogo ); + $snameLogo = preg_replace( "/[éèê]/", "e", $snameLogo ); + $snameLogo = preg_replace( "/[ÉÈÊ]/", "E", $snameLogo ); + $snameLogo = preg_replace( "/[óòôõº]/", "o", $snameLogo ); + $snameLogo = preg_replace( "/[ÓÒÔÕ]/", "O", $snameLogo ); + $snameLogo = preg_replace( "/[úùû]/", "u", $snameLogo ); + $snameLogo = preg_replace( "/[ÚÙÛ]/", "U", $snameLogo ); + $snameLogo = str_replace( "ç", "c", $snameLogo ); + $snameLogo = str_replace( "Ç", "C", $snameLogo ); + $snameLogo = str_replace( "[ñ]", "n", $snameLogo ); + $snameLogo = str_replace( "[Ñ]", "N", $snameLogo ); + return ($snameLogo); + } - } - + $sfunction = $_GET['function']; + switch ($sfunction) { + case 'replacementLogo': + $snameLogo = urldecode( $_GET['NAMELOGO'] ); + $snameLogo = trim( $snameLogo ); + $snameLogo = changeNamelogo( $snameLogo ); + G::loadClass( 'configuration' ); + $oConf = new Configurations(); + $aConf = Array ('WORKSPACE_LOGO_NAME' => SYS_SYS,'DEFAULT_LOGO_NAME' => $snameLogo + ); + + $oConf->aConfig = $aConf; + $oConf->saveConfig( 'USER_LOGO_REPLACEMENT', '', '', '' ); + + G::SendTemporalMessage( 'ID_REPLACED_LOGO', 'tmp-info', 'labels' ); + //header('location: uplogo.php'); + //G::header('location: uplogo'); + break; + case 'restoreLogo': + $snameLogo = $_GET['NAMELOGO']; + G::loadClass( 'configuration' ); + $oConf = new Configurations(); + $aConf = Array ('WORKSPACE_LOGO_NAME' => '','DEFAULT_LOGO_NAME' => '' + ); + + $oConf->aConfig = $aConf; + $oConf->saveConfig( 'USER_LOGO_REPLACEMENT', '', '', '' ); + + G::SendTemporalMessage( 'ID_REPLACED_LOGO', 'tmp-info', 'labels' ); + break; + + } + +} catch (Exception $oException) { + die( $oException->getMessage() ); } -catch (Exception $oException) { - die($oException->getMessage()); -} -?> +