CODE STYLE, workflow/engine/methods/setup/ PART 1

FILES:
appCacheViewAjax.php
appCacheViewConf.php
appearance.php
calendarDelete.php
calendarEdit.php
calendarList.php
calendarSave.php
calendarValidate.php
calendar_Ajax.php
clearCompiled.php
clearCompiledAjax.php
connectionDB.php
connectionWS.php
cron.php
cronAjax.php
customFunctions.php
debug.php
deleteSessions.php
emailSystemCron.php
emailSystemSpool.php
emailSystemTest.php
emails.php
emails_Ajax.php
emails_Save.php
environmentSettings.php
environmentSettingsAjax.php
This commit is contained in:
jennylee
2012-10-17 15:40:37 -04:00
parent a065bacbfb
commit 6ee79318c4
26 changed files with 1232 additions and 1303 deletions

View File

@@ -1,219 +1,228 @@
<?php
require_once('classes/model/AppCacheView.php');
require_once ('classes/model/AppCacheView.php');
$request = isset($_POST['request'])? $_POST['request']: (isset($_GET['request'])? $_GET['request']: null);
switch($request){
$request = isset( $_POST['request'] ) ? $_POST['request'] : (isset( $_GET['request'] ) ? $_GET['request'] : null);
switch ($request) {
//check if the APP_CACHE VIEW table and their triggers are installed
case 'info':
$result = new stdClass();
$result->info = Array();
//check the language, if no info in config about language, the default is 'en'
G::loadClass('configuration');
$oConf = new Configurations;
$oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE','','','','');
$appCacheViewEngine = $oConf->aConfig;
if( isset($appCacheViewEngine['LANG']) ) {
$lang = $appCacheViewEngine['LANG'];
$status = strtoupper($appCacheViewEngine['STATUS']);
}
else {
$confParams = Array(
'LANG' => 'en',
'STATUS'=> ''
);
$oConf->aConfig = $confParams;
$oConf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');
$lang = 'en';
$status = '';
}
$result = new stdClass();
$result->info = Array ();
//get user Root from hash
$result->info = array ();
$result->error = false;
//check the language, if no info in config about language, the default is 'en'
G::loadClass( 'configuration' );
$oConf = new Configurations();
$oConf->loadConfig( $x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '' );
$appCacheViewEngine = $oConf->aConfig;
//setup the appcacheview object, and the path for the sql files
$appCache = new AppCacheView();
$appCache->setPathToAppCacheFiles ( PATH_METHODS . 'setup' . PATH_SEP .'setupSchemas'. PATH_SEP );
$res = $appCache->getMySQLVersion();
$result->info[] = array ('name' => 'MySQL Version', 'value'=> $res );
$res = $appCache->checkGrantsForUser( false );
$currentUser = $res['user'];
$currentUserIsSuper = $res['super'];
$result->info[] = array ('name' => 'Current User', 'value'=> $currentUser );
$result->info[] = array ('name' => 'Current User has SUPER privilege', 'value'=> $currentUserIsSuper );
try {
PROPEL::Init ( PATH_METHODS.'dbConnections/rootDbConnections.php' );
$con = Propel::getConnection("root");
}
catch ( Exception $e ) {
$result->info[] = array ('name' => 'Checking MySql Root user', 'value'=> 'failed' );
$result->error = true;
$result->errorMsg = $e->getMessage();
}
//if user does not have the SUPER privilege we need to use the root user and grant the SUPER priv. to normal user.
if ( ! $currentUserIsSuper && !$result->error ) {
$res = $appCache->checkGrantsForUser( true );
if ( !isset( $res['error'] ) ) {
$result->info[] = array ('name' => 'Root User', 'value'=> $res['user'] );
$result->info[] = array ('name' => 'Root User has SUPER privilege', 'value'=> $res['super'] );
}
else {
$result->info[] = array ('name' => 'Error', 'value'=> $res['msg'] );
if (isset( $appCacheViewEngine['LANG'] )) {
$lang = $appCacheViewEngine['LANG'];
$status = strtoupper( $appCacheViewEngine['STATUS'] );
} else {
$confParams = Array ('LANG' => 'en','STATUS' => ''
);
$oConf->aConfig = $confParams;
$oConf->saveConfig( 'APP_CACHE_VIEW_ENGINE', '', '', '' );
$lang = 'en';
$status = '';
}
$res = $appCache->setSuperForUser( $currentUser );
if ( !isset( $res['error'] ) ) {
$result->info[] = array ('name' => 'Setting SUPER privilege', 'value'=> 'Successfully' );
}
else {
$result->error = true;
$result->errorMsg = $res['msg'];
}
$currentUserIsSuper = true;
}
//get user Root from hash
$result->info = array ();
$result->error = false;
//now check if table APPCACHEVIEW exists, and it have correct number of fields, etc.
$res = $appCache->checkAppCacheView();
$result->info[] = array ('name' => 'Table APP_CACHE_VIEW', 'value'=> $res['found']);
$result->info[] = array ('name' => 'Rows in APP_CACHE_VIEW', 'value'=> $res['count']);
//now check if we have the triggers installed
//APP_DELEGATION INSERT
$res = $appCache->triggerAppDelegationInsert($lang, false);
$result->info[] = array ('name' => 'Trigger APP_DELEGATION INSERT', 'value'=> $res);
//APP_DELEGATION Update
$res = $appCache->triggerAppDelegationUpdate($lang, false);
$result->info[] = array ('name' => 'Trigger APP_DELEGATION UPDATE', 'value'=> $res);
//APPLICATION UPDATE
$res = $appCache->triggerApplicationUpdate($lang, false);
$result->info[] = array ('name' => 'Trigger APPLICATION UPDATE', 'value'=> $res);
//APPLICATION DELETE
$res = $appCache->triggerApplicationDelete($lang, false);
$result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res);
//CONTENT UPDATE
$res = $appCache->triggerContentUpdate($lang, false);
$result->info[] = array("name" => "Trigger CONTENT UPDATE", "value" => $res);
//show language
$result->info[] = array ('name' => 'Language', 'value'=> $lang );
echo G::json_encode($result);
break;
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 'build':
$sqlToExe = Array();
G::LoadClass('configuration');
$conf = new Configurations;
//DEPRECATED $lang = $_POST['lang'];
//there is no more support for other languages that english
$lang = 'en';
try {
//setup the appcacheview object, and the path for the sql files
$appCache = new AppCacheView();
$appCache->setPathToAppCacheFiles ( PATH_METHODS . 'setup' . PATH_SEP .'setupSchemas'. PATH_SEP );
$appCache->setPathToAppCacheFiles( PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP );
//APP_DELEGATION INSERT
$res = $appCache->triggerAppDelegationInsert($lang, true);
//$result->info[] = array ('name' => 'Trigger APP_DELEGATION INSERT', 'value'=> $res);
//APP_DELEGATION Update
$res = $appCache->triggerAppDelegationUpdate($lang, true);
//$result->info[] = array ('name' => 'Trigger APP_DELEGATION UPDATE', 'value'=> $res);
//APPLICATION UPDATE
$res = $appCache->triggerApplicationUpdate($lang, true);
//$result->info[] = array ('name' => 'Trigger APPLICATION UPDATE', 'value'=> $res);
//APPLICATION DELETE
$res = $appCache->triggerApplicationDelete($lang, true);
//$result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res);
//CONTENT UPDATE
$res = $appCache->triggerContentUpdate($lang, true);
//$result->info[] = array("name" => "Trigger CONTENT UPDATE", "value" => $res);
//build using the method in AppCacheView Class
$res = $appCache->fillAppCacheView($lang);
//$result->info[] = array ('name' => 'build APP_CACHE_VIEW', 'value'=> $res);
//set status in config table
$confParams = Array(
'LANG' => $lang,
'STATUS'=> 'active'
);
$conf->aConfig = $confParams;
$conf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');
$response = new StdClass();
$result->success = true;
$result->msg = "Completed successfully";
echo G::json_encode($result);
}
catch (Exception $e) {
$confParams = Array(
'lang'=>$lang,
'status'=> 'failed'
$res = $appCache->getMySQLVersion();
$result->info[] = array ('name' => 'MySQL Version','value' => $res
);
$appCacheViewEngine = $oServerConf->setProperty('APP_CACHE_VIEW_ENGINE', $confParams);
echo '{success: false, msg:"'.$e->getMessage().'"}';
}
break;
$res = $appCache->checkGrantsForUser( false );
$currentUser = $res['user'];
$currentUserIsSuper = $res['super'];
$result->info[] = array ('name' => 'Current User','value' => $currentUser
);
$result->info[] = array ('name' => 'Current User has SUPER privilege','value' => $currentUserIsSuper
);
try {
PROPEL::Init( PATH_METHODS . 'dbConnections/rootDbConnections.php' );
$con = Propel::getConnection( "root" );
} catch (Exception $e) {
$result->info[] = array ('name' => 'Checking MySql Root user','value' => 'failed'
);
$result->error = true;
$result->errorMsg = $e->getMessage();
}
//if user does not have the SUPER privilege we need to use the root user and grant the SUPER priv. to normal user.
if (! $currentUserIsSuper && ! $result->error) {
$res = $appCache->checkGrantsForUser( true );
if (! isset( $res['error'] )) {
$result->info[] = array ('name' => 'Root User','value' => $res['user']
);
$result->info[] = array ('name' => 'Root User has SUPER privilege','value' => $res['super']
);
} else {
$result->info[] = array ('name' => 'Error','value' => $res['msg']
);
}
$res = $appCache->setSuperForUser( $currentUser );
if (! isset( $res['error'] )) {
$result->info[] = array ('name' => 'Setting SUPER privilege','value' => 'Successfully'
);
} else {
$result->error = true;
$result->errorMsg = $res['msg'];
}
$currentUserIsSuper = true;
}
//now check if table APPCACHEVIEW exists, and it have correct number of fields, etc.
$res = $appCache->checkAppCacheView();
$result->info[] = array ('name' => 'Table APP_CACHE_VIEW','value' => $res['found']
);
$result->info[] = array ('name' => 'Rows in APP_CACHE_VIEW','value' => $res['count']
);
//now check if we have the triggers installed
//APP_DELEGATION INSERT
$res = $appCache->triggerAppDelegationInsert( $lang, false );
$result->info[] = array ('name' => 'Trigger APP_DELEGATION INSERT','value' => $res
);
//APP_DELEGATION Update
$res = $appCache->triggerAppDelegationUpdate( $lang, false );
$result->info[] = array ('name' => 'Trigger APP_DELEGATION UPDATE','value' => $res
);
//APPLICATION UPDATE
$res = $appCache->triggerApplicationUpdate( $lang, false );
$result->info[] = array ('name' => 'Trigger APPLICATION UPDATE','value' => $res
);
//APPLICATION DELETE
$res = $appCache->triggerApplicationDelete( $lang, false );
$result->info[] = array ('name' => 'Trigger APPLICATION DELETE','value' => $res
);
//CONTENT UPDATE
$res = $appCache->triggerContentUpdate( $lang, false );
$result->info[] = array ("name" => "Trigger CONTENT UPDATE","value" => $res
);
//show language
$result->info[] = array ('name' => 'Language','value' => $lang
);
echo G::json_encode( $result );
break;
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 'build':
$sqlToExe = Array ();
G::LoadClass( 'configuration' );
$conf = new Configurations();
//DEPRECATED $lang = $_POST['lang'];
//there is no more support for other languages that english
$lang = 'en';
try {
//setup the appcacheview object, and the path for the sql files
$appCache = new AppCacheView();
$appCache->setPathToAppCacheFiles( PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP );
//APP_DELEGATION INSERT
$res = $appCache->triggerAppDelegationInsert( $lang, true );
//$result->info[] = array ('name' => 'Trigger APP_DELEGATION INSERT', 'value'=> $res);
//APP_DELEGATION Update
$res = $appCache->triggerAppDelegationUpdate( $lang, true );
//$result->info[] = array ('name' => 'Trigger APP_DELEGATION UPDATE', 'value'=> $res);
//APPLICATION UPDATE
$res = $appCache->triggerApplicationUpdate( $lang, true );
//$result->info[] = array ('name' => 'Trigger APPLICATION UPDATE', 'value'=> $res);
//APPLICATION DELETE
$res = $appCache->triggerApplicationDelete( $lang, true );
//$result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res);
//CONTENT UPDATE
$res = $appCache->triggerContentUpdate( $lang, true );
//$result->info[] = array("name" => "Trigger CONTENT UPDATE", "value" => $res);
//build using the method in AppCacheView Class
$res = $appCache->fillAppCacheView( $lang );
//$result->info[] = array ('name' => 'build APP_CACHE_VIEW', 'value'=> $res);
//set status in config table
$confParams = Array ('LANG' => $lang,'STATUS' => 'active'
);
$conf->aConfig = $confParams;
$conf->saveConfig( 'APP_CACHE_VIEW_ENGINE', '', '', '' );
$response = new StdClass();
$result->success = true;
$result->msg = "Completed successfully";
echo G::json_encode( $result );
} catch (Exception $e) {
$confParams = Array ('lang' => $lang,'status' => 'failed'
);
$appCacheViewEngine = $oServerConf->setProperty( 'APP_CACHE_VIEW_ENGINE', $confParams );
echo '{success: false, msg:"' . $e->getMessage() . '"}';
}
break;
case 'recreate-root':
$sh=md5(filemtime(PATH_GULLIVER."/class.g.php"));
$h=G::encrypt($_POST['host'].$sh.$_POST['user'].$sh.$_POST['password'].$sh.(1),$sh);
$insertStatements = "define ( 'HASH_INSTALLATION','{$h}' ); \ndefine ( 'SYSTEM_HASH', '{$sh}' ); \n";
$lines = array();
$content = '';
$filename = PATH_HOME.'engine'.PATH_SEP.'config'.PATH_SEP.'paths_installed.php';
$lines = file($filename);
$sh = md5( filemtime( PATH_GULLIVER . "/class.g.php" ) );
$h = G::encrypt( $_POST['host'] . $sh . $_POST['user'] . $sh . $_POST['password'] . $sh . (1), $sh );
$insertStatements = "define ( 'HASH_INSTALLATION','{$h}' ); \ndefine ( 'SYSTEM_HASH', '{$sh}' ); \n";
$lines = array ();
$content = '';
$filename = PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php';
$lines = file( $filename );
$count = 1;
foreach ($lines as $line_num => $line) {
$pos = strpos($line, "define");
if ($pos!==false&&$count<3) {
$content = $content. $line;
$count++;
}
}
$content = "<?php \n".$content."\n".$insertStatements."\n";
if (file_put_contents($filename, $content)!=false){
echo G::loadTranslation('ID_MESSAGE_ROOT_CHANGE_SUCESS');
} else {
echo G::loadTranslation('ID_MESSAGE_ROOT_CHANGE_FAILURE');
}
break;
}
$count = 1;
foreach ($lines as $line_num => $line) {
$pos = strpos( $line, "define" );
if ($pos !== false && $count < 3) {
$content = $content . $line;
$count ++;
}
}
$content = "<?php \n" . $content . "\n" . $insertStatements . "\n";
if (file_put_contents( $filename, $content ) != false) {
echo G::loadTranslation( 'ID_MESSAGE_ROOT_CHANGE_SUCESS' );
} else {
echo G::loadTranslation( 'ID_MESSAGE_ROOT_CHANGE_FAILURE' );
}
break;
}

View File

@@ -1,37 +1,39 @@
<?php
<?php
// header('Pragma: no-cache');
// header('Cache-Control: no-store, no-cache, must-revalidate');
$oHeadPublisher =& headPublisher::getSingleton();
//$oHeadPublisher->setExtSkin( 'xtheme-blue');
$oHeadPublisher->addExtJsScript('setup/appCacheViewConf', false); //adding a javascript file .js
$oHeadPublisher->addContent('setup/appCacheViewConf'); //adding a html file .html.
require_once('classes/model/AppCacheView.php');
G::loadClass('configuration');
$oConf = new Configurations;
$oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE','','','','');
//first check about APP_CACHE_VIEW is enabled or not,
if ( isset($oConf->aConfig['LANG']) && isset($oConf->aConfig['STATUS']) && $oConf->aConfig['STATUS'] == 'active'){
$oHeadPublisher = & headPublisher::getSingleton();
//$oHeadPublisher->setExtSkin( 'xtheme-blue');
$oHeadPublisher->addExtJsScript( 'setup/appCacheViewConf', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'setup/appCacheViewConf' ); //adding a html file .html.
require_once ('classes/model/AppCacheView.php');
G::loadClass( 'configuration' );
$oConf = new Configurations();
$oConf->loadConfig( $x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '' );
//first check about APP_CACHE_VIEW is enabled or not,
if (isset( $oConf->aConfig['LANG'] ) && isset( $oConf->aConfig['STATUS'] ) && $oConf->aConfig['STATUS'] == 'active') {
$appCacheViewEnabled = true;
}
else {
} else {
$appCacheViewEnabled = false;
}
$lang = isset($oConf->aConfig['LANG']) ? $oConf->aConfig['LANG'] : 'en';
//$oHeadPublisher->assign('appCacheViewEnabled', $appCacheViewEnabled);
}
$lang = isset( $oConf->aConfig['LANG'] ) ? $oConf->aConfig['LANG'] : 'en';
$labels = G::getTranslations(Array(
'ID_PROCESSING', 'ID_CACHE_LANGUAGE', 'ID_CACHE_HOST', 'ID_CACHE_USER', 'ID_CACHE_PASSWORD',
'ID_CACHE_TITLE_INFO', 'ID_CACHE_SUBTITLE_REBUILD', 'ID_CACHE_BTN_BUILD',
'ID_CACHE_BUILDING', 'ID_CACHE_SUBTITLE_SETUP_DB', 'ID_CACHE_BTN_SETUP_PASSWRD', 'ID_CACHE_SUBTITLE_SETUP_SESSION', 'ID_CACHE_BTN_SETUP_SESSION'
));
// $oHeadPublisher->assign('TRANSLATIONS', $labels);
// $TRANSLATIONS->ID_PROCESSING = G::LoadTranslation('ID_PROCESSING');
// $oHeadPublisher->assign( 'TRANSLATIONS', $TRANSLATIONS); //translations
$oHeadPublisher->assign( 'currentLang', $lang); //current language
//$oHeadPublisher->assign('appCacheViewEnabled', $appCacheViewEnabled);
$labels = G::getTranslations( Array ('ID_PROCESSING','ID_CACHE_LANGUAGE','ID_CACHE_HOST','ID_CACHE_USER','ID_CACHE_PASSWORD','ID_CACHE_TITLE_INFO','ID_CACHE_SUBTITLE_REBUILD','ID_CACHE_BTN_BUILD','ID_CACHE_BUILDING','ID_CACHE_SUBTITLE_SETUP_DB','ID_CACHE_BTN_SETUP_PASSWRD','ID_CACHE_SUBTITLE_SETUP_SESSION','ID_CACHE_BTN_SETUP_SESSION'
) );
// $oHeadPublisher->assign('TRANSLATIONS', $labels);
// $TRANSLATIONS->ID_PROCESSING = G::LoadTranslation('ID_PROCESSING');
// $oHeadPublisher->assign( 'TRANSLATIONS', $TRANSLATIONS); //translations
$oHeadPublisher->assign( 'currentLang', $lang ); //current language
G::RenderPage( 'publish', 'extJs' );
G::RenderPage('publish', 'extJs');

View File

@@ -1,10 +1,10 @@
<?php
/**
* appearance.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,24 +12,24 @@
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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;
$dbc = new DBConnection();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent("content", "setup/company_template");
G::RenderPage( 'publish' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( "content", "setup/company_template" );
G::RenderPage( 'publish' );
?>company logo
<script language="JavaScript">
@@ -38,8 +38,11 @@ window.onload = new Function("myOnLoad()");
function myOnLoad()
{
<?php if ($var == 'change') { ?>
location.reload();
<?php } ?>
location.reload();
<?php
}
?>
}
</script>
</script>

View File

@@ -1,20 +1,18 @@
<?php
try {
<?php
try {
$CalendarUid = $_GET['id'];
G::LoadClass( 'calendar' );
$calendarObj = new calendar();
$calendarObj->deleteCalendar( $CalendarUid );
G::LoadClass('calendar');
$calendarObj=new calendar();
$calendarObj->deleteCalendar($CalendarUid);
G::Header( 'location: calendarList' );
G::Header('location: calendarList');
}
catch ( Exception $e ) {
$G_PUBLISH = new Publisher;
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}
}

View File

@@ -1,60 +1,59 @@
<?php
/**
* calendarEdit.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if($RBAC->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;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'CALENDAR';
$CalendarUid = str_replace ( '"', '', isset ( $_GET ['id'] ) ? $_GET ['id'] : G::GenerateUniqueID () );
//TODO: Add validation before save for all fields
G::LoadClass ( 'calendar' );
$calendarObj = new calendar ( );
if ((isset ( $_GET ['id'] )) && ($_GET ['id'] != "")) {
$fields = $calendarObj->getCalendarInfoE ( $CalendarUid );
$fields ['OLD_NAME'] = $fields['CALENDAR_NAME'];
}
if (! (isset ( $fields ['CALENDAR_UID'] ))) { //For a new Calendar
$fields ['CALENDAR_UID'] = $CalendarUid;
$fields ['OLD_NAME'] = '';
//Default Business Hour
$fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_DAY'] = 7;
$fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_START'] = "09:00";
$fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_END'] = "17:00";
}
if ((isset ( $_GET ['cp'] )) && ($_GET ['cp'] == 1)) { // Copy Calendar
$fields ['CALENDAR_UID'] = G::GenerateUniqueID ();
$fields ['CALENDAR_NAME'] = G::LoadTranslation ( "ID_COPY_OF" ) . " " . $fields ['CALENDAR_NAME'];
}
$G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/calendarEdit', '', $fields, 'calendarSave' );
G::RenderPage ( 'publishBlank', 'blank' );
?>
<?php
/**
* calendarEdit.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if ($RBAC->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();
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'CALENDAR';
$CalendarUid = str_replace( '"', '', isset( $_GET['id'] ) ? $_GET['id'] : G::GenerateUniqueID() );
//TODO: Add validation before save for all fields
G::LoadClass( 'calendar' );
$calendarObj = new calendar();
if ((isset( $_GET['id'] )) && ($_GET['id'] != "")) {
$fields = $calendarObj->getCalendarInfoE( $CalendarUid );
$fields['OLD_NAME'] = $fields['CALENDAR_NAME'];
}
if (! (isset( $fields['CALENDAR_UID'] ))) { //For a new Calendar
$fields['CALENDAR_UID'] = $CalendarUid;
$fields['OLD_NAME'] = '';
//Default Business Hour
$fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7;
$fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00";
$fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00";
}
if ((isset( $_GET['cp'] )) && ($_GET['cp'] == 1)) { // Copy Calendar
$fields['CALENDAR_UID'] = G::GenerateUniqueID();
$fields['CALENDAR_NAME'] = G::LoadTranslation( "ID_COPY_OF" ) . " " . $fields['CALENDAR_NAME'];
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/calendarEdit', '', $fields, 'calendarSave' );
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -1,51 +1,49 @@
<?php
/**
* calendarList.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if($RBAC->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;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'CALENDAR';
$G_PUBLISH = new Publisher;
G::LoadClass('configuration');
$c = new Configurations();
$configPage = $c->getConfiguration('calendarList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('setup/calendarList', false); //adding a javascript file .js
$oHeadPublisher->addContent('setup/calendarList'); //adding a html file .html.
$oHeadPublisher->assign('CONFIG', $Config);
G::RenderPage('publish', 'extJs');
?>
<?php
/**
* calendarList.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if ($RBAC->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();
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'CALENDAR';
$G_PUBLISH = new Publisher();
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration( 'calendarList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'setup/calendarList', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'setup/calendarList' ); //adding a html file .html.
$oHeadPublisher->assign( 'CONFIG', $Config );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,10 +1,10 @@
<?php
/**
* calendarSave.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,43 +12,41 @@
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
{
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;
switch ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' )) {
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;
}
try {
$form = $_POST['form'];
G::LoadClass('calendar');
$calendarObj=new calendar();
$calendarObj->saveCalendarInfo($form);
try {
$form = $_POST['form'];
G::Header('location: calendarList');
}
catch ( Exception $e ) {
$G_PUBLISH = new Publisher;
G::LoadClass( 'calendar' );
$calendarObj = new calendar();
$calendarObj->saveCalendarInfo( $form );
G::Header( 'location: calendarList' );
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
}
}

View File

@@ -12,68 +12,66 @@
*
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
// validating the fields of the Calendar Edit form.
// checking permissions
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
{
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;
switch ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' )) {
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;
}
// validating the fields
$message = array();
$oldName = isset($_POST['oldName'])?$_POST['oldName']:'';
$message = array ();
$oldName = isset( $_POST['oldName'] ) ? $_POST['oldName'] : '';
switch ($_POST['action']){
case 'calendarName':
require_once ('classes/model/CalendarDefinition.php');
$oCalendar = new CalendarDefinition();
$aCalendars = $oCalendar->getCalendarList(false,true);
// var_dump($_POST['name']);
// var_dump($aCalendars);
//$count = 0;
$aCalendarDefinitions = end($aCalendars);
// var_dump($aCalendarDefinitions);
foreach($aCalendarDefinitions as $aDefinitions) {
if (trim($_POST['name'])==''){
$validated = false;
$message = G::loadTranslation('ID_CALENDAR_INVALID_NAME');
switch ($_POST['action']) {
case 'calendarName':
require_once ('classes/model/CalendarDefinition.php');
$oCalendar = new CalendarDefinition();
$aCalendars = $oCalendar->getCalendarList( false, true );
// var_dump($_POST['name']);
// var_dump($aCalendars);
//$count = 0;
$aCalendarDefinitions = end( $aCalendars );
// var_dump($aCalendarDefinitions);
foreach ($aCalendarDefinitions as $aDefinitions) {
if (trim( $_POST['name'] ) == '') {
$validated = false;
$message = G::loadTranslation( 'ID_CALENDAR_INVALID_NAME' );
break;
}
if ($aDefinitions['CALENDAR_NAME'] != $_POST['name']) {
$validated = true;
} else {
if ($aDefinitions['CALENDAR_NAME'] != $oldName) {
$validated = false;
$message = G::loadTranslation( 'ID_CALENDAR_INVALID_NAME' );
break;
}
}
}
break;
}
if ($aDefinitions['CALENDAR_NAME']!=$_POST['name']){
$validated = true;
} else {
if ($aDefinitions['CALENDAR_NAME']!=$oldName) {
case 'calendarDates':
$validated = false;
$message = G::loadTranslation('ID_CALENDAR_INVALID_NAME');
$message = G::loadTranslation( 'ID_CALENDAR_INVALID_WORK_DATES' );
break;
}
}
}
break;
case 'calendarDates':
$validated = false;
$message = G::loadTranslation('ID_CALENDAR_INVALID_WORK_DATES');
break;
}
if (!$validated){
if (! $validated) {
echo ($message);
}

View File

@@ -12,91 +12,89 @@
*
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if($RBAC->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;
if ($RBAC->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();
}
$_POST['action'] = $_REQUEST['action'];
switch ($_POST['action'])
{
case 'calendarList':
G::LoadClass('configuration');
G::LoadClass('calendar');
$co = new Configurations();
$config = $co->getConfiguration('calendarList', 'pageSize','',$_SESSION['USER_LOGGED']);
$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
$filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
$calendar = new calendar();
$CRI = $calendar->getCalendarCriterias($filter, $start, $limit);
$aUsers = $calendar->getAllCounterByCalendar('USER');
$aTasks = $calendar->getAllCounterByCalendar('TASK');
$aProcess = $calendar->getAllCounterByCalendar('PROCESS');
$total_cals = CalendarDefinitionPeer::doCount($CRI['COUNTER']);
$oDataSet = CalendarDefinitionPeer::doSelectRS($CRI['LIST']);
$oDataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aCals = array();
while ($oDataSet->next()){
$aCals[] = $oDataSet->getRow();
$index = sizeof($aCals)-1;
$aCals[$index]['TOTAL_USERS'] = isset($aUsers[$aCals[$index]['CALENDAR_UID']])? $aUsers[$aCals[$index]['CALENDAR_UID']]: 0;
$aCals[$index]['TOTAL_TASKS'] = isset($aTasks[$aCals[$index]['CALENDAR_UID']])? $aTasks[$aCals[$index]['CALENDAR_UID']]: 0;
$aCals[$index]['TOTAL_PROCESS'] = isset($aProcess[$aCals[$index]['CALENDAR_UID']])? $aProcess[$aCals[$index]['CALENDAR_UID']]: 0;
}
echo '{cals: '.G::json_encode($aCals).', total_cals: '.$total_cals.'}';
break;
case 'updatePageSize':
G::LoadClass('configuration');
$c = new Configurations();
$arr['pageSize'] = $_REQUEST['size'];
$arr['dateSave'] = date('Y-m-d H:i:s');
$config = Array();
$config[] = $arr;
$c->aConfig = $config;
$c->saveConfig('calendarList', 'pageSize','',$_SESSION['USER_LOGGED']);
echo '{success: true}';
break;
case 'canDeleteCalendar':
$cal_uid = $_POST['CAL_UID'];
G::LoadClass('calendar');
$cal = new calendar();
$total = 0;
$u = $cal->getAllCounterByCalendar('USER');
$t_u = isset($u[$cal_uid]) ? $u[$cal_uid]: 0;
$t = $cal->getAllCounterByCalendar('TASK');
$t_t = isset($t[$cal_uid]) ? $t[$cal_uid]: 0;
$p = $cal->getAllCounterByCalendar('PROCESS');
$t_p = isset($p[$cal_uid]) ? $p[$cal_uid]: 0;
$total = $t_u + $t_t + $t_p;
$response = ($total==0)? 'true': 'false';
echo '{success: '.$response.'}';
break;
case 'deleteCalendar':
$CalendarUid = $_POST['CAL_UID'];
G::LoadClass('calendar');
$calendarObj=new calendar();
$calendarObj->deleteCalendar($CalendarUid);
echo '{success: true}';
break;
switch ($_POST['action']) {
case 'calendarList':
G::LoadClass( 'configuration' );
G::LoadClass( 'calendar' );
$co = new Configurations();
$config = $co->getConfiguration( 'calendarList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$limit_size = isset( $config['pageSize'] ) ? $config['pageSize'] : 20;
$start = isset( $_REQUEST['start'] ) ? $_REQUEST['start'] : 0;
$limit = isset( $_REQUEST['limit'] ) ? $_REQUEST['limit'] : $limit_size;
$filter = isset( $_REQUEST['textFilter'] ) ? $_REQUEST['textFilter'] : '';
$calendar = new calendar();
$CRI = $calendar->getCalendarCriterias( $filter, $start, $limit );
$aUsers = $calendar->getAllCounterByCalendar( 'USER' );
$aTasks = $calendar->getAllCounterByCalendar( 'TASK' );
$aProcess = $calendar->getAllCounterByCalendar( 'PROCESS' );
$total_cals = CalendarDefinitionPeer::doCount( $CRI['COUNTER'] );
$oDataSet = CalendarDefinitionPeer::doSelectRS( $CRI['LIST'] );
$oDataSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aCals = array ();
while ($oDataSet->next()) {
$aCals[] = $oDataSet->getRow();
$index = sizeof( $aCals ) - 1;
$aCals[$index]['TOTAL_USERS'] = isset( $aUsers[$aCals[$index]['CALENDAR_UID']] ) ? $aUsers[$aCals[$index]['CALENDAR_UID']] : 0;
$aCals[$index]['TOTAL_TASKS'] = isset( $aTasks[$aCals[$index]['CALENDAR_UID']] ) ? $aTasks[$aCals[$index]['CALENDAR_UID']] : 0;
$aCals[$index]['TOTAL_PROCESS'] = isset( $aProcess[$aCals[$index]['CALENDAR_UID']] ) ? $aProcess[$aCals[$index]['CALENDAR_UID']] : 0;
}
echo '{cals: ' . G::json_encode( $aCals ) . ', total_cals: ' . $total_cals . '}';
break;
case 'updatePageSize':
G::LoadClass( 'configuration' );
$c = new Configurations();
$arr['pageSize'] = $_REQUEST['size'];
$arr['dateSave'] = date( 'Y-m-d H:i:s' );
$config = Array ();
$config[] = $arr;
$c->aConfig = $config;
$c->saveConfig( 'calendarList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
echo '{success: true}';
break;
case 'canDeleteCalendar':
$cal_uid = $_POST['CAL_UID'];
G::LoadClass( 'calendar' );
$cal = new calendar();
$total = 0;
$u = $cal->getAllCounterByCalendar( 'USER' );
$t_u = isset( $u[$cal_uid] ) ? $u[$cal_uid] : 0;
$t = $cal->getAllCounterByCalendar( 'TASK' );
$t_t = isset( $t[$cal_uid] ) ? $t[$cal_uid] : 0;
$p = $cal->getAllCounterByCalendar( 'PROCESS' );
$t_p = isset( $p[$cal_uid] ) ? $p[$cal_uid] : 0;
$total = $t_u + $t_t + $t_p;
$response = ($total == 0) ? 'true' : 'false';
echo '{success: ' . $response . '}';
break;
case 'deleteCalendar':
$CalendarUid = $_POST['CAL_UID'];
G::LoadClass( 'calendar' );
$calendarObj = new calendar();
$calendarObj->deleteCalendar( $CalendarUid );
echo '{success: true}';
break;
}
?>

View File

@@ -1,29 +1,30 @@
<?php
/**
* class.g.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('setup/clearCompiled', true ); //adding a javascript file .js
G::RenderPage('publish', 'extJs');
<?php
/**
* class.g.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'setup/clearCompiled', true ); //adding a javascript file .js
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,30 +1,29 @@
<?php
try {
if (isset($_POST['javascriptCache']) || isset($_POST['metadataCache']) || isset($_POST['htmlCache'])) {
if (isset($_POST['javascriptCache'])) {
G::rm_dir(PATH_C . 'ExtJs');
$response->javascript = true;
}
if (isset( $_POST['javascriptCache'] ) || isset( $_POST['metadataCache'] ) || isset( $_POST['htmlCache'] )) {
if (isset($_POST['metadataCache'])) {
G::rm_dir(PATH_C . 'xmlform');
$response->xmlform = true;
}
if (isset( $_POST['javascriptCache'] )) {
G::rm_dir( PATH_C . 'ExtJs' );
$response->javascript = true;
}
if (isset($_POST['htmlCache'])) {
G::rm_dir(PATH_C . 'smarty');
$response->smarty = true;
if (isset( $_POST['metadataCache'] )) {
G::rm_dir( PATH_C . 'xmlform' );
$response->xmlform = true;
}
if (isset( $_POST['htmlCache'] )) {
G::rm_dir( PATH_C . 'smarty' );
$response->smarty = true;
}
$response->success = true;
} else {
$response->success = false;
}
$response->success = true;
}
else{
} catch (Exception $e) {
$response->success = false;
}
$response->message = $e->getMessage();
}
catch (Exception $e) {
$response->success = false;
$response->message = $e->getMessage();
}
echo G::json_encode($response);
echo G::json_encode( $response );

View File

@@ -1,10 +1,10 @@
<?php
/**
* connectionDB.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,21 +12,21 @@
*
* This program is distributed in the hope that it will be useful,
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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", "pagedTable", "setup/connection_db", "", "", "" );
G::RenderPage( 'publish' );
$dbc = new DBConnection;
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( "xmlform", "pagedTable", "setup/connection_db","","", "" );
G::RenderPage( 'publish' );
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* connectionWS.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,21 +12,21 @@
*
* This program is distributed in the hope that it will be useful,
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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", "pagedTable", "setup/connection_ws", "", "", "" );
G::RenderPage( 'publish' );
$dbc = new DBConnection;
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( "xmlform", "pagedTable", "setup/connection_ws","","", "" );
G::RenderPage( 'publish' );
?>

View File

@@ -1,31 +1,27 @@
<?php
G::LoadClass("system");
G::LoadClass("wsTools");
G::LoadClass("configuration");
G::LoadClass( "system" );
G::LoadClass( "wsTools" );
G::LoadClass( "configuration" );
global $RBAC;
if ($RBAC->userCanAccess("PM_SETUP_ADVANCE") != 1) {
G::SendTemporalMessage("ID_USER_HAVENT_RIGHTS_PAGE", "error", "labels");
exit(0);
if ($RBAC->userCanAccess( "PM_SETUP_ADVANCE" ) != 1) {
G::SendTemporalMessage( "ID_USER_HAVENT_RIGHTS_PAGE", "error", "labels" );
exit( 0 );
}
//Cron status
$bCronIsRunning = false;
$sLastExecution = null;
$processcTimeProcess = 0;
$processcTimeStart = 0;
$processcTimeStart = 0;
if (file_exists(PATH_DATA . "cron")) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]);
if (file_exists( PATH_DATA . "cron" )) {
$arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
$bCronIsRunning = (boolean) ($arrayCron["bCronIsRunning"]);
$sLastExecution = $arrayCron["sLastExecution"];
$processcTimeProcess = (isset($arrayCron["processcTimeProcess"]))? intval($arrayCron["processcTimeProcess"]) : 10;
$processcTimeStart = (isset($arrayCron["processcTimeStart"]))? $arrayCron["processcTimeStart"] : 0;
$processcTimeProcess = (isset( $arrayCron["processcTimeProcess"] )) ? intval( $arrayCron["processcTimeProcess"] ) : 10;
$processcTimeStart = (isset( $arrayCron["processcTimeStart"] )) ? $arrayCron["processcTimeStart"] : 0;
}
if ($bCronIsRunning && $processcTimeStart != 0) {
@@ -37,54 +33,55 @@ if ($bCronIsRunning && $processcTimeStart != 0) {
//Data
$c = new Configurations();
$configPage = $c->getConfiguration("cronList", "pageSize", null, $_SESSION["USER_LOGGED"]);
$configPage = $c->getConfiguration( "cronList", "pageSize", null, $_SESSION["USER_LOGGED"] );
$config = array();
$config["pageSize"] = (isset($configPage["pageSize"]))? $configPage["pageSize"] : 20;
$config = array ();
$config["pageSize"] = (isset( $configPage["pageSize"] )) ? $configPage["pageSize"] : 20;
$cronInfo = array();
$fileLog = PATH_DATA . "log" . PATH_SEP . "cron.log";
$fileLogSize = (file_exists($fileLog))? number_format(filesize($fileLog) * (1 / 1024) * (1 / 1024), 4, ".", "") : 0;
$cronInfo = array ();
$fileLog = PATH_DATA . "log" . PATH_SEP . "cron.log";
$fileLogSize = (file_exists( $fileLog )) ? number_format( filesize( $fileLog ) * (1 / 1024) * (1 / 1024), 4, ".", "" ) : 0;
$cronInfo["status"] = G::LoadTranslation((($bCronIsRunning)? "ID_CRON_STATUS_ACTIVE" : "ID_CRON_STATUS_INACTIVE"));
$cronInfo["lastExecution"] = (!empty($sLastExecution))? $sLastExecution : "";
$cronInfo["status"] = G::LoadTranslation( (($bCronIsRunning) ? "ID_CRON_STATUS_ACTIVE" : "ID_CRON_STATUS_INACTIVE") );
$cronInfo["lastExecution"] = (! empty( $sLastExecution )) ? $sLastExecution : "";
$cronInfo["fileLogName"] = "cron.log";
$cronInfo["fileLogSize"] = $fileLogSize;
$cronInfo["fileLogPath"] = $fileLog;
//Workspaces
$workspaces = System::listWorkspaces();
$arrayAux = array();
$arrayAux = array ();
foreach ($workspaces as $index => $workspace) {
$arrayAux[] = $workspace->name;
}
sort($arrayAux);
sort( $arrayAux );
$arrayWorkspace = array();
$arrayWorkspace = array ();
foreach ($arrayAux as $index => $value) {
$arrayWorkspace[] = array($value, $value);
$arrayWorkspace[] = array ($value,$value
);
}
array_unshift($arrayWorkspace, array("ALL", G::LoadTranslation("ID_ALL_WORKSPACES")));
array_unshift( $arrayWorkspace, array ("ALL",G::LoadTranslation( "ID_ALL_WORKSPACES" )
) );
//Status
$arrayStatus = array(
array("ALL", G::LoadTranslation("ID_ALL")),
array("COMPLETED", G::LoadTranslation("COMPLETED")),
array("FAILED", G::LoadTranslation("ID_FAILED"))
$arrayStatus = array (array ("ALL",G::LoadTranslation( "ID_ALL" )
),array ("COMPLETED",G::LoadTranslation( "COMPLETED" )
),array ("FAILED",G::LoadTranslation( "ID_FAILED" )
)
);
$oHeadPublisher = &headPublisher::getSingleton();
$oHeadPublisher->addContent("setup/cron"); //Adding a html file .html
$oHeadPublisher->addExtJsScript("setup/cron", false); //Adding a javascript file .js
$oHeadPublisher->assign("CONFIG", $config);
$oHeadPublisher->assign("CRON", $cronInfo);
$oHeadPublisher->assign("WORKSPACE", $arrayWorkspace);
$oHeadPublisher->assign("STATUS", $arrayStatus);
$oHeadPublisher->addContent( "setup/cron" ); //Adding a html file .html
$oHeadPublisher->addExtJsScript( "setup/cron", false ); //Adding a javascript file .js
$oHeadPublisher->assign( "CONFIG", $config );
$oHeadPublisher->assign( "CRON", $cronInfo );
$oHeadPublisher->assign( "WORKSPACE", $arrayWorkspace );
$oHeadPublisher->assign( "STATUS", $arrayStatus );
G::RenderPage("publish", "extJs");
G::RenderPage( "publish", "extJs" );

View File

@@ -1,39 +1,33 @@
<?php
function mktimeDate($date)
{
$arrayAux = getdate(strtotime($date));
$mktDate = mktime(
$arrayAux["hours"],
$arrayAux["minutes"],
$arrayAux["seconds"],
$arrayAux["mon"],
$arrayAux["mday"],
$arrayAux["year"]
);
function mktimeDate ($date)
{
$arrayAux = getdate( strtotime( $date ) );
$mktDate = mktime( $arrayAux["hours"], $arrayAux["minutes"], $arrayAux["seconds"], $arrayAux["mon"], $arrayAux["mday"], $arrayAux["year"] );
return $mktDate;
}
function cronArraySet($str, $filter)
function cronArraySet ($str, $filter)
{
$arrayAux = explode("|", $str);
$arrayAux = explode( "|", $str );
$date = "";
$workspace = "";
$action = "";
$status = "";
$description = trim($arrayAux[0]);
$date = "";
$workspace = "";
$action = "";
$status = "";
$description = trim( $arrayAux[0] );
if (count($arrayAux) > 1) {
$date = (isset($arrayAux[0]))? trim($arrayAux[0]) : "";
$workspace = (isset($arrayAux[1]))? trim($arrayAux[1]) : "";
$action = (isset($arrayAux[2]))? trim($arrayAux[2]) : "";
$status = (isset($arrayAux[3]))? trim($arrayAux[3]) : "";
$description = (isset($arrayAux[4]))? trim($arrayAux[4]) : "";
if (count( $arrayAux ) > 1) {
$date = (isset( $arrayAux[0] )) ? trim( $arrayAux[0] ) : "";
$workspace = (isset( $arrayAux[1] )) ? trim( $arrayAux[1] ) : "";
$action = (isset( $arrayAux[2] )) ? trim( $arrayAux[2] ) : "";
$status = (isset( $arrayAux[3] )) ? trim( $arrayAux[3] ) : "";
$description = (isset( $arrayAux[4] )) ? trim( $arrayAux[4] ) : "";
}
$mktDate = (!empty($date))? mktimeDate($date) : 0;
$mktDate = (! empty( $date )) ? mktimeDate( $date ) : 0;
//Filter
$sw = 1;
@@ -57,68 +51,63 @@ function cronArraySet($str, $filter)
}
}
if (!empty($filter["dateFrom"]) && $mktDate > 0) {
if (!(mktimeDate($filter["dateFrom"]) <= $mktDate)) {
if (! empty( $filter["dateFrom"] ) && $mktDate > 0) {
if (! (mktimeDate( $filter["dateFrom"] ) <= $mktDate)) {
$sw = 0;
}
}
if (!empty($filter["dateTo"]) && $mktDate > 0) {
if (!($mktDate <= mktimeDate($filter["dateTo"] . " 23:59:59"))) {
if (! empty( $filter["dateTo"] ) && $mktDate > 0) {
if (! ($mktDate <= mktimeDate( $filter["dateTo"] . " 23:59:59" ))) {
$sw = 0;
}
}
$arrayData = array();
$arrayData = array ();
if ($sw == 1) {
$arrayData = array(
"DATE" => $date,
"WORKSPACE" => $workspace,
"ACTION" => $action,
"STATUS" => $status,
"DESCRIPTION" => $description
$arrayData = array ("DATE" => $date,"WORKSPACE" => $workspace,"ACTION" => $action,"STATUS" => $status,"DESCRIPTION" => $description
);
}
return $arrayData;
}
function cronDataGet($filter, $r, $i)
function cronDataGet ($filter, $r, $i)
{
$r = $r + 1; //+ 1, to determine the next page
$i = $i + 1;
$arrayData = array();
$arrayData = array ();
$strAux = null;
$numRec = 0;
$cont = 0;
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
if (file_exists($file)) {
$fh = fopen($file, "r");
if (file_exists( $file )) {
$fh = fopen( $file, "r" );
for($pos = 0; fseek($fh, $pos, SEEK_END) !== -1; $pos--) {
$char = fgetc($fh);
for ($pos = 0; fseek( $fh, $pos, SEEK_END ) !== - 1; $pos --) {
$char = fgetc( $fh );
if ($char == "\n") {
$strAux = trim($strAux);
$strAux = trim( $strAux );
if (!empty($strAux)) {
$arrayAux = cronArraySet($strAux, $filter);
if (! empty( $strAux )) {
$arrayAux = cronArraySet( $strAux, $filter );
if (count($arrayAux) > 0) {
if (count( $arrayAux ) > 0) {
$cont = $cont + 1;
if ($cont >= $i && count($arrayData) + 1 <= $r) {
if ($cont >= $i && count( $arrayData ) + 1 <= $r) {
$arrayData[] = $arrayAux;
$numRec = $cont;
}
}
}
if (count($arrayData) == $r) {
if (count( $arrayData ) == $r) {
break;
}
@@ -129,74 +118,67 @@ function cronDataGet($filter, $r, $i)
$strAux = $char . $strAux;
}
$strAux = trim($strAux);
$strAux = trim( $strAux );
if (!empty($strAux)) {
$arrayAux = cronArraySet($strAux, $filter);
if (! empty( $strAux )) {
$arrayAux = cronArraySet( $strAux, $filter );
if (count($arrayAux) > 0) {
if (count( $arrayAux ) > 0) {
$cont = $cont + 1;
if ($cont >= $i && count($arrayData) + 1 <= $r) {
if ($cont >= $i && count( $arrayData ) + 1 <= $r) {
$arrayData[] = $arrayAux;
$numRec = $cont;
}
}
}
fclose($fh);
fclose( $fh );
}
//Delete element
$r = $r - 1;
if (count($arrayData) > $r) {
$arrayAux = array_pop($arrayData);
if (count( $arrayData ) > $r) {
$arrayAux = array_pop( $arrayData );
}
return array($numRec, $arrayData);
return array ($numRec,$arrayData
);
}
$option = (isset( $_REQUEST["option"] )) ? $_REQUEST["option"] : null;
$option = (isset($_REQUEST["option"]))? $_REQUEST["option"] : null;
$response = array();
$response = array ();
switch ($option) {
case "LST":
$pageSize = $_REQUEST["pageSize"];
$pageSize = $_REQUEST["pageSize"];
$workspace = $_REQUEST["workspace"];
$status = $_REQUEST["status"];
$dateFrom = $_REQUEST["dateFrom"];
$dateTo = $_REQUEST["dateTo"];
$status = $_REQUEST["status"];
$dateFrom = $_REQUEST["dateFrom"];
$dateTo = $_REQUEST["dateTo"];
$arrayFilter = array(
"workspace" => $workspace,
"status" => $status,
"dateFrom" => str_replace("T00:00:00", null, $dateFrom),
"dateTo" => str_replace("T00:00:00", null, $dateTo)
$arrayFilter = array ("workspace" => $workspace,"status" => $status,"dateFrom" => str_replace( "T00:00:00", null, $dateFrom ),"dateTo" => str_replace( "T00:00:00", null, $dateTo )
);
$limit = isset($_REQUEST["limit"])? $_REQUEST["limit"] : $pageSize;
$start = isset($_REQUEST["start"])? $_REQUEST["start"] : 0;
$limit = isset( $_REQUEST["limit"] ) ? $_REQUEST["limit"] : $pageSize;
$start = isset( $_REQUEST["start"] ) ? $_REQUEST["start"] : 0;
list($numRec, $data) = cronDataGet($arrayFilter, $limit, $start);
list ($numRec, $data) = cronDataGet( $arrayFilter, $limit, $start );
$response = array("success" => true, "resultTotal" => $numRec, "resultRoot" => $data);
$response = array ("success" => true,"resultTotal" => $numRec,"resultRoot" => $data
);
break;
case "EMPTY":
$status = 1;
try {
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
if (file_exists($file)) {
if (file_exists( $file )) {
//file_put_contents($file, null);
unlink($file);
unlink( $file );
}
$response["status"] = "OK";
@@ -211,5 +193,5 @@ switch ($option) {
break;
}
echo G::json_encode($response);
echo G::json_encode( $response );

View File

@@ -1,10 +1,10 @@
<?php
/**
* customFunctions.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,22 +12,22 @@
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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;
$dbc = new DBConnection();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'table', 'paged-table2', 'setup/Custom_Functions', '', '', '' );
G::RenderPage( 'publish-treeview' );
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('table', 'paged-table2', 'setup/Custom_Functions', '', '', '');
G::RenderPage( 'publish-treeview' );
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* debug.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,29 +12,28 @@
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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;
$dbc = new DBConnection();
$G_PUBLISH = new Publisher();
G::LoadClass ( 'lexico' );
$lex = new Lexico( $dbc );
$Fields['SESSION_PC'] = $lex->getFluidValue ( 'SESSION_PC', 'Y' );
$Fields['SESSION_BROWSER'] = $lex->getFluidValue ( 'SESSION_BROWSER', 'Y' );
G::LoadClass( 'lexico' );
$lex = new Lexico( $dbc );
$Fields['SESSION_PC'] = $lex->getFluidValue( 'SESSION_PC', 'Y' );
$Fields['SESSION_BROWSER'] = $lex->getFluidValue( 'SESSION_BROWSER', 'Y' );
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/session","", $Fields , "session2" );
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/session", "", $Fields, "session2" );
G::RenderPage( 'publish-treeview' );
G::RenderPage( 'publish-treeview' );
?>

View File

@@ -1,55 +1,56 @@
<?php
function getAllFiles($directory, $recursive = true ) {
$result = array();
$handle = opendir($directory);
while ($datei = readdir($handle))
{
if (($datei != '.') && ($datei != '..'))
{
$file = $directory.$datei;
if (is_dir($file)) {
function getAllFiles ($directory, $recursive = true)
{
$result = array ();
$handle = opendir( $directory );
while ($datei = readdir( $handle )) {
if (($datei != '.') && ($datei != '..')) {
$file = $directory . $datei;
if (is_dir( $file )) {
if ($recursive) {
$result = array_merge($result, getAllFiles($file.'/'));
$result = array_merge( $result, getAllFiles( $file . '/' ) );
}
} else {
$result[] = $file;
}
}
}
closedir($handle);
closedir( $handle );
return $result;
}
function getFilesTimestamp($directory, $recursive = true) {
$allFiles = getAllFiles($directory, $recursive);
function getFilesTimestamp ($directory, $recursive = true)
{
$allFiles = getAllFiles( $directory, $recursive );
$fileArray = array ();
foreach ($allFiles as $val) {
$timeResult['file'] = $val;
$timeResult['timestamp'] = filemtime($val);
$timeResult['file'] = $val;
$timeResult['timestamp'] = filemtime( $val );
$fileArray[] = $timeResult;
}
return $fileArray;
}
$currentTime = strtotime("now");
$timeDifference = 72*60*60;
$currentTime = strtotime( "now" );
$timeDifference = 72 * 60 * 60;
$limitTime = $currentTime - $timeDifference;
$sessionsPath = PATH_DATA.'session'.PATH_SEP;
$filesResult = getFilesTimestamp($sessionsPath);
$sessionsPath = PATH_DATA . 'session' . PATH_SEP;
$filesResult = getFilesTimestamp( $sessionsPath );
$count = 0;
foreach ($filesResult as $file){
if ( $file['timestamp'] < $limitTime ){
unlink ($file['file']);
$count++;
}
foreach ($filesResult as $file) {
if ($file['timestamp'] < $limitTime) {
unlink( $file['file'] );
$count ++;
}
}
if ($count>0) {
$response['message'] = G::loadTranslation('ID_REMOVED_SESSION_FILES');
if ($count > 0) {
$response['message'] = G::loadTranslation( 'ID_REMOVED_SESSION_FILES' );
} else {
$response['message'] = G::loadTranslation('ID_NO_OLDER_SESSION_FILES');
$response['message'] = G::loadTranslation( 'ID_NO_OLDER_SESSION_FILES' );
}
echo $response['message'];
?>

View File

@@ -12,32 +12,30 @@
*
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'MAILSYSTEM';
G::LoadClass( 'package' );
G::LoadClass( 'smtp' );
G::LoadClass( 'spool' );
G::LoadClass('package');
G::LoadClass('smtp');
G::LoadClass('spool');
$run = new spoolRun();
unset($run);
$run = new spoolRun();
unset( $run );
$Fields['MESSAGE'] = 'Hello world, this is my first email ... ';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $Fields, '' );
G::RenderPage( 'publish' );
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $Fields, '');
G::RenderPage('publish');

View File

@@ -12,57 +12,52 @@
* @category web_mail
* @subpackage spool
* @filesource
* @version
*
* @file tom_spool.php
* @version @file tom_spool.php
*
*/
if( isset ( $_POST['form']) )
{
$frm = "{$_POST['form']}";
if (isset( $_POST['form'] )) {
$frm = "{$_POST['form']}";
G::LoadClass('insert');
G::LoadClass( 'insert' );
$db_spool = array();
$db_spool['msg_uid'] = 'msg_uid';
$db_spool['app_uid'] = 'app_uid';
$db_spool['del_index'] = 99; // random number
$db_spool['app_msg_type'] = 'email message';
$db_spool['app_msg_subject'] = 'subject field'; //"{$frm['subject']}";
$db_spool['app_msg_from'] = '"ian armstrong" <ian@colosa.com>';//"{$frm['from_email']}";
$db_spool['app_msg_to'] = '<ika@openmail.cc>'; //"{$frm['to_email']}";
$db_spool['app_msg_body'] = 'body field'; //"{$frm['body']}";
$db_spool['app_msg_date'] = time();
$db_spool['app_msg_cc'] = '<ian@openmail.cc>';
$db_spool['app_msg_bcc'] = '<ian.k.armstrong@gmail.com>';
$db_spool['app_msg_template'] = "/path/to/template";
$db_spool['app_msg_status'] = "pending";
$db_spool = array ();
$db_spool['app_msg_attach'] = serialize(array('attachment_1','attachment_2'));
$db_spool['msg_uid'] = 'msg_uid';
$db_spool['app_uid'] = 'app_uid';
$db_spool['del_index'] = 99; // random number
$db_spool['app_msg_type'] = 'email message';
$db_spool['app_msg_subject'] = 'subject field'; //"{$frm['subject']}";
$db_spool['app_msg_from'] = '"ian armstrong" <ian@colosa.com>'; //"{$frm['from_email']}";
$db_spool['app_msg_to'] = '<ika@openmail.cc>'; //"{$frm['to_email']}";
$db_spool['app_msg_body'] = 'body field'; //"{$frm['body']}";
$db_spool['app_msg_date'] = time();
$db_spool['app_msg_cc'] = '<ian@openmail.cc>';
$db_spool['app_msg_bcc'] = '<ian.k.armstrong@gmail.com>';
$db_spool['app_msg_template'] = "/path/to/template";
$db_spool['app_msg_status'] = "pending";
/*
if(isset($frm['attachments']) && count($frm['attachments']) >0 )
{
foreach($frm['attachments'] as $attchment)
{
$db_spool['app_msg_attach'][] = "$attchment";
$db_spool['app_msg_attach'] = serialize( array ('attachment_1','attachment_2'
) );
}
/*
if(isset($frm['attachments']) && count($frm['attachments']) >0 )
{
foreach($frm['attachments'] as $attchment)
{
$db_spool['app_msg_attach'][] = "$attchment";
}
}*/
}*/
$insert = new insert( $db_spool );
$status = $insert->returnStatus();
unset( $insert );
$insert = new insert($db_spool);
$status = $insert->returnStatus();
unset($insert);
}
}
$Fields['MESSAGE'] = $status;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $Fields, 'emailSystemSpool' );
G::RenderPage( 'publish' );
$Fields['MESSAGE'] = $status;
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $Fields, 'emailSystemSpool');
G::RenderPage('publish');
?>

