CODE STYLE, workflow/engine/methods/setup/ PART 3 (final)

FILES:
setup.js
setup.php
setupAjax.php
showLogoFile.php
skin_Ajax.php
skinsExport.php
skinsList.php
skinsNew.php
skinsSave.php
upgrade.php
upgrade_RBAC.php
upgrade_System.php
upgrade_SystemAjax.php
uplogo.php
webServices.php
webServicesAjax.php
webServicesList.php
webServicesSetup.php
webServicesSetupSave.php
weekend.php
weekendAjax.php
workPeriod.js
workPeriod.php
workPeriodGraph.php
workPeriodSave.php
This commit is contained in:
jennylee
2012-10-17 17:21:35 -04:00
parent 4bd1ce1a41
commit 0f6644bcb0
25 changed files with 3146 additions and 3103 deletions

View File

@@ -1,73 +1,84 @@
function abc(panel, txt) {
/*
* commonDialog ( '', 'saved' , 'saved', {}, '' ) ; setTimeout (
* leimnud.closure({instance:myDialog,method:function(panel){
*
* myDialog.remove(); panel.tabLastSelected=false; panel.tabSelected=1;
* panel.makeTab(); },args:panel}) , 1000 );
*/
var img = document.getElementById('workPeriodGraph');
img.src = 'workPeriodGraph?b=' + Math.random();
function abc( panel, txt ) {
/* commonDialog ( '', 'saved' , 'saved', {}, '' ) ;
setTimeout ( leimnud.closure({instance:myDialog,method:function(panel){
myDialog.remove();
panel.tabLastSelected=false;
panel.tabSelected=1;
panel.makeTab();
},args:panel}) , 1000 );
*/
var img = document.getElementById( 'workPeriodGraph' );
img.src = 'workPeriodGraph?b=' + Math.random() ;
// panel.clearContent();
// panel.addContent ( txt );
// panel.clearContent();
// panel.addContent ( txt );
return false;
}
function showHideFilterForm( divName)
{
if (document.getElementById( divName ).style.display==='none')
document.getElementById( divName).style.display = '';
function showHideFilterForm(divName) {
if (document.getElementById(divName).style.display === 'none')
document.getElementById(divName).style.display = '';
else
document.getElementById( divName).style.display = 'none';
document.getElementById(divName).style.display = 'none';
}
function newHoliday(ev) {
var coor = leimnud.dom.mouse(ev);
var myPanel=new leimnud.module.panel();
myPanel.options={
size:{w:500,h:200},
position:{x:coor.x-200,y:coor.y},
title:"New Holiday",
theme:"panel",
control:{
close:true,
drag:true
var myPanel = new leimnud.module.panel();
myPanel.options = {
size : {
w : 500,
h : 200
},
fx: { modal:true }
position : {
x : coor.x - 200,
y : coor.y
},
title : "New Holiday",
theme : "panel",
control : {
close : true,
drag : true
},
fx : {
modal : true
}
};
myPanel.make();
var r = new leimnud.module.rpc.xmlhttp({url:"holidayNew.php"});
r.callback=leimnud.closure({Function:function(rpc){
var r = new leimnud.module.rpc.xmlhttp({
url : "holidayNew.php"
});
r.callback = leimnud.closure({
Function : function(rpc) {
myPanel.addContent(rpc.xmlhttp.responseText);
},args:r})
},
args : r
})
r.make();
}
function deleteHoliday( uid ) {
function deleteHoliday(uid) {
url = "setupAjax.php?action=deleteHoliday&uid=" + uid;
var r = new leimnud.module.rpc.xmlhttp({url: url });
r.callback=leimnud.closure({Function:function(rpc){
//myPanel.addContent(rpc.xmlhttp.responseText);
var r = new leimnud.module.rpc.xmlhttp({
url : url
});
r.callback = leimnud.closure({
Function : function(rpc) {
// myPanel.addContent(rpc.xmlhttp.responseText);
myPanel = setupPanel.panels.control;
myPanel.tabLastSelected=false;
myPanel.tabSelected=0;
myPanel.tabLastSelected = false;
myPanel.tabSelected = 0;
myPanel.makeTab();
},args:r})
},
args : r
})
r.make();
// myPanel.clearContent();
// myPanel.addContent ( uid );
// myPanel.clearContent();
// myPanel.addContent ( uid );
}

View File

@@ -20,68 +20,63 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* New Admin User interface
*
* @author Erik A. O. <erik@colosa.com, aortiz.erik@gmail.com>
* @date Apr 5th, 2010
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
$G_MAIN_MENU = "processmaker";
$G_ID_MENU_SELECTED = "SETUP";
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load('setup');
$toolItems = Array();
$oMenu->load( 'setup' );
$toolItems = Array ();
foreach( $oMenu->Options as $i=>$option) {
$toolItems[] = Array(
'id' => $oMenu->Id[$i],
'link' => ($oMenu->Options[$i]!='')? $oMenu->Options[$i]: '#',
'onclick' => ($oMenu->JS[$i]!='')? $oMenu->JS[$i]: '',
'label' => $oMenu->Labels[$i],
'icon' => ($oMenu->Icons[$i]!='')? $oMenu->Icons[$i]: 'icon-pmlogo.png',
'target'=> ($oMenu->JS[$i]!='')? '': 'admToolsContent'
foreach ($oMenu->Options as $i => $option) {
$toolItems[] = Array ('id' => $oMenu->Id[$i],'link' => ($oMenu->Options[$i] != '') ? $oMenu->Options[$i] : '#','onclick' => ($oMenu->JS[$i] != '') ? $oMenu->JS[$i] : '','label' => $oMenu->Labels[$i],'icon' => ($oMenu->Icons[$i] != '') ? $oMenu->Icons[$i] : 'icon-pmlogo.png','target' => ($oMenu->JS[$i] != '') ? '' : 'admToolsContent'
);
}
$template = new TemplatePower( PATH_TPL . 'setup' . PATH_SEP . 'tools.html' );
$template->prepare();
$template->assign ('LeftWidth', '230');
$template->assign ('contentHeight', '520');
$template->assign( 'LeftWidth', '230' );
$template->assign( 'contentHeight', '520' );
if( isset($_GET['i18']) ){
if (isset( $_GET['i18'] )) {
$_SESSION['TOOLS_VIEWTYPE'] = true;
$template->assign ('displayLanguageTool', 'block');
$template->assign( 'displayLanguageTool', 'block' );
} else {
$template->assign ('displayLanguageTool', 'none');
$template->assign( 'displayLanguageTool', 'none' );
}
if( isset($_GET['newSite']) ){
$template->assign ('displayNewSiteTool', 'block');
if (isset( $_GET['newSite'] )) {
$template->assign( 'displayNewSiteTool', 'block' );
} else {
$template->assign ('displayNewSiteTool', 'none');
$template->assign( 'displayNewSiteTool', 'none' );
}
foreach($toolItems as $item) {
$template->newBlock( 'tool_options');
foreach($item as $propertyName=>$propertyValue)
$template->assign ($propertyName, $propertyValue);
foreach ($toolItems as $item) {
$template->newBlock( 'tool_options' );
foreach ($item as $propertyName => $propertyValue)
$template->assign( $propertyName, $propertyValue );
}
$G_PUBLISH->AddContent('template', '', '', '', $template );
G::RenderPage('publish');
if(isset($_GET['module'])){
$G_PUBLISH->AddContent( 'template', '', '', '', $template );
G::RenderPage( 'publish' );
if (isset( $_GET['module'] )) {
print "
<script>
admToolsContent.location='".$_GET['module']."';
admToolsContent.location='" . $_GET['module'] . "';
</script>
";
}

View File

@@ -20,22 +20,22 @@
*
* 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;
//$oSMTPJSON = new Services_JSON();
//$oSMTPData = $oSMTPJSON->decode(stripslashes($_POST['data']));
//$sOutput = '';
G::LoadClass('setup');
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
//$oSMTPJSON = new Services_JSON();
//$oSMTPData = $oSMTPJSON->decode(stripslashes($_POST['data']));
//$sOutput = '';
G::LoadClass( 'setup' );
$oSMTPSetup = new Setup(new DBConnection);
$oSMTPSetup = new Setup( new DBConnection() );
$action = strtolower ( $_GET['action'] );
$data = $_GET;
$action = strtolower( $_GET['action'] );
$data = $_GET;
$arr = get_class_methods( get_class( $oSMTPSetup ) );
foreach ($arr as $method) {
if ($method == $action)
$oSMTPSetup->{$action}( $_GET );
}
$arr = get_class_methods( get_class($oSMTPSetup) );
foreach ($arr as $method) {
if ( $method == $action )
$oSMTPSetup->{$action} ( $_GET );
}
?>

View File

@@ -20,97 +20,96 @@
*
* 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_CASES"))!=1) return $RBAC_Response;
$idDecode64 = base64_decode($_GET['id']);
$idExploded = explode( '/', $idDecode64 );
if ( $idExploded[0] == '' ) array_shift($idExploded);
if ( $idExploded[0] == 'plugin' ) {
$idDecode64 = base64_decode( $_GET['id'] );
$idExploded = explode( '/', $idDecode64 );
if ($idExploded[0] == '')
array_shift( $idExploded );
if ($idExploded[0] == 'plugin') {
//Get the Plugin Folder, always the first element
$pluginFolder = $idExploded[1];
$pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html'. PATH_SEP . $idExploded[2];
if ( file_exists ( $pluginFilename ) ) {
G::streamFile ( $pluginFilename );
}
die;
$pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html' . PATH_SEP . $idExploded[2];
if (file_exists( $pluginFilename )) {
G::streamFile( $pluginFilename );
}
die();
}
$ainfoSite = explode("/",$_SERVER["REQUEST_URI"]);
$ainfoSite = explode( "/", $_SERVER["REQUEST_URI"] );
//it was added to show the logo into management plugin add by krlos
if(isset($_GET['wsName']) && $_GET['wsName']!=''){
if (isset( $_GET['wsName'] ) && $_GET['wsName'] != '') {
$ainfoSite[1] = $_GET['wsName'];
}
}
//end add
$dir=PATH_DATA."sites".PATH_SEP.str_replace("sys","",$ainfoSite[1]).PATH_SEP."files/logos";
$imagen = $dir .PATH_SEP.$idDecode64;
$dir = PATH_DATA . "sites" . PATH_SEP . str_replace( "sys", "", $ainfoSite[1] ) . PATH_SEP . "files/logos";
$imagen = $dir . PATH_SEP . $idDecode64;
if (is_file( $imagen )) {
showLogo( $imagen );
if (is_file($imagen))
{
showLogo($imagen);
} else {
}
else {
$newDir = PATH_DATA."sites".PATH_SEP.str_replace("sys","",$ainfoSite[1]).PATH_SEP."files/logos";
$newDir = PATH_DATA . "sites" . PATH_SEP . str_replace( "sys", "", $ainfoSite[1] ) . PATH_SEP . "files/logos";
$dir = PATH_HOME . "public_html/files/logos";
if(!is_dir($newDir)){
G::mk_dir($newDir);
if (! is_dir( $newDir )) {
G::mk_dir( $newDir );
}
//this function does copy all logos from public_html/files/logos to /shared/site/yourSite/files/logos
//cpyMoreLogos($dir,$newDir);
$newDir .= PATH_SEP.$idDecode64;
$dir .= PATH_SEP.$idDecode64;
copy($dir,$newDir);
showLogo($newDir);
die;
$newDir .= PATH_SEP . $idDecode64;
$dir .= PATH_SEP . $idDecode64;
copy( $dir, $newDir );
showLogo( $newDir );
die();
}
}
function showLogo($imagen){
$info = @getimagesize($imagen);
$fp = fopen($imagen, "rb");
function showLogo ($imagen)
{
$info = @getimagesize( $imagen );
$fp = fopen( $imagen, "rb" );
if ($info && $fp) {
header("Content-type: {$info['mime']}");
fpassthru($fp);
exit;
header( "Content-type: {$info['mime']}" );
fpassthru( $fp );
exit();
} else {
throw new Exception("Image format not valid");
}
throw new Exception( "Image format not valid" );
}
}
function cpyMoreLogos($dir,$newDir){
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if(($file!=".")&&($file!="..")) {
$extention=explode(".", $file);
$aImageProp=getimagesize($dir.'/'.$file, $info);
$sfileExtention = strtoupper($extention[count($extention)-1]);
if( in_array($sfileExtention, array('JPG','JPEG','PNG','GIF') ) ) {
function cpyMoreLogos ($dir, $newDir)
{
if (file_exists( $dir )) {
if ($handle = opendir( $dir )) {
while (false !== ($file = readdir( $handle ))) {
if (($file != ".") && ($file != "..")) {
$extention = explode( ".", $file );
$aImageProp = getimagesize( $dir . '/' . $file, $info );
$sfileExtention = strtoupper( $extention[count( $extention ) - 1] );
if (in_array( $sfileExtention, array ('JPG','JPEG','PNG','GIF'
) )) {
$dir1 = $dir.PATH_SEP.$file;
$dir2 = $newDir.PATH_SEP.$file;
$dir1 = $dir . PATH_SEP . $file;
$dir2 = $newDir . PATH_SEP . $file;
//print $dir1 ." *** ".$dir2."<br><br>";
copy($dir1,$dir2);
copy( $dir1, $dir2 );
}
}
}
closedir($handle);
}
closedir( $handle );
}
}
}
die;
die();
?>
<script>
</script>

View File

@@ -1,255 +1,250 @@
<?php
if (!isset($_REQUEST ['action'])) {
$res ['success'] = false;
$res ['error']=$res ['message'] = 'You may request an action';
if (! isset( $_REQUEST['action'] )) {
$res['success'] = false;
$res['error'] = $res['message'] = 'You may request an action';
print G::json_encode($res);
die ();
print G::json_encode( $res );
die();
}
if (!function_exists($_REQUEST ['action'])) {
$res ['success'] = false;
$res ['error']=$res ['message'] = 'The requested action does not exist';
if (! function_exists( $_REQUEST['action'] )) {
$res['success'] = false;
$res['error'] = $res['message'] = 'The requested action does not exist';
print G::json_encode($res);
die ();
print G::json_encode( $res );
die();
}
$restrictedFunctions=array('copy_skin_folder','addTarFolder');
if (in_array($_REQUEST ['action'],$restrictedFunctions)) {
$res ['success'] = false;
$res ['error']=$res ['message'] = 'The requested action does not exist *';
print G::json_encode($res);
die ();
$restrictedFunctions = array ('copy_skin_folder','addTarFolder'
);
if (in_array( $_REQUEST['action'], $restrictedFunctions )) {
$res['success'] = false;
$res['error'] = $res['message'] = 'The requested action does not exist *';
print G::json_encode( $res );
die();
}
$functionName = $_REQUEST ['action'];
$functionParams = isset($_REQUEST ['params']) ? $_REQUEST ['params'] : array();
$functionName = $_REQUEST['action'];
$functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array ();
$functionName();
function updatePageSize()
function updatePageSize ()
{
G::LoadClass('configuration');
G::LoadClass( 'configuration' );
$c = new Configurations();
$arr['pageSize'] = $_REQUEST['size'];
$arr['dateSave'] = date('Y-m-d H:i:s');
$config = Array();
$arr['dateSave'] = date( 'Y-m-d H:i:s' );
$config = Array ();
$config[] = $arr;
$c->aConfig = $config;
$c->saveConfig('skinsList', 'pageSize', '', $_SESSION['USER_LOGGED']);
$c->saveConfig( 'skinsList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
echo '{success: true}';
}
function skinList()
function skinList ()
{
G::loadClass('system');
G::loadClass( 'system' );
$skinList = System::getSkingList();
$wildcard = '';
if(isset($_REQUEST['activeskin']))
{
if (isset( $_REQUEST['activeskin'] )) {
$wildcard = '@';
}
foreach ($skinList['skins'] as $key => $value) {
if ($value['SKIN_FOLDER_ID'] != 'simplified' && $value['SKIN_FOLDER_ID'] != 'uxs') {
if($skinList['currentSkin'] == $value['SKIN_FOLDER_ID']){
$value['SKIN_STATUS'] = $wildcard . G::LoadTranslation('ID_ACTIVE');
if ($skinList['currentSkin'] == $value['SKIN_FOLDER_ID']) {
$value['SKIN_STATUS'] = $wildcard . G::LoadTranslation( 'ID_ACTIVE' );
$value['SKIN_NAME'] = $wildcard . $value['SKIN_NAME'];
$value['SKIN_DESCRIPTION'] = $wildcard . $value['SKIN_DESCRIPTION'];
$value['SKIN_AUTHOR'] = $wildcard . $value['SKIN_AUTHOR'];
$value['SKIN_CREATEDATE'] = $wildcard . $value['SKIN_CREATEDATE'];
$value['SKIN_MODIFIEDDATE'] = $wildcard . $value['SKIN_MODIFIEDDATE'];
}
else{
$value['SKIN_STATUS'] = G::LoadTranslation('ID_INACTIVE');
} else {
$value['SKIN_STATUS'] = G::LoadTranslation( 'ID_INACTIVE' );
}
$skinListArray['skins'][] = $value;
}
}
$skinListArray['currentSkin'] = $skinList['currentSkin'];
echo G::json_encode($skinListArray);
echo G::json_encode( $skinListArray );
}
function newSkin($baseSkin='classic')
function newSkin ($baseSkin = 'classic')
{
$skinBase = $baseSkin != "" ? strtolower($baseSkin) : 'classic';
if ((isset($_REQUEST['skinBase'])) && ($_REQUEST['skinBase'] != "")) {
$skinBase = strtolower($_REQUEST['skinBase']);
$skinBase = $baseSkin != "" ? strtolower( $baseSkin ) : 'classic';
if ((isset( $_REQUEST['skinBase'] )) && ($_REQUEST['skinBase'] != "")) {
$skinBase = strtolower( $_REQUEST['skinBase'] );
}
try {
if (!(isset($_REQUEST['skinName']))) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')) );
if (! (isset( $_REQUEST['skinName'] ))) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_NAME_REQUIRED' ) ));
}
if (!(isset($_REQUEST['skinFolder']))) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')) );
if (! (isset( $_REQUEST['skinFolder'] ))) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_REQUIRED' ) ));
}
//Should validate skin folder name here
//if....
$skinName = $_REQUEST['skinName'];
$skinFolder = $_REQUEST['skinFolder'];
$skinDescription = isset($_REQUEST['skinDescription']) ? $_REQUEST['skinDescription'] : '';
$skinAuthor = isset($_REQUEST['skinAuthor']) ? $_REQUEST['skinAuthor'] : 'ProcessMaker Team';
$skinDescription = isset( $_REQUEST['skinDescription'] ) ? $_REQUEST['skinDescription'] : '';
$skinAuthor = isset( $_REQUEST['skinAuthor'] ) ? $_REQUEST['skinAuthor'] : 'ProcessMaker Team';
if (is_dir(PATH_CUSTOM_SKINS . $skinFolder)) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')) );
if (is_dir( PATH_CUSTOM_SKINS . $skinFolder )) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
}
if (strtolower($skinFolder) == 'classic') {
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')) );
if (strtolower( $skinFolder ) == 'classic') {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
}
//All validations OK then create skin
switch ($skinBase) {
//Validate skin base
case 'uxmodern':
copy_skin_folder(G::ExpandPath("skinEngine") . 'uxmodern' . PATH_SEP, PATH_CUSTOM_SKINS .
$skinFolder,array("config.xml"));
$pathBase=G::ExpandPath("skinEngine") . 'base' . PATH_SEP;
copy_skin_folder( G::ExpandPath( "skinEngine" ) . 'uxmodern' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml"
) );
$pathBase = G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP;
break;
case 'classic':
//Special Copy of this dir + xmlreplace
copy_skin_folder(G::ExpandPath("skinEngine") . 'base' . PATH_SEP, PATH_CUSTOM_SKINS .
$skinFolder,array("config.xml","baseCss"));
$pathBase=G::ExpandPath("skinEngine") . 'base' . PATH_SEP;
copy_skin_folder( G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml","baseCss"
) );
$pathBase = G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP;
break;
default:
//Commmon copy/paste of a folder + xmlrepalce
copy_skin_folder(PATH_CUSTOM_SKINS . $skinBase, PATH_CUSTOM_SKINS . $skinFolder,array("config.xml"));
$pathBase=PATH_CUSTOM_SKINS.$skinBase;
copy_skin_folder( PATH_CUSTOM_SKINS . $skinBase, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml"
) );
$pathBase = PATH_CUSTOM_SKINS . $skinBase;
break;
}
//ReBuild config file
//TODO: Improve this pre_replace lines
$configFileOriginal = $pathBase . PATH_SEP . 'config.xml';
$configFileFinal = PATH_CUSTOM_SKINS . $skinFolder . PATH_SEP . 'config.xml';
$xmlConfiguration = file_get_contents($configFileOriginal);
$xmlConfiguration = preg_replace('/(<id>)(.+?)(<\/id>)/i', '<id>' . G::generateUniqueID() .
'</id><!-- $2 -->', $xmlConfiguration);
$xmlConfiguration = preg_replace("/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName .
"</name><!-- $2 -->", $xmlConfiguration);
$xmlConfiguration = preg_replace("/(<description>)(.+?)(<\/description>)/i", "<description>" .
$skinDescription . "</description><!-- $2 -->", $xmlConfiguration);
$xmlConfiguration = preg_replace("/(<author>)(.+?)(<\/author>)/i", "<author>" . $skinAuthor .
"</author><!-- $2 -->", $xmlConfiguration);
$xmlConfiguration = preg_replace("/(<createDate>)(.+?)(<\/createDate>)/i", "<createDate>" .
date("Y-m-d H:i:s") . "</createDate><!-- $2 -->", $xmlConfiguration);
$xmlConfiguration = preg_replace("/(<modifiedDate>)(.+?)(<\/modifiedDate>)/i", "<modifiedDate>" .
date("Y-m-d H:i:s") . "</modifiedDate><!-- $2 -->", $xmlConfiguration);
file_put_contents($configFileFinal, $xmlConfiguration);
$xmlConfiguration = file_get_contents( $configFileOriginal );
$xmlConfiguration = preg_replace( '/(<id>)(.+?)(<\/id>)/i', '<id>' . G::generateUniqueID() . '</id><!-- $2 -->', $xmlConfiguration );
$xmlConfiguration = preg_replace( "/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName . "</name><!-- $2 -->", $xmlConfiguration );
$xmlConfiguration = preg_replace( "/(<description>)(.+?)(<\/description>)/i", "<description>" . $skinDescription . "</description><!-- $2 -->", $xmlConfiguration );
$xmlConfiguration = preg_replace( "/(<author>)(.+?)(<\/author>)/i", "<author>" . $skinAuthor . "</author><!-- $2 -->", $xmlConfiguration );
$xmlConfiguration = preg_replace( "/(<createDate>)(.+?)(<\/createDate>)/i", "<createDate>" . date( "Y-m-d H:i:s" ) . "</createDate><!-- $2 -->", $xmlConfiguration );
$xmlConfiguration = preg_replace( "/(<modifiedDate>)(.+?)(<\/modifiedDate>)/i", "<modifiedDate>" . date( "Y-m-d H:i:s" ) . "</modifiedDate><!-- $2 -->", $xmlConfiguration );
file_put_contents( $configFileFinal, $xmlConfiguration );
$response['success'] = true;
$response['message'] = G::LoadTranslation('ID_SKIN_SUCCESS_CREATE');
print_r(G::json_encode($response));
$response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESS_CREATE' );
print_r( G::json_encode( $response ) );
} catch (Exception $e) {
$response['success'] = false;
$response['message'] = $e->getMessage();
$response['error'] = $e->getMessage();
print_r(G::json_encode($response));
print_r( G::json_encode( $response ) );
}
}
function importSkin()
function importSkin ()
{
try {
if (!isset($_FILES['uploadedFile'])) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED')) );
if (! isset( $_FILES['uploadedFile'] )) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FILE_REQUIRED' ) ));
}
$uploadedInstances = count($_FILES['uploadedFile']['name']);
$uploadedInstances = count( $_FILES['uploadedFile']['name'] );
$sw_error = false;
$sw_error_exists = isset($_FILES['uploadedFile']['error']);
$sw_error_exists = isset( $_FILES['uploadedFile']['error'] );
$emptyInstances = 0;
$quequeUpload = array();
$quequeUpload = array ();
// upload files & check for errors
$tmp = $_FILES['uploadedFile']['tmp_name'];
$items = stripslashes($_FILES['uploadedFile']['name']);
$items = stripslashes( $_FILES['uploadedFile']['name'] );
if ($sw_error_exists) {
$up_err = $_FILES['uploadedFile']['error'];
} else {
$up_err= ( file_exists($tmp) ? 0 : 4);
$up_err = (file_exists( $tmp ) ? 0 : 4);
}
if ($items == "" || $up_err == 4) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED')));
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FILE_REQUIRED' ) ));
}
if ($up_err == 1 || $up_err == 2) {
throw ( new Exception(G::LoadTranslation('ID_FILE_TOO_BIG')));
throw (new Exception( G::LoadTranslation( 'ID_FILE_TOO_BIG' ) ));
//$errors[$i]='miscfilesize';
}
if ($up_err == 3) {
throw ( new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR')));
throw (new Exception( G::LoadTranslation( 'ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR' ) ));
//$errors[$i]='miscfilepart';
}
if (!@is_uploaded_file($tmp)) {
throw ( new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR')));
if (! @is_uploaded_file( $tmp )) {
throw (new Exception( G::LoadTranslation( 'ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR' ) ));
//$errors[$i]='uploadfile';
}
$fileInfo = pathinfo($items);
$validType = array('tar', 'gz');
$fileInfo = pathinfo( $items );
$validType = array ('tar','gz'
);
if (!in_array($fileInfo['extension'], $validType)) {
throw ( new Exception(G::LoadTranslation('ID_FILE_UPLOAD_INCORRECT_EXTENSION')));
if (! in_array( $fileInfo['extension'], $validType )) {
throw (new Exception( G::LoadTranslation( 'ID_FILE_UPLOAD_INCORRECT_EXTENSION' ) ));
//$errors[$i]='wrongtype';
}
$filename = $items;
$tempPath = PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP;
G::verifyPath($tempPath, true);
G::verifyPath( $tempPath, true );
$tempName = $tmp;
G::uploadFile($tempName, $tempPath, $filename);
G::LoadThirdParty('pear/Archive', 'Tar');
$tar = new Archive_Tar($tempPath . $filename);
G::uploadFile( $tempName, $tempPath, $filename );
G::LoadThirdParty( 'pear/Archive', 'Tar' );
$tar = new Archive_Tar( $tempPath . $filename );
$aFiles = $tar->listContent();
$swConfigFile = false;
foreach ($aFiles as $key => $val) {
if (basename($val['filename']) == 'config.xml') {
$skinName = dirname($val['filename']);
$skinArray = explode("/", $skinName);
if (count($skinArray) == 1) {
if (basename( $val['filename'] ) == 'config.xml') {
$skinName = dirname( $val['filename'] );
$skinArray = explode( "/", $skinName );
if (count( $skinArray ) == 1) {
$swConfigFile = true;
}
}
}
if (!$swConfigFile) {
@unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename);
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING')));
if (! $swConfigFile) {
@unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );
throw (new Exception( G::LoadTranslation( 'ID_SKIN_CONFIGURATION_MISSING' ) ));
}
if (is_dir(PATH_CUSTOM_SKINS . $skinName)) {
if ((isset($_REQUEST['overwrite_files'])) && ($_REQUEST['overwrite_files'] == 'on')) {
G::rm_dir(PATH_CUSTOM_SKINS . $skinName, false);
if (is_dir( PATH_CUSTOM_SKINS . $skinName )) {
if ((isset( $_REQUEST['overwrite_files'] )) && ($_REQUEST['overwrite_files'] == 'on')) {
G::rm_dir( PATH_CUSTOM_SKINS . $skinName, false );
} else {
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')));
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
}
}
$res = $tar->extract(PATH_CUSTOM_SKINS);
if (!$res) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_ERROR_EXTRACTING')));
$res = $tar->extract( PATH_CUSTOM_SKINS );
if (! $res) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ERROR_EXTRACTING' ) ));
}
//Delete Temporal
@unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename);
@unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );
$response['success'] = true;
$response['message'] = G::LoadTranslation('ID_SKIN_SUCCESSFUL_IMPORTED');
print_r(G::json_encode($response));
$response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESSFUL_IMPORTED' );
print_r( G::json_encode( $response ) );
} catch (Exception $e) {
$response['success'] = false;
$response['message'] = $e->getMessage();
$response['error'] = $e->getMessage();
print_r(G::json_encode($response));
print_r( G::json_encode( $response ) );
}
}
function exportSkin($skinToExport="")
function exportSkin ($skinToExport = "")
{
try {
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')) );
if (! isset( $_REQUEST['SKIN_FOLDER_ID'] )) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_NAME_REQUIRED' ) ));
}
$skinName = $_REQUEST['SKIN_FOLDER_ID'];
@@ -257,113 +252,116 @@ function exportSkin($skinToExport="")
$skinFolderBase = PATH_CUSTOM_SKINS . $skinName;
$skinFolder = $skinFolderBase . PATH_SEP;
$skinTar = PATH_CUSTOM_SKINS . $skinName . '.tar';
if (!is_dir($skinFolder)) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_DOESNT_EXIST')) );
if (! is_dir( $skinFolder )) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_DOESNT_EXIST' ) ));
}
if (!file_exists($skinFolder . "config.xml")) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING')) );
if (! file_exists( $skinFolder . "config.xml" )) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_CONFIGURATION_MISSING' ) ));
}
if (file_exists($skinTar)) {
if (file_exists( $skinTar )) {
//try to delete
if (!unlink($skinTar)) {
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_PERMISSIONS')) );
if (! unlink( $skinTar )) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_PERMISSIONS' ) ));
}
}
//Try to generate tar file
G::LoadThirdParty('pear/Archive', 'Tar');
$tar = new Archive_Tar($skinTar);
G::LoadThirdParty( 'pear/Archive', 'Tar' );
$tar = new Archive_Tar( $skinTar );
$tar->_compress = false;
addTarFolder($tar, $skinFolder, PATH_CUSTOM_SKINS);
addTarFolder( $tar, $skinFolder, PATH_CUSTOM_SKINS );
$response['success'] = true;
$response['message'] = $skinTar;
print_r(G::json_encode($response));
print_r( G::json_encode( $response ) );
} catch (Exception $e) {
$response['success'] = false;
$response['message'] = $e->getMessage();
print_r(G::json_encode($response));
print_r( G::json_encode( $response ) );
}
}
function deleteSkin()
function deleteSkin ()
{
try {
if (!(isset($_REQUEST['SKIN_FOLDER_ID']))) {
throw (new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')));
if (! (isset( $_REQUEST['SKIN_FOLDER_ID'] ))) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_REQUIRED' ) ));
}
if (($_REQUEST['SKIN_FOLDER_ID'])=="classic") {
throw (new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE')));
if (($_REQUEST['SKIN_FOLDER_ID']) == "classic") {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_NOT_DELETEABLE' ) ));
}
$folderId=$_REQUEST['SKIN_FOLDER_ID'];
if (!is_dir(PATH_CUSTOM_SKINS.$folderId)) {
throw (new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS')));
$folderId = $_REQUEST['SKIN_FOLDER_ID'];
if (! is_dir( PATH_CUSTOM_SKINS . $folderId )) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_NOT_EXISTS' ) ));
}
//Delete
G::rm_dir(PATH_CUSTOM_SKINS.$folderId);
G::rm_dir( PATH_CUSTOM_SKINS . $folderId );
$response['success'] = true;
$response['message'] = "$folderId deleted";
} catch (Exception $e) {
$response['success'] = false;
$response['error']=$response['message'] = $e->getMessage();
print_r(G::json_encode($response));
$response['error'] = $response['message'] = $e->getMessage();
print_r( G::json_encode( $response ) );
}
}
function streamSkin()
function streamSkin ()
{
$skinTar = $_REQUEST['file'];
$bDownload = true;
G::streamFile($skinTar, $bDownload, basename($skinTar));
@unlink($fileTar);
G::streamFile( $skinTar, $bDownload, basename( $skinTar ) );
@unlink( $fileTar );
}
function addTarFolder($tar, $pathBase, $pluginHome)
function addTarFolder ($tar, $pathBase, $pluginHome)
{
$aux = explode(PATH_SEP, $pathBase);
if ($aux[count($aux) - 2] == '.svn') {
$aux = explode( PATH_SEP, $pathBase );
if ($aux[count( $aux ) - 2] == '.svn') {
return;
}
if ($handle = opendir($pathBase)) {
while (false !== ($file = readdir($handle))) {
if (is_file($pathBase . $file)) {
if ($handle = opendir( $pathBase )) {
while (false !== ($file = readdir( $handle ))) {
if (is_file( $pathBase . $file )) {
//print "file $file \n";
$tar->addModify($pathBase . $file, '', $pluginHome);
$tar->addModify( $pathBase . $file, '', $pluginHome );
}
if (is_dir($pathBase . $file) && $file != '..' && $file != '.') {
if (is_dir( $pathBase . $file ) && $file != '..' && $file != '.') {
//print "dir $pathBase$file \n";
addTarFolder($tar, $pathBase . $file . PATH_SEP, $pluginHome);
addTarFolder( $tar, $pathBase . $file . PATH_SEP, $pluginHome );
}
}
closedir($handle);
closedir( $handle );
}
}
function copy_skin_folder($path, $dest, $exclude=array())
function copy_skin_folder ($path, $dest, $exclude = array())
{
$defaultExcluded=array(".","..");
$excludedItems=array_merge($defaultExcluded,$exclude);
if (is_dir($path)) {
@mkdir($dest);
$objects = scandir($path);
if (sizeof($objects) > 0) {
$defaultExcluded = array (".",".."
);
$excludedItems = array_merge( $defaultExcluded, $exclude );
if (is_dir( $path )) {
@mkdir( $dest );
$objects = scandir( $path );
if (sizeof( $objects ) > 0) {
foreach ($objects as $file) {
if (in_array($file,$excludedItems)) {
if (in_array( $file, $excludedItems )) {
continue;
}
// go on
if (is_dir($path . PATH_SEP . $file)) {
copy_skin_folder($path . PATH_SEP . $file, $dest . PATH_SEP . $file,$exclude);
if (is_dir( $path . PATH_SEP . $file )) {
copy_skin_folder( $path . PATH_SEP . $file, $dest . PATH_SEP . $file, $exclude );
} else {
copy($path . PATH_SEP . $file, $dest . PATH_SEP . $file);
copy( $path . PATH_SEP . $file, $dest . PATH_SEP . $file );
}
}
}
return true;
} elseif (is_file($path)) {
return copy($path, $dest);
} elseif (is_file( $path )) {
return copy( $path, $dest );
} else {
return false;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* skinsExport.php
*
@@ -20,27 +21,28 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
function copyFile ( $input, $output ) {
$content = file_get_contents ( $input );
$filename = $output . PATH_SEP . basename ( $input );
return file_put_contents ( $filename, $content );
}
function copyFile ($input, $output)
{
$content = file_get_contents( $input );
$filename = $output . PATH_SEP . basename( $input );
return file_put_contents( $filename, $content );
}
function savePluginFile ( $tplName, $fileName, $fields ) {
$pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' .PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl';
function savePluginFile ($tplName, $fileName, $fields)
{
$pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl';
$template = new TemplatePower( $pluginTpl );
$template->prepare();
if ( is_array ($fields) ) {
foreach ( $fields as $block => $data ) {
if (is_array( $fields )) {
foreach ($fields as $block => $data) {
$template->gotoBlock( "_ROOT" );
if ( is_array( $data) )
foreach ( $data as $rowId => $row ) {
if (is_array( $data ))
foreach ($data as $rowId => $row) {
$template->newBlock( $block );
foreach ( $row as $key => $val )
foreach ($row as $key => $val)
$template->assign( $key, $val );
}
else
@@ -49,38 +51,40 @@
}
$content = $template->getOutputContent();
$iSize = file_put_contents ( $fileName, $content );
$iSize = file_put_contents( $fileName, $content );
return $iSize;
}
}
function addTarFolder ( $tar, $pathBase,$pluginHome ) {
$aux = explode( PATH_SEP, $pathBase);
if ( $aux[count($aux) -2 ] == '.svn' ) return;
function addTarFolder ($tar, $pathBase, $pluginHome)
{
$aux = explode( PATH_SEP, $pathBase );
if ($aux[count( $aux ) - 2] == '.svn')
return;
if ($handle = opendir( $pathBase )) {
while ( false !== ($file = readdir($handle))) {
if ( is_file ( $pathBase . $file ) ) {
while (false !== ($file = readdir( $handle ))) {
if (is_file( $pathBase . $file )) {
//print "file $file \n";
$tar->addModify( $pathBase . $file,'', $pluginHome);
$tar->addModify( $pathBase . $file, '', $pluginHome );
}
if ( is_dir ( $pathBase . $file ) && $file != '..' && $file != '.' ) {
if (is_dir( $pathBase . $file ) && $file != '..' && $file != '.') {
//print "dir $pathBase$file \n";
addTarFolder ( $tar, $pathBase . $file . PATH_SEP ,$pluginHome);
addTarFolder( $tar, $pathBase . $file . PATH_SEP, $pluginHome );
}
}
closedir($handle);
}
closedir( $handle );
}
}
function packPlugin ( $pluginName, $version ) {
function packPlugin ($pluginName, $version)
{
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $pluginName . PATH_SEP;
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $pluginName ;
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $pluginName;
$fileTar = PATH_DATA . 'skins' . PATH_SEP . $pluginName . '-' . $version . '.tar';
G::LoadSystem ('templatePower');
/*
G::LoadSystem( 'templatePower' );
/*
$pluginDirectory = PATH_PLUGINS . $pluginName;
$pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
$pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
@@ -92,93 +96,92 @@
die ;
}
*/
G::LoadThirdParty( 'pear/Archive','Tar');
$tar = new Archive_Tar ( $fileTar);
$tar->_compress=false;
G::LoadThirdParty( 'pear/Archive', 'Tar' );
$tar = new Archive_Tar( $fileTar );
$tar->_compress = false;
//$tar->createModify( $pathHome . PATH_SEP . $pluginName . '.php' ,'', $pathHome);
addTarFolder ( $tar, $pathBase, $pathHome );
addTarFolder( $tar, $pathBase, $pathHome );
$aFiles = $tar->listContent();
return $fileTar;
}
}
global $RBAC;
switch ($RBAC->userCanAccess('PM_SETUP'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
switch ($RBAC->userCanAccess( 'PM_SETUP' )) {
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;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
G::LoadClass("system");
G::LoadClass( "system" );
$id = $_GET['id'];
$id = $_GET['id'];
$fileObj = PATH_SKINS . $id . '.cnf';
$fileObj = PATH_SKINS . $id . '.cnf';
if ( !file_exists($fileObj) ) {
if (! file_exists( $fileObj )) {
$oConf = new stdClass();
$oConf->name = $id;
$oConf->description = "description of skin $id ";
$oConf->version = 1;
file_put_contents ( $fileObj, serialize ( $oConf) );
}
file_put_contents( $fileObj, serialize( $oConf ) );
}
$oConf = unserialize ( file_get_contents ( $fileObj ));
$oConf->version += 1;
file_put_contents ( $fileObj, serialize ( $oConf) );
$oConf = unserialize( file_get_contents( $fileObj ) );
$oConf->version += 1;
file_put_contents( $fileObj, serialize( $oConf ) );
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $id . PATH_SEP;
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $id . PATH_SEP . $id . PATH_SEP;
$pathPublic = $pathBase . 'data' . PATH_SEP . 'public_html' . PATH_SEP ;
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $id . PATH_SEP;
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $id . PATH_SEP . $id . PATH_SEP;
$pathPublic = $pathBase . 'data' . PATH_SEP . 'public_html' . PATH_SEP;
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
G::mk_dir ( $pathBase );
G::mk_dir ( $pathBase . 'data' );
G::mk_dir ( $pathPublic );
G::mk_dir ( $pathPublic . 'images' );
G::mk_dir( $pathBase );
G::mk_dir( $pathBase . 'data' );
G::mk_dir( $pathPublic );
G::mk_dir( $pathPublic . 'images' );
// file_put_contents ( PATH_DATA . 'skins' . PATH_SEP . $id , "hello world" );
$fields['className'] = $id;
$fields['version'] = $oConf->version;
$fields['description'] = $oConf->description;
$fields['PMversion'] = System::getVersion();
savePluginFile ( 'skinPluginMainClass' , $pathHome . $id . '.php', $fields );
$fields['className'] = $id;
$fields['version'] = $oConf->version;
$fields['description'] = $oConf->description;
$fields['PMversion'] = System::getVersion();
savePluginFile( 'skinPluginMainClass', $pathHome . $id . '.php', $fields );
savePluginFile ( 'skinPluginClass' , $pathBase . 'class.' . $id . '.php', $fields );
savePluginFile( 'skinPluginClass', $pathBase . 'class.' . $id . '.php', $fields );
copyFile ( PATH_SKINS . $id . '.php' , $pathBase . 'data' );
copyFile ( PATH_SKINS . $id . '.html' , $pathBase . 'data' );
copyFile ( PATH_SKINS . $id . '.cnf' , $pathBase . 'data' );
copyFile( PATH_SKINS . $id . '.php', $pathBase . 'data' );
copyFile( PATH_SKINS . $id . '.html', $pathBase . 'data' );
copyFile( PATH_SKINS . $id . '.cnf', $pathBase . 'data' );
copyFile ( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc' , $pathPublic );
copyFile ( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css' , $pathPublic );
copyFile( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc', $pathPublic );
copyFile( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css', $pathPublic );
$aFiles = array ();
if ($handle = opendir( $pathImages )) {
while ( false !== ($file = readdir($handle))) {
if ( substr($file,0,1) != '.' ) {
if ( isset($aFiles[ $file ]) ) $aFiles[$file] = 0;
copyFile ( $pathImages. $file , $pathPublic . 'images' . PATH_SEP );
$aFiles = array ();
if ($handle = opendir( $pathImages )) {
while (false !== ($file = readdir( $handle ))) {
if (substr( $file, 0, 1 ) != '.') {
if (isset( $aFiles[$file] ))
$aFiles[$file] = 0;
copyFile( $pathImages . $file, $pathPublic . 'images' . PATH_SEP );
}
}
closedir($handle);
}
closedir( $handle );
}
$fileTar = packPlugin ( $id, $oConf->version );
$fileTar = packPlugin( $id, $oConf->version );
$bDownload = true;
G::streamFile( $fileTar, $bDownload, basename( $fileTar ) );
$bDownload = true;
G::streamFile ( $fileTar, $bDownload, basename($fileTar) );
@G::rm_dir( $pathHome );
@unlink( $fileTar );
@G::rm_dir ($pathHome);
@unlink ($fileTar);

View File

@@ -20,13 +20,12 @@
*
* 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');
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;
die();
}
$G_MAIN_MENU = 'processmaker';
@@ -34,120 +33,117 @@ $G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'CALENDAR';
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
G::LoadClass('configuration');
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration('skinList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$configPage = $c->getConfiguration( 'skinList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('setup/skinList', false); //adding a javascript file .js
$oHeadPublisher->addContent('setup/skinList'); //adding a html file .html.
$oHeadPublisher->assign('CONFIG', $Config);
$oHeadPublisher->assign('SYS_SKIN', SYS_SKIN);
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'setup/skinList', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'setup/skinList' ); //adding a html file .html.
$oHeadPublisher->assign( 'CONFIG', $Config );
$oHeadPublisher->assign( 'SYS_SKIN', SYS_SKIN );
$oHeadPublisher->assign('FORMATS',$c->getFormats());
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
G::RenderPage('publish', 'extJs');
die;
G::RenderPage( 'publish', 'extJs' );
die();
global $RBAC;
$access = $RBAC->userCanAccess('PM_SETUP');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
$access = $RBAC->userCanAccess( 'PM_SETUP' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
// lets display the items
$items[] = array ( 'id' => 'char', 'title' => 'char', 'type' => 'char', 'creator' => 'char' ,
'modifiedBy' => 'char', 'filename' => 'char', 'size' => 'char', 'mime' => 'char');
// lets display the items
$items[] = array ('id' => 'char','title' => 'char','type' => 'char','creator' => 'char','modifiedBy' => 'char','filename' => 'char','size' => 'char','mime' => 'char'
);
//***************** Skins **************************
$aFiles = array ();
if ($handle = opendir( PATH_SKINS )) {
while ( false !== ($file = readdir($handle))) {
G::pr($file);
$filename = substr ( $file,0, strrpos($file, '.'));
//***************** Skins **************************
$aFiles = array ();
if ($handle = opendir( PATH_SKINS )) {
while (false !== ($file = readdir( $handle ))) {
G::pr( $file );
$filename = substr( $file, 0, strrpos( $file, '.' ) );
// list of no complete skins
$aFilterSkinsList = Array('blank', 'green', 'raw', 'tracker', 'iphone', 'green-submenu', 'extJsInitLoad', 'extJs' );
$aFilterSkinsList = Array ('blank','green','raw','tracker','iphone','green-submenu','extJsInitLoad','extJs'
);
if ( !is_dir(PATH_SKINS. $file) ) {
if ( !in_array($filename, $aFilterSkinsList) /*&& /*/ && !strpos($file, '.tar', 1) ) {
if ( !isset($aFiles[ $filename ]) ) $aFiles[$filename] = 0;
if ( strpos($file, '.php', 1) ) $aFiles[ $filename ] += 1;
if ( strpos($file, '.html',1) ) $aFiles[ $filename ] += 2;
if (! is_dir( PATH_SKINS . $file )) {
if (! in_array( $filename, $aFilterSkinsList ) /*&& /*/ && ! strpos( $file, '.tar', 1 )) {
if (! isset( $aFiles[$filename] ))
$aFiles[$filename] = 0;
if (strpos( $file, '.php', 1 ))
$aFiles[$filename] += 1;
if (strpos( $file, '.html', 1 ))
$aFiles[$filename] += 2;
}
}
}
closedir($handle);
closedir( $handle );
//now walk in the array to get the .cnf file and display properties
foreach ( $aFiles as $key => $val ) {
foreach ($aFiles as $key => $val) {
$description = '';
$version = '';
if ( file_exists ( PATH_SKINS . $key . '.cnf' ) ) {
$serial = file_get_contents ( PATH_SKINS . $key . '.cnf' );
$previousErrorRep = ini_get("error_reporting");
error_reporting( E_ERROR ) ;
$prop = unserialize ( $serial );
if (file_exists( PATH_SKINS . $key . '.cnf' )) {
$serial = file_get_contents( PATH_SKINS . $key . '.cnf' );
$previousErrorRep = ini_get( "error_reporting" );
error_reporting( E_ERROR );
$prop = unserialize( $serial );
error_reporting( $previousErrorRep );
if ( !is_object( $prop ) ) {
@unlink ( PATH_SKINS . $key . '.cnf');
if (! is_object( $prop )) {
@unlink( PATH_SKINS . $key . '.cnf' );
}
if ( isset ( $prop) && isset($prop->description) ) $description = $prop->description;
if ( isset ( $prop) && isset($prop->version ) ) $version = $prop->version;
if (isset( $prop ) && isset( $prop->description ))
$description = $prop->description;
if (isset( $prop ) && isset( $prop->version ))
$version = $prop->version;
}
$linkPackValue = G::LoadTranslation('ID_EXPORT') ;
$link = 'skinsExport?id=' . $key ;
$items[] = array (
'id' => count($items),
'name' => $key,
'filename' => $key,
'description' => $description,
'version' => $version,
'url' => $link,
'linkPackValue' => $linkPackValue
$linkPackValue = G::LoadTranslation( 'ID_EXPORT' );
$link = 'skinsExport?id=' . $key;
$items[] = array ('id' => count( $items ),'name' => $key,'filename' => $key,'description' => $description,'version' => $version,'url' => $link,'linkPackValue' => $linkPackValue
);
}
$folders['items'] = $items;
}
}
$_DBArray['plugins'] = $items;
$_SESSION['_DBArray'] = $_DBArray;
$_DBArray['plugins'] = $items;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass( 'ArrayPeer');
$c = new Criteria ('dbarray');
$c->setDBArrayTable('plugins');
$c->addAscendingOrderByColumn ('id');
G::LoadClass( 'ArrayPeer' );
$c = new Criteria( 'dbarray' );
$c->setDBArrayTable( 'plugins' );
$c->addAscendingOrderByColumn( 'id' );
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'SKINS';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'SKINS';
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/skinsList', $c );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/skinsList', $c );
G::RenderPage('publishBlank', 'blank');
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -20,39 +20,38 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$access = $RBAC->userCanAccess('PM_SETUP');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
$access = $RBAC->userCanAccess( 'PM_SETUP' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
$dbc = new DBConnection;
$G_PUBLISH = new Publisher;
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'SKINS';
$dbc = new DBConnection();
$G_PUBLISH = new Publisher();
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'SKINS';
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/skinsNew", '', null, "skinsSave");
G::RenderPage( 'publishBlank', 'blank' );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/skinsNew", '', null, "skinsSave" );
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -1,4 +1,5 @@
<?php
/**
* skinsSave.php
*
@@ -20,76 +21,68 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
function xcopy ( $pathSource, $pathTarget ) {
G::mk_dir ($pathTarget);
function xcopy ($pathSource, $pathTarget)
{
G::mk_dir( $pathTarget );
if ($handle = opendir( $pathSource )) {
while ( false !== ($file = readdir($handle))) {
if ( substr($file,0,1) != '.' && !is_dir ($file) ) {
$content = file_get_contents ( $pathSource . $file );
$filename = $pathTarget . $file ;
file_put_contents ( $filename, $content );
while (false !== ($file = readdir( $handle ))) {
if (substr( $file, 0, 1 ) != '.' && ! is_dir( $file )) {
$content = file_get_contents( $pathSource . $file );
$filename = $pathTarget . $file;
file_put_contents( $filename, $content );
}
}
closedir($handle);
closedir( $handle );
}
}
}
global $RBAC;
switch ($RBAC->userCanAccess('PM_SETUP'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
switch ($RBAC->userCanAccess( 'PM_SETUP' )) {
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;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
G::LoadClass("system");
G::LoadClass( "system" );
$id = strip_tags ( str_replace ( ' ', '_', trim ($_POST['form']['NAME']) ) );
$desc = $_POST['form']['DESCRIPTION'];
$id = strip_tags( str_replace( ' ', '_', trim( $_POST['form']['NAME'] ) ) );
$desc = $_POST['form']['DESCRIPTION'];
$fileObj = PATH_SKINS . $id . '.cnf';
$fileObj = PATH_SKINS . $id . '.cnf';
if ( !file_exists($fileObj) ) {
if (! file_exists( $fileObj )) {
$oConf = new stdClass();
$oConf->name = $id;
$oConf->description = $desc;
$oConf->version = 1;
file_put_contents ( $fileObj, serialize ( $oConf) );
}
file_put_contents( $fileObj, serialize( $oConf ) );
}
$oConf = unserialize ( file_get_contents ( $fileObj ));
$oConf = unserialize( file_get_contents( $fileObj ) );
$contentPHP = file_get_contents ( PATH_SKINS . 'green.php' );
$contentPHP = str_replace ( 'green.html', $id.'.html', $contentPHP );
file_put_contents ( PATH_SKINS . $id . '.php', $contentPHP );
$contentPHP = file_get_contents( PATH_SKINS . 'green.php' );
$contentPHP = str_replace( 'green.html', $id . '.html', $contentPHP );
file_put_contents( PATH_SKINS . $id . '.php', $contentPHP );
$contentHTML = file_get_contents ( PATH_SKINS . 'green.html' );
$contentHTML = str_replace ( 'green', $id , $contentHTML );
file_put_contents ( PATH_SKINS . $id . '.html', $contentHTML );
$contentHTML = file_get_contents( PATH_SKINS . 'green.html' );
$contentHTML = str_replace( 'green', $id, $contentHTML );
file_put_contents( PATH_SKINS . $id . '.html', $contentHTML );
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
G::mk_dir ( $pathImages );
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
G::mk_dir( $pathImages );
xcopy (
PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP ,
PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP
);
xcopy( PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP, PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP );
xcopy (
PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images'. PATH_SEP,
PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images'. PATH_SEP
);
xcopy( PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP, PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP );
G::Header( 'Location: ../../' . $id . '/setup/skinsList' );
G::Header ( 'Location: ../../' . $id . '/setup/skinsList' );

View File

@@ -20,55 +20,53 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
$POST_MAX_SIZE = ini_get( 'post_max_size' );
$mul = substr( $POST_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
if ($postMaxSize < $uploadMaxSize)
$uploadMaxSize = $postMaxSize;
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'UPGRADE';
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'UPGRADE';
G::LoadClass( "system" );
G::LoadClass("system");
$Fields['PM_VERSION'] = System::getVersion();
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
$Fields['PM_VERSION'] = System::getVersion();
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/upgrade', '', $Fields, 'upgrade_System');
G::RenderPage('publishBlank', 'blank');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/upgrade', '', $Fields, 'upgrade_System' );
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -40,3 +40,4 @@ $aRequiredPermissions = array('PM_LOGIN',
'PM_FOLDERS_ADD_FOLDER',
'PM_FOLDERS_ADD_FILE'
);

View File

@@ -20,7 +20,6 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
@@ -30,20 +29,19 @@
* @date May 12th, 2010
*/
global $RBAC;
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
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;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
set_time_limit(0);
set_time_limit( 0 );
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
@@ -54,28 +52,28 @@ require_once "classes/class.system.php";
$oSystem = new System();
try {
if( ! $oSystem->verifyFileForUpgrade() ){
throw ( new Exception ("There was an error uploading the file, probably the file size if greater than upload_max_filesize parameter in php.ini, please check this parameter and try again." ) );
if (! $oSystem->verifyFileForUpgrade()) {
throw (new Exception( "There was an error uploading the file, probably the file size if greater than upload_max_filesize parameter in php.ini, please check this parameter and try again." ));
}
$oSystem->cleanupUpgradeDirectory();
$oSystem->getUpgradedFilesList();
$ver = $oSystem->upgrade();
$G_PUBLISH = new Publisher;
$aMessage['THEMESSAGE1'] = G::LoadTranslation('ID_UPGRADE_READY') ." <b>". $ver[0] ."</b> ". G::LoadTranslation('ID_TO') ." <b>". $ver[1] ."</b>";
$aMessage['THEMESSAGE2'] = file_get_contents($oSystem->sUpgradeFileList);
$G_PUBLISH = new Publisher();
$aMessage['THEMESSAGE1'] = G::LoadTranslation( 'ID_UPGRADE_READY' ) . " <b>" . $ver[0] . "</b> " . G::LoadTranslation( 'ID_TO' ) . " <b>" . $ver[1] . "</b>";
$aMessage['THEMESSAGE2'] = file_get_contents( $oSystem->sUpgradeFileList );
$aMessage['THEMESSAGE3'] = '';
if ( !is_Array($oSystem->aErrors) || count($oSystem->aErrors) == 0 )
$aMessage['THEMESSAGE4'] = G::LoadTranslation('ID_NONE');
if (! is_Array( $oSystem->aErrors ) || count( $oSystem->aErrors ) == 0)
$aMessage['THEMESSAGE4'] = G::LoadTranslation( 'ID_NONE' );
else
$aMessage['THEMESSAGE4'] = implode( "\n", $oSystem->aErrors) ;
$aMessage['THEMESSAGE4'] = implode( "\n", $oSystem->aErrors );
$oHeadPublisher =& headPublisher::getSingleton();
if( file_exists(PATH_CORE . 'js' . PATH_SEP . 'setup' . PATH_SEP . 'upgrade_System.js') ){
$oHeadPublisher->addScriptFile('/jscore/setup/upgrade_System.js');
$oHeadPublisher = & headPublisher::getSingleton();
if (file_exists( PATH_CORE . 'js' . PATH_SEP . 'setup' . PATH_SEP . 'upgrade_System.js' )) {
$oHeadPublisher->addScriptFile( '/jscore/setup/upgrade_System.js' );
} else {
$oHeadPublisher->addScriptCode("function upgradeSystem(wsCount) {
$oHeadPublisher->addScriptCode( "function upgradeSystem(wsCount) {
document.getElementById('form[THETITLE3]').innerHTML = wsCount + ' workspaces to update.';
document.getElementById('form[SUBTITLE4]').innerHTML = '&nbsp;&nbsp;<img src='/images/alert.gif' width='13' height='13' border='0'> Please wait...';
updateWorkspace(wsCount);
@@ -93,18 +91,18 @@ try {
updateWorkspace(id-1);
}.extend(this);
oRPC.make();
};");
};" );
}
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfoUpdate', '', $aMessage );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showInfoUpdate', '', $aMessage );
G::RenderPage( 'publishBlank', 'blank' );
G::evalJScript('upgradeSystem('.count($oSystem->aWorkspaces).')');
exit(0);
}
catch (Exception $e) {
$G_PUBLISH = new Publisher;
G::evalJScript( 'upgradeSystem(' . count( $oSystem->aWorkspaces ) . ')' );
exit( 0 );
} 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( 'publishBlank', 'blank' );
exit(0);
exit( 0 );
}

View File

@@ -20,72 +20,72 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $DB_ADAPTER;
global $DB_HOST;
global $DB_USER;
global $DB_PASS;
global $DB_NAME;
set_time_limit (0);
global $DB_ADAPTER;
global $DB_HOST;
global $DB_USER;
global $DB_PASS;
global $DB_NAME;
set_time_limit( 0 );
$id = '';
if ( isset($_POST['id'] ) ) $id = $_POST['id'];
$id = '';
if (isset( $_POST['id'] ))
$id = $_POST['id'];
G::LoadClass('languages');
G::LoadSystem('database_mysql');
G::LoadClass( 'languages' );
G::LoadSystem( 'database_mysql' );
$aUpgradeData = unserialize( file_get_contents (PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin" ));
$aWorkspaces = $aUpgradeData['workspaces'];
$aUpgradeData = unserialize( file_get_contents( PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin" ) );
$aWorkspaces = $aUpgradeData['workspaces'];
if ( is_array ( $aWorkspaces ) && count($aWorkspaces) > 0 ) {
$workspace = array_shift ( $aUpgradeData['workspaces']);
if (is_array( $aWorkspaces ) && count( $aWorkspaces ) > 0) {
$workspace = array_shift( $aUpgradeData['workspaces'] );
eval ( getDatabaseCredentials(PATH_DB . $workspace . PATH_SEP . 'db.php')) ;
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
eval( getDatabaseCredentials( PATH_DB . $workspace . PATH_SEP . 'db.php' ) );
$oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
$oDataBase->iFetchType = MYSQL_NUM;
//processing .po file
if ( $aUpgradeData['sPoFile'] != '' ) {
if ($aUpgradeData['sPoFile'] != '') {
$oLanguages = new languages();
$oLanguages->importLanguage($aUpgradeData['sPoFile'], $aUpgradeData['bForceXmlPoFile'] );
$oLanguages->importLanguage( $aUpgradeData['sPoFile'], $aUpgradeData['bForceXmlPoFile'] );
$aUpgradeData['bForceXmlPoFile'] = false;
}
if ($aUpgradeData['sSchemaFile'] != '')
processMasterSchemaFile( $aUpgradeData['sSchemaFile'] );
//draw a gauge control indicating the progress in workspaces
$gauge = intval( (( $aUpgradeData['wsQuantity'] - count($aWorkspaces) + 1 ) / $aUpgradeData['wsQuantity'] ) * 301 );
$gauge = intval( (($aUpgradeData['wsQuantity'] - count( $aWorkspaces ) + 1) / $aUpgradeData['wsQuantity']) * 301 );
print "<table cellpadding=0><tr><td><img src='/images/ajax-loader.gif' border=0/></td><td>";
print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >";
print "<div style='color:#FFF; height:16px; text-align:center; padding-top:3px; background-image: url(/skins/green/images/bm.jpg); background-repeat: repeat-x; width: {$gauge}px' ></div> </div>";
print "</td><td width='40%'><font color=black> Upgrading the workspace </font><b><font color=green>$workspace</font></b></td><td width=250 align=right>| $id Remaining</td></tr></table>";
file_put_contents (PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin", serialize($aUpgradeData) );
}
else {
file_put_contents( PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin", serialize( $aUpgradeData ) );
} else {
print "<table cellpadding=0><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>";
print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >";
print "<div style='color:#FFF; height:16px; text-align:center; padding-top:3px; background-image: url(/skins/green/images/bm.jpg); background-repeat: repeat-x; width: 301px' ></div> </div>";
print "</td><td> Finished! All workspaces were upgraded successfully.</td></tr></table>";
}
}
die;
die();
function getDatabaseCredentials ( $dbFile ) {
function getDatabaseCredentials ($dbFile)
{
$sContent = file_get_contents( $dbFile );
$sContent = str_replace('<?php', '', $sContent);
$sContent = str_replace('<?', '', $sContent);
$sContent = str_replace('?>', '', $sContent);
$sContent = str_replace('define', '', $sContent);
$sContent = str_replace("('", '$', $sContent);
$sContent = str_replace("',", '=', $sContent);
$sContent = str_replace(");", ';', $sContent);
$sContent = str_replace( '<?php', '', $sContent );
$sContent = str_replace( '<?', '', $sContent );
$sContent = str_replace( '?>', '', $sContent );
$sContent = str_replace( 'define', '', $sContent );
$sContent = str_replace( "('", '$', $sContent );
$sContent = str_replace( "',", '=', $sContent );
$sContent = str_replace( ");", ';', $sContent );
return $sContent;
}
function processMasterSchemaFile ( $sSchemaFile ) {
function processMasterSchemaFile ($sSchemaFile)
{
global $DB_ADAPTER;
global $DB_HOST;
global $DB_USER;
@@ -94,32 +94,31 @@ function processMasterSchemaFile ( $sSchemaFile ) {
global $aUpgradeData;
//convert newSchema to array
if ( isset($aUpgradeData['aNewSchema']) ) {
if (isset( $aUpgradeData['aNewSchema'] )) {
$aNewSchema = $aUpgradeData['aNewSchema'];
}
else {
$aNewSchema = schemaToArray($sSchemaFile);
} else {
$aNewSchema = schemaToArray( $sSchemaFile );
$aUpgradeData['aNewSchema'] = $aNewSchema;
}
$aOldSchema = processSchemaFile();
if ( is_null($aOldSchema) ) {
if (is_null( $aOldSchema )) {
return;
}
$aChanges = obtainChanges($aOldSchema, $aNewSchema);
$aChanges = obtainChanges( $aOldSchema, $aNewSchema );
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if ( !$oDataBase->isConnected() ) {
$oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
if (! $oDataBase->isConnected()) {
return;
}
$oDataBase->iFetchType = MYSQL_NUM;
$oDataBase->logQuery ( count ($aChanges ) );
$oDataBase->logQuery( count( $aChanges ) );
foreach ($aChanges['tablesToAdd'] as $sTable => $aColumns) {
$oDataBase->executeQuery($oDataBase->generateCreateTableSQL($sTable, $aColumns));
if (isset($aChanges['tablesToAdd'][$sTable]['INDEXES'])) {
$oDataBase->executeQuery( $oDataBase->generateCreateTableSQL( $sTable, $aColumns ) );
if (isset( $aChanges['tablesToAdd'][$sTable]['INDEXES'] )) {
foreach ($aChanges['tablesToAdd'][$sTable]['INDEXES'] as $indexName => $aIndex) {
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $indexName, $aIndex ) );
$oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $indexName, $aIndex ) );
}
}
}
@@ -129,13 +128,13 @@ function processMasterSchemaFile ( $sSchemaFile ) {
foreach ($aAction as $sColumn => $vData) {
switch ($sAction) {
case 'DROP':
$oDataBase->executeQuery($oDataBase->generateDropColumnSQL($sTable, $vData));
$oDataBase->executeQuery( $oDataBase->generateDropColumnSQL( $sTable, $vData ) );
break;
case 'ADD':
$oDataBase->executeQuery($oDataBase->generateAddColumnSQL($sTable, $sColumn, $vData));
$oDataBase->executeQuery( $oDataBase->generateAddColumnSQL( $sTable, $sColumn, $vData ) );
break;
case 'CHANGE':
$oDataBase->executeQuery($oDataBase->generateChangeColumnSQL($sTable, $sColumn, $vData));
$oDataBase->executeQuery( $oDataBase->generateChangeColumnSQL( $sTable, $sColumn, $vData ) );
break;
}
}
@@ -143,22 +142,22 @@ function processMasterSchemaFile ( $sSchemaFile ) {
}
foreach ($aChanges['tablesWithNewIndex'] as $sTable => $aIndexes) {
foreach ($aIndexes as $sIndexName => $aIndexFields ) {
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $sIndexName, $aIndexFields ));
foreach ($aIndexes as $sIndexName => $aIndexFields) {
$oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $sIndexName, $aIndexFields ) );
}
}
foreach ($aChanges['tablesToAlterIndex'] as $sTable => $aIndexes) {
foreach ($aIndexes as $sIndexName => $aIndexFields ) {
$oDataBase->executeQuery($oDataBase->generateDropKeySQL($sTable, $sIndexName ));
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $sIndexName, $aIndexFields ));
foreach ($aIndexes as $sIndexName => $aIndexFields) {
$oDataBase->executeQuery( $oDataBase->generateDropKeySQL( $sTable, $sIndexName ) );
$oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $sIndexName, $aIndexFields ) );
}
}
$oDataBase->close();
}
function processSchemaFile( ) {
function processSchemaFile ()
{
global $DB_ADAPTER;
global $DB_HOST;
global $DB_USER;
@@ -166,35 +165,35 @@ function processSchemaFile( ) {
global $DB_NAME;
try {
G::LoadSystem( 'database_' . strtolower($DB_ADAPTER));
G::LoadSystem( 'database_' . strtolower( $DB_ADAPTER ) );
$aOldSchema = array();
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
$aOldSchema = array ();
$oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
if ( !$oDataBase->isConnected() ) {
$oDataBase->logQuery ('Does not exist an available connection!');
return NULL;
if (! $oDataBase->isConnected()) {
$oDataBase->logQuery( 'Does not exist an available connection!' );
return null;
}
$oDataBase->iFetchType = MYSQL_NUM;
$oDataset1 = $oDataBase->executeQuery($oDataBase->generateShowTablesSQL());
$oDataset1 = $oDataBase->executeQuery( $oDataBase->generateShowTablesSQL() );
} catch ( Exception $e ) {
$oDataBase->logQuery ( $e->getmessage() );
return NULL;
} catch (Exception $e) {
$oDataBase->logQuery( $e->getmessage() );
return null;
}
//going thru all tables in current WF_ database
while ($aRow1 = $oDataBase->getRegistry( $oDataset1) ) {
$aPrimaryKeys = array();
$sTable = strtoupper($aRow1[0]);
while ($aRow1 = $oDataBase->getRegistry( $oDataset1 )) {
$aPrimaryKeys = array ();
$sTable = strtoupper( $aRow1[0] );
//get description of each table, ( column and primary keys )
//$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL($aRow1[0]) );
$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL($sTable ) );
$aOldSchema[ $sTable ] = array();
$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL( $sTable ) );
$aOldSchema[$sTable] = array ();
$oDataBase->iFetchType = MYSQL_ASSOC;
while ($aRow2 = $oDataBase->getRegistry($oDataset2)) {
while ($aRow2 = $oDataBase->getRegistry( $oDataset2 )) {
$aOldSchema[$sTable][$aRow2['Field']]['Field'] = $aRow2['Field'];
$aOldSchema[$sTable][$aRow2['Field']]['Type'] = $aRow2['Type'];
$aOldSchema[$sTable][$aRow2['Field']]['Null'] = $aRow2['Null'];
@@ -202,14 +201,14 @@ function processSchemaFile( ) {
}
//get indexes of each table SHOW INDEX FROM `ADDITIONAL_TABLES`; -- WHERE Key_name <> 'PRIMARY'
$oDataset2 = $oDataBase->executeQuery($oDataBase->generateTableIndexSQL($aRow1[0]));
$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateTableIndexSQL( $aRow1[0] ) );
$oDataBase->iFetchType = MYSQL_ASSOC;
while ($aRow2 = $oDataBase->getRegistry($oDataset2)) {
if ( !isset($aOldSchema[$sTable]['INDEXES']) ) {
$aOldSchema[$sTable]['INDEXES'] = array();
while ($aRow2 = $oDataBase->getRegistry( $oDataset2 )) {
if (! isset( $aOldSchema[$sTable]['INDEXES'] )) {
$aOldSchema[$sTable]['INDEXES'] = array ();
}
if (!isset($aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] ) ) {
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] = array();
if (! isset( $aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] )) {
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] = array ();
}
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']][] = $aRow2['Column_name'];
}
@@ -217,65 +216,68 @@ function processSchemaFile( ) {
$oDataBase->iFetchType = MYSQL_NUM; //this line is neccesary because the next fetch needs to be with MYSQL_NUM
}
//finally return the array with old schema obtained from the Database
if ( count($aOldSchema) == 0 ) $aOldSchema = null;
if (count( $aOldSchema ) == 0)
$aOldSchema = null;
return $aOldSchema;
}
//process the schema file in the patch file, and obtain an array
function schemaToArray($sSchemaFile) {
function schemaToArray ($sSchemaFile)
{
try {
$aSchema = array();
$aSchema = array ();
$oXml = new DomDocument();
$oXml->load($sSchemaFile);
$aTables = $oXml->getElementsByTagName('table');
$oXml->load( $sSchemaFile );
$aTables = $oXml->getElementsByTagName( 'table' );
foreach ($aTables as $oTable) {
$aPrimaryKeys = array();
$sTableName = $oTable->getAttribute('name');
$aSchema[$sTableName] = array();
$aColumns = $oTable->getElementsByTagName('column');
$aPrimaryKeys = array ();
$sTableName = $oTable->getAttribute( 'name' );
$aSchema[$sTableName] = array ();
$aColumns = $oTable->getElementsByTagName( 'column' );
foreach ($aColumns as $oColumn) {
$sColumName = $oColumn->getAttribute('name');
$aSchema[$sTableName][$sColumName] = array();
$aVendors = $oColumn->getElementsByTagName('vendor');
$sColumName = $oColumn->getAttribute( 'name' );
$aSchema[$sTableName][$sColumName] = array ();
$aVendors = $oColumn->getElementsByTagName( 'vendor' );
foreach ($aVendors as $oVendor) {
if ($oVendor->getAttribute('type') == DB_ADAPTER) {
if ($oVendor->getAttribute( 'type' ) == DB_ADAPTER) {
break;
}
}
$aParameters = $oColumn->getElementsByTagName('parameter');
$aParameters = $oColumn->getElementsByTagName( 'parameter' );
foreach ($aParameters as $oParameter) {
$parameterName = ucwords($oParameter->getAttribute('name'));
if ( $parameterName == 'Key' && strtoupper($oParameter->getAttribute('value')) == 'PRI' ) {
$aPrimaryKeys[] = $oColumn->getAttribute('name');
$parameterName = ucwords( $oParameter->getAttribute( 'name' ) );
if ($parameterName == 'Key' && strtoupper( $oParameter->getAttribute( 'value' ) ) == 'PRI') {
$aPrimaryKeys[] = $oColumn->getAttribute( 'name' );
}
if ( in_array ( $parameterName, array('Field','Type','Null','Default') ) ) {
$aSchema[$sTableName][$sColumName][$parameterName] = $oParameter->getAttribute('value');
if (in_array( $parameterName, array ('Field','Type','Null','Default'
) )) {
$aSchema[$sTableName][$sColumName][$parameterName] = $oParameter->getAttribute( 'value' );
}
}
}
if ( is_array($aPrimaryKeys) && count($aPrimaryKeys) > 0 ) {
if (is_array( $aPrimaryKeys ) && count( $aPrimaryKeys ) > 0) {
$aSchema[$sTableName]['INDEXES']['PRIMARY'] = $aPrimaryKeys;
}
$aIndexes = $oTable->getElementsByTagName('index');
$aIndexes = $oTable->getElementsByTagName( 'index' );
foreach ($aIndexes as $oIndex) {
$aIndex = array();
$aIndexesColumns = $oIndex->getElementsByTagName('index-column');
$aIndex = array ();
$aIndexesColumns = $oIndex->getElementsByTagName( 'index-column' );
foreach ($aIndexesColumns as $oIndexColumn) {
$aIndex[] = $oIndexColumn->getAttribute('name');
$aIndex[] = $oIndexColumn->getAttribute( 'name' );
}
$aSchema[$sTableName]['INDEXES'][ $oIndex->getAttribute('name') ] = $aIndex;
$aSchema[$sTableName]['INDEXES'][$oIndex->getAttribute( 'name' )] = $aIndex;
}
}
return $aSchema;
}
catch (Exception $oError) {
} catch (Exception $oError) {
throw $oError;
}
}
function obtainChanges($aOldSchema, $aNewSchema) {
function obtainChanges ($aOldSchema, $aNewSchema)
{
//$aChanges = array('tablesToDelete' => array(), 'tablesToAdd' => array(), 'tablesToAlter' => array());
//Tables to delete, but this is disabled
//foreach ($aOldSchema as $sTableName => $aColumns) {
@@ -286,19 +288,21 @@ function obtainChanges($aOldSchema, $aNewSchema) {
// }
//}
$aChanges = array('tablesToAdd' => array(), 'tablesToAlter' => array(), 'tablesWithNewIndex' => array(), 'tablesToAlterIndex'=> array());
$aChanges = array ('tablesToAdd' => array (),'tablesToAlter' => array (),'tablesWithNewIndex' => array (),'tablesToAlterIndex' => array ()
);
//new tables to create and alter
foreach ($aNewSchema as $sTableName => $aColumns) {
if (!isset($aOldSchema[$sTableName])) {
if (! isset( $aOldSchema[$sTableName] )) {
$aChanges['tablesToAdd'][$sTableName] = $aColumns;
}
else {
} else {
//drop old columns
foreach ($aOldSchema[$sTableName] as $sColumName => $aParameters) {
if (!isset($aNewSchema[$sTableName][$sColumName])) {
if (!isset($aChanges['tablesToAlter'][$sTableName])) {
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array());
if (! isset( $aNewSchema[$sTableName][$sColumName] )) {
if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
$aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
);
}
$aChanges['tablesToAlter'][$sTableName]['DROP'][$sColumName] = $sColumName;
}
@@ -308,52 +312,55 @@ function obtainChanges($aOldSchema, $aNewSchema) {
//foreach ($aNewSchema[$sTableName] as $sColumName => $aParameters) {
foreach ($aColumns as $sColumName => $aParameters) {
if ($sColumName != 'INDEXES') {
if (!isset($aOldSchema[$sTableName][$sColumName])) { //this column doesnt exist in oldschema
if (!isset($aChanges['tablesToAlter'][$sTableName])) {
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array());
if (! isset( $aOldSchema[$sTableName][$sColumName] )) { //this column doesnt exist in oldschema
if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
$aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
);
}
$aChanges['tablesToAlter'][$sTableName]['ADD'][$sColumName] = $aParameters;
}
else { //the column exists
} else { //the column exists
$newField = $aNewSchema[$sTableName][$sColumName];
$oldField = $aOldSchema[$sTableName][$sColumName];
//both are null, no change is required
if ( !isset($newField['Default']) && !isset($oldField['Default'])) $changeDefaultAttr = false;
if (! isset( $newField['Default'] ) && ! isset( $oldField['Default'] ))
$changeDefaultAttr = false;
//one of them is null, change IS required
if ( !isset($newField['Default']) && isset($oldField['Default']) && $oldField['Default']!= '') $changeDefaultAttr = true;
if ( isset($newField['Default']) && !isset($oldField['Default'])) $changeDefaultAttr = true;
if (! isset( $newField['Default'] ) && isset( $oldField['Default'] ) && $oldField['Default'] != '')
$changeDefaultAttr = true;
if (isset( $newField['Default'] ) && ! isset( $oldField['Default'] ))
$changeDefaultAttr = true;
//both are defined and they are different.
if ( isset($newField['Default']) && isset($oldField['Default']) ) {
if ( $newField['Default'] != $oldField['Default'] )
if (isset( $newField['Default'] ) && isset( $oldField['Default'] )) {
if ($newField['Default'] != $oldField['Default'])
$changeDefaultAttr = true;
else
$changeDefaultAttr = false;
}
//special cases
// BLOB and TEXT columns cannot have DEFAULT values. http://dev.mysql.com/doc/refman/5.0/en/blob.html
if ( in_array(strtolower($newField['Type']), array('text','mediumtext') ) )
if (in_array( strtolower( $newField['Type'] ), array ('text','mediumtext'
) ))
$changeDefaultAttr = false;
//#1067 - Invalid default value for datetime field
if ( in_array($newField['Type'], array('datetime')) && isset($newField['Default']) && $newField['Default']== '' )
if (in_array( $newField['Type'], array ('datetime'
) ) && isset( $newField['Default'] ) && $newField['Default'] == '')
$changeDefaultAttr = false;
//#1067 - Invalid default value for int field
if ( substr($newField['Type'], 0, 3 ) && isset($newField['Default']) && $newField['Default']== '' )
if (substr( $newField['Type'], 0, 3 ) && isset( $newField['Default'] ) && $newField['Default'] == '')
$changeDefaultAttr = false;
//if any difference exists, then insert the difference in aChanges
if ( $newField['Field'] != $oldField['Field'] ||
$newField['Type'] != $oldField['Type'] ||
$newField['Null'] != $oldField['Null'] ||
$changeDefaultAttr ) {
if (!isset($aChanges['tablesToAlter'][$sTableName])) {
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array());
if ($newField['Field'] != $oldField['Field'] || $newField['Type'] != $oldField['Type'] || $newField['Null'] != $oldField['Null'] || $changeDefaultAttr) {
if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
$aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
);
}
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Field'] = $newField['Field'];
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Type'] = $newField['Type'];
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Null'] = $newField['Null'];
if ( isset($newField['Default']) )
if (isset( $newField['Default'] ))
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = $newField['Default'];
else
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = null;
@@ -361,21 +368,21 @@ function obtainChanges($aOldSchema, $aNewSchema) {
}
}
} //only columns, no the indexes column
}//foreach $aColumns
} //foreach $aColumns
//now check the indexes of table
if ( isset($aNewSchema[$sTableName]['INDEXES']) ) {
foreach ( $aNewSchema[$sTableName]['INDEXES'] as $indexName => $indexFields ) {
if (!isset( $aOldSchema[$sTableName]['INDEXES'][$indexName]) ) {
if (!isset($aChanges['tablesWithNewIndex'][$sTableName])) {
$aChanges['tablesWithNewIndex'][$sTableName] = array();
if (isset( $aNewSchema[$sTableName]['INDEXES'] )) {
foreach ($aNewSchema[$sTableName]['INDEXES'] as $indexName => $indexFields) {
if (! isset( $aOldSchema[$sTableName]['INDEXES'][$indexName] )) {
if (! isset( $aChanges['tablesWithNewIndex'][$sTableName] )) {
$aChanges['tablesWithNewIndex'][$sTableName] = array ();
}
$aChanges['tablesWithNewIndex'][$sTableName][$indexName] = $indexFields;
}
else {
if ( $aOldSchema[$sTableName]['INDEXES'][$indexName] != $indexFields ) {
if (!isset($aChanges['tablesToAlterIndex'][$sTableName])) {
$aChanges['tablesToAlterIndex'][$sTableName] = array();
} else {
if ($aOldSchema[$sTableName]['INDEXES'][$indexName] != $indexFields) {
if (! isset( $aChanges['tablesToAlterIndex'][$sTableName] )) {
$aChanges['tablesToAlterIndex'][$sTableName] = array ();
}
$aChanges['tablesToAlterIndex'][$sTableName][$indexName] = $indexFields;
}

View File

@@ -20,42 +20,42 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
G::LoadClass('replacementLogo');
global $RBAC;
G::LoadClass( 'replacementLogo' );
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
die;
}
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
die();
}
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get( 'post_max_size' );
$mul = substr( $POST_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
if ($postMaxSize < $uploadMaxSize)
$uploadMaxSize = $postMaxSize;
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'LOGO';
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'LOGO';
$G_PUBLISH = new Publisher;
$oHeadPublisher =& headPublisher::getSingleton();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/uplogo', '', $Fields );
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/uplogo', '', $Fields );
$G_PUBLISH->AddContent('view', 'setup/uplogo' );
G::RenderPage( "publishBlank", "blank");
$G_PUBLISH->AddContent( 'view', 'setup/uplogo' );
G::RenderPage( "publishBlank", "blank" );
?>
<script>
@@ -100,3 +100,4 @@
window.location = 'uplogo';
}
</script>

View File

@@ -20,37 +20,34 @@
*
* 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_FACTORY') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
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;
die();
}
$G_MAIN_MENU = 'processmaker';
//$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
//$G_ID_SUB_MENU_SELECTED = 'WEBSERVICES';
$G_MAIN_MENU = 'processmaker';
//$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
//$G_ID_SUB_MENU_SELECTED = 'WEBSERVICES';
if (!extension_loaded('soap')) {
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/wsMessage');
if (! extension_loaded( 'soap' )) {
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/wsMessage' );
G::RenderPage( "publish" );
}
else
{
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('view', 'setup/webServicesTree' );
$G_PUBLISH->AddContent('smarty', 'groups/groups_usersList', '', '', array());
} else {
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'setup/webServicesTree' );
$G_PUBLISH->AddContent( 'smarty', 'groups/groups_usersList', '', '', array () );
G::RenderPage( "publish-treeview", 'blank');
}
$link_Edit = G::encryptlink('webServicesSetup');
$link_List = G::encryptlink('webServicesList');
G::RenderPage( "publish-treeview", 'blank' );
}
$link_Edit = G::encryptlink( 'webServicesSetup' );
$link_List = G::encryptlink( 'webServicesList' );
?>
<script>

File diff suppressed because it is too large Load Diff

View File

@@ -20,17 +20,17 @@
*
* 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_FACTORY') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
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;
die();
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'setup/webServicesTree' );
G::RenderPage( "publish-raw", "raw" );
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('view', 'setup/webServicesTree' );
G::RenderPage( "publish-raw" , "raw" );
?>

View File

@@ -20,44 +20,44 @@
*
* 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_FACTORY"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1)
return $RBAC_Response;
G::LoadClass('groups');
G::LoadClass( 'groups' );
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
if (!isset($_SESSION['END_POINT'])) {
if (! isset( $_SESSION['END_POINT'] )) {
$aFields['WS_HOST'] = $_SERVER['HTTP_HOST'];
$aFields['WS_WORKSPACE'] = SYS_SYS;
} else {
if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) {
preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias );
} else {
preg_match( '@^(?:http://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias );
}
else {
if (strpos($_SESSION['END_POINT'], 'https') !== false) {
preg_match('@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias);
}
else {
preg_match('@^(?:http://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias);
}
$aAux = explode(':', $coincidencias[1]);
$aAux = explode( ':', $coincidencias[1] );
$aFields['WS_HOST'] = $aAux[0];
$aFields['WS_PORT'] = (isset($aAux[1]) ? $aAux[1] : '');
$aAux = explode($aAux[0] . (isset($aAux[1]) ? ':' . $aAux[1] : ''), $_SESSION['END_POINT']);
$aAux = explode('/', $aAux[1]);
$aFields['WS_WORKSPACE'] = substr($aAux[1], 3);
}
$aFields['WS_PORT'] = (isset( $aAux[1] ) ? $aAux[1] : '');
$aAux = explode( $aAux[0] . (isset( $aAux[1] ) ? ':' . $aAux[1] : ''), $_SESSION['END_POINT'] );
$aAux = explode( '/', $aAux[1] );
$aFields['WS_WORKSPACE'] = substr( $aAux[1], 3 );
}
$rows[] = array ( 'uid' => 'char', 'name' => 'char', 'age' => 'integer', 'balance' => 'float' );
$rows[] = array ( 'uid' => 'http', 'name' => 'http' );
$rows[] = array ( 'uid' => 'https', 'name' => 'https' );
$rows[] = array ('uid' => 'char','name' => 'char','age' => 'integer','balance' => 'float'
);
$rows[] = array ('uid' => 'http','name' => 'http'
);
$rows[] = array ('uid' => 'https','name' => 'https'
);
$_DBArray['protocol'] = $rows;
$_SESSION['_DBArray'] = $_DBArray;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/webServicesSetup', '', $aFields , 'webServicesSetupSave');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/webServicesSetup', '', $aFields, 'webServicesSetupSave' );
G::RenderPage( "publish" , "raw" );
G::RenderPage( "publish", "raw" );
?>

View File

@@ -1,22 +1,16 @@
<?php
unset($_SESSION['WS_SESSION_ID']);
unset( $_SESSION['WS_SESSION_ID'] );
if($_POST['form']['WS_PROTOCOL']!='' && $_POST['form']['WS_WORKSPACE']!='')
{
if($_POST['form']['WS_PORT']!='')
{
$_SESSION['END_POINT']=$_POST['form']['WS_PROTOCOL'].'://' .$_POST['form']['WS_HOST'] . ':' .$_POST['form']['WS_PORT'] .'/sys' .$_POST['form']['WS_WORKSPACE'].'/en/classic/services/wsdl2';
G::header('location: webServices?x=1');
}
else
{ $_SESSION['END_POINT']=$_POST['form']['WS_PROTOCOL'].'://' .$_POST['form']['WS_HOST'] .'/sys' .$_POST['form']['WS_WORKSPACE'].'/en/classic/services/wsdl2';
G::header('location: webServices?x=1');
}
$_SESSION['WS_WORKSPACE']=$_POST['form']['WS_WORKSPACE'];
}
else
{
G::header('location: webServices?x=0');
if ($_POST['form']['WS_PROTOCOL'] != '' && $_POST['form']['WS_WORKSPACE'] != '') {
if ($_POST['form']['WS_PORT'] != '') {
$_SESSION['END_POINT'] = $_POST['form']['WS_PROTOCOL'] . '://' . $_POST['form']['WS_HOST'] . ':' . $_POST['form']['WS_PORT'] . '/sys' . $_POST['form']['WS_WORKSPACE'] . '/en/classic/services/wsdl2';
G::header( 'location: webServices?x=1' );
} else {
$_SESSION['END_POINT'] = $_POST['form']['WS_PROTOCOL'] . '://' . $_POST['form']['WS_HOST'] . '/sys' . $_POST['form']['WS_WORKSPACE'] . '/en/classic/services/wsdl2';
G::header( 'location: webServices?x=1' );
}
$_SESSION['WS_WORKSPACE'] = $_POST['form']['WS_WORKSPACE'];
} else {
G::header( 'location: webServices?x=0' );
}
?>

View File

@@ -20,32 +20,35 @@
*
* 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::LoadInclude('ajax');
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
G::LoadInclude( 'ajax' );
$G_ENABLE_BLANK_SKIN = true;
$G_ENABLE_BLANK_SKIN = true;
$ARR_WEEKDAYS[0] = array('SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY');
$ARR_WEEKDAYS['es'] = array("Domingo?", "Lunes?", "Martes?", "Miércoles?", "Jueves?", "Viernes?", "Sábado?");
$ARR_WEEKDAYS['en'] = array("Sunday?", "Monday?", "Tuesday?", "Wednesday?", "Thursday?", "Friday?", "Saturday?");
$ARR_WEEKDAYS['fa'] = array('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه ','جمعه','آدینه');
$ARR_WEEKDAYS[0] = array ('SUNDAY','MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY'
);
$ARR_WEEKDAYS['es'] = array ("Domingo?","Lunes?","Martes?","Miércoles?","Jueves?","Viernes?","Sábado?"
);
$ARR_WEEKDAYS['en'] = array ("Sunday?","Monday?","Tuesday?","Wednesday?","Thursday?","Friday?","Saturday?"
);
$ARR_WEEKDAYS['fa'] = array ('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه ','جمعه','آدینه'
);
$dbc = new DBConnection;
$ses = new DBSession($dbc);
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$holidays=$ses->execute( "SELECT LEX_VALUE FROM LEXICO WHERE LEX_TOPIC ='NOWORKINGDAY' ");
$holidays = $ses->execute( "SELECT LEX_VALUE FROM LEXICO WHERE LEX_TOPIC ='NOWORKINGDAY' " );
$config=array();
for($id=0;$id<7;$id++)
{
$res=$ses->execute(" SELECT * FROM LEXICO WHERE LEX_KEY = '".$ARR_WEEKDAYS[0][$id]."' AND LEX_TOPIC ='HOLIDAY' ");
$res=$res->read();
$config[$ARR_WEEKDAYS[0][$id]]=$res['LEX_VALUE'];
$config = array ();
for ($id = 0; $id < 7; $id ++) {
$res = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '" . $ARR_WEEKDAYS[0][$id] . "' AND LEX_TOPIC ='HOLIDAY' " );
$res = $res->read();
$config[$ARR_WEEKDAYS[0][$id]] = $res['LEX_VALUE'];
}
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/weekend', '',$config ,'' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/weekend', '', $config, '' );
G::RenderPage( 'publish' );
?>
<script language="JavaScript">

View File

@@ -20,11 +20,11 @@
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
G::ForceLogin( 'WF_PROCESS' );
G::LoadInclude('ajax');
G::LoadInclude( 'ajax' );
$G_HELP_PAGE = "setup-environment-time-controls-weekend";
@@ -36,35 +36,37 @@ $G_ID_MENU_SELECTED = "SETUP";
$G_ID_SUB_MENU_SELECTED = "ENVIRONMENT";
$G_ID_THIRD_MENU_SELECTED = "WEEKEND";
$dbc = new DBConnection;
$ses = new DBSession($dbc);
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$holidays=$ses->execute('SELECT LEX_VALUE FROM LEXICO WHERE LEX_TOPIC ="HOLIDAY"');
$holidays = $ses->execute( 'SELECT LEX_VALUE FROM LEXICO WHERE LEX_TOPIC ="HOLIDAY"' );
$funcion=strtolower(get_ajax_value('function'));
$funcions=get_defined_functions();
if (in_array($funcion,$funcions['user'])) eval($funcion.'();');
$funcion = strtolower( get_ajax_value( 'function' ) );
$funcions = get_defined_functions();
if (in_array( $funcion, $funcions['user'] ))
eval( $funcion . '();' );
function setDays()
function setDays ()
{
$days=get_ajax_value('days');
$values=get_ajax_value('values');
$days=explode(',',$days);
$values=explode(',',$values);
for($r=1;$r<sizeof($days);$r++)
setDay($days[$r],$values[$r]);
$days = get_ajax_value( 'days' );
$values = get_ajax_value( 'values' );
$days = explode( ',', $days );
$values = explode( ',', $values );
for ($r = 1; $r < sizeof( $days ); $r ++)
setDay( $days[$r], $values[$r] );
}
function setDay($day,$dayValue)
function setDay ($day, $dayValue)
{
global $ses;
$dayValue = (strcasecmp($dayValue,'true')==0)?1:0;
$res=$ses->execute(" SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' ");
if ($res->count()==0)
$res=$ses->execute(" INSERT INTO LEXICO (LEX_TOPIC, LEX_KEY, LEX_VALUE) VALUES ('HOLIDAY', '$day', $dayValue) ");
$dayValue = (strcasecmp( $dayValue, 'true' ) == 0) ? 1 : 0;
$res = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' " );
if ($res->count() == 0)
$res = $ses->execute( " INSERT INTO LEXICO (LEX_TOPIC, LEX_KEY, LEX_VALUE) VALUES ('HOLIDAY', '$day', $dayValue) " );
else
$res=$ses->execute(" UPDATE LEXICO SET LEX_VALUE = $dayValue WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' ");
$res=$ses->execute(" SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' ");
$res=$res->read();
echo ($res['LEX_VALUE']=='1')?'true':'false';
$res = $ses->execute( " UPDATE LEXICO SET LEX_VALUE = $dayValue WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' " );
$res = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' " );
$res = $res->read();
echo ($res['LEX_VALUE'] == '1') ? 'true' : 'false';
}
?>

View File

@@ -1,20 +1,16 @@
function abc(panel, txt) {
/*
* commonDialog ( '', 'saved' , 'saved', {}, '' ) ; setTimeout (
* leimnud.closure({instance:myDialog,method:function(panel){
*
* myDialog.remove(); panel.tabLastSelected=false; panel.tabSelected=1;
* panel.makeTab(); },args:panel}) , 1000 );
*/
var img = document.getElementById('workPeriodGraph');
img.src = 'workPeriodGraph?b=' + Math.random();
function abc( panel, txt ) {
/* commonDialog ( '', 'saved' , 'saved', {}, '' ) ;
setTimeout ( leimnud.closure({instance:myDialog,method:function(panel){
myDialog.remove();
panel.tabLastSelected=false;
panel.tabSelected=1;
panel.makeTab();
},args:panel}) , 1000 );
*/
var img = document.getElementById( 'workPeriodGraph' );
img.src = 'workPeriodGraph?b=' + Math.random() ;
// panel.clearContent();
// panel.addContent ( txt );
// panel.clearContent();
// panel.addContent ( txt );
return false;
}

View File

@@ -20,30 +20,30 @@
*
* 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;
G::LoadClass( "workPeriod" );
G::LoadClass( "workPeriod" );
$dbc = new DBConnection;
$ses = new DBSession( $dbc );
$obj = new workPeriod( $dbc );
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$obj = new workPeriod( $dbc );
$row = $obj->Load ();
$row = $obj->Load();
$row['SUNDAY'] = $row['noWorkingDays'][0];
$row['MONDAY'] = $row['noWorkingDays'][1];
$row['TUESDAY'] = $row['noWorkingDays'][2];
$row['WEDNESDAY'] = $row['noWorkingDays'][3];
$row['THURSDAY'] = $row['noWorkingDays'][4];
$row['FRIDAY'] = $row['noWorkingDays'][5];
$row['SATURDAY'] = $row['noWorkingDays'][6];
$row['SUNDAY'] = $row['noWorkingDays'][0];
$row['MONDAY'] = $row['noWorkingDays'][1];
$row['TUESDAY'] = $row['noWorkingDays'][2];
$row['WEDNESDAY'] = $row['noWorkingDays'][3];
$row['THURSDAY'] = $row['noWorkingDays'][4];
$row['FRIDAY'] = $row['noWorkingDays'][5];
$row['SATURDAY'] = $row['noWorkingDays'][6];
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( "image", "image", "workPeriodGraph" );
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/workPeriod","", $row , "workPeriodSave" );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( "image", "image", "workPeriodGraph" );
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/workPeriod", "", $row, "workPeriodSave" );
G::RenderPage( 'publish' );
G::RenderPage( 'publish' );
?>

View File

@@ -20,83 +20,85 @@
*
* 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;
Header("Content-type: image/jpeg");
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
Header( "Content-type: image/jpeg" );
G::LoadClass( "workPeriod" );
G::LoadClass( "workPeriod" );
$dbc = new DBConnection;
$ses = new DBSession( $dbc );
$obj = new workPeriod( $dbc );
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$obj = new workPeriod( $dbc );
$row = $obj->Load ();
$row = $obj->Load();
$initPeriod1 = $row['initPeriod1']/ 60;
$endPeriod1 = $row['endPeriod1'] / 60;
$initPeriod2 = $row['initPeriod2']/ 60;
$endPeriod2 = $row['endPeriod2'] / 60;
$noWorkingDays = $row['noWorkingDays'];
$initPeriod1 = $row['initPeriod1'] / 60;
$endPeriod1 = $row['endPeriod1'] / 60;
$initPeriod2 = $row['initPeriod2'] / 60;
$endPeriod2 = $row['endPeriod2'] / 60;
$noWorkingDays = $row['noWorkingDays'];
$cant = 7;
$cant = 7;
$w = 660;
$h = $cant*18 + 20;
$im= ImageCreate($w, $h);
$width = $w;
$height = $h;
$center_x = intval($width / 2);
$center_y = intval($height / 2);
$w = 660;
$h = $cant * 18 + 20;
$im = ImageCreate( $w, $h );
$width = $w;
$height = $h;
$center_x = intval( $width / 2 );
$center_y = intval( $height / 2 );
$bgcolor = ImageColorAllocate($im, 250, 250, 255);
$plomo = ImageColorAllocate($im, 220, 220, 220);
$orange = ImageColorAllocate($im, 255, 64, 64);
$gris = ImageColorAllocate($im, 150, 150, 155);
$white = ImageColorAllocate($im, 255, 255, 255);
$red = ImageColorAllocate($im, 255, 0, 0);
$brown = ImageColorAllocate($im, 160, 80, 0);
$black = ImageColorAllocate($im, 0,0,0);
ImageFilledRectangle($im, 0, 0, $width-1, $height-1, $bgcolor);
ImageRectangle ($im, 0, 0, $width-1, $height-1, $black);
$bgcolor = ImageColorAllocate( $im, 250, 250, 255 );
$plomo = ImageColorAllocate( $im, 220, 220, 220 );
$orange = ImageColorAllocate( $im, 255, 64, 64 );
$gris = ImageColorAllocate( $im, 150, 150, 155 );
$white = ImageColorAllocate( $im, 255, 255, 255 );
$red = ImageColorAllocate( $im, 255, 0, 0 );
$brown = ImageColorAllocate( $im, 160, 80, 0 );
$black = ImageColorAllocate( $im, 0, 0, 0 );
ImageFilledRectangle( $im, 0, 0, $width - 1, $height - 1, $bgcolor );
ImageRectangle( $im, 0, 0, $width - 1, $height - 1, $black );
$x = 10;
$y = 20;
$x1 = 78;
$x2 = $x1 + 2 * 6;
$x = 10; $y = 20;
$x1 = 78;
$x2 = $x1 + 2*6;
$weekday[0] = 'Sunday';
$weekday[1] = 'Monday';
$weekday[2] = 'Tuesday';
$weekday[3] = 'Wednesday';
$weekday[4] = 'Thursday';
$weekday[5] = 'Friday';
$weekday[6] = 'Saturday';
$weekday[0] = 'Sunday';
$weekday[1] = 'Monday';
$weekday[2] = 'Tuesday';
$weekday[3] = 'Wednesday';
$weekday[4] = 'Thursday';
$weekday[5] = 'Friday';
$weekday[6] = 'Saturday';
for ( $day = 0; $day < count ($weekday ); $day ++ ) {
ImageString($im, 2, $x, $y, $weekday[$day], $black);
for ($i = 0; $i < 24*6; $i++) {
ImageRectangle($im, $x1+$i* 4, $y, $x1+ ($i+1)*4, $y+12, $plomo );
if ( $i >= $initPeriod1 * 6 && $i < $endPeriod2 * 6 && ( $i < $endPeriod1 * 6 || $i >= $initPeriod2 * 6 ) )
for ($day = 0; $day < count( $weekday ); $day ++) {
ImageString( $im, 2, $x, $y, $weekday[$day], $black );
for ($i = 0; $i < 24 * 6; $i ++) {
ImageRectangle( $im, $x1 + $i * 4, $y, $x1 + ($i + 1) * 4, $y + 12, $plomo );
if ($i >= $initPeriod1 * 6 && $i < $endPeriod2 * 6 && ($i < $endPeriod1 * 6 || $i >= $initPeriod2 * 6))
$color = $orange;
else
$color = $white;
if ( isset ( $noWorkingDays[ $day ]) && $noWorkingDays[ $day ] ) $color = $white;
ImageFillToBorder($im, $x1+$i*4+1, $y+1, $plomo, $color );
if (isset( $noWorkingDays[$day] ) && $noWorkingDays[$day])
$color = $white;
ImageFillToBorder( $im, $x1 + $i * 4 + 1, $y + 1, $plomo, $color );
}
$y+=18;
}
$y += 18;
}
$y = 20;
for ($i = 0; $i <= 24; $i++) {
ImageLine($im, $x1+$i* 4*6, $y-5, $x1+ $i*4*6, $y-5+18*$cant, $gris);
if ( $i < 24 ) {
ImageLine($im, $x2+$i* 4*6, $y-5, $x2+ $i*4*6, $y-5+18*$cant, $plomo);
ImageString($im, 1, $x1+$i* 4*6, $y-10, $i, $black);
$y = 20;
for ($i = 0; $i <= 24; $i ++) {
ImageLine( $im, $x1 + $i * 4 * 6, $y - 5, $x1 + $i * 4 * 6, $y - 5 + 18 * $cant, $gris );
if ($i < 24) {
ImageLine( $im, $x2 + $i * 4 * 6, $y - 5, $x2 + $i * 4 * 6, $y - 5 + 18 * $cant, $plomo );
ImageString( $im, 1, $x1 + $i * 4 * 6, $y - 10, $i, $black );
}
}
//ImageString($im, 2, 5, 5, $initPeriod1*6 . ", $endPeriod1, $initPeriod2, $endPeriod2 ", $black);
}
//ImageString($im, 2, 5, 5, $initPeriod1*6 . ", $endPeriod1, $initPeriod2, $endPeriod2 ", $black);
ImageJpeg( $im );
ImageJpeg($im);
?>

View File

@@ -20,24 +20,24 @@
*
* 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::LoadClass( "workPeriod" );
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
G::LoadClass( "workPeriod" );
$frm = $_POST['form'];
$noWorkingDays[0] = isset ( $frm['SUNDAY'] ) && $frm['SUNDAY'] != '';
$noWorkingDays[1] = isset ( $frm['MONDAY'] ) && $frm['MONDAY'] != '';
$noWorkingDays[2] = isset ( $frm['TUESDAY'] ) && $frm['TUESDAY'] != '';
$noWorkingDays[3] = isset ( $frm['WEDNESDAY']) && $frm['WEDNESDAY'] != '';
$noWorkingDays[4] = isset ( $frm['THURSDAY'] ) && $frm['THURSDAY'] != '';
$noWorkingDays[5] = isset ( $frm['FRIDAY'] ) && $frm['FRIDAY'] != '';
$noWorkingDays[6] = isset ( $frm['SATURDAY'] ) && $frm['SATURDAY'] != '';
$frm = $_POST['form'];
$noWorkingDays[0] = isset( $frm['SUNDAY'] ) && $frm['SUNDAY'] != '';
$noWorkingDays[1] = isset( $frm['MONDAY'] ) && $frm['MONDAY'] != '';
$noWorkingDays[2] = isset( $frm['TUESDAY'] ) && $frm['TUESDAY'] != '';
$noWorkingDays[3] = isset( $frm['WEDNESDAY'] ) && $frm['WEDNESDAY'] != '';
$noWorkingDays[4] = isset( $frm['THURSDAY'] ) && $frm['THURSDAY'] != '';
$noWorkingDays[5] = isset( $frm['FRIDAY'] ) && $frm['FRIDAY'] != '';
$noWorkingDays[6] = isset( $frm['SATURDAY'] ) && $frm['SATURDAY'] != '';
$dbc = new DBConnection();
$obj = new workPeriod( $dbc );
$obj->Save ( $frm['initPeriod1'], $frm['endPeriod1'], $frm['initPeriod2'], $frm['endPeriod2'], $noWorkingDays );
$dbc = new DBConnection();
$obj = new workPeriod( $dbc );
$obj->Save( $frm['initPeriod1'], $frm['endPeriod1'], $frm['initPeriod2'], $frm['endPeriod2'], $noWorkingDays );
print "ok";
die();
print "ok";
die;
?>