View File

@@ -12,34 +12,32 @@
*
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
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;
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;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'MAILSYSTEM';
$Fields['domain'] = 'colosa.com';
@@ -49,7 +47,7 @@ $Fields['from_email'] = 'ian@colosa.com';
$Fields['subject'] = 'Test email';
$Fields['body'] = 'Hello world, this is my first email ... ';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/emailSetupTest', '', $Fields, 'emailSystemSpool' );
G::RenderPage( 'publish' );
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/emailSetupTest', '', $Fields, 'emailSystemSpool');
G::RenderPage('publish');

View File

@@ -12,70 +12,73 @@
*
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_FACTORY') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
//G::header('location: ../login/login');
die;
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_FACTORY' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login');
die();
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'EMAILS';
require_once 'classes/model/Configuration.php';
$oConfiguration = new Configuration();
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria('workflow');
$oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails');
$oCriteria->add(ConfigurationPeer::OBJ_UID, '');
$oCriteria->add(ConfigurationPeer::PRO_UID, '');
$oCriteria->add(ConfigurationPeer::USR_UID, '');
$oCriteria->add(ConfigurationPeer::APP_UID, '');
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' );
$oCriteria->add( ConfigurationPeer::OBJ_UID, '' );
$oCriteria->add( ConfigurationPeer::PRO_UID, '' );
$oCriteria->add( ConfigurationPeer::USR_UID, '' );
$oCriteria->add( ConfigurationPeer::APP_UID, '' );
if (ConfigurationPeer::doCount($oCriteria) == 0) {
$oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '', 'MESS_RAUTH' => ''));
$aFields = array();
}
else {
$aFields = $oConfiguration->load('Emails', '', '', '', '');
if (trim($aFields['CFG_VALUE']) != '') {
$aFields = unserialize($aFields['CFG_VALUE']);
}
else {
$aFields = array();
}
if (ConfigurationPeer::doCount( $oCriteria ) == 0) {
$oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => '','MESS_RAUTH' => ''
) );
$aFields = array ();
} else {
$aFields = $oConfiguration->load( 'Emails', '', '', '', '' );
if (trim( $aFields['CFG_VALUE'] ) != '') {
$aFields = unserialize( $aFields['CFG_VALUE'] );
} else {
$aFields = array ();
}
}
$aFields['SMTPSecure'] = (isset($aFields['SMTPSecure']) && $aFields['SMTPSecure'] != '')? $aFields['SMTPSecure'] : 'none';
$aFields['SMTPSecure'] = (isset( $aFields['SMTPSecure'] ) && $aFields['SMTPSecure'] != '') ? $aFields['SMTPSecure'] : 'none';
$rows[] = array ( 'uid' => 'char', 'name' => 'char', 'age' => 'integer', 'balance' => 'float' );
$rows[] = array ( 'uid' => 'PHPMAILER', 'name' => 'SMTP (PHPMailer)' );
$rows[] = array ('uid' => 'char','name' => 'char','age' => 'integer','balance' => 'float'
);
$rows[] = array ('uid' => 'PHPMAILER','name' => 'SMTP (PHPMailer)'
);
// ending OpenMail support
// $rows[] = array ( 'uid' => 'OPENMAIL', 'name' => 'SMTP (OpenMail)' );
$rows[] = array ( 'uid' => 'MAIL', 'name' => 'Mail (PHP)' );
$rows[] = array ('uid' => 'MAIL','name' => 'Mail (PHP)'
);
$_DBArray['mails'] = $rows;
$_SESSION['_DBArray'] = $_DBArray;
$trn = G::getTranslations(Array('ID_SUCESS', 'ID_FAIL', ''));
$trn = G::getTranslations( Array ('ID_SUCESS','ID_FAIL',''
) );
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
$oHeadPublisher = headPublisher::getSingleton();
$oHeadPublisher->addScriptCode('var TRANSLATIONS='.G::json_encode($trn).';');
$oHeadPublisher->addScriptFile('/jscore/setup/emails.js');
$oHeadPublisher->addScriptCode( 'var TRANSLATIONS=' . G::json_encode( $trn ) . ';' );
$oHeadPublisher->addScriptFile( '/jscore/setup/emails.js' );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/emails', '', $aFields, 'emails_Save' );
G::RenderPage( 'publishBlank', 'blank' );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/emails', '', $aFields, 'emails_Save');
G::RenderPage('publishBlank', 'blank');

View File

@@ -12,325 +12,294 @@
*
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
$request = (isset($_POST['action']))?$_POST['action']:$_POST['request'];
$request = (isset( $_POST['action'] )) ? $_POST['action'] : $_POST['request'];
switch ($request) {
case 'init':
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('view', 'setup/mailConnectiontest');
G::RenderPage('publish', 'raw');
break;
case 'mailTestMail_Show':
define("SUCCESSFUL", 'SUCCESSFUL');
define("FAILED", 'FAILED');
$mail_to = $_POST['mail_to'];
$send_test_mail = $_POST['send_test_mail'];
$_POST['FROM_NAME'] = $mail_to;
$_POST['FROM_EMAIL'] = $mail_to;
$_POST['MESS_ENGINE'] = 'MAIL';
$_POST['MESS_SERVER'] = 'localhost';
$_POST['MESS_PORT'] = 25;
$_POST['MESS_ACCOUNT'] = $mail_to;
$_POST['MESS_PASSWORD'] = '';
$_POST['TO'] = $mail_to;
$_POST['SMTPAuth'] = true;
$resp = sendTestMail();
if($resp->status){
print(SUCCESSFUL.','.$resp->msg);
} else {
print(FAILED.','.$resp->msg);
}
break;
case 'testConnection':
G::LoadClass('net');
G::LoadThirdParty('phpmailer', 'class.smtp');
define("SUCCESSFUL", 'SUCCESSFUL');
define("FAILED", 'FAILED');
$varaux = preg_match("([^//]*$)", $_POST['srv'], $regs);
if($regs)
$srv = $regs[0];
else
$srv = $_POST['srv'];
$port = ($_POST['port'] == 'default')? 25: $_POST['port'];
$user = $_POST['account'];
$passwd = $_POST['passwd'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
case 'init':
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'setup/mailConnectiontest' );
G::RenderPage( 'publish', 'raw' );
break;
case 'mailTestMail_Show':
define( "SUCCESSFUL", 'SUCCESSFUL' );
define( "FAILED", 'FAILED' );
$mail_to = $_POST['mail_to'];
$send_test_mail = $_POST['send_test_mail'];
$_POST['FROM_NAME'] = $mail_to;
$_POST['FROM_EMAIL'] = $mail_to;
$_POST['MESS_ENGINE'] = 'MAIL';
$_POST['MESS_SERVER'] = 'localhost';
$_POST['MESS_PORT'] = 25;
$_POST['MESS_ACCOUNT'] = $mail_to;
$_POST['MESS_PASSWORD'] = '';
$_POST['TO'] = $mail_to;
$_POST['SMTPAuth'] = true;
$resp = sendTestMail();
if ($resp->status) {
print (SUCCESSFUL . ',' . $resp->msg) ;
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
print (FAILED . ',' . $resp->msg) ;
}
}
$_POST['passwd'] = $passwd;
$step = $_POST['step'];
$auth_required = $_POST['auth_required'];
$send_test_mail = $_POST['send_test_mail'];
$mail_to = $_POST['mail_to'];
$SMTPSecure = $_POST['SMTPSecure'];
$timeout = 10;
break;
case 'testConnection':
G::LoadClass( 'net' );
G::LoadThirdParty( 'phpmailer', 'class.smtp' );
$Server = new NET($srv);
$smtp = new SMTP;
define( "SUCCESSFUL", 'SUCCESSFUL' );
define( "FAILED", 'FAILED' );
$varaux = preg_match( "([^//]*$)", $_POST['srv'], $regs );
if ($regs)
$srv = $regs[0];
else
$srv = $_POST['srv'];
switch ($step) {
case 1:
if ($Server->getErrno() == 0) {
print(SUCCESSFUL.',');
} else {
print(FAILED.','.$Server->error);
}
break;
case 2:
if($port == 0){
$port = $smtp->SMTP_PORT;
}
$Server->scannPort($port);
if ($Server->getErrno() == 0) {
print(SUCCESSFUL.',');
} else {
print(FAILED.','.$Server->error);
}
break;
#try to connect to host
case 3:
$hostinfo = array();
if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) {
$host = $hostinfo[1];
$port = $hostinfo[2];
} else {
$host = $srv;
}
$tls = ($SMTPSecure == 'tls');
$ssl = ($SMTPSecure == 'ssl');
$resp = $smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $timeout);
if ($resp) {
print(SUCCESSFUL.','.$smtp->status);
} else {
print(FAILED.','.$smtp->error['error']);
}
break;
#try login to host
case 4:
if($auth_required == 'yes') {
try {
$hostinfo = array();
if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) {
$host = $hostinfo[1];
$port = $hostinfo[2];
$port = ($_POST['port'] == 'default') ? 25 : $_POST['port'];
$user = $_POST['account'];
$passwd = $_POST['passwd'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) {
if (count( $auxPass ) == 2) {
$passwd = $auxPass[1];
} else {
$host = $srv;
array_shift( $auxPass );
$passwd = implode( '', $auxPass );
}
}
$_POST['passwd'] = $passwd;
$step = $_POST['step'];
$auth_required = $_POST['auth_required'];
$send_test_mail = $_POST['send_test_mail'];
$mail_to = $_POST['mail_to'];
$SMTPSecure = $_POST['SMTPSecure'];
$timeout = 10;
$tls = ($SMTPSecure == 'tls');
$ssl = ($SMTPSecure == 'ssl');
$Server = new NET( $srv );
$smtp = new SMTP();
$resp = $smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $timeout);
if ($resp) {
switch ($step) {
case 1:
if ($Server->getErrno() == 0) {
print (SUCCESSFUL . ',') ;
} else {
print (FAILED . ',' . $Server->error) ;
}
break;
case 2:
if ($port == 0) {
$port = $smtp->SMTP_PORT;
}
$Server->scannPort( $port );
if ($Server->getErrno() == 0) {
print (SUCCESSFUL . ',') ;
} else {
print (FAILED . ',' . $Server->error) ;
}
break;
#try to connect to host
case 3:
$hostinfo = array ();
$hello = $_SERVER['SERVER_NAME'];
$smtp->Hello($hello);
if ($tls) {
if (!$smtp->StartTLS()) {
// problem with tls
if (preg_match( '/^(.+):([0-9]+)$/', $srv, $hostinfo )) {
$host = $hostinfo[1];
$port = $hostinfo[2];
} else {
$host = $srv;
}
//We must resend HELO after tls negotiation
$smtp->Hello($hello);
}
$tls = ($SMTPSecure == 'tls');
$ssl = ($SMTPSecure == 'ssl');
if( $smtp->Authenticate($user, $passwd ) ) {
print(SUCCESSFUL.','.$smtp->status);
} else {
print(FAILED.','.$smtp->error['error']);
}
$resp = $smtp->Connect( ($ssl ? 'ssl://' : '') . $host, $port, $timeout );
if ($resp) {
print (SUCCESSFUL . ',' . $smtp->status) ;
} else {
print (FAILED . ',' . $smtp->error['error']) ;
}
break;
#try login to host
case 4:
if ($auth_required == 'yes') {
try {
$hostinfo = array ();
} else {
print(FAILED.','.$smtp->error['error']);
}
} catch (Exception $e) {
print(FAILED.','.$e->getMessage());
}
} else {
print(SUCCESSFUL.', No authentication required!');
if (preg_match( '/^(.+):([0-9]+)$/', $srv, $hostinfo )) {
$host = $hostinfo[1];
$port = $hostinfo[2];
} else {
$host = $srv;
}
$tls = ($SMTPSecure == 'tls');
$ssl = ($SMTPSecure == 'ssl');
$resp = $smtp->Connect( ($ssl ? 'ssl://' : '') . $host, $port, $timeout );
if ($resp) {
$hello = $_SERVER['SERVER_NAME'];
$smtp->Hello( $hello );
if ($tls) {
if (! $smtp->StartTLS()) {
// problem with tls
}
//We must resend HELO after tls negotiation
$smtp->Hello( $hello );
}
if ($smtp->Authenticate( $user, $passwd )) {
print (SUCCESSFUL . ',' . $smtp->status) ;
} else {
print (FAILED . ',' . $smtp->error['error']) ;
}
} else {
print (FAILED . ',' . $smtp->error['error']) ;
}
} catch (Exception $e) {
print (FAILED . ',' . $e->getMessage()) ;
}
} else {
print (SUCCESSFUL . ', No authentication required!') ;
}
break;
case 5:
if ($send_test_mail == 'yes') {
try {
//print(SUCCESSFUL.',ok');
$_POST['FROM_NAME'] = 'Process Maker O.S. [Test mail]';
$_POST['FROM_EMAIL'] = $user;
$_POST['MESS_ENGINE'] = 'PHPMAILER';
$_POST['MESS_SERVER'] = $srv;
$_POST['MESS_PORT'] = $port;
$_POST['MESS_ACCOUNT'] = $user;
$_POST['MESS_PASSWORD'] = $passwd;
$_POST['TO'] = $mail_to;
if ($auth_required == 'yes') {
$_POST['SMTPAuth'] = true;
} else {
$_POST['SMTPAuth'] = false;
}
$resp = sendTestMail();
if ($resp->status) {
print (SUCCESSFUL . ',' . $resp->msg) ;
} else {
print (FAILED . ',' . $resp->msg) ;
}
} catch (Exception $e) {
print (FAILED . ',' . $e->getMessage()) ;
}
} else {
print ('jump this step') ;
}
break;
default:
print ('test finished!') ;
}
break;
case 5:
if($send_test_mail == 'yes'){
try {
//print(SUCCESSFUL.',ok');
$_POST['FROM_NAME'] = 'Process Maker O.S. [Test mail]';
$_POST['FROM_EMAIL'] = $user;
$_POST['MESS_ENGINE'] = 'PHPMAILER';
$_POST['MESS_SERVER'] = $srv;
$_POST['MESS_PORT'] = $port;
$_POST['MESS_ACCOUNT'] = $user;
$_POST['MESS_PASSWORD'] = $passwd;
$_POST['TO'] = $mail_to;
if($auth_required == 'yes'){
$_POST['SMTPAuth'] = true;
} else {
$_POST['SMTPAuth'] = false;
}
$resp = sendTestMail();
if($resp->status){
print(SUCCESSFUL.','.$resp->msg);
} else {
print(FAILED.','.$resp->msg);
}
} catch (Exception $e) {
print(FAILED.','.$e->getMessage());
}
} else {
print('jump this step');
}
break;
default:
print('test finished!');
}
break;
break;
}
function sendTestMail() {
G::LoadClass("system");
$sFrom = ($_POST['FROM_NAME'] != '' ? $_POST['FROM_NAME'] . ' ' : '') . '<' . $_POST['FROM_EMAIL'] . '>';
$sSubject = G::LoadTranslation('ID_MESS_TEST_SUBJECT');
$msg = G::LoadTranslation('ID_MESS_TEST_BODY');
function sendTestMail ()
{
G::LoadClass( "system" );
$sFrom = ($_POST['FROM_NAME'] != '' ? $_POST['FROM_NAME'] . ' ' : '') . '<' . $_POST['FROM_EMAIL'] . '>';
$sSubject = G::LoadTranslation( 'ID_MESS_TEST_SUBJECT' );
$msg = G::LoadTranslation( 'ID_MESS_TEST_BODY' );
switch ($_POST['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break;
case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break;
}
switch ($_POST['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation( 'ID_MESS_ENGINE_TYPE_1' );
break;
case 'PHPMAILER':
$engine = G::LoadTranslation( 'ID_MESS_ENGINE_TYPE_2' );
break;
case 'OPENMAIL':
$engine = G::LoadTranslation( 'ID_MESS_ENGINE_TYPE_3' );
break;
}
$sBody = "
$sBody = "
<table style=\"background-color: white; font-family: Arial,Helvetica,sans-serif; color: black; font-size: 11px; text-align: left;\" cellpadding='10' cellspacing='0' width='100%'>
<tbody><tr><td><img id='logo' src='http://".$_SERVER['SERVER_NAME']."/images/processmaker.logo.jpg' /></td></tr>
<tr><td style='font-size: 14px;'>$msg [".date('H:i:s')."] - $engine</td></tr>
<tbody><tr><td><img id='logo' src='http://" . $_SERVER['SERVER_NAME'] . "/images/processmaker.logo.jpg' /></td></tr>
<tr><td style='font-size: 14px;'>$msg [" . date( 'H:i:s' ) . "] - $engine</td></tr>
<tr><td style='vertical-align:middel;'>
<br /><hr><b>This Business Process is powered by ProcessMaker ver. ".System::getVersion().".<b><br />
<br /><hr><b>This Business Process is powered by ProcessMaker ver. " . System::getVersion() . ".<b><br />
<a href='http://www.processmaker.com' style='color:#c40000;'>www.processmaker.com</a><br /></td>
</tr></tbody></table>";
G::LoadClass('spool');
$oSpool = new spoolRun();
G::LoadClass( 'spool' );
$oSpool = new spoolRun();
$passwd = $_POST['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$_POST['MESS_PASSWORD'] = $passwd;
$oSpool->setConfig( array(
'MESS_ENGINE' => $_POST['MESS_ENGINE'],
'MESS_SERVER' => $_POST['MESS_SERVER'],
'MESS_PORT' => $_POST['MESS_PORT'],
'MESS_ACCOUNT' => $_POST['MESS_ACCOUNT'],
'MESS_PASSWORD' => $_POST['MESS_PASSWORD'],
'SMTPAuth' => $_POST['SMTPAuth'],
'SMTPSecure' => isset($_POST['SMTPSecure'])?$_POST['SMTPSecure']:'none'
));
$oSpool->create(array(
'msg_uid' => '',
'app_uid' => '',
'del_index' => 0,
'app_msg_type' => 'TEST',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $_POST['TO'],
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_attach'=>'' // Added By Ankit
));
$oSpool->sendMail();
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
if ($oSpool->status == 'sent') {
$o->status = true;
$o->msg = G::LoadTranslation('ID_MAIL_TEST_SUCCESS');
}
else {
$o->status = false;
$o->msg = $oSpool->error;
}
return $o;
}
function e_utf8_encode($input) {
$utftext = null;
for ($n = 0; $n < strlen($input); $n++) {
$c = ord($input[$n]);
if ($c < 128) {
$utftext .= chr($c);
} else if (($c > 128) && ($c < 2048)) {
$utftext .= chr(($c >> 6) | 192);
$utftext .= chr(($c & 63) | 128);
} else {
$utftext .= chr(($c >> 12) | 224);
$utftext .= chr((($c & 6) & 63) | 128);
$utftext .= chr(($c & 63) | 128);
$passwd = $_POST['MESS_PASSWORD'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) {
if (count( $auxPass ) == 2) {
$passwd = $auxPass[1];
} else {
array_shift( $auxPass );
$passwd = implode( '', $auxPass );
}
}
}
$_POST['MESS_PASSWORD'] = $passwd;
return $utftext;
$oSpool->setConfig( array ('MESS_ENGINE' => $_POST['MESS_ENGINE'],'MESS_SERVER' => $_POST['MESS_SERVER'],'MESS_PORT' => $_POST['MESS_PORT'],'MESS_ACCOUNT' => $_POST['MESS_ACCOUNT'],'MESS_PASSWORD' => $_POST['MESS_PASSWORD'],'SMTPAuth' => $_POST['SMTPAuth'],'SMTPSecure' => isset( $_POST['SMTPSecure'] ) ? $_POST['SMTPSecure'] : 'none'
) );
$oSpool->create( array ('msg_uid' => '','app_uid' => '','del_index' => 0,'app_msg_type' => 'TEST','app_msg_subject' => $sSubject,'app_msg_from' => $sFrom,'app_msg_to' => $_POST['TO'],'app_msg_body' => $sBody,'app_msg_cc' => '','app_msg_bcc' => '','app_msg_attach' => '','app_msg_template' => '','app_msg_status' => 'pending','app_msg_attach' => '' // Added By Ankit
) );
$oSpool->sendMail();
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
if ($oSpool->status == 'sent') {
$o->status = true;
$o->msg = G::LoadTranslation( 'ID_MAIL_TEST_SUCCESS' );
} else {
$o->status = false;
$o->msg = $oSpool->error;
}
return $o;
}
function e_utf8_encode ($input)
{
$utftext = null;
for ($n = 0; $n < strlen( $input ); $n ++) {
$c = ord( $input[$n] );
if ($c < 128) {
$utftext .= chr( $c );
} else if (($c > 128) && ($c < 2048)) {
$utftext .= chr( ($c >> 6) | 192 );
$utftext .= chr( ($c & 63) | 128 );
} else {
$utftext .= chr( ($c >> 12) | 224 );
$utftext .= chr( (($c & 6) & 63) | 128 );
$utftext .= chr( ($c & 63) | 128 );
}
}
return $utftext;
}

View File

@@ -12,60 +12,54 @@
*
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/Configuration.php';
$oConfiguration = new Configuration();
$aFields['MESS_ENABLED'] = isset($_POST['form']['MESS_ENABLED']) ? $_POST['form']['MESS_ENABLED'] : '';
$aFields['MESS_ENGINE'] = isset($_POST['form']['MESS_ENABLED']) ?$_POST['form']['MESS_ENGINE']: '';
$aFields['MESS_SERVER'] = isset($_POST['form']['MESS_ENABLED']) ?trim($_POST['form']['MESS_SERVER']): '';
$aFields['MESS_RAUTH'] = isset($_POST['form']['MESS_ENABLED']) ?isset($_POST['form']['MESS_RAUTH']) ? $_POST['form']['MESS_RAUTH'] : '': '';
$aFields['MESS_PORT'] = isset($_POST['form']['MESS_ENABLED']) ?$_POST['form']['MESS_PORT']: '';
$aFields['MESS_ACCOUNT'] = isset($_POST['form']['MESS_ENABLED']) ?$_POST['form']['MESS_ACCOUNT']: '';
$aFields['MESS_PASSWORD'] = isset($_POST['form']['MESS_ENABLED']) ?$_POST['form']['MESS_PASSWORD']: '';
$aFields['MESS_PASSWORD_HIDDEN'] = isset($_POST['form']['MESS_ENABLED']) ?$_POST['form']['MESS_PASSWORD_HIDDEN']: '';
if ($aFields['MESS_PASSWORD_HIDDEN'] !='') {
$aFields['MESS_PASSWORD'] = $aFields['MESS_PASSWORD_HIDDEN'];
$aFields['MESS_ENABLED'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['MESS_ENABLED'] : '';
$aFields['MESS_ENGINE'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['MESS_ENGINE'] : '';
$aFields['MESS_SERVER'] = isset( $_POST['form']['MESS_ENABLED'] ) ? trim( $_POST['form']['MESS_SERVER'] ) : '';
$aFields['MESS_RAUTH'] = isset( $_POST['form']['MESS_ENABLED'] ) ? isset( $_POST['form']['MESS_RAUTH'] ) ? $_POST['form']['MESS_RAUTH'] : '' : '';
$aFields['MESS_PORT'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['MESS_PORT'] : '';
$aFields['MESS_ACCOUNT'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['MESS_ACCOUNT'] : '';
$aFields['MESS_PASSWORD'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['MESS_PASSWORD'] : '';
$aFields['MESS_PASSWORD_HIDDEN'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['MESS_PASSWORD_HIDDEN'] : '';
if ($aFields['MESS_PASSWORD_HIDDEN'] != '') {
$aFields['MESS_PASSWORD'] = $aFields['MESS_PASSWORD_HIDDEN'];
}
$aFields['MESS_PASSWORD_HIDDEN'] = '';
$aPasswd = G::decrypt($aFields['MESS_PASSWORD'],'EMAILENCRYPT');
$aPasswd = G::decrypt( $aFields['MESS_PASSWORD'], 'EMAILENCRYPT' );
$passwd = $aFields['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) {
if (count( $auxPass ) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
array_shift( $auxPass );
$passwd = implode( '', $auxPass );
}
}
$aFields['MESS_PASSWORD'] = $passwd;
if ($aFields['MESS_PASSWORD'] != '') { // for plain text
$aFields['MESS_PASSWORD'] = 'hash:'.$aFields['MESS_PASSWORD'];
$aFields['MESS_PASSWORD'] = G::encrypt($aFields['MESS_PASSWORD'],'EMAILENCRYPT');
if ($aFields['MESS_PASSWORD'] != '') { // for plain text
$aFields['MESS_PASSWORD'] = 'hash:' . $aFields['MESS_PASSWORD'];
$aFields['MESS_PASSWORD'] = G::encrypt( $aFields['MESS_PASSWORD'], 'EMAILENCRYPT' );
}
$aFields['MESS_BACKGROUND'] = isset($_POST['form']['MESS_ENABLED']) ?isset($_POST['form']['MESS_BACKGROUND']) ? $_POST['form']['MESS_BACKGROUND'] : '': '';
$aFields['MESS_EXECUTE_EVERY'] = isset($_POST['form']['MESS_ENABLED']) ?$_POST['form']['MESS_EXECUTE_EVERY']: '';
$aFields['MESS_SEND_MAX'] = isset($_POST['form']['MESS_ENABLED']) ?$_POST['form']['MESS_SEND_MAX']: '';
$aFields['SMTPSecure'] = isset($_POST['form']['MESS_ENABLED']) ?$_POST['form']['SMTPSecure']: '';
$aFields['MESS_TRY_SEND_INMEDIATLY'] = isset($_POST['form']['MESS_ENABLED']) ?isset($_POST['form']['MESS_TRY_SEND_INMEDIATLY']) ? $_POST['form']['MESS_TRY_SEND_INMEDIATLY'] : '': '';
$oConfiguration->update(array(
'CFG_UID' => 'Emails',
'OBJ_UID' => '',
'CFG_VALUE' => serialize($aFields),
'PRO_UID' => '',
'USR_UID' => '',
'APP_UID' => '')
);
G::SendTemporalMessage('ID_CHANGES_SAVED', 'TMP-INFO', 'label', 4, '100%');
G::header('location: emails');
$aFields['MESS_BACKGROUND'] = isset( $_POST['form']['MESS_ENABLED'] ) ? isset( $_POST['form']['MESS_BACKGROUND'] ) ? $_POST['form']['MESS_BACKGROUND'] : '' : '';
$aFields['MESS_EXECUTE_EVERY'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['MESS_EXECUTE_EVERY'] : '';
$aFields['MESS_SEND_MAX'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['MESS_SEND_MAX'] : '';
$aFields['SMTPSecure'] = isset( $_POST['form']['MESS_ENABLED'] ) ? $_POST['form']['SMTPSecure'] : '';
$aFields['MESS_TRY_SEND_INMEDIATLY'] = isset( $_POST['form']['MESS_ENABLED'] ) ? isset( $_POST['form']['MESS_TRY_SEND_INMEDIATLY'] ) ? $_POST['form']['MESS_TRY_SEND_INMEDIATLY'] : '' : '';
$oConfiguration->update( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => serialize( $aFields ),'PRO_UID' => '','USR_UID' => '','APP_UID' => ''
) );
G::SendTemporalMessage( 'ID_CHANGES_SAVED', 'TMP-INFO', 'label', 4, '100%' );
G::header( 'location: emails' );

View File

@@ -1,8 +1,9 @@
<?php
G::loadClass('configuration');
$c = new Configurations;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('setup/environmentSettings', true);
//$conf->aConfig['startCaseHideProcessInf']
$oHeadPublisher->assign('FORMATS',$c->getFormats());
G::RenderPage('publish', 'extJs');
<?php
G::loadClass( 'configuration' );
$c = new Configurations();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'setup/environmentSettings', true );
//$conf->aConfig['startCaseHideProcessInf']
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,62 +1,51 @@
<?php
/**
* @author Erik A.O. <erik@colosa.com>
* @date Sept 13th, 2010
*
*/
G::LoadClass("configuration");
$request = isset($_POST["request"])? $_POST["request"] : (isset($_GET["request"])? $_GET["request"] : null);
switch ($request) {
case "getUserMaskList":
$result->rows = Configurations::getUserNameFormats();
print(G::json_encode($result));
break;
case "getDateFormats":
$result->rows = Configurations::getDateFormats();
print(G::json_encode($result));
break;
case "getCasesListDateFormat":
$result->rows = Configurations::getDateFormats();;
print(G::json_encode($result));
break;
case "getCasesListRowNumber":
for ($i = 10; $i <= 50; $i+=5) {
$formats[] = array("id" => "$i", "name" => "$i");
}
$result->rows = $formats;
print(G::json_encode($result));
break;
case "save":
$conf = new Configurations();
$conf->aConfig = array(
"format" => $_POST["userFormat"],
"dateFormat" => $_POST["dateFormat"],
"startCaseHideProcessInf" => ((isset($_POST["hideProcessInf"]))? true : false),
"casesListDateFormat" => $_POST["casesListDateFormat"],
"casesListRowNumber" => intval($_POST["casesListRowNumber"]),
"casesListRefreshTime" => intval($_POST["txtCasesRefreshTime"])
);
$conf->saveConfig("ENVIRONMENT_SETTINGS", "");
$response = new stdclass();
$response->success = true;
$response->msg = G::LoadTranslation("ID_SAVED_SUCCESSFULLY");
echo G::json_encode($response);
break;
}
<?php
/**
*
* @author Erik A.O. <erik@colosa.com>
* @date Sept 13th, 2010
*
*/
G::LoadClass( "configuration" );
$request = isset( $_POST["request"] ) ? $_POST["request"] : (isset( $_GET["request"] ) ? $_GET["request"] : null);
switch ($request) {
case "getUserMaskList":
$result->rows = Configurations::getUserNameFormats();
print (G::json_encode( $result )) ;
break;
case "getDateFormats":
$result->rows = Configurations::getDateFormats();
print (G::json_encode( $result )) ;
break;
case "getCasesListDateFormat":
$result->rows = Configurations::getDateFormats();
;
print (G::json_encode( $result )) ;
break;
case "getCasesListRowNumber":
for ($i = 10; $i <= 50; $i += 5) {
$formats[] = array ("id" => "$i","name" => "$i"
);
}
$result->rows = $formats;
print (G::json_encode( $result )) ;
break;
case "save":
$conf = new Configurations();
$conf->aConfig = array ("format" => $_POST["userFormat"],"dateFormat" => $_POST["dateFormat"],"startCaseHideProcessInf" => ((isset( $_POST["hideProcessInf"] )) ? true : false),"casesListDateFormat" => $_POST["casesListDateFormat"],"casesListRowNumber" => intval( $_POST["casesListRowNumber"] ),"casesListRefreshTime" => intval( $_POST["txtCasesRefreshTime"] )
);
$conf->saveConfig( "ENVIRONMENT_SETTINGS", "" );
$response = new stdclass();
$response->success = true;
$response->msg = G::LoadTranslation( "ID_SAVED_SUCCESSFULLY" );
echo G::json_encode( $response );
break;
